< prev index next >

src/hotspot/share/jvmci/jvmciCompiler.cpp

Print this page

 69 }
 70 
 71 void JVMCICompiler::bootstrap(TRAPS) {
 72   if (Arguments::mode() == Arguments::_int) {
 73     // Nothing to do in -Xint mode
 74     return;
 75   }
 76   _bootstrapping = true;
 77   ResourceMark rm(THREAD);
 78   HandleMark hm(THREAD);
 79   if (PrintBootstrap) {
 80     tty->print("Bootstrapping JVMCI");
 81   }
 82   jlong start = os::javaTimeNanos();
 83 
 84   Array<Method*>* objectMethods = vmClasses::Object_klass()->methods();
 85   // Initialize compile queue with a selected set of methods.
 86   int len = objectMethods->length();
 87   for (int i = 0; i < len; i++) {
 88     methodHandle mh(THREAD, objectMethods->at(i));
 89     if (!mh->is_native() && !mh->is_static() && !mh->is_object_initializer() && !mh->is_static_initializer()) {



 90       ResourceMark rm;
 91       int hot_count = 10; // TODO: what's the appropriate value?
 92       CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, hot_count, CompileTask::Reason_Bootstrap, CHECK);
 93     }
 94   }
 95 
 96   int qsize;
 97   bool first_round = true;
 98   int z = 0;
 99   do {
100     // Loop until there is something in the queue.
101     do {
102       THREAD->sleep(100);
103       qsize = CompileBroker::queue_size(CompLevel_full_optimization);
104     } while (!_bootstrap_compilation_request_handled && first_round && qsize == 0);
105     first_round = false;
106     if (PrintBootstrap) {
107       while (z < (_methods_compiled / 100)) {
108         ++z;
109         tty->print_raw(".");

123   if (_disabled) {
124     return true;
125   }
126   if (_bootstrapping) {
127     // When bootstrapping, the JVMCI compiler can compile its own methods.
128     return false;
129   }
130   if (UseJVMCINativeLibrary) {
131     // This mechanism exists to force compilation of a JVMCI compiler by C1
132     // to reduce the compilation time spent on the JVMCI compiler itself. In
133     // +UseJVMCINativeLibrary mode, the JVMCI compiler is AOT compiled.
134     return false;
135   } else {
136     JVMCIRuntime* runtime = JVMCI::java_runtime();
137     if (runtime != nullptr) {
138       JVMCIObject receiver = runtime->probe_HotSpotJVMCIRuntime();
139       if (receiver.is_null()) {
140         return false;
141       }
142       JVMCIEnv* ignored_env = nullptr;
143       objArrayHandle excludeModules(JavaThread::current(), HotSpotJVMCI::HotSpotJVMCIRuntime::excludeFromJVMCICompilation(ignored_env, HotSpotJVMCI::resolve(receiver)));
144       if (excludeModules.not_null()) {
145         ModuleEntry* moduleEntry = method->method_holder()->module();
146         for (int i = 0; i < excludeModules->length(); i++) {
147           if (excludeModules->obj_at(i) == moduleEntry->module_oop()) {
148             return true;
149           }
150         }
151       }
152     }
153     return false;
154   }
155 }
156 
157 // Compilation entry point for methods
158 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
159   ShouldNotReachHere();
160 }
161 
162 void JVMCICompiler::stopping_compiler_thread(CompilerThread* current) {
163   if (UseJVMCINativeLibrary) {

 69 }
 70 
 71 void JVMCICompiler::bootstrap(TRAPS) {
 72   if (Arguments::mode() == Arguments::_int) {
 73     // Nothing to do in -Xint mode
 74     return;
 75   }
 76   _bootstrapping = true;
 77   ResourceMark rm(THREAD);
 78   HandleMark hm(THREAD);
 79   if (PrintBootstrap) {
 80     tty->print("Bootstrapping JVMCI");
 81   }
 82   jlong start = os::javaTimeNanos();
 83 
 84   Array<Method*>* objectMethods = vmClasses::Object_klass()->methods();
 85   // Initialize compile queue with a selected set of methods.
 86   int len = objectMethods->length();
 87   for (int i = 0; i < len; i++) {
 88     methodHandle mh(THREAD, objectMethods->at(i));
 89     if (!mh->is_native() &&
 90         !mh->is_static() &&
 91         !mh->is_object_constructor() &&
 92         !mh->is_class_initializer()) {
 93       ResourceMark rm;
 94       int hot_count = 10; // TODO: what's the appropriate value?
 95       CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, hot_count, CompileTask::Reason_Bootstrap, CHECK);
 96     }
 97   }
 98 
 99   int qsize;
100   bool first_round = true;
101   int z = 0;
102   do {
103     // Loop until there is something in the queue.
104     do {
105       THREAD->sleep(100);
106       qsize = CompileBroker::queue_size(CompLevel_full_optimization);
107     } while (!_bootstrap_compilation_request_handled && first_round && qsize == 0);
108     first_round = false;
109     if (PrintBootstrap) {
110       while (z < (_methods_compiled / 100)) {
111         ++z;
112         tty->print_raw(".");

126   if (_disabled) {
127     return true;
128   }
129   if (_bootstrapping) {
130     // When bootstrapping, the JVMCI compiler can compile its own methods.
131     return false;
132   }
133   if (UseJVMCINativeLibrary) {
134     // This mechanism exists to force compilation of a JVMCI compiler by C1
135     // to reduce the compilation time spent on the JVMCI compiler itself. In
136     // +UseJVMCINativeLibrary mode, the JVMCI compiler is AOT compiled.
137     return false;
138   } else {
139     JVMCIRuntime* runtime = JVMCI::java_runtime();
140     if (runtime != nullptr) {
141       JVMCIObject receiver = runtime->probe_HotSpotJVMCIRuntime();
142       if (receiver.is_null()) {
143         return false;
144       }
145       JVMCIEnv* ignored_env = nullptr;
146       refArrayHandle excludeModules(JavaThread::current(), HotSpotJVMCI::HotSpotJVMCIRuntime::excludeFromJVMCICompilation(ignored_env, HotSpotJVMCI::resolve(receiver)));
147       if (excludeModules.not_null()) {
148         ModuleEntry* moduleEntry = method->method_holder()->module();
149         for (int i = 0; i < excludeModules->length(); i++) {
150           if (excludeModules->obj_at(i) == moduleEntry->module_oop()) {
151             return true;
152           }
153         }
154       }
155     }
156     return false;
157   }
158 }
159 
160 // Compilation entry point for methods
161 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
162   ShouldNotReachHere();
163 }
164 
165 void JVMCICompiler::stopping_compiler_thread(CompilerThread* current) {
166   if (UseJVMCINativeLibrary) {
< prev index next >