Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.truffle.test/sl/TestInliningRecursive1.sl @ 17257:f735aa886cf6
Truffle: add new inlining tests; adapt tests for context sensitive inlining.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 29 Sep 2014 18:46:40 +0200 |
parents | |
children | 04d6bb76cfb3 |
comparison
equal
deleted
inserted
replaced
17256:88d5fd9e1a6c | 17257:f735aa886cf6 |
---|---|
1 /* | |
2 * Test recursive calls do not get inlined and do not crash. | |
3 */ | |
4 function fib(a) { | |
5 if (a == 2 || a == 1) { | |
6 return 1; | |
7 } | |
8 return fib(a-1) + fib(a-2); | |
9 } | |
10 | |
11 function test() { | |
12 i = 0; | |
13 sum = 0; | |
14 while (i < 100) { | |
15 sum = sum + fib(7); | |
16 i = i + 1; | |
17 } | |
18 return sum; | |
19 } | |
20 | |
21 function main() { | |
22 waitForOptimization(callUntilOptimized(test)); | |
23 assertTrue(isInlined(test, test, fib), "fib is not inlined"); | |
24 assertFalse(isInlined(test, fib, fib), "fib -> fib is not inlined"); | |
25 } |