annotate graal/com.oracle.graal.truffle.test/sl/TestInlining.sl @ 21887:543f150e7fa0

com.oracle.jvmci.service.Service is now a marker for service implementations available via JVMCI; removed Truffle -> JVMCI dependency
author Doug Simon <doug.simon@oracle.com>
date Tue, 09 Jun 2015 22:44:34 +0200
parents f735aa886cf6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }