Invoke support for Quick Compiler
Fleshed out invoke and const-string support. Fixed a bug in Phi node
insertion.
With this CL, the "Recursive Fibonacci" and "HelloWorld" milestones are
met.
Added are a set of "HL" (for High-Level) invoke intrinsics. Until we
complete the merging of the Quick & Iceland runtime models the invoke
code sequences are slightly different. Thus, the Greenland IR needs
to represent invokes at a somewhat higher level than Iceland. The
test for fast/slow path needs to happen during the lowering of the
HLInvokeXXX intrinsics in both the Quick and Portable paths.
This will generally be the case in the short term - push fast/slow
path determination below the Greenland IR level. As unification
proceeds, we'll pull as much as makes sense into the common front end.
Change-Id: I0a18edf1be18583c0afdc3f7e10a3e4691968e77
diff --git a/test/Fibonacci/Fibonacci.java b/test/Fibonacci/Fibonacci.java
index 9c94367..a5c4e4b 100644
--- a/test/Fibonacci/Fibonacci.java
+++ b/test/Fibonacci/Fibonacci.java
@@ -16,6 +16,8 @@
class Fibonacci {
+/*
+ // Iterative version
static int fibonacci(int n) {
if (n == 0) {
return 0;
@@ -29,12 +31,22 @@
}
return y;
}
+*/
+
+ // Recursive version
+ static int fibonacci(int n) {
+ if ((n == 0) || (n == 1)) {
+ return n;
+ } else {
+ return fibonacci(n - 1) + (fibonacci(n - 2));
+ }
+ }
public static void main(String[] args) {
String arg = (args.length > 0) ? args[0] : "10";
try {
int x = Integer.parseInt(arg);
- int y = fibonacci(x); /* to warm up cache */
+ int y = fibonacci(x);
System.out.printf("fibonacci(%d)=%d\n", x, y);
y = fibonacci(x + 1);
System.out.printf("fibonacci(%d)=%d\n", x + 1, y);