# HG changeset patch # User Thomas Wuerthinger # Date 1321475248 -3600 # Node ID 0e8a2a629afb17964925599962d731ec08f8099e # Parent 5a8c44b5fb8086b28e948488c197d03d02f00eb1 Pass-by compilation broker. diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/c1/c1_IR.hpp --- a/src/share/vm/c1/c1_IR.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/c1/c1_IR.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -237,7 +237,7 @@ // reexecute allowed only for the topmost frame bool reexecute = topmost ? should_reexecute() : false; bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis. - recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals); + recorder->describe_scope(pc_offset, (methodOop)scope()->method()->get_oop(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals); } }; diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/c1/c1_LIRAssembler.cpp --- a/src/share/vm/c1/c1_LIRAssembler.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/c1/c1_LIRAssembler.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -405,7 +405,7 @@ if (s == NULL) break; IRScope* scope = s->scope(); //Always pass false for reexecute since these ScopeDescs are never used for deopt - debug_info->describe_scope(pc_offset, scope->method(), s->bci(), false/*reexecute*/, false/*rethrow_exception*/); + debug_info->describe_scope(pc_offset, (methodOop)scope->method()->get_oop(), s->bci(), false/*reexecute*/, false/*rethrow_exception*/); } debug_info->end_non_safepoint(pc_offset); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/ci/ciObjectFactory.cpp --- a/src/share/vm/ci/ciObjectFactory.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/ci/ciObjectFactory.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -230,7 +230,9 @@ vmSymbols::SID sid = vmSymbols::find_sid(key); if (sid != vmSymbols::NO_SID) { // do not pollute the main cache with it - return vm_symbol_at(sid); + ciSymbol* result = vm_symbol_at(sid); + assert(result != NULL, ""); + return result; } assert(vmSymbols::find_sid(key) == vmSymbols::NO_SID, ""); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -302,6 +302,7 @@ template(com_sun_cri_ci_CiKind, "com/sun/cri/ci/CiKind") \ template(com_sun_cri_ci_CiRuntimeCall, "com/sun/cri/ci/CiRuntimeCall") \ template(startCompiler_name, "startCompiler") \ + template(bootstrap_name, "bootstrap") \ template(shutdownCompiler_name, "shutdownCompiler") \ template(compileMethod_name, "compileMethod") \ template(pollJavaQueue_name, "pollJavaQueue") \ @@ -453,6 +454,7 @@ template(void_long_signature, "()J") \ template(void_float_signature, "()F") \ template(void_double_signature, "()D") \ + template(bool_void_signature, "(Z)V") \ template(int_void_signature, "(I)V") \ template(int_int_signature, "(I)I") \ template(char_char_signature, "(C)C") \ diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/code/debugInfoRec.cpp --- a/src/share/vm/code/debugInfoRec.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/code/debugInfoRec.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -280,7 +280,7 @@ // must call add_safepoint before: it sets PcDesc and this routine uses // the last PcDesc set void DebugInformationRecorder::describe_scope(int pc_offset, - ciMethod* method, + methodHandle method, int bci, bool reexecute, bool rethrow_exception, @@ -307,7 +307,7 @@ stream()->write_int(sender_stream_offset); // serialize scope - jobject method_enc = (method == NULL)? NULL: method->constant_encoding(); + jobject method_enc = JNIHandles::make_local(Thread::current(), method()); stream()->write_int(oop_recorder()->find_index(method_enc)); stream()->write_bci(bci); assert(method == NULL || diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/code/debugInfoRec.hpp --- a/src/share/vm/code/debugInfoRec.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/code/debugInfoRec.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -98,7 +98,7 @@ // by add_non_safepoint, and the locals, expressions, and monitors // must all be null. void describe_scope(int pc_offset, - ciMethod* method, + methodHandle method, int bci, bool reexecute, bool rethrow_exception, diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -591,8 +591,6 @@ _last = task->prev(); } - // (tw) Immediately set compiling flag. - JavaThread::current()->as_CompilerThread()->set_compiling(true); --_size; } @@ -657,70 +655,6 @@ } } -// Bootstrap the graal compiler. Compiles all methods until compile queue is empty and no compilation is active. -void CompileBroker::bootstrap_graal() { - HandleMark hm; - Thread* THREAD = Thread::current(); - tty->print_cr("Bootstrapping graal...."); - - GraalCompiler* compiler = GraalCompiler::instance(); - assert(compiler != NULL, "just checking"); - - jlong start = os::javaTimeMillis(); - add_method_to_queue(SystemDictionary::Object_klass(), vmSymbols::object_initializer_name(), vmSymbols::void_method_signature()); - add_method_to_queue(SystemDictionary::Object_klass(), vmSymbols::equals_name(), vmSymbols::object_boolean_signature()); - add_method_to_queue(SystemDictionary::String_klass(), vmSymbols::length_name(), vmSymbols::void_int_signature()); - add_method_to_queue(SystemDictionary::String_klass(), vmSymbols::object_initializer_name(), vmSymbols::void_method_signature()); - - int z = 0; - while (true) { - { - HandleMark hm; - ResourceMark rm; - MutexLocker locker(_c1_method_queue->lock(), Thread::current()); - if (_c1_method_queue->is_empty()) { - MutexLocker mu(Threads_lock); // grab Threads_lock - JavaThread* current = Threads::first(); - bool compiling = false; - while (current != NULL) { - if (current->is_Compiler_thread()) { - CompilerThread* comp_thread = current->as_CompilerThread(); - if (comp_thread->is_compiling()) { - if (TraceGraal >= 4) { - tty->print_cr("Compile queue empty, but following thread is still compiling:"); - comp_thread->print(); - } - compiling = true; - } - } - current = current->next(); - } - if (!compiling) { - break; - } - } - if (TraceGraal >= 5) { - _c1_method_queue->print(); - } - } - - { - //ThreadToNativeFromVM trans(JavaThread::current()); - os::sleep(THREAD, 10, true); - } - ++z; - } - - // Do a full garbage collection. - Universe::heap()->collect(GCCause::_java_lang_system_gc); - - jlong diff = os::javaTimeMillis() - start; - tty->print_cr("Finished bootstrap in %d ms", diff); - if (CITime) CompileBroker::print_times(); - tty->print_cr("==========================================================================="); -} - - void CompileBroker::notify_java_queue() { HandleMark hm; ResourceMark rm; @@ -1111,7 +1045,7 @@ { MutexLocker locker(queue->lock(), THREAD); - if (Thread::current()->is_Compiler_thread() && CompilerThread::current()->is_compiling() && !BackgroundCompilation) { + if (JavaThread::current()->is_compiling() && !BackgroundCompilation) { TRACE_graal_1("Recursive compile %s!", method->name_and_sig_as_C_string()); method->set_not_compilable(); @@ -1182,16 +1116,20 @@ // and in that case it's best to protect both the testing (here) of // these bits, and their updating (here and elsewhere) under a // common lock. - task = create_compile_task(queue, + /*task = create_compile_task(queue, compile_id, method, osr_bci, comp_level, hot_method, hot_count, comment, - blocking); + blocking);*/ } - if (blocking) { + if (!JavaThread::current()->is_compiling()) { + method->set_queued_for_compilation(); + GraalCompiler::instance()->compile_method(method, osr_bci); + } + /*if (blocking) { wait_for_completion(task); - } + }*/ } @@ -1574,17 +1512,9 @@ log->stamp(); log->end_elem(); } - - if (UseGraal) { - thread->set_compiling(true); // Prevent recursive compilations while the compiler is initializing. - ThreadToNativeFromVM trans(JavaThread::current()); - GraalCompiler::instance()->initialize(); - } while (true) { { - // Unset compiling flag. - thread->set_compiling(false); // We need this HandleMark to avoid leaking VM handles. HandleMark hm(thread); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/compiler/compileBroker.hpp --- a/src/share/vm/compiler/compileBroker.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/compiler/compileBroker.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -404,7 +404,6 @@ static void print_compiler_threads_on(outputStream* st); - static void bootstrap_graal(); static void add_method_to_queue(klassOop k, Symbol* name, Symbol* signature); static void notify_java_queue(); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -257,6 +257,7 @@ ThreadToNativeFromVM t((JavaThread*) Thread::current()); nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, false, install_code); + method->clear_queued_for_compilation(); } // constructor used to create a stub @@ -363,6 +364,7 @@ } else if (assumption->is_a(CiAssumptions_ConcreteMethod::klass())) { assumption_ConcreteMethod(assumption); } else { + assumption->print(); fatal("unexpected Assumption subclass"); } } @@ -474,7 +476,6 @@ oop hotspot_method = CiCodePos::method(code_pos); methodOop method = getMethodFromHotSpotMethod(hotspot_method); - ciMethod *cimethod = (ciMethod *) _env->get_object(method); jint bci = CiCodePos::bci(code_pos); bool reexecute; if (bci == -1) { @@ -546,9 +547,9 @@ throw_exception = true; } - _debug_recorder->describe_scope(pc_offset, cimethod, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token); + _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token); } else { - _debug_recorder->describe_scope(pc_offset, cimethod, bci, reexecute, false, false, false, NULL, NULL, NULL); + _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, false, false, false, NULL, NULL, NULL); } } diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -41,9 +41,9 @@ // Initialization void GraalCompiler::initialize() { - if (_initialized) return; - _initialized = true; - CompilerThread* THREAD = CompilerThread::current(); + + ThreadToNativeFromVM trans(JavaThread::current()); + JavaThread* THREAD = JavaThread::current(); TRACE_graal_1("GraalCompiler::initialize"); initialize_buffer_blob(); @@ -57,6 +57,8 @@ } env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); + ResourceMark rm; + HandleMark hm; { VM_ENTRY_MARK; check_pending_exception("Could not register natives"); @@ -78,6 +80,12 @@ vm_abort(false); } } + VMExits::startCompiler(); + } + + _initialized = true; + if (BootstrapGraal) { + VMExits::bootstrap(); } } @@ -96,20 +104,30 @@ } } +void GraalCompiler::compile_method(methodHandle method, int entry_bci) { + EXCEPTION_CONTEXT + if (!_initialized) 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); + 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) { - assert(_initialized, "must already be initialized"); VM_ENTRY_MARK; ResourceMark rm; HandleMark hm; TRACE_graal_2("GraalCompiler::compile_method"); - CompilerThread::current()->set_compiling(true); - methodOop method = (methodOop) target->get_oop(); - Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK); - VMExits::compileMethod(hotspot_method, entry_bci); - CompilerThread::current()->set_compiling(false); + + compile_method((methodOop)target->get_oop(), entry_bci); TRACE_graal_2("GraalCompiler::compile_method exit"); } @@ -197,6 +215,7 @@ HotSpotTypeResolved::set_compiler(obj, VMExits::compilerInstance()()); if (klass->oop_is_instance()) { + ResourceMark rm; instanceKlass* ik = (instanceKlass*)klass()->klass_part(); Handle full_name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NULL); HotSpotType::set_name(obj, full_name()); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalCompiler.hpp --- a/src/share/vm/graal/graalCompiler.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalCompiler.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -54,6 +54,8 @@ // Compilation entry point for methods virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci); + void compile_method(methodHandle target, int entry_bci); + // Print compilation timers and statistics virtual void print_timers(); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalEnv.cpp --- a/src/share/vm/graal/graalEnv.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalEnv.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -152,6 +152,7 @@ KlassHandle GraalEnv::get_klass_by_name(KlassHandle accessing_klass, Symbol* klass_name, bool require_local) { + ResourceMark rm; return get_klass_by_name_impl(accessing_klass, constantPoolHandle(), klass_name, @@ -228,6 +229,7 @@ int index, bool& is_accessible, KlassHandle accessor) { + ResourceMark rm; return get_klass_by_index_impl(cpool, index, is_accessible, accessor); } @@ -286,6 +288,7 @@ // Get a field by index from a klass's constant pool. void GraalEnv::get_field_by_index(instanceKlassHandle accessor, fieldDescriptor& fd, int index) { + ResourceMark rm; return get_field_by_index_impl(accessor, fd, index); } @@ -338,14 +341,13 @@ int holder_index = cpool->klass_ref_index_at(index); bool holder_is_accessible; KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, KlassHandle(Thread::current(), accessor)); - instanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder); // Get the method's name and signature. Symbol* name_sym = cpool->name_ref_at(index); Symbol* sig_sym = cpool->signature_ref_at(index); if (holder_is_accessible) { // Our declared holder is loaded. - instanceKlass* lookup = declared_holder; + instanceKlass* lookup = get_instance_klass_for_declared_method_holder(holder); methodOop m = lookup_method(accessor, lookup, name_sym, sig_sym, bc); if (m != NULL && (bc == Bytecodes::_invokestatic @@ -393,6 +395,7 @@ methodHandle GraalEnv::get_method_by_index(constantPoolHandle cpool, int index, Bytecodes::Code bc, instanceKlass* accessor) { + ResourceMark rm; assert(bc != Bytecodes::_invokedynamic, "invokedynamic not yet supported"); return get_method_by_index_impl(cpool, index, bc, accessor); } diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalVMEntries.cpp --- a/src/share/vm/graal/graalVMEntries.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalVMEntries.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -67,6 +67,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { TRACE_graal_3("VMEntries::RiMethod_exceptionHandlers"); VM_ENTRY_MARK + ResourceMark rm; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); typeArrayHandle handlers = method->exception_table(); int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; @@ -180,23 +181,22 @@ // public native int RiMethod_exceptionProbability(long vmId, int bci); JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { TRACE_graal_3("VMEntries::RiMethod_exceptionProbability"); - { - VM_ENTRY_MARK; - methodOop method = getMethodFromHotSpotMethod(hotspot_method); - methodDataOop method_data = method->method_data(); - if (method_data == NULL || !method_data->is_mature()) { - return -1; - } - ProfileData* data = method_data->bci_to_data(bci); - if (data == NULL) { - return 0; - } - uint trap = Deoptimization::trap_state_is_recompiled(data->trap_state())? 1: 0; - if (trap > 0) { - return 100; - } else { - return trap; - } + VM_ENTRY_MARK; + ResourceMark rm; + methodOop method = getMethodFromHotSpotMethod(hotspot_method); + methodDataOop method_data = method->method_data(); + if (method_data == NULL || !method_data->is_mature()) { + return -1; + } + ProfileData* data = method_data->bci_to_data(bci); + if (data == NULL) { + return 0; + } + uint trap = Deoptimization::trap_state_is_recompiled(data->trap_state())? 1: 0; + if (trap > 0) { + return 100; + } else { + return trap; } } @@ -232,13 +232,8 @@ Handle obj; { VM_ENTRY_MARK; + ResourceMark rm; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); - if (strstr(method->name_and_sig_as_C_string(), "factor") != NULL) { -// tty->print_cr("here"); - } - if (bci == 123) { -// tty->print_cr("here2"); - } methodDataHandle method_data = method->method_data(); if (method_data == NULL || !method_data->is_mature()) { return NULL; @@ -295,6 +290,7 @@ JNIEXPORT jdouble JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2branchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { TRACE_graal_3("VMEntries::RiMethod_typeProfile"); + ResourceMark rm; methodOop method = getMethodFromHotSpotMethod(hotspot_method); methodDataOop method_data = method->method_data(); @@ -328,6 +324,7 @@ JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { TRACE_graal_3("VMEntries::RiMethod_typeProfile"); VM_ENTRY_MARK; + ResourceMark rm; methodOop method = getMethodFromHotSpotMethod(hotspot_method); methodDataOop method_data = method->method_data(); @@ -373,6 +370,7 @@ JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { TRACE_graal_3("VMEntries::RiSignature_lookupType"); VM_ENTRY_MARK; + ResourceMark rm; Symbol* nameSymbol = VmIds::toSymbol(jname); Handle name = JNIHandles::resolve(jname); @@ -524,13 +522,11 @@ JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { TRACE_graal_3("VMEntries::RiConstantPool_lookupField"); VM_ENTRY_MARK; + ResourceMark rm; index = GraalCompiler::to_cp_index_u2(index); constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(constantPoolHolder)))->constants(); - ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); - ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); - int nt_index = cp->name_and_type_ref_index_at(index); int sig_index = cp->signature_ref_index_at(nt_index); Symbol* signature = cp->symbol_at(sig_index); @@ -736,6 +732,7 @@ JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1fields(JNIEnv *, jobject, jobject klass) { TRACE_graal_3("VMEntries::RiType_fields"); VM_ENTRY_MARK; + ResourceMark rm; instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); class MyFieldClosure : public FieldClosure { diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalVMExits.cpp --- a/src/share/vm/graal/graalVMExits.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalVMExits.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -73,8 +73,6 @@ 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"); - - startCompiler(); } jboolean VMExits::setOption(Handle option) { @@ -140,6 +138,15 @@ check_pending_exception("Error while calling startCompiler"); } +void VMExits::bootstrap() { + JavaThread* THREAD = JavaThread::current(); + JavaValue result(T_VOID); + JavaCallArguments args; + args.push_oop(instance()); + JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::bootstrap_name(), vmSymbols::void_method_signature(), &args, THREAD); + check_pending_exception("Error while calling boostrap"); +} + void VMExits::pollJavaQueue() { JavaThread* THREAD = JavaThread::current(); JavaValue result(T_VOID); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/graal/graalVMExits.hpp --- a/src/share/vm/graal/graalVMExits.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/graal/graalVMExits.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -58,6 +58,9 @@ // public abstract void startCompiler(); static void startCompiler(); + + // public abstract void bootstrap(); + static void bootstrap(); // public abstract void pollJavaQueue(); static void pollJavaQueue(); diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/opto/output.cpp --- a/src/share/vm/opto/output.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/opto/output.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -934,7 +934,7 @@ assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI"); assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest"); // Now we can describe the scope. - debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, return_oop, locvals, expvals, monvals); + debug_info()->describe_scope(safepoint_pc_offset, (methodOop)scope_method->get_oop(), jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, return_oop, locvals, expvals, monvals); } // End jvms loop // Mark the end of the scope set. @@ -1017,7 +1017,7 @@ JVMState* jvms = youngest_jvms->of_depth(depth); ciMethod* method = jvms->has_method() ? jvms->method() : NULL; assert(!jvms->should_reexecute() || depth==max_depth, "reexecute allowed only for the youngest"); - debug_info->describe_scope(pc_offset, method, jvms->bci(), jvms->should_reexecute()); + debug_info->describe_scope(pc_offset, (methodOop)method->get_oop(), jvms->bci(), jvms->should_reexecute()); } // Mark the end of the scope set. diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/prims/jni.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -3361,6 +3361,12 @@ *vm = (JavaVM *)(&main_vm); *(JNIEnv**)penv = thread->jni_environment(); + if (UseGraal) { + GraalCompiler* compiler = GraalCompiler::instance(); + ciObjectFactory::initialize(); + compiler->initialize(); + } + // Tracks the time application was running before GC RuntimeService::record_application_start(); @@ -3369,10 +3375,6 @@ JvmtiExport::post_thread_start(thread); } - if (UseGraal && BootstrapGraal) { - CompileBroker::bootstrap_graal(); - } - // Check if we should compile all classes on bootclasspath NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/runtime/thread.cpp Wed Nov 16 21:27:28 2011 +0100 @@ -2938,7 +2938,7 @@ static void compiler_thread_entry(JavaThread* thread, TRAPS) { assert(thread->is_Compiler_thread(), "must be compiler thread"); - CompileBroker::compiler_thread_loop(); + //CompileBroker::compiler_thread_loop(); } // Create a CompilerThread @@ -2948,7 +2948,6 @@ _task = NULL; _queue = queue; _counters = counters; - _is_compiling = false; _scanned_nmethod = NULL; #ifndef PRODUCT diff -r 5a8c44b5fb80 -r 0e8a2a629afb src/share/vm/runtime/thread.hpp --- a/src/share/vm/runtime/thread.hpp Wed Nov 16 16:46:32 2011 +0100 +++ b/src/share/vm/runtime/thread.hpp Wed Nov 16 21:27:28 2011 +0100 @@ -716,6 +716,7 @@ // (tw) Necessary for holding a compilation buffer and ci environment. Moved from CompilerThread to JavaThread in order to enable code installation from Java application code. BufferBlob* _buffer_blob; ciEnv* _env; + bool _is_compiling; #ifdef ASSERT private: @@ -853,9 +854,6 @@ volatile int _exception_stack_size; // Size of frame where exception happened volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site. - // support for compilation - bool _is_compiling; // is true if a compilation is active inthis thread (one compilation per thread possible) - // support for JNI critical regions jint _jni_active_critical; // count of entries into JNI critical region @@ -916,6 +914,9 @@ return (struct JNINativeInterface_ *)_jni_environment.functions; } + bool is_compiling() const { return _is_compiling; } + void set_compiling(bool b) { _is_compiling = b; } + // Get/set the thread's compilation environment. ciEnv* env() { return _env; } void set_env(ciEnv* env) { _env = env; } @@ -942,10 +943,6 @@ // Testers virtual bool is_Java_thread() const { return true; } - // compilation - void set_is_compiling(bool f) { _is_compiling = f; } - bool is_compiling() const { return _is_compiling; } - // Thread chain operations JavaThread* next() const { return _next; } void set_next(JavaThread* p) { _next = p; } @@ -1716,7 +1713,6 @@ CompileLog* _log; CompileTask* _task; CompileQueue* _queue; - bool _is_compiling; nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper @@ -1726,8 +1722,6 @@ CompilerThread(CompileQueue* queue, CompilerCounters* counters); - bool is_compiling() const { return _is_compiling; } - void set_compiling(bool b) { _is_compiling = b; } bool is_Compiler_thread() const { return true; } // Hide this compiler thread from external view. // (tw) For Graal, the compiler thread should be visible.