changeset 5528:751b6ab65d54

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 08 Jun 2012 18:35:28 +0200
parents 3152b08f34e0 (diff) e05bb6f6c58b (current diff)
children d487ae06265d
files
diffstat 38 files changed, 398 insertions(+), 353 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/GraalTest.java	Fri Jun 08 18:35:28 2012 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+
+public class GraalTest {
+
+    @Test
+    public void testRuntimeAvailable() {
+        assertNotNull(Graal.getRuntime());
+        System.out.println(Graal.getRuntime().getClass());
+    }
+
+    @Test
+    public void testRuntimeNamed() {
+        assertNotNull(Graal.getRuntime().getName());
+    }
+}
--- a/graal/com.oracle.graal.api/src/com/oracle/graal/api/Graal.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.api/src/com/oracle/graal/api/Graal.java	Fri Jun 08 18:35:28 2012 +0200
@@ -26,32 +26,27 @@
 public class Graal {
 
     private static GraalRuntime runtime;
-    private static volatile boolean initialized;
 
     private static native GraalRuntime initializeRuntime();
 
     public static GraalRuntime getRuntime() {
-        ensureInitialized();
         return runtime;
     }
 
-    public static boolean hasRuntime() {
-        return getRuntime() != null;
-    }
-
-    private static void ensureInitialized() {
-        boolean wasInitialized = initialized;
-        if (!wasInitialized) {
-            synchronized (Graal.class) {
-                if (!initialized) {
-                    try {
-                        runtime = initializeRuntime();
-                    } catch (UnsatisfiedLinkError e) {
-                        runtime = null;
-                    }
-                    initialized = true;
+    static {
+        try {
+            runtime = initializeRuntime();
+        } catch (UnsatisfiedLinkError e) {
+            runtime = new GraalRuntime() {
+                @Override
+                public String getName() {
+                    return "";
                 }
-            }
+                @Override
+                public <T> T getCapability(Class<T> clazz) {
+                    return null;
+                }
+            };
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNode.java	Fri Jun 08 18:35:28 2012 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.graph;
+
+
+public class TestNode extends Node implements Node.IterableNodeType {
+    private String name;
+
+    public TestNode(String name) {
+        this.name = name;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java	Fri Jun 08 18:35:28 2012 +0200
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.graph;
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.junit.*;
+
+
+
+public class TypedNodeIteratorTest {
+
+    @Test
+    public void singleNodeTest() {
+        Graph graph = new Graph();
+        graph.add(new TestNode("a"));
+        assertTrue(graph.hasNode(TestNode.class));
+        assertEquals("a", toString(graph.getNodes(TestNode.class)));
+    }
+
+    @Test
+    public void deletingNodeTest() {
+        TestNode testNode = new TestNode("a");
+        Graph graph = new Graph();
+        graph.add(testNode);
+        testNode.safeDelete();
+        assertEquals("", toString(graph.getNodes(TestNode.class)));
+    }
+
+    @Test
+    public void deleteAndAddTest() {
+        TestNode testNode = new TestNode("b");
+        Graph graph = new Graph();
+        graph.add(new TestNode("a"));
+        graph.add(testNode);
+        testNode.safeDelete();
+        assertEquals("a", toString(graph.getNodes(TestNode.class)));
+        graph.add(new TestNode("c"));
+        assertEquals("ac", toString(graph.getNodes(TestNode.class)));
+    }
+
+    @Test
+    public void iteratorBehaviorTest() {
+        Graph graph = new Graph();
+        graph.add(new TestNode("a"));
+        Iterator<TestNode> iterator = graph.getNodes(TestNode.class).iterator();
+        assertTrue(iterator.hasNext());
+        assertEquals("a", iterator.next().getName());
+        assertFalse(iterator.hasNext());
+        graph.add(new TestNode("b"));
+        assertTrue(iterator.hasNext());
+        assertEquals("b", iterator.next().getName());
+        assertFalse(iterator.hasNext());
+        TestNode c = new TestNode("c");
+        graph.add(c);
+        assertTrue(iterator.hasNext());
+        c.safeDelete();
+        assertFalse(iterator.hasNext());
+    }
+
+    @Test
+    public void complicatedIterationTest() {
+        Graph graph = new Graph();
+        graph.add(new TestNode("a"));
+        for (TestNode tn : graph.getNodes(TestNode.class)) {
+            String name = tn.getName();
+            for (int i = 0; i < name.length(); ++i) {
+                char c = name.charAt(i);
+                if (c == 'a') {
+                    tn.safeDelete();
+                    graph.add(new TestNode("b"));
+                    graph.add(new TestNode("c"));
+                } else if (c == 'b') {
+                    tn.safeDelete();
+                } else if (c == 'c') {
+                    graph.add(new TestNode("d"));
+                    graph.add(new TestNode("e"));
+                    graph.add(new TestNode("d"));
+                    graph.add(new TestNode("e"));
+                    graph.add(new TestNode("e"));
+                    graph.add(new TestNode("d"));
+                    graph.add(new TestNode("e"));
+                    graph.add(new TestNode("d"));
+                } else if (c == 'd') {
+                    for (TestNode tn2 : graph.getNodes(TestNode.class)) {
+                        if (tn2.getName().equals("e")) {
+                            tn2.safeDelete();
+                        } else if (tn2.getName().equals("c")) {
+                            tn2.safeDelete();
+                        }
+                    }
+                } else if (c == 'e') {
+                    fail("All e nodes must have been deleted by visiting the d node");
+                }
+            }
+        }
+        assertEquals("dddd", toString(graph.getNodes(TestNode.class)));
+    }
+
+    @Test
+    public void addingNodeDuringIterationTest() {
+        Graph graph = new Graph();
+        graph.add(new TestNode("a"));
+        StringBuilder sb = new StringBuilder();
+        int z = 0;
+        for (TestNode tn : graph.getNodes(TestNode.class)) {
+            if (z == 0) {
+                graph.add(new TestNode("b"));
+            }
+            sb.append(tn.getName());
+            z++;
+        }
+        assertEquals(2, z);
+        assertEquals("ab", sb.toString());
+        z = 0;
+        for (TestNode tn : graph.getNodes(TestNode.class)) {
+            if (z == 0) {
+                graph.add(new TestNode("c"));
+            }
+            assertNotNull(tn);
+            z++;
+        }
+        assertEquals(3, z);
+    }
+
+    private static String toString(Iterable<TestNode> nodes) {
+        StringBuilder sb = new StringBuilder();
+        for (TestNode tn : nodes) {
+            sb.append(tn.getName());
+        }
+        return sb.toString();
+    }
+}
--- a/graal/com.oracle.graal.graph/.checkstyle_checks.xml	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.graph/.checkstyle_checks.xml	Fri Jun 08 18:35:28 2012 +0200
@@ -132,6 +132,7 @@
   </module>
   <module name="RegexpHeader">
     <property name="header" value="/\*\n \* Copyright \(c\) (20[0-9][0-9], )?20[0-9][0-9], Oracle and/or its affiliates. All rights reserved.\n \* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n \*\n \* This code is free software; you can redistribute it and/or modify it\n \* under the terms of the GNU General Public License version 2 only, as\n \* published by the Free Software Foundation.\n \*\n \* This code is distributed in the hope that it will be useful, but WITHOUT\n \* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n \* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n \* version 2 for more details \(a copy is included in the LICENSE file that\n \* accompanied this code\).\n \*\n \* You should have received a copy of the GNU General Public License version\n \* 2 along with this work; if not, write to the Free Software Foundation,\n \* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n \*\n \* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n \* or visit www.oracle.com if you need additional information or have any\n \* questions.\n \*/\n"/>
+    <property name="fileExtensions" value="java"/>
   </module>
   <module name="FileTabCharacter">
     <property name="severity" value="error"/>
--- a/graal/com.oracle.graal.graph/test/com/oracle/graal/graph/test/TestNode.java	Fri Jun 08 15:17:43 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.graph.test;
-
-import com.oracle.graal.graph.*;
-
-
-public class TestNode extends Node implements Node.IterableNodeType {
-    private String name;
-
-    public TestNode(String name) {
-        this.name = name;
-    }
-
-
-    public String getName() {
-        return name;
-    }
-}
--- a/graal/com.oracle.graal.graph/test/com/oracle/graal/graph/test/TypedNodeIteratorTest.java	Fri Jun 08 15:17:43 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.graph.test;
-import static org.junit.Assert.*;
-
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.graph.*;
-
-
-
-public class TypedNodeIteratorTest {
-
-    @Test
-    public void singleNodeTest() {
-        Graph graph = new Graph();
-        graph.add(new TestNode("a"));
-        assertTrue(graph.hasNode(TestNode.class));
-        assertEquals("a", toString(graph.getNodes(TestNode.class)));
-    }
-
-    @Test
-    public void deletingNodeTest() {
-        TestNode testNode = new TestNode("a");
-        Graph graph = new Graph();
-        graph.add(testNode);
-        testNode.safeDelete();
-        assertEquals("", toString(graph.getNodes(TestNode.class)));
-    }
-
-    @Test
-    public void deleteAndAddTest() {
-        TestNode testNode = new TestNode("b");
-        Graph graph = new Graph();
-        graph.add(new TestNode("a"));
-        graph.add(testNode);
-        testNode.safeDelete();
-        assertEquals("a", toString(graph.getNodes(TestNode.class)));
-        graph.add(new TestNode("c"));
-        assertEquals("ac", toString(graph.getNodes(TestNode.class)));
-    }
-
-    @Test
-    public void iteratorBehaviorTest() {
-        Graph graph = new Graph();
-        graph.add(new TestNode("a"));
-        Iterator<TestNode> iterator = graph.getNodes(TestNode.class).iterator();
-        assertTrue(iterator.hasNext());
-        assertEquals("a", iterator.next().getName());
-        assertFalse(iterator.hasNext());
-        graph.add(new TestNode("b"));
-        assertTrue(iterator.hasNext());
-        assertEquals("b", iterator.next().getName());
-        assertFalse(iterator.hasNext());
-        TestNode c = new TestNode("c");
-        graph.add(c);
-        assertTrue(iterator.hasNext());
-        c.safeDelete();
-        assertFalse(iterator.hasNext());
-    }
-
-    @Test
-    public void complicatedIterationTest() {
-        Graph graph = new Graph();
-        graph.add(new TestNode("a"));
-        for (TestNode tn : graph.getNodes(TestNode.class)) {
-            String name = tn.getName();
-            for (int i = 0; i < name.length(); ++i) {
-                char c = name.charAt(i);
-                if (c == 'a') {
-                    tn.safeDelete();
-                    graph.add(new TestNode("b"));
-                    graph.add(new TestNode("c"));
-                } else if (c == 'b') {
-                    tn.safeDelete();
-                } else if (c == 'c') {
-                    graph.add(new TestNode("d"));
-                    graph.add(new TestNode("e"));
-                    graph.add(new TestNode("d"));
-                    graph.add(new TestNode("e"));
-                    graph.add(new TestNode("e"));
-                    graph.add(new TestNode("d"));
-                    graph.add(new TestNode("e"));
-                    graph.add(new TestNode("d"));
-                } else if (c == 'd') {
-                    for (TestNode tn2 : graph.getNodes(TestNode.class)) {
-                        if (tn2.getName().equals("e")) {
-                            tn2.safeDelete();
-                        } else if (tn2.getName().equals("c")) {
-                            tn2.safeDelete();
-                        }
-                    }
-                } else if (c == 'e') {
-                    fail("All e nodes must have been deleted by visiting the d node");
-                }
-            }
-        }
-        assertEquals("dddd", toString(graph.getNodes(TestNode.class)));
-    }
-
-    @Test
-    public void addingNodeDuringIterationTest() {
-        Graph graph = new Graph();
-        graph.add(new TestNode("a"));
-        StringBuilder sb = new StringBuilder();
-        int z = 0;
-        for (TestNode tn : graph.getNodes(TestNode.class)) {
-            if (z == 0) {
-                graph.add(new TestNode("b"));
-            }
-            sb.append(tn.getName());
-            z++;
-        }
-        assertEquals(2, z);
-        assertEquals("ab", sb.toString());
-        z = 0;
-        for (TestNode tn : graph.getNodes(TestNode.class)) {
-            if (z == 0) {
-                graph.add(new TestNode("c"));
-            }
-            assertNotNull(tn);
-            z++;
-        }
-        assertEquals(3, z);
-    }
-
-    private static String toString(Iterable<TestNode> nodes) {
-        StringBuilder sb = new StringBuilder();
-        for (TestNode tn : nodes) {
-            sb.append(tn.getName());
-        }
-        return sb.toString();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Jun 08 18:35:28 2012 +0200
@@ -47,18 +47,18 @@
 
     private volatile boolean cancelled;
 
-    private final HotSpotCompiler compiler;
+    private final HotSpotCompilerImpl compiler;
     private final PhasePlan plan;
     private final HotSpotMethodResolved method;
     private final OptimisticOptimizations optimisticOpts;
     private final int id;
     private final int priority;
 
-    public static CompilationTask create(HotSpotCompiler compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
+    public static CompilationTask create(HotSpotCompilerImpl compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
         return new CompilationTask(compiler, plan, optimisticOpts, method, id, priority);
     }
 
-    private CompilationTask(HotSpotCompiler compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
+    private CompilationTask(HotSpotCompilerImpl compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
         this.compiler = compiler;
         this.plan = plan;
         this.method = method;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Fri Jun 08 18:35:28 2012 +0200
@@ -32,9 +32,9 @@
  */
 public abstract class CompilerObject implements Serializable, FormatWithToString {
     private static final long serialVersionUID = -4551670987101214877L;
-    protected final HotSpotCompiler compiler;
+    protected final HotSpotCompilerImpl compiler;
 
-    protected CompilerObject(HotSpotCompiler compiler) {
+    protected CompilerObject(HotSpotCompilerImpl compiler) {
         this.compiler = compiler;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiler.java	Fri Jun 08 15:17:43 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.hotspot.ri.*;
-
-public interface HotSpotCompiler {
-
-    CompilerToVM getCompilerToVM();
-    VMToCompiler getVMToCompiler();
-    GraalCompiler getCompiler();
-    RiType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve);
-    HotSpotVMConfig getConfig();
-    HotSpotRuntime getRuntime();
-    CiTarget getTarget();
-    HotSpotGraphCache getCache();
-    void evictDeoptedGraphs();
-
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java	Fri Jun 08 18:35:28 2012 +0200
@@ -22,10 +22,8 @@
  */
 package com.oracle.graal.hotspot;
 
-import java.io.*;
 import java.lang.reflect.*;
-import java.net.*;
-
+import com.oracle.graal.api.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
@@ -34,18 +32,17 @@
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
 import com.oracle.graal.hotspot.ri.*;
-import com.oracle.graal.hotspot.server.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.cri.xir.*;
 
 /**
  * Singleton class holding the instance of the GraalCompiler.
  */
-public final class HotSpotCompilerImpl implements HotSpotCompiler, Remote {
+public final class HotSpotCompilerImpl implements GraalRuntime {
 
-    private static HotSpotCompiler theInstance;
+    private static HotSpotCompilerImpl theInstance;
 
-    public static HotSpotCompiler getInstance() {
+    public static HotSpotCompilerImpl getInstance() {
         if (theInstance == null) {
             initialize();
         }
@@ -57,30 +54,11 @@
             return;
         }
 
-        String remote = System.getProperty("graal.remote");
-        if (remote != null) {
-            // remote compilation (will not create a local Compiler)
-            try {
-                System.out.println("Graal compiler started in client/server mode, server: " + remote);
-                Socket socket = new Socket(remote, 1199);
-                ReplacingStreams streams = new ReplacingStreams(socket.getOutputStream(), socket.getInputStream());
-                streams.getInvocation().sendResult(new CompilerToVMImpl());
-
-                theInstance = (HotSpotCompiler) streams.getInvocation().waitForResult(false);
-            } catch (IOException e1) {
-                System.out.println("Connection to compilation server FAILED.");
-                throw new RuntimeException(e1);
-            } catch (ClassNotFoundException e2) {
-                System.out.println("Connection to compilation server FAILED.");
-                throw new RuntimeException(e2);
-            }
-        } else {
-            // ordinary local compilation
-            theInstance = new HotSpotCompilerImpl(null);
-        }
+        // ordinary local compilation
+        theInstance = new HotSpotCompilerImpl(null);
     }
 
-    public static HotSpotCompiler initializeServer(CompilerToVM entries) {
+    public static HotSpotCompilerImpl initializeServer(CompilerToVM entries) {
         assert theInstance == null;
         theInstance = new HotSpotCompilerImpl(entries);
         return theInstance;
@@ -145,7 +123,6 @@
         }
     }
 
-    @Override
     public CiTarget getTarget() {
         if (target == null) {
             final int wordSize = 8;
@@ -170,7 +147,6 @@
         return getInstance().getCompiler();
     }
 
-    @Override
     public GraalCompiler getCompiler() {
         if (compiler == null) {
             // these options are important - graal will not generate correct code without them
@@ -192,22 +168,18 @@
         return compiler;
     }
 
-    @Override
     public HotSpotGraphCache getCache() {
         return cache;
     }
 
-    @Override
     public CompilerToVM getCompilerToVM() {
         return compilerToVm;
     }
 
-    @Override
     public VMToCompiler getVMToCompiler() {
         return vmToCompiler;
     }
 
-    @Override
     public RiType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve) {
         if (returnType.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) {
             VMToCompilerImpl exitsNative = (VMToCompilerImpl) vmToCompiler;
@@ -242,7 +214,6 @@
         return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve);
     }
 
-    @Override
     public HotSpotRuntime getRuntime() {
         if (runtime == null) {
             runtime = new HotSpotRuntime(config, this);
@@ -262,4 +233,14 @@
             }
         }
     }
+
+    @Override
+    public String getName() {
+        return "HotSpotGraalRuntime";
+    }
+
+    @Override
+    public <T> T getCapability(Class<T> clazz) {
+        return null;
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Fri Jun 08 18:35:28 2012 +0200
@@ -42,7 +42,7 @@
     public final Site[] sites;
     public final ExceptionHandler[] exceptionHandlers;
 
-    public HotSpotTargetMethod(HotSpotCompiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
+    public HotSpotTargetMethod(HotSpotCompilerImpl compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
         super(compiler);
         this.method = method;
         this.targetMethod = targetMethod;
@@ -56,7 +56,7 @@
         }
     }
 
-    private HotSpotTargetMethod(HotSpotCompiler compiler, CiTargetMethod targetMethod, String name) {
+    private HotSpotTargetMethod(HotSpotCompilerImpl compiler, CiTargetMethod targetMethod, String name) {
         super(compiler);
         this.method = null;
         this.targetMethod = targetMethod;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Jun 08 18:35:28 2012 +0200
@@ -37,7 +37,6 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.hotspot.counters.*;
 import com.oracle.graal.hotspot.ri.*;
 import com.oracle.graal.hotspot.server.*;
@@ -51,7 +50,7 @@
  */
 public class VMToCompilerImpl implements VMToCompiler, Remote {
 
-    private final HotSpotCompiler compiler;
+    private final HotSpotCompilerImpl compiler;
     private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
 
     public final HotSpotTypePrimitive typeBoolean;
@@ -70,7 +69,7 @@
 
     private PrintStream log = System.out;
 
-    public VMToCompilerImpl(HotSpotCompiler compiler) {
+    public VMToCompilerImpl(HotSpotCompilerImpl compiler) {
         this.compiler = compiler;
 
         typeBoolean = new HotSpotTypePrimitive(compiler, RiKind.Boolean);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Fri Jun 08 18:35:28 2012 +0200
@@ -33,7 +33,7 @@
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
+import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
@@ -142,7 +142,7 @@
     }
 
 
-    public static void printCounters(HotSpotCompiler compiler) {
+    public static void printCounters(HotSpotCompilerImpl compiler) {
         if (!GraalOptions.MethodEntryCounters) {
             return;
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Fri Jun 08 18:35:28 2012 +0200
@@ -25,7 +25,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of {@link RiCodeInfo} for HotSpot.
@@ -39,7 +38,7 @@
     public final CiTargetMethod targetMethod;
     private HotSpotMethodResolved method;
 
-    public HotSpotCodeInfo(HotSpotCompiler compiler, CiTargetMethod targetMethod, HotSpotMethodResolved method) {
+    public HotSpotCodeInfo(HotSpotCompilerImpl compiler, CiTargetMethod targetMethod, HotSpotMethodResolved method) {
         super(compiler);
         assert targetMethod != null;
         this.method = method;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java	Fri Jun 08 18:35:28 2012 +0200
@@ -27,7 +27,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiCompiledMethod for HotSpot.
@@ -42,7 +41,7 @@
     private final RiResolvedMethod method;
     private long nmethod;
 
-    public HotSpotCompiledMethod(HotSpotCompiler compiler, RiResolvedMethod method) {
+    public HotSpotCompiledMethod(HotSpotCompilerImpl compiler, RiResolvedMethod method) {
         super(compiler);
         this.method = method;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java	Fri Jun 08 18:35:28 2012 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiConstantPool for HotSpot.
@@ -35,7 +34,7 @@
 
     private final HotSpotTypeResolvedImpl type;
 
-    public HotSpotConstantPool(HotSpotCompiler compiler, HotSpotTypeResolvedImpl type) {
+    public HotSpotConstantPool(HotSpotCompilerImpl compiler, HotSpotTypeResolvedImpl type) {
         super(compiler);
         this.type = type;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Fri Jun 08 18:35:28 2012 +0200
@@ -31,7 +31,6 @@
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Represents a field in a HotSpot type.
@@ -46,7 +45,7 @@
     private final int accessFlags;
     private RiConstant constant;                // Constant part only valid for static fields.
 
-    public HotSpotField(HotSpotCompiler compiler, RiResolvedType holder, String name, RiType type, int offset, int accessFlags) {
+    public HotSpotField(HotSpotCompilerImpl compiler, RiResolvedType holder, String name, RiType type, int offset, int accessFlags) {
         super(compiler);
         this.holder = holder;
         this.name = name;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java	Fri Jun 08 18:35:28 2012 +0200
@@ -23,7 +23,6 @@
 package com.oracle.graal.hotspot.ri;
 
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * A mechanism for safely conveying a HotSpot klassOop value from the compiler to the C++ code.
@@ -40,7 +39,7 @@
      */
     public final Class javaMirror;
 
-    public HotSpotKlassOop(HotSpotCompiler compiler, Class javaMirror) {
+    public HotSpotKlassOop(HotSpotCompilerImpl compiler, Class javaMirror) {
         super(compiler);
         this.javaMirror = javaMirror;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java	Fri Jun 08 18:35:28 2012 +0200
@@ -24,14 +24,13 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 public abstract class HotSpotMethod extends CompilerObject implements RiMethod {
 
     private static final long serialVersionUID = 7167491397941960839L;
     protected String name;
 
-    protected HotSpotMethod(HotSpotCompiler compiler) {
+    protected HotSpotMethod(HotSpotCompilerImpl compiler) {
         super(compiler);
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java	Fri Jun 08 18:35:28 2012 +0200
@@ -30,7 +30,6 @@
 import com.oracle.graal.api.meta.RiTypeProfile.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 
 public final class HotSpotMethodData extends CompilerObject {
@@ -57,7 +56,7 @@
     private int normalDataSize;
     private int extraDataSize;
 
-    private HotSpotMethodData(HotSpotCompiler compiler) {
+    private HotSpotMethodData(HotSpotCompilerImpl compiler) {
         super(compiler);
         throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM");
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java	Fri Jun 08 18:35:28 2012 +0200
@@ -23,7 +23,7 @@
 package com.oracle.graal.hotspot.ri;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
+import com.oracle.graal.hotspot.*;
 
 /**
  * Implementation of RiMethod for unresolved HotSpot methods.
@@ -33,7 +33,7 @@
     private final RiSignature signature;
     protected RiType holder;
 
-    public HotSpotMethodUnresolved(HotSpotCompiler compiler, String name, String signature, RiType holder) {
+    public HotSpotMethodUnresolved(HotSpotCompilerImpl compiler, String name, String signature, RiType holder) {
         super(compiler);
         this.name = name;
         this.holder = holder;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java	Fri Jun 08 18:35:28 2012 +0200
@@ -26,7 +26,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 
 public final class HotSpotProfilingInfo extends CompilerObject implements RiProfilingInfo {
@@ -41,7 +40,7 @@
     private HotSpotMethodData methodData;
     private final int codeSize;
 
-    public HotSpotProfilingInfo(HotSpotCompiler compiler, HotSpotMethodData methodData, int codeSize) {
+    public HotSpotProfilingInfo(HotSpotCompilerImpl compiler, HotSpotMethodData methodData, int codeSize) {
         super(compiler);
         this.methodData = methodData;
         this.codeSize = codeSize;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Fri Jun 08 18:35:28 2012 +0200
@@ -37,7 +37,6 @@
 import com.oracle.graal.cri.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.hotspot.target.amd64.*;
@@ -56,10 +55,10 @@
     public final HotSpotVMConfig config;
     final HotSpotRegisterConfig regConfig;
     private final HotSpotRegisterConfig globalStubRegConfig;
-    private final HotSpotCompiler compiler;
+    private final HotSpotCompilerImpl compiler;
     private CheckCastSnippets.Templates checkcasts;
 
-    public HotSpotRuntime(HotSpotVMConfig config, HotSpotCompiler compiler) {
+    public HotSpotRuntime(HotSpotVMConfig config, HotSpotCompilerImpl compiler) {
         this.config = config;
         this.compiler = compiler;
         regConfig = new HotSpotRegisterConfig(config, false);
@@ -77,7 +76,7 @@
     }
 
 
-    public HotSpotCompiler getCompiler() {
+    public HotSpotCompilerImpl getCompiler() {
         return compiler;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java	Fri Jun 08 18:35:28 2012 +0200
@@ -26,7 +26,6 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.java.*;
 
 /**
@@ -41,7 +40,7 @@
     private RiType[] argumentTypes;
     private RiType returnTypeCache;
 
-    public HotSpotSignature(HotSpotCompiler compiler, String signature) {
+    public HotSpotSignature(HotSpotCompilerImpl compiler, String signature) {
         super(compiler);
         assert signature.length() > 0;
         this.originalString = signature;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java	Fri Jun 08 18:35:28 2012 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Common interface for all HotSpot RiType-implementations.
@@ -33,7 +32,7 @@
     private static final long serialVersionUID = -4252886265301910771L;
     protected String name;
 
-    protected HotSpotType(HotSpotCompiler compiler) {
+    protected HotSpotType(HotSpotCompilerImpl compiler) {
         super(compiler);
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Fri Jun 08 18:35:28 2012 +0200
@@ -27,7 +27,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
+import com.oracle.graal.hotspot.*;
 
 /**
  * Implementation of RiType for primitive HotSpot types.
@@ -38,7 +38,7 @@
     private RiKind kind;
     private final HotSpotKlassOop klassOop;
 
-    public HotSpotTypePrimitive(HotSpotCompiler compiler, RiKind kind) {
+    public HotSpotTypePrimitive(HotSpotCompilerImpl compiler, RiKind kind) {
         super(compiler);
         this.kind = kind;
         this.name = String.valueOf(Character.toUpperCase(kind.typeChar));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java	Fri Jun 08 18:35:28 2012 +0200
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
+import com.oracle.graal.hotspot.*;
 
 /**
  * Implementation of RiType for unresolved HotSpot classes.
@@ -38,7 +38,7 @@
     /**
      * Creates a new unresolved type for a specified type descriptor.
      */
-    public HotSpotTypeUnresolved(HotSpotCompiler compiler, String name) {
+    public HotSpotTypeUnresolved(HotSpotCompilerImpl compiler, String name) {
         super(compiler);
         assert name.length() > 0 : "name cannot be empty";
 
@@ -62,7 +62,7 @@
         this.dimensions = dims;
     }
 
-    public HotSpotTypeUnresolved(HotSpotCompiler compiler, String name, int dimensions) {
+    public HotSpotTypeUnresolved(HotSpotCompilerImpl compiler, String name, int dimensions) {
         super(compiler);
         assert dimensions >= 0;
         this.simpleName = name;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java	Fri Jun 08 18:35:28 2012 +0200
@@ -37,7 +37,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.cri.xir.*;
 import com.oracle.max.cri.xir.CiXirAssembler.XirConstant;
@@ -76,12 +75,12 @@
     private final HotSpotVMConfig config;
     private final CiTarget target;
     private final CiRegisterConfig registerConfig;
-    private final HotSpotCompiler compiler;
+    private final HotSpotCompilerImpl compiler;
 
 
     private CiXirAssembler globalAsm;
 
-    public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, HotSpotCompiler compiler) {
+    public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, HotSpotCompilerImpl compiler) {
         this.config = config;
         this.target = target;
         this.registerConfig = registerConfig;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Jun 08 15:17:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Jun 08 18:35:28 2012 +0200
@@ -29,7 +29,6 @@
 import javax.net.*;
 
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
 
@@ -44,9 +43,9 @@
 
     public interface ConnectionObserver {
 
-        void connectionStarted(HotSpotCompiler compiler);
+        void connectionStarted(HotSpotCompilerImpl compiler);
 
-        void connectionFinished(HotSpotCompiler compiler);
+        void connectionFinished(HotSpotCompilerImpl compiler);
     }
 
     private final boolean multiple;
@@ -92,7 +91,7 @@
                 CompilerToVM toVM = (CompilerToVM) streams.getInvocation().waitForResult(false);
 
                 // return the initialized compiler to the client
-                HotSpotCompiler compiler = HotSpotCompilerImpl.initializeServer(toVM);
+                HotSpotCompilerImpl compiler = HotSpotCompilerImpl.initializeServer(toVM);
                 compiler.getCompiler();
                 streams.getInvocation().sendResult(compiler);
 
--- a/mx/projects	Fri Jun 08 15:17:43 2012 +0200
+++ b/mx/projects	Fri Jun 08 18:35:28 2012 +0200
@@ -28,6 +28,13 @@
 project@com.oracle.graal.api@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.api@javaCompliance=1.7
 
+# graal.api.test
+project@com.oracle.graal.api.test@subDir=graal
+project@com.oracle.graal.api.test@sourceDirs=src
+project@com.oracle.graal.api.test@dependencies=JUNIT,com.oracle.graal.api
+project@com.oracle.graal.api.test@checkstyle=com.oracle.graal.graph
+project@com.oracle.graal.api.test@javaCompliance=1.7
+
 # graal.api.meta
 project@com.oracle.graal.api.meta@subDir=graal
 project@com.oracle.graal.api.meta@sourceDirs=src
@@ -57,10 +64,17 @@
 
 # graal.graph
 project@com.oracle.graal.graph@subDir=graal
-project@com.oracle.graal.graph@sourceDirs=src,test
-project@com.oracle.graal.graph@dependencies=com.oracle.graal.debug,JUNIT
+project@com.oracle.graal.graph@sourceDirs=src
+project@com.oracle.graal.graph@dependencies=com.oracle.graal.debug
 project@com.oracle.graal.graph@javaCompliance=1.7
 
+# graal.graph.test
+project@com.oracle.graal.graph.test@subDir=graal
+project@com.oracle.graal.graph.test@sourceDirs=src
+project@com.oracle.graal.graph.test@checkstyle=com.oracle.graal.graph
+project@com.oracle.graal.graph.test@dependencies=JUNIT,com.oracle.graal.graph
+project@com.oracle.graal.graph.test@javaCompliance=1.7
+
 # graal.debug
 project@com.oracle.graal.debug@subDir=graal
 project@com.oracle.graal.debug@sourceDirs=src
@@ -126,7 +140,7 @@
 # graal.test
 project@com.oracle.graal.tests@subDir=graal
 project@com.oracle.graal.tests@sourceDirs=src
-project@com.oracle.graal.tests@dependencies=com.oracle.graal.printer
+project@com.oracle.graal.tests@dependencies=JUNIT,com.oracle.graal.printer
 project@com.oracle.graal.tests@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.tests@javaCompliance=1.7
 
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Jun 08 15:17:43 2012 +0200
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Jun 08 18:35:28 2012 +0200
@@ -282,7 +282,6 @@
   template(com_oracle_graal_hotspot_HotSpotKlassOop,              "com/oracle/graal/hotspot/ri/HotSpotKlassOop")                  \
   template(com_oracle_graal_hotspot_HotSpotExceptionHandler,      "com/oracle/graal/hotspot/ri/HotSpotExceptionHandler")          \
   template(com_oracle_graal_hotspot_HotSpotProxy,                 "com/oracle/graal/hotspot/HotSpotProxy")                        \
-  template(com_oracle_graal_hotspot_Compiler,                     "com/oracle/graal/hotspot/HotSpotCompiler")                            \
   template(com_oracle_graal_hotspot_CompilerImpl,                 "com/oracle/graal/hotspot/HotSpotCompilerImpl")                        \
   template(com_oracle_max_cri_ri_RiMethod,                            "com/oracle/graal/api/meta/RiMethod")                                   \
   template(com_oracle_max_cri_ri_RiResolvedField,                     "com/oracle/graal/api/meta/RiResolvedField")                            \
@@ -349,7 +348,7 @@
   template(getVMToCompiler_signature,                 "()Lcom/oracle/graal/hotspot/bridge/VMToCompiler;")               \
   template(getInstance_name,                          "getInstance")                                                    \
   template(initialize_name,                           "initialize")                                                     \
-  template(getInstance_signature,                     "()Lcom/oracle/graal/hotspot/HotSpotCompiler;")                          \
+  template(getInstance_signature,                     "()Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;")                          \
   template(forObject_name,                            "forObject")                                                      \
   template(callbackInternal_name,                     "callbackInternal")                                               \
   template(callback_signature,                        "(Ljava/lang/Object;)Ljava/lang/Object;")                         \
--- a/src/share/vm/graal/graalJavaAccess.hpp	Fri Jun 08 15:17:43 2012 +0200
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Fri Jun 08 18:35:28 2012 +0200
@@ -46,7 +46,7 @@
 
 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, static_oop_field)   \
   start_class(HotSpotTypeResolved)                                                      \
-    oop_field(HotSpotTypeResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompiler;")     \
+    oop_field(HotSpotTypeResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;")     \
     oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;")                     \
     oop_field(HotSpotTypeResolved, simpleName, "Ljava/lang/String;")                    \
     int_field(HotSpotTypeResolved, accessFlags)                                         \
@@ -63,7 +63,7 @@
     oop_field(HotSpotKlassOop, javaMirror, "Ljava/lang/Class;")                         \
     end_class                                                                           \
   start_class(HotSpotMethodResolved)                                                    \
-    oop_field(HotSpotMethodResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompiler;")   \
+    oop_field(HotSpotMethodResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;")   \
     oop_field(HotSpotMethodResolved, name, "Ljava/lang/String;")                        \
     oop_field(HotSpotMethodResolved, holder, "Lcom/oracle/graal/api/meta/RiResolvedType;")  \
     oop_field(HotSpotMethodResolved, javaMirror, "Ljava/lang/Object;")                  \
@@ -74,7 +74,7 @@
     boolean_field(HotSpotMethodResolved, canBeInlined)                                  \
   end_class                                                                             \
   start_class(HotSpotMethodData)                                                        \
-    oop_field(HotSpotMethodData, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompiler;")       \
+    oop_field(HotSpotMethodData, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;")       \
     oop_field(HotSpotMethodData, hotspotMirror, "Ljava/lang/Object;")                   \
     int_field(HotSpotMethodData, normalDataSize)                                        \
     int_field(HotSpotMethodData, extraDataSize)                                         \
@@ -88,7 +88,7 @@
     int_field(HotSpotField, accessFlags)                                                \
   end_class                                                                             \
   start_class(HotSpotCompiledMethod)                                                    \
-    oop_field(HotSpotCompiledMethod, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompiler;")   \
+    oop_field(HotSpotCompiledMethod, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;")   \
     long_field(HotSpotCompiledMethod, nmethod)                                          \
     oop_field(HotSpotCompiledMethod, method, "Lcom/oracle/graal/api/meta/RiResolvedMethod;")\
   end_class                                                                             \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/graal/graalRuntime.cpp	Fri Jun 08 18:35:28 2012 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+
+#include "graal/graalVMToCompiler.hpp"
+
+// JVM_InitializeGraalRuntime
+JVM_ENTRY(jobject, JVM_InitializeGraalRuntime(JNIEnv *env, jclass graalclass))
+  return VMToCompiler::compilerPermObject();
+JVM_END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/graal/graalRuntime.hpp	Fri Jun 08 18:35:28 2012 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+class GraalRuntime : public AllStatic {
+
+private:
+  jobject _runtimeObject;
+
+public:
+  static jobject instance() { return _runtimeObject; }
+
+};
\ No newline at end of file
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Fri Jun 08 15:17:43 2012 +0200
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Fri Jun 08 18:35:28 2012 +0200
@@ -53,13 +53,13 @@
 
 Handle VMToCompiler::instance() {
   if (JNIHandles::resolve(_vmToCompilerPermObject) == NULL) {
-    KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
+    KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current());
     check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.Compiler");
 
     JavaValue result(T_OBJECT);
     JavaCallArguments args;
     args.set_receiver(compilerInstance());
-    JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMToCompiler_name(), vmSymbols::getVMToCompiler_signature(), &args, Thread::current());
+    JavaCalls::call_virtual(&result, compilerKlass, vmSymbols::getVMToCompiler_name(), vmSymbols::getVMToCompiler_signature(), &args, Thread::current());
     check_pending_exception("Couldn't get VMToCompiler");
     _vmToCompilerPermObject = JNIHandles::make_global((oop) result.get_jobject());
   }
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Fri Jun 08 15:17:43 2012 +0200
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Fri Jun 08 18:35:28 2012 +0200
@@ -44,6 +44,10 @@
 
   static Handle compilerInstance();
 
+  static jobject compilerPermObject() {
+    return _compilerPermObject;
+  }
+
   // public static boolean HotSpotOptions.setOption(String option);
   static jboolean setOption(Handle option);
 
--- a/src/share/vm/prims/nativeLookup.cpp	Fri Jun 08 15:17:43 2012 +0200
+++ b/src/share/vm/prims/nativeLookup.cpp	Fri Jun 08 18:35:28 2012 +0200
@@ -121,6 +121,9 @@
   void JNICALL JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls);
   void JNICALL JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass unsafecls);
   void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
+#ifdef GRAAL
+  jobject JNICALL JVM_InitializeGraalRuntime(JNIEnv *env, jclass graalclass);
+#endif
 }
 
 #define CC (char*)  /* cast a literal from (const char*) */
@@ -134,6 +137,10 @@
   { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
   { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
   { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         }
+#ifdef GRAAL
+  ,
+  { CC"Java_com_oracle_graal_api_Graal_initializeRuntime",         NULL, FN_PTR(JVM_InitializeGraalRuntime)      }
+#endif
 };
 
 static address lookup_special_native(char* jni_name) {