Mercurial > hg > graal-compiler
diff src/share/vm/compiler/compileBroker.cpp @ 3650:0e8a2a629afb
Pass-by compilation broker.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Nov 2011 21:27:28 +0100 |
parents | 9c2c0a182f13 |
children | a31028282e3e |
line wrap: on
line diff
--- 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);