50 } 51 52 void JVMCICompiler::bootstrap(TRAPS) { 53 assert(THREAD->is_Java_thread(), "must be"); 54 if (Arguments::mode() == Arguments::_int) { 55 // Nothing to do in -Xint mode 56 return; 57 } 58 _bootstrapping = true; 59 ResourceMark rm; 60 HandleMark hm; 61 if (PrintBootstrap) { 62 tty->print("Bootstrapping JVMCI"); 63 } 64 jlong start = os::javaTimeMillis(); 65 66 Array<Method*>* objectMethods = SystemDictionary::Object_klass()->methods(); 67 // Initialize compile queue with a selected set of methods. 68 int len = objectMethods->length(); 69 for (int i = 0; i < len; i++) { 70 methodHandle mh = objectMethods->at(i); 71 if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) { 72 ResourceMark rm; 73 int hot_count = 10; // TODO: what's the appropriate value? 74 CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, CompileTask::Reason_Bootstrap, THREAD); 75 } 76 } 77 78 int qsize; 79 bool first_round = true; 80 int z = 0; 81 do { 82 // Loop until there is something in the queue. 83 do { 84 ((JavaThread*)THREAD)->sleep(100); 85 qsize = CompileBroker::queue_size(CompLevel_full_optimization); 86 } while (!_bootstrap_compilation_request_handled && first_round && qsize == 0); 87 first_round = false; 88 if (PrintBootstrap) { 89 while (z < (_methods_compiled / 100)) { 90 ++z; 91 tty->print_raw("."); 92 } 93 } 94 } while (qsize != 0); 95 96 if (PrintBootstrap) { 97 tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methods_compiled); 98 } 99 _bootstrapping = false; 100 JVMCI::compiler_runtime()->bootstrap_finished(CHECK); 101 } 102 103 bool JVMCICompiler::force_comp_at_level_simple(Method *method) { 104 if (UseJVMCINativeLibrary) { 105 // This mechanism exists to force compilation of a JVMCI compiler by C1 106 // to reduces the compilation time spent on the JVMCI compiler itself. In 107 // +UseJVMCINativeLibrary mode, the JVMCI compiler is AOT compiled. 108 return false; 109 } 110 111 if (_bootstrapping) { 112 // When bootstrapping, the JVMCI compiler can compile its own methods. 113 return false; 114 } 115 116 JVMCIRuntime* runtime = JVMCI::compiler_runtime(); 117 if (runtime != NULL && runtime->is_HotSpotJVMCIRuntime_initialized()) { 118 JavaThread* thread = JavaThread::current(); 119 HandleMark hm(thread); 120 THREAD_JVMCIENV(thread); 121 JVMCIObject receiver = runtime->get_HotSpotJVMCIRuntime(JVMCIENV); 122 objArrayHandle excludeModules(thread, HotSpotJVMCI::HotSpotJVMCIRuntime::excludeFromJVMCICompilation(JVMCIENV, HotSpotJVMCI::resolve(receiver))); 123 if (excludeModules.not_null()) { | 50 } 51 52 void JVMCICompiler::bootstrap(TRAPS) { 53 assert(THREAD->is_Java_thread(), "must be"); 54 if (Arguments::mode() == Arguments::_int) { 55 // Nothing to do in -Xint mode 56 return; 57 } 58 _bootstrapping = true; 59 ResourceMark rm; 60 HandleMark hm; 61 if (PrintBootstrap) { 62 tty->print("Bootstrapping JVMCI"); 63 } 64 jlong start = os::javaTimeMillis(); 65 66 Array<Method*>* objectMethods = SystemDictionary::Object_klass()->methods(); 67 // Initialize compile queue with a selected set of methods. 68 int len = objectMethods->length(); 69 for (int i = 0; i < len; i++) { 70 methodHandle mh(THREAD, objectMethods->at(i)); 71 if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) { 72 ResourceMark rm; 73 int hot_count = 10; // TODO: what's the appropriate value? 74 CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, CompileTask::Reason_Bootstrap, THREAD); 75 } 76 } 77 78 int qsize; 79 bool first_round = true; 80 int z = 0; 81 do { 82 // Loop until there is something in the queue. 83 do { 84 ((JavaThread*)THREAD)->sleep(100); 85 qsize = CompileBroker::queue_size(CompLevel_full_optimization); 86 } while (!_bootstrap_compilation_request_handled && first_round && qsize == 0); 87 first_round = false; 88 if (PrintBootstrap) { 89 while (z < (_methods_compiled / 100)) { 90 ++z; 91 tty->print_raw("."); 92 } 93 } 94 } while (qsize != 0); 95 96 if (PrintBootstrap) { 97 tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methods_compiled); 98 } 99 _bootstrapping = false; 100 JVMCI::compiler_runtime()->bootstrap_finished(CHECK); 101 } 102 103 bool JVMCICompiler::force_comp_at_level_simple(const methodHandle& method) { 104 if (UseJVMCINativeLibrary) { 105 // This mechanism exists to force compilation of a JVMCI compiler by C1 106 // to reduces the compilation time spent on the JVMCI compiler itself. In 107 // +UseJVMCINativeLibrary mode, the JVMCI compiler is AOT compiled. 108 return false; 109 } 110 111 if (_bootstrapping) { 112 // When bootstrapping, the JVMCI compiler can compile its own methods. 113 return false; 114 } 115 116 JVMCIRuntime* runtime = JVMCI::compiler_runtime(); 117 if (runtime != NULL && runtime->is_HotSpotJVMCIRuntime_initialized()) { 118 JavaThread* thread = JavaThread::current(); 119 HandleMark hm(thread); 120 THREAD_JVMCIENV(thread); 121 JVMCIObject receiver = runtime->get_HotSpotJVMCIRuntime(JVMCIENV); 122 objArrayHandle excludeModules(thread, HotSpotJVMCI::HotSpotJVMCIRuntime::excludeFromJVMCICompilation(JVMCIENV, HotSpotJVMCI::resolve(receiver))); 123 if (excludeModules.not_null()) { |