Mercurial > hg > truffle
annotate graal/com.oracle.graal.truffle.test/sl/TestInlining.sl @ 19885:b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 17 Mar 2015 12:05:49 +0100 |
parents | f735aa886cf6 |
children |
rev | line source |
---|---|
17257
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * This tests that simple arithmetic gets inlined. |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 */ |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 function add(a, b) { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 return a + b; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 function test() { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 i = 0; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 while (i < 100) { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 i = add(i, 1); |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 return i; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 function main() { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 waitForOptimization(callUntilOptimized(test)); |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 assertTrue(isInlined(test, test, add), "add is not inlined"); |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 } |