# HG changeset patch # User Thomas Wuerthinger # Date 1321482903 -3600 # Node ID a31028282e3ef19628de98445c2a7520172871ec # Parent 0e8a2a629afb17964925599962d731ec08f8099e Support blocking compilation. diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Wed Nov 16 23:35:03 2011 +0100 @@ -306,7 +306,7 @@ template(shutdownCompiler_name, "shutdownCompiler") \ template(compileMethod_name, "compileMethod") \ template(pollJavaQueue_name, "pollJavaQueue") \ - template(compileMethod_signature, "(Lcom/oracle/max/graal/hotspot/HotSpotMethodResolved;I)V") \ + template(compileMethod_signature, "(Lcom/oracle/max/graal/hotspot/HotSpotMethodResolved;IZ)V") \ template(setOption_name, "setOption") \ template(setDefaultOptions_name, "setDefaultOptions") \ template(setOption_signature, "(Ljava/lang/String;)Z") \ diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Nov 16 23:35:03 2011 +0100 @@ -1125,8 +1125,11 @@ if (!JavaThread::current()->is_compiling()) { method->set_queued_for_compilation(); - GraalCompiler::instance()->compile_method(method, osr_bci); + GraalCompiler::instance()->compile_method(method, osr_bci, blocking); + } else { + // Recursive compile request => ignore. } + /*if (blocking) { wait_for_completion(task); }*/ diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Wed Nov 16 23:35:03 2011 +0100 @@ -81,11 +81,11 @@ } } VMExits::startCompiler(); - } - _initialized = true; - if (BootstrapGraal) { - VMExits::bootstrap(); + _initialized = true; + if (BootstrapGraal) { + VMExits::bootstrap(); + } } } @@ -104,32 +104,28 @@ } } -void GraalCompiler::compile_method(methodHandle method, int entry_bci) { +void GraalCompiler::compile_method(methodHandle method, int entry_bci, jboolean blocking) { EXCEPTION_CONTEXT - if (!_initialized) return; + if (!_initialized) { + method->clear_queued_for_compilation(); + method->invocation_counter()->reset(); + method->backedge_counter()->reset(); + return; + } assert(_initialized, "must already be initialized"); ResourceMark rm; ciEnv* current_env = JavaThread::current()->env(); JavaThread::current()->set_env(NULL); JavaThread::current()->set_compiling(true); Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK); - VMExits::compileMethod(hotspot_method, entry_bci); + VMExits::compileMethod(hotspot_method, entry_bci, blocking); JavaThread::current()->set_compiling(false); JavaThread::current()->set_env(current_env); } // Compilation entry point for methods void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { - VM_ENTRY_MARK; - ResourceMark rm; - HandleMark hm; - - TRACE_graal_2("GraalCompiler::compile_method"); - - - compile_method((methodOop)target->get_oop(), entry_bci); - - TRACE_graal_2("GraalCompiler::compile_method exit"); + ShouldNotReachHere(); } void GraalCompiler::exit() { diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/graal/graalCompiler.hpp --- a/src/share/vm/graal/graalCompiler.hpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/graal/graalCompiler.hpp Wed Nov 16 23:35:03 2011 +0100 @@ -54,7 +54,7 @@ // Compilation entry point for methods virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci); - void compile_method(methodHandle target, int entry_bci); + void compile_method(methodHandle target, int entry_bci, jboolean blocking); // Print compilation timers and statistics virtual void print_timers(); diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/graal/graalVMExits.cpp --- a/src/share/vm/graal/graalVMExits.cpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/graal/graalVMExits.cpp Wed Nov 16 23:35:03 2011 +0100 @@ -97,7 +97,7 @@ check_pending_exception("Error while calling setDefaultOptions"); } -void VMExits::compileMethod(Handle hotspot_method, int entry_bci) { +void VMExits::compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking) { assert(!hotspot_method.is_null(), "just checking"); Thread* THREAD = Thread::current(); JavaValue result(T_VOID); @@ -105,6 +105,7 @@ args.push_oop(instance()); args.push_oop(hotspot_method); args.push_int(entry_bci); + args.push_int(blocking); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD); check_pending_exception("Error while calling compileMethod"); } diff -r 0e8a2a629afb -r a31028282e3e src/share/vm/graal/graalVMExits.hpp --- a/src/share/vm/graal/graalVMExits.hpp Wed Nov 16 21:27:28 2011 +0100 +++ b/src/share/vm/graal/graalVMExits.hpp Wed Nov 16 23:35:03 2011 +0100 @@ -50,8 +50,8 @@ // public static void HotSpotOptions.setDefaultOptions(); static void setDefaultOptions(); - // public abstract void compileMethod(long vmId, String name, int entry_bci); - static void compileMethod(Handle hotspot_method, int entry_bci); + // public abstract void compileMethod(long vmId, String name, int entry_bci, boolean blocking); + static void compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking); // public abstract void shutdownCompiler(); static void shutdownCompiler();