Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.truffle.test/sl/TestInliningRecursive2.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 | 5787218bad91 |
comparison
equal
deleted
inserted
replaced
17256:88d5fd9e1a6c | 17257:f735aa886cf6 |
---|---|
1 /* | |
2 * Tests that indirect recursions are not inlined. | |
3 */ | |
4 function fib(a) { | |
5 if (a == 2 || a == 1) { | |
6 return 1; | |
7 } | |
8 return call(fib, a-1) + call(fib, a-2) + call(void, 0); | |
9 } | |
10 | |
11 function call(f, a) { | |
12 return f(a); | |
13 } | |
14 | |
15 function void(a) { | |
16 return a; | |
17 } | |
18 | |
19 function test() { | |
20 i = 0; | |
21 sum = 0; | |
22 while (i < 100) { | |
23 sum = sum + fib(7); | |
24 i = i + 1; | |
25 } | |
26 return sum; | |
27 } | |
28 | |
29 function main() { | |
30 waitForOptimization(callUntilOptimized(test)); | |
31 assertTrue(isInlined(test, test, fib), "not inlined: test -> fib"); | |
32 if (getOption("TruffleContextSensitiveInlining")) { | |
33 assertTrue(isInlined(test, fib, call), "not inlined: fib -> call"); | |
34 assertFalse(isInlined(test, call, fib), "inlined: call -> fib"); | |
35 assertTrue(isInlined(test, call, void), "inlined: call -> void"); | |
36 } | |
37 } |