annotate graal/com.oracle.truffle.sl.test/tests/Inlining.sl @ 16067:915ebb306fcc

Truffle/Source: major API revision - All source-related classes now in com.oracle.truffle.api.source - SourceFactory replaced with factory methods on Source - Revision, renaming, and documentation to methods on Source and SourceSection - NullSourceSection is now a utility class
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Fri, 06 Jun 2014 17:51:47 -0700
parents 2caa107f51ce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }