comparison graal/com.oracle.graal.truffle.test/src/sl/TestInliningRecursive2.sl @ 22720:bba4e91a2d63

Move .sl testcases/outputs (resources) into projects src directory
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Tue, 29 Sep 2015 15:02:34 +0200
parents graal/com.oracle.graal.truffle.test/sl/TestInliningRecursive2.sl@e66a6f8d63e3
children
comparison
equal deleted inserted replaced
22719:f035cf1d2e5a 22720:bba4e91a2d63
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 callUntilOptimized(test);
31 assertTrue(isInlined(test, test, fib), "not inlined: test -> fib");
32 }