forked from jensnicolay/jipda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjipda.js
More file actions
72 lines (69 loc) · 2.09 KB
/
Copy pathjipda.js
File metadata and controls
72 lines (69 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function concEval(src)
{
var ast = Ast.createAst(src);
var cesk = jsCesk({a:createConcAg(), l: new ConcLattice()});
var system = cesk.explore(ast);
var result = computeResultValue(system.result);
print(result.value);
}
function typeEval(src)
{
var ast = Ast.createAst(src);
var cesk = jsCesk({a:createTagAg(), l: new JipdaLattice()});
var system = cesk.explore(ast);
var result = computeResultValue(system.result);
print(result.value);
}
function concEval1(src)
{
var ast = Ast.createAst(src, {loc:true});
var cesk = jsCesk({a:createConcAg(), l: new ConcLattice(), errors:true});
var system = cesk.concExplore(ast);
var result = computeResultValue(system.result);
var resultValue = result.value;
print(result.msgs.join("\n"));
print(resultValue);
}
function serverTest()
{
var padStr = " ";
function cut(x, n)
{
return (x + padStr).slice(0,n);
}
function pad(x, n)
{
var s = String(x);
if (s.length > n)
{
return s;
}
return (x + padStr).slice(0,n);
}
var bprefix = "test/resources/";
var benchmarks =
["return1.js",
"fib.js",
"gcIpdExample.js",
"rotate.js",
"access-nbody-mod.js",
"sunspider/controlflow-recursive.js",
"crypto-sha1-mod.js",
"sunspider/math-spectral-norm.js",
]
var r = benchmarks.forEach(
function (benchmark)
{
var src = read(bprefix + benchmark);
var ast = Ast.createAst(src);
var cesk = jsCesk({a:createTagAg(), l:new JipdaLattice(), errors:true});
var system = cesk.explore(ast);
var result = computeResultValue(system.result);
var resultValue = result.value;
print(cut(benchmark,32), pad(Math.round(system.time),8), pad(system.states.count(),8), pad(system.result.count(),4), pad(system.contexts.count(), 6), pad(resultValue,20));
if (result.msgs.length > 0)
{
result.msgs.join("\n");
}
});
}