Mercurial > hg > truffle
annotate graal/com.oracle.graal.truffle.test/sl/TestInlining.sl @ 21103:ece51b327e71
All MemoryNode can be used as lastAccessLocation not only MemoryCheckpoints
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Thu, 23 Apr 2015 20:31:35 +0200 |
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 } |