Mercurial > hg > graal-jvmci-8
changeset 5532:82f2bb47c97e
Clean up on HotSpotCompilerImpl class.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 08 Jun 2012 22:39:39 +0200 |
parents | 816fb2492760 |
children | c5c13f3ed5c4 |
files | graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalVMToCompiler.cpp src/share/vm/graal/graalVMToCompiler.hpp |
diffstat | 5 files changed, 11 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- 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; + } }
--- 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
--- 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];
--- 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());
--- 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() {