# HG changeset patch # User Thomas Wuerthinger # Date 1339173093 -7200 # Node ID 87e4aed94b265c5ef025483f5d46347b8a75f2d6 # Parent 77d302416830edbb057b1d48127e3f1c0c7e00d2 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming). diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiler.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiler.java Fri Jun 08 17:55:28 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(); - -} diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java Fri Jun 08 18:31:33 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 getCapability(Class clazz) { + return null; + } } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Jun 08 17:55:28 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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 com.oracle.graal.api.*; - - -public class HotSpotGraalRuntime implements GraalRuntime { - - public HotSpotGraalRuntime() { - } - - @Override - public String getName() { - return "HotSpotGraalRuntime"; - } - - @Override - public T getCapability(Class clazz) { - return null; - } -} diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Jun 08 18:31:33 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); diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java Fri Jun 08 18:31:33 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); } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Fri Jun 08 18:31:33 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"); } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Jun 08 18:31:33 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; } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java Fri Jun 08 18:31:33 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); } diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Fri Jun 08 18:31:33 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)); diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Fri Jun 08 18:31:33 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; diff -r 77d302416830 -r 87e4aed94b26 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 17:55:28 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 18:31:33 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); diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Fri Jun 08 17:55:28 2012 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Jun 08 18:31:33 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;") \ diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Fri Jun 08 17:55:28 2012 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Fri Jun 08 18:31:33 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 \ diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Fri Jun 08 17:55:28 2012 +0200 +++ b/src/share/vm/graal/graalRuntime.cpp Fri Jun 08 18:31:33 2012 +0200 @@ -23,14 +23,9 @@ #include "precompiled.hpp" +#include "graal/graalVMToCompiler.hpp" + // JVM_InitializeGraalRuntime JVM_ENTRY(jobject, JVM_InitializeGraalRuntime(JNIEnv *env, jclass graalclass)) - ThreadToNativeFromVM ttnfv(thread); - jclass klass = env->FindClass("com/oracle/graal/hotspot/HotSpotGraalRuntime"); - guarantee(klass != NULL, "Could not find class com.oracle.graal.hotspot.HotSpotGraalRuntime"); - jmethodID constructor = env->GetMethodID(klass, "", "()V"); - guarantee(constructor != NULL, "Constructor of HotSpotGraalRuntime must not have any parameters"); - jobject newObj = env->AllocObject(klass); - env->CallVoidMethod(newObj, constructor); - return newObj; + return VMToCompiler::compilerPermObject(); JVM_END \ No newline at end of file diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/graal/graalRuntime.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/graal/graalRuntime.hpp Fri Jun 08 18:31:33 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 diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/graal/graalVMToCompiler.cpp --- a/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 17:55:28 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 18:31:33 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()); } diff -r 77d302416830 -r 87e4aed94b26 src/share/vm/graal/graalVMToCompiler.hpp --- a/src/share/vm/graal/graalVMToCompiler.hpp Fri Jun 08 17:55:28 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.hpp Fri Jun 08 18:31:33 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);