changeset 5514:5d19620a331d

Added VirtualMachineComponent as well as CompilationQueue and Interpreter interfaces.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Jun 2012 20:39:56 +0200
parents 933322fc2e79
children 35753b8c098a
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationQueue.java graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VirtualMachineComponent.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java mx/projects
diffstat 35 files changed, 458 insertions(+), 371 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationQueue.java	Thu Jun 07 20:39:56 2012 +0200
@@ -0,0 +1,30 @@
+/*
+ * 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.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+
+public interface CompilationQueue {
+    boolean enqueue(final RiResolvedMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Thu Jun 07 20:39:56 2012 +0200
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package com.oracle.graal.api.interpreter;
+
+import com.oracle.graal.api.meta.*;
+
+public interface Interpreter extends VirtualMachineComponent {
+    Object execute(RiResolvedMethod method, Object... arguments);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VirtualMachineComponent.java	Thu Jun 07 20:39:56 2012 +0200
@@ -0,0 +1,28 @@
+/*
+ * 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.meta;
+
+
+public interface VirtualMachineComponent {
+    void setOption(String name, String value);
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Jun 07 20:39:56 2012 +0200
@@ -47,18 +47,18 @@
 
     private volatile boolean cancelled;
 
-    private final Compiler compiler;
+    private final HotSpotCompiler 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(Compiler compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
+    public static CompilationTask create(HotSpotCompiler compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
         return new CompilationTask(compiler, plan, optimisticOpts, method, id, priority);
     }
 
-    private CompilationTask(Compiler compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) {
+    private CompilationTask(HotSpotCompiler 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/Compiler.java	Thu Jun 07 19:53:13 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 Compiler {
-
-    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/CompilerImpl.java	Thu Jun 07 19:53:13 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2011, 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.hotspot;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.cri.*;
-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 CompilerImpl implements Compiler, Remote {
-
-    private static Compiler theInstance;
-
-    public static Compiler getInstance() {
-        if (theInstance == null) {
-            initialize();
-        }
-        return theInstance;
-    }
-
-    public static synchronized void initialize() {
-        if (theInstance != null) {
-            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 = (Compiler) 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 CompilerImpl(null);
-        }
-    }
-
-    public static Compiler initializeServer(CompilerToVM entries) {
-        assert theInstance == null;
-        theInstance = new CompilerImpl(entries);
-        return theInstance;
-    }
-
-    private final CompilerToVM compilerToVm;
-    private final VMToCompiler vmToCompiler;
-
-    private HotSpotRuntime runtime;
-    private GraalCompiler compiler;
-    private CiTarget target;
-    private volatile HotSpotGraphCache cache;
-
-    private final HotSpotVMConfig config;
-
-    public HotSpotVMConfig getConfig() {
-        return config;
-    }
-
-    private CompilerImpl(CompilerToVM initialEntries) {
-
-        CompilerToVM toVM = initialEntries;
-        // initialize CompilerToVM
-        if (toVM == null) {
-            toVM = new CompilerToVMImpl();
-        }
-
-        // initialize VmToCompiler
-        VMToCompiler toCompiler = new VMToCompilerImpl(this);
-
-        // logging, etc.
-        if (CountingProxy.ENABLED) {
-            toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler);
-            toVM = CountingProxy.getProxy(CompilerToVM.class, toVM);
-        }
-        if (Logger.ENABLED) {
-            toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler);
-            toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM);
-        }
-
-        // set the final fields
-        compilerToVm = toVM;
-        vmToCompiler = toCompiler;
-
-        // initialize compiler
-        config = compilerToVm.getConfiguration();
-        config.check();
-
-        if (Boolean.valueOf(System.getProperty("graal.printconfig"))) {
-            printConfig(config);
-        }
-    }
-
-    private static void printConfig(HotSpotVMConfig config) {
-        Field[] fields = config.getClass().getDeclaredFields();
-        for (Field f : fields) {
-            f.setAccessible(true);
-            try {
-                Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config))));
-            } catch (Exception e) {
-            }
-        }
-    }
-
-    @Override
-    public CiTarget getTarget() {
-        if (target == null) {
-            final int wordSize = 8;
-            final int stackFrameAlignment = 16;
-            target = new CiTarget(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true, true);
-        }
-
-        return target;
-    }
-
-    /**
-     * Factory method for getting a {@link ExtendedRiRuntime} instance. This method is called via reflection.
-     */
-    public static ExtendedRiRuntime getGraalRuntime() {
-        return getInstance().getRuntime();
-    }
-
-    /**
-     * Factory method for getting a {@link GraalCompiler} instance. This method is called via reflection.
-     */
-    public static GraalCompiler getGraalCompiler() {
-        return getInstance().getCompiler();
-    }
-
-    @Override
-    public GraalCompiler getCompiler() {
-        if (compiler == null) {
-            // these options are important - graal will not generate correct code without them
-            GraalOptions.StackShadowPages = config.stackShadowPages;
-
-            RiXirGenerator generator = new HotSpotXirGenerator(config, getTarget(), getRuntime().getGlobalStubRegisterConfig(), this);
-            if (Logger.ENABLED) {
-                generator = LoggingProxy.getProxy(RiXirGenerator.class, generator);
-            }
-
-            Backend backend = Backend.create(runtime, target);
-            generator.initialize(backend.newXirAssembler());
-
-            compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator);
-            if (GraalOptions.CacheGraphs) {
-                cache = new HotSpotGraphCache();
-            }
-        }
-        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;
-            RiKind kind = RiKind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0));
-            switch(kind) {
-                case Boolean:
-                    return exitsNative.typeBoolean;
-                case Byte:
-                    return exitsNative.typeByte;
-                case Char:
-                    return exitsNative.typeChar;
-                case Double:
-                    return exitsNative.typeDouble;
-                case Float:
-                    return exitsNative.typeFloat;
-                case Illegal:
-                    break;
-                case Int:
-                    return exitsNative.typeInt;
-                case Jsr:
-                    break;
-                case Long:
-                    return exitsNative.typeLong;
-                case Object:
-                    break;
-                case Short:
-                    return exitsNative.typeShort;
-                case Void:
-                    return exitsNative.typeVoid;
-            }
-        }
-        return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve);
-    }
-
-    @Override
-    public HotSpotRuntime getRuntime() {
-        if (runtime == null) {
-            runtime = new HotSpotRuntime(config, this);
-        }
-        return runtime;
-    }
-
-    public void evictDeoptedGraphs() {
-        if (cache != null) {
-            long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds();
-            if (deoptedGraphs != null) {
-                if (deoptedGraphs.length == 0) {
-                    cache.clear();
-                } else {
-                    cache.removeGraphs(deoptedGraphs);
-                }
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Thu Jun 07 20:39:56 2012 +0200
@@ -32,9 +32,9 @@
  */
 public abstract class CompilerObject implements Serializable, FormatWithToString {
     private static final long serialVersionUID = -4551670987101214877L;
-    protected final Compiler compiler;
+    protected final HotSpotCompiler compiler;
 
-    protected CompilerObject(Compiler compiler) {
+    protected CompilerObject(HotSpotCompiler compiler) {
         this.compiler = compiler;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java	Thu Jun 07 20:39:56 2012 +0200
@@ -58,7 +58,7 @@
     public void run() {
         if (GraalOptions.Debug) {
             Debug.enable();
-            PrintStream log = CompilerImpl.getInstance().getVMToCompiler().log();
+            PrintStream log = HotSpotCompilerImpl.getInstance().getVMToCompiler().log();
             HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter, log);
             Debug.setConfig(hotspotDebugConfig);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiler.java	Thu Jun 07 20:39:56 2012 +0200
@@ -0,0 +1,43 @@
+/*
+ * 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();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java	Thu Jun 07 20:39:56 2012 +0200
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2011, 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.hotspot;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.*;
+import com.oracle.graal.compiler.target.*;
+import com.oracle.graal.cri.*;
+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 {
+
+    private static HotSpotCompiler theInstance;
+
+    public static HotSpotCompiler getInstance() {
+        if (theInstance == null) {
+            initialize();
+        }
+        return theInstance;
+    }
+
+    public static synchronized void initialize() {
+        if (theInstance != null) {
+            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);
+        }
+    }
+
+    public static HotSpotCompiler initializeServer(CompilerToVM entries) {
+        assert theInstance == null;
+        theInstance = new HotSpotCompilerImpl(entries);
+        return theInstance;
+    }
+
+    private final CompilerToVM compilerToVm;
+    private final VMToCompiler vmToCompiler;
+
+    private HotSpotRuntime runtime;
+    private GraalCompiler compiler;
+    private CiTarget target;
+    private volatile HotSpotGraphCache cache;
+
+    private final HotSpotVMConfig config;
+
+    public HotSpotVMConfig getConfig() {
+        return config;
+    }
+
+    private HotSpotCompilerImpl(CompilerToVM initialEntries) {
+
+        CompilerToVM toVM = initialEntries;
+        // initialize CompilerToVM
+        if (toVM == null) {
+            toVM = new CompilerToVMImpl();
+        }
+
+        // initialize VmToCompiler
+        VMToCompiler toCompiler = new VMToCompilerImpl(this);
+
+        // logging, etc.
+        if (CountingProxy.ENABLED) {
+            toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler);
+            toVM = CountingProxy.getProxy(CompilerToVM.class, toVM);
+        }
+        if (Logger.ENABLED) {
+            toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler);
+            toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM);
+        }
+
+        // set the final fields
+        compilerToVm = toVM;
+        vmToCompiler = toCompiler;
+
+        // initialize compiler
+        config = compilerToVm.getConfiguration();
+        config.check();
+
+        if (Boolean.valueOf(System.getProperty("graal.printconfig"))) {
+            printConfig(config);
+        }
+    }
+
+    private static void printConfig(HotSpotVMConfig config) {
+        Field[] fields = config.getClass().getDeclaredFields();
+        for (Field f : fields) {
+            f.setAccessible(true);
+            try {
+                Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config))));
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    @Override
+    public CiTarget getTarget() {
+        if (target == null) {
+            final int wordSize = 8;
+            final int stackFrameAlignment = 16;
+            target = new CiTarget(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true, true);
+        }
+
+        return target;
+    }
+
+    /**
+     * Factory method for getting a {@link ExtendedRiRuntime} instance. This method is called via reflection.
+     */
+    public static ExtendedRiRuntime getGraalRuntime() {
+        return getInstance().getRuntime();
+    }
+
+    /**
+     * Factory method for getting a {@link GraalCompiler} instance. This method is called via reflection.
+     */
+    public static GraalCompiler getGraalCompiler() {
+        return getInstance().getCompiler();
+    }
+
+    @Override
+    public GraalCompiler getCompiler() {
+        if (compiler == null) {
+            // these options are important - graal will not generate correct code without them
+            GraalOptions.StackShadowPages = config.stackShadowPages;
+
+            RiXirGenerator generator = new HotSpotXirGenerator(config, getTarget(), getRuntime().getGlobalStubRegisterConfig(), this);
+            if (Logger.ENABLED) {
+                generator = LoggingProxy.getProxy(RiXirGenerator.class, generator);
+            }
+
+            Backend backend = Backend.create(runtime, target);
+            generator.initialize(backend.newXirAssembler());
+
+            compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator);
+            if (GraalOptions.CacheGraphs) {
+                cache = new HotSpotGraphCache();
+            }
+        }
+        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;
+            RiKind kind = RiKind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0));
+            switch(kind) {
+                case Boolean:
+                    return exitsNative.typeBoolean;
+                case Byte:
+                    return exitsNative.typeByte;
+                case Char:
+                    return exitsNative.typeChar;
+                case Double:
+                    return exitsNative.typeDouble;
+                case Float:
+                    return exitsNative.typeFloat;
+                case Illegal:
+                    break;
+                case Int:
+                    return exitsNative.typeInt;
+                case Jsr:
+                    break;
+                case Long:
+                    return exitsNative.typeLong;
+                case Object:
+                    break;
+                case Short:
+                    return exitsNative.typeShort;
+                case Void:
+                    return exitsNative.typeVoid;
+            }
+        }
+        return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve);
+    }
+
+    @Override
+    public HotSpotRuntime getRuntime() {
+        if (runtime == null) {
+            runtime = new HotSpotRuntime(config, this);
+        }
+        return runtime;
+    }
+
+    public void evictDeoptedGraphs() {
+        if (cache != null) {
+            long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds();
+            if (deoptedGraphs != null) {
+                if (deoptedGraphs.length == 0) {
+                    cache.clear();
+                } else {
+                    cache.removeGraphs(deoptedGraphs);
+                }
+            }
+        }
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Thu Jun 07 20:39:56 2012 +0200
@@ -42,7 +42,7 @@
     public final Site[] sites;
     public final ExceptionHandler[] exceptionHandlers;
 
-    public HotSpotTargetMethod(Compiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
+    public HotSpotTargetMethod(HotSpotCompiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
         super(compiler);
         this.method = method;
         this.targetMethod = targetMethod;
@@ -56,7 +56,7 @@
         }
     }
 
-    private HotSpotTargetMethod(Compiler compiler, CiTargetMethod targetMethod, String name) {
+    private HotSpotTargetMethod(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Jun 07 20:39:56 2012 +0200
@@ -37,7 +37,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+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 +51,7 @@
  */
 public class VMToCompilerImpl implements VMToCompiler, Remote {
 
-    private final Compiler compiler;
+    private final HotSpotCompiler compiler;
     private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
 
     public final HotSpotTypePrimitive typeBoolean;
@@ -70,7 +70,7 @@
 
     private PrintStream log = System.out;
 
-    public VMToCompilerImpl(Compiler compiler) {
+    public VMToCompilerImpl(HotSpotCompiler compiler) {
         this.compiler = compiler;
 
         typeBoolean = new HotSpotTypePrimitive(compiler, RiKind.Boolean);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Thu Jun 07 20:39:56 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.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 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(Compiler compiler) {
+    public static void printCounters(HotSpotCompiler compiler) {
         if (!GraalOptions.MethodEntryCounters) {
             return;
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Thu Jun 07 20:39:56 2012 +0200
@@ -57,7 +57,7 @@
     @Override
     public void generate(LIRGeneratorTool generator) {
         LIRGenerator gen = (LIRGenerator) generator;
-        HotSpotVMConfig config = CompilerImpl.getInstance().getConfig();
+        HotSpotVMConfig config = HotSpotCompilerImpl.getInstance().getConfig();
         RiResolvedMethod method = frameState.method();
         boolean isStatic = Modifier.isStatic(method.accessFlags());
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Thu Jun 07 20:39:56 2012 +0200
@@ -36,7 +36,7 @@
     }
 
     protected void generateBarrier(RiValue adr, LIRGeneratorTool gen) {
-        HotSpotVMConfig config = CompilerImpl.getInstance().getConfig();
+        HotSpotVMConfig config = HotSpotCompilerImpl.getInstance().getConfig();
         RiValue base = gen.emitUShr(adr, RiConstant.forInt(config.cardtableShift));
 
         long startAddress = config.cardtableStartAddress;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Thu Jun 07 20:39:56 2012 +0200
@@ -25,7 +25,7 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of {@link RiCodeInfo} for HotSpot.
@@ -39,7 +39,7 @@
     public final CiTargetMethod targetMethod;
     private HotSpotMethodResolved method;
 
-    public HotSpotCodeInfo(Compiler compiler, CiTargetMethod targetMethod, HotSpotMethodResolved method) {
+    public HotSpotCodeInfo(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java	Thu Jun 07 20:39:56 2012 +0200
@@ -27,7 +27,7 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiCompiledMethod for HotSpot.
@@ -42,7 +42,7 @@
     private final RiResolvedMethod method;
     private long nmethod;
 
-    public HotSpotCompiledMethod(Compiler compiler, RiResolvedMethod method) {
+    public HotSpotCompiledMethod(HotSpotCompiler compiler, RiResolvedMethod method) {
         super(compiler);
         this.method = method;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java	Thu Jun 07 20:39:56 2012 +0200
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiConstantPool for HotSpot.
@@ -35,7 +35,7 @@
 
     private final HotSpotTypeResolvedImpl type;
 
-    public HotSpotConstantPool(Compiler compiler, HotSpotTypeResolvedImpl type) {
+    public HotSpotConstantPool(HotSpotCompiler compiler, HotSpotTypeResolvedImpl type) {
         super(compiler);
         this.type = type;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Thu Jun 07 20:39:56 2012 +0200
@@ -31,7 +31,7 @@
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Represents a field in a HotSpot type.
@@ -46,7 +46,7 @@
     private final int accessFlags;
     private RiConstant constant;                // Constant part only valid for static fields.
 
-    public HotSpotField(Compiler compiler, RiResolvedType holder, String name, RiType type, int offset, int accessFlags) {
+    public HotSpotField(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java	Thu Jun 07 20:39:56 2012 +0200
@@ -23,7 +23,7 @@
 package com.oracle.graal.hotspot.ri;
 
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * A mechanism for safely conveying a HotSpot klassOop value from the compiler to the C++ code.
@@ -40,7 +40,7 @@
      */
     public final Class javaMirror;
 
-    public HotSpotKlassOop(Compiler compiler, Class javaMirror) {
+    public HotSpotKlassOop(HotSpotCompiler compiler, Class javaMirror) {
         super(compiler);
         this.javaMirror = javaMirror;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java	Thu Jun 07 20:39:56 2012 +0200
@@ -24,14 +24,14 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+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(Compiler compiler) {
+    protected HotSpotMethod(HotSpotCompiler compiler) {
         super(compiler);
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java	Thu Jun 07 20:39:56 2012 +0200
@@ -30,7 +30,7 @@
 import com.oracle.graal.api.meta.RiTypeProfile.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 
 public final class HotSpotMethodData extends CompilerObject {
@@ -38,7 +38,7 @@
     private static final long serialVersionUID = -8873133496591225071L;
 
     static {
-        config = CompilerImpl.getInstance().getConfig();
+        config = HotSpotCompilerImpl.getInstance().getConfig();
     }
 
     // TODO (chaeubl) use same logic as in NodeClass?
@@ -57,7 +57,7 @@
     private int normalDataSize;
     private int extraDataSize;
 
-    private HotSpotMethodData(Compiler compiler) {
+    private HotSpotMethodData(HotSpotCompiler compiler) {
         super(compiler);
         throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM");
     }
@@ -344,7 +344,7 @@
                     Object graalMirror = unsafe.getObject(receiverKlassOop, (long) config.graalMirrorKlassOffset);
                     if (graalMirror == null) {
                         Class<?> javaClass = (Class<?>) unsafe.getObject(receiverKlassOop, (long) config.classMirrorOffset);
-                        graalMirror = CompilerImpl.getInstance().getCompilerToVM().getType(javaClass);
+                        graalMirror = HotSpotCompilerImpl.getInstance().getCompilerToVM().getType(javaClass);
                         assert graalMirror != null : "must not return null";
                     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java	Thu Jun 07 20:39:56 2012 +0200
@@ -23,7 +23,7 @@
 package com.oracle.graal.hotspot.ri;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiMethod for unresolved HotSpot methods.
@@ -33,7 +33,7 @@
     private final RiSignature signature;
     protected RiType holder;
 
-    public HotSpotMethodUnresolved(Compiler compiler, String name, String signature, RiType holder) {
+    public HotSpotMethodUnresolved(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java	Thu Jun 07 20:39:56 2012 +0200
@@ -26,7 +26,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 
 public final class HotSpotProfilingInfo extends CompilerObject implements RiProfilingInfo {
@@ -41,7 +41,7 @@
     private HotSpotMethodData methodData;
     private final int codeSize;
 
-    public HotSpotProfilingInfo(Compiler compiler, HotSpotMethodData methodData, int codeSize) {
+    public HotSpotProfilingInfo(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Thu Jun 07 20:39:56 2012 +0200
@@ -37,7 +37,7 @@
 import com.oracle.graal.cri.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+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 +56,10 @@
     public final HotSpotVMConfig config;
     final HotSpotRegisterConfig regConfig;
     private final HotSpotRegisterConfig globalStubRegConfig;
-    private final Compiler compiler;
+    private final HotSpotCompiler compiler;
     private CheckCastSnippets.Templates checkcasts;
 
-    public HotSpotRuntime(HotSpotVMConfig config, Compiler compiler) {
+    public HotSpotRuntime(HotSpotVMConfig config, HotSpotCompiler compiler) {
         this.config = config;
         this.compiler = compiler;
         regConfig = new HotSpotRegisterConfig(config, false);
@@ -77,7 +77,7 @@
     }
 
 
-    public Compiler getCompiler() {
+    public HotSpotCompiler getCompiler() {
         return compiler;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java	Thu Jun 07 20:39:56 2012 +0200
@@ -26,7 +26,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.java.*;
 
 /**
@@ -41,7 +41,7 @@
     private RiType[] argumentTypes;
     private RiType returnTypeCache;
 
-    public HotSpotSignature(Compiler compiler, String signature) {
+    public HotSpotSignature(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java	Thu Jun 07 20:39:56 2012 +0200
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Common interface for all HotSpot RiType-implementations.
@@ -33,7 +33,7 @@
     private static final long serialVersionUID = -4252886265301910771L;
     protected String name;
 
-    protected HotSpotType(Compiler compiler) {
+    protected HotSpotType(HotSpotCompiler compiler) {
         super(compiler);
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Thu Jun 07 20:39:56 2012 +0200
@@ -27,7 +27,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiType for primitive HotSpot types.
@@ -38,7 +38,7 @@
     private RiKind kind;
     private final HotSpotKlassOop klassOop;
 
-    public HotSpotTypePrimitive(Compiler compiler, RiKind kind) {
+    public HotSpotTypePrimitive(HotSpotCompiler 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/HotSpotTypeResolvedImpl.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java	Thu Jun 07 20:39:56 2012 +0200
@@ -276,7 +276,7 @@
         return klassOopCache;
     }
 
-    private static final int SECONDARY_SUPER_CACHE_OFFSET = CompilerImpl.getInstance().getConfig().secondarySuperCacheOffset;
+    private static final int SECONDARY_SUPER_CACHE_OFFSET = HotSpotCompilerImpl.getInstance().getConfig().secondarySuperCacheOffset;
 
     public boolean isPrimaryType() {
         return SECONDARY_SUPER_CACHE_OFFSET != superCheckOffset;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java	Thu Jun 07 20:39:56 2012 +0200
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 
 /**
  * Implementation of RiType for unresolved HotSpot classes.
@@ -38,7 +38,7 @@
     /**
      * Creates a new unresolved type for a specified type descriptor.
      */
-    public HotSpotTypeUnresolved(Compiler compiler, String name) {
+    public HotSpotTypeUnresolved(HotSpotCompiler compiler, String name) {
         super(compiler);
         assert name.length() > 0 : "name cannot be empty";
 
@@ -62,7 +62,7 @@
         this.dimensions = dims;
     }
 
-    public HotSpotTypeUnresolved(Compiler compiler, String name, int dimensions) {
+    public HotSpotTypeUnresolved(HotSpotCompiler 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	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java	Thu Jun 07 20:39:56 2012 +0200
@@ -37,7 +37,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+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 +76,12 @@
     private final HotSpotVMConfig config;
     private final CiTarget target;
     private final CiRegisterConfig registerConfig;
-    private final Compiler compiler;
+    private final HotSpotCompiler compiler;
 
 
     private CiXirAssembler globalAsm;
 
-    public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, Compiler compiler) {
+    public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, HotSpotCompiler compiler) {
         this.config = config;
         this.target = target;
         this.registerConfig = registerConfig;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java	Thu Jun 07 20:39:56 2012 +0200
@@ -29,7 +29,7 @@
 import javax.net.*;
 
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.Compiler;
+import com.oracle.graal.hotspot.HotSpotCompiler;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
 
@@ -44,9 +44,9 @@
 
     public interface ConnectionObserver {
 
-        void connectionStarted(Compiler compiler);
+        void connectionStarted(HotSpotCompiler compiler);
 
-        void connectionFinished(Compiler compiler);
+        void connectionFinished(HotSpotCompiler compiler);
     }
 
     private final boolean multiple;
@@ -92,7 +92,7 @@
                 CompilerToVM toVM = (CompilerToVM) streams.getInvocation().waitForResult(false);
 
                 // return the initialized compiler to the client
-                Compiler compiler = CompilerImpl.initializeServer(toVM);
+                HotSpotCompiler compiler = HotSpotCompilerImpl.initializeServer(toVM);
                 compiler.getCompiler();
                 streams.getInvocation().sendResult(compiler);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Jun 07 20:39:56 2012 +0200
@@ -373,11 +373,11 @@
 
     @Fold
     private static int cardTableShift() {
-        return CompilerImpl.getInstance().getConfig().cardtableShift;
+        return HotSpotCompilerImpl.getInstance().getConfig().cardtableShift;
     }
 
     @Fold
     private static long cardTableStart() {
-        return CompilerImpl.getInstance().getConfig().cardtableStartAddress;
+        return HotSpotCompilerImpl.getInstance().getConfig().cardtableStartAddress;
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Thu Jun 07 19:53:13 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Thu Jun 07 20:39:56 2012 +0200
@@ -276,22 +276,22 @@
 
     @Fold
     private static int superCheckOffsetOffset() {
-        return CompilerImpl.getInstance().getConfig().superCheckOffsetOffset;
+        return HotSpotCompilerImpl.getInstance().getConfig().superCheckOffsetOffset;
     }
 
     @Fold
     private static int secondarySuperCacheOffset() {
-        return CompilerImpl.getInstance().getConfig().secondarySuperCacheOffset;
+        return HotSpotCompilerImpl.getInstance().getConfig().secondarySuperCacheOffset;
     }
 
     @Fold
     private static int secondarySupersOffset() {
-        return CompilerImpl.getInstance().getConfig().secondarySupersOffset;
+        return HotSpotCompilerImpl.getInstance().getConfig().secondarySupersOffset;
     }
 
     @Fold
     private static int hubOffset() {
-        return CompilerImpl.getInstance().getConfig().hubOffset;
+        return HotSpotCompilerImpl.getInstance().getConfig().hubOffset;
     }
 
     public static void printCounter(PrintStream out, Counter c, long total) {
--- a/mx/projects	Thu Jun 07 19:53:13 2012 +0200
+++ b/mx/projects	Thu Jun 07 20:39:56 2012 +0200
@@ -153,7 +153,7 @@
 # max.cri
 project@com.oracle.max.cri@subDir=graal
 project@com.oracle.max.cri@sourceDirs=src
-project@com.oracle.max.cri@dependencies=com.oracle.graal.api.meta,com.oracle.graal.api.code
+project@com.oracle.max.cri@dependencies=com.oracle.graal.api.code
 project@com.oracle.max.cri@checkstyle=com.oracle.graal.graph
 project@com.oracle.max.cri@javaCompliance=1.7