Mercurial > hg > truffle
annotate graal/com.oracle.graal.truffle.test/sl/TestInliningRecursive1.sl @ 19912:94289b44c934
Add BenchmarkCounterFactory to PostAllocationOptimizationContext.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 16 Mar 2015 17:15:52 +0100 |
parents | e66a6f8d63e3 |
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 * Test recursive calls do not get inlined and do not crash. |
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 fib(a) { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 if (a == 2 || a == 1) { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 return 1; |
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 return fib(a-1) + fib(a-2); |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 function test() { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 i = 0; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 sum = 0; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 while (i < 100) { |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 sum = sum + fib(7); |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 i = i + 1; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 return sum; |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 } |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 |
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 function main() { |
17405
04d6bb76cfb3
Truffle: update callUntilOptimized to wait for the compilation and call it once optimized.
Christian Humer <christian.humer@gmail.com>
parents:
17257
diff
changeset
|
22 callUntilOptimized(test); |
17257
f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 } |