Mercurial > hg > truffle
annotate graal/com.oracle.truffle.sl.test/tests/Inlining.sl @ 19248:a2ff253c458f
Truffle/Instrumentation: code cleanups in tools CoverageTracker and NodeExecCounter, especially for tutorial value
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 10 Feb 2015 16:44:19 -0800 |
parents | 2caa107f51ce |
children |
rev | line source |
---|---|
13866
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 function a() {return 42;} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 function b() {return a();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 function c() {return b();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 function d() {return c();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 function e() {return c();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 function f() {return c();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 function g() {return d() + e() + f();} |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 function main() { |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 i = 0; |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 result = 0; |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 while (i < 10000) { |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 result = result + g(); |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 i = i + 1; |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 } |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 return result; |
2caa107f51ce
SL: added testcase for inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 } |