# HG changeset patch # User Thomas Wuerthinger # Date 1339187979 -7200 # Node ID 82f2bb47c97ee2899adce31027de59d81d6645da # Parent 816fb2492760f586514c96d01ed35b2b7cc44173 Clean up on HotSpotCompilerImpl class. diff -r 816fb2492760 -r 82f2bb47c97e graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 22:00:05 2012 +0200 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 22:39:39 2012 +0200 @@ -91,7 +91,7 @@ CompilerToVM toVM = (CompilerToVM) streams.getInvocation().waitForResult(false); // return the initialized compiler to the client - HotSpotCompilerImpl compiler = HotSpotCompilerImpl.initializeServer(toVM); + HotSpotCompilerImpl compiler = initializeServer(toVM); compiler.getCompiler(); streams.getInvocation().sendResult(compiler); @@ -118,4 +118,10 @@ } } while (multiple); } + + @SuppressWarnings("unused") + private static HotSpotCompilerImpl initializeServer(CompilerToVM toVM) { + // TODO(thomaswue): Fix creation of compiler instances on server side. + return null; + } } diff -r 816fb2492760 -r 82f2bb47c97e 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 22:00:05 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java Fri Jun 08 22:39:39 2012 +0200 @@ -28,7 +28,6 @@ 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.*; @@ -40,28 +39,10 @@ */ public final class HotSpotCompilerImpl implements GraalRuntime { - private static HotSpotCompilerImpl theInstance; + private static final HotSpotCompilerImpl instance = new HotSpotCompilerImpl(); public static HotSpotCompilerImpl getInstance() { - if (theInstance == null) { - initialize(); - } - return theInstance; - } - - public static synchronized void initialize() { - if (theInstance != null) { - return; - } - - // ordinary local compilation - theInstance = new HotSpotCompilerImpl(null); - } - - public static HotSpotCompilerImpl initializeServer(CompilerToVM entries) { - assert theInstance == null; - theInstance = new HotSpotCompilerImpl(entries); - return theInstance; + return instance; } private final CompilerToVM compilerToVm; @@ -78,13 +59,9 @@ return config; } - private HotSpotCompilerImpl(CompilerToVM initialEntries) { + private HotSpotCompilerImpl() { - CompilerToVM toVM = initialEntries; - // initialize CompilerToVM - if (toVM == null) { - toVM = new CompilerToVMImpl(); - } + CompilerToVM toVM = new CompilerToVMImpl(); // initialize VmToCompiler VMToCompiler toCompiler = new VMToCompilerImpl(this); @@ -102,8 +79,6 @@ // set the final fields compilerToVm = toVM; vmToCompiler = toCompiler; - - // initialize compiler config = compilerToVm.getConfiguration(); config.check(); @@ -133,20 +108,6 @@ 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(); - } - public GraalCompiler getCompiler() { if (compiler == null) { // these options are important - graal will not generate correct code without them diff -r 816fb2492760 -r 82f2bb47c97e src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Fri Jun 08 22:00:05 2012 +0200 +++ b/src/share/vm/graal/graalCompiler.cpp Fri Jun 08 22:39:39 2012 +0200 @@ -73,7 +73,6 @@ { VM_ENTRY_MARK; HandleMark hm; - VMToCompiler::initializeCompiler(); VMToCompiler::setDefaultOptions(); for (int i = 0; i < Arguments::num_graal_args(); ++i) { const char* arg = Arguments::graal_args_array()[i]; diff -r 816fb2492760 -r 82f2bb47c97e src/share/vm/graal/graalVMToCompiler.cpp --- a/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 22:00:05 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 22:39:39 2012 +0200 @@ -66,15 +66,6 @@ return Handle(JNIHandles::resolve_non_null(_vmToCompilerPermObject)); } -void VMToCompiler::initializeCompiler() { - KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); - check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.CompilerImpl"); - - JavaValue result(T_VOID); - JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::initialize_name(), vmSymbols::void_method_signature(), Thread::current()); - check_pending_exception("Couldn't initialize compiler"); -} - jboolean VMToCompiler::setOption(Handle option) { assert(!option.is_null(), ""); KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current()); diff -r 816fb2492760 -r 82f2bb47c97e src/share/vm/graal/graalVMToCompiler.hpp --- a/src/share/vm/graal/graalVMToCompiler.hpp Fri Jun 08 22:00:05 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.hpp Fri Jun 08 22:39:39 2012 +0200 @@ -40,8 +40,6 @@ static Handle instance(); public: - static void initializeCompiler(); - static Handle compilerInstance(); static jobject compilerPermObject() {