comparison src/share/vm/prims/jni.cpp @ 18134:6a2f814224b1

hotspot/graal: simplify CTW logic. now, the following configurations are supported: (1) CTW with Graal, graal compiled by itself with bootstrap (--vm graal -XX:+BootstrapGraal -XX:-TieredCompilation -XX:+CompileTheWorld) (2) CTW with Graal, graal compiled by C1/itself aka. tiered with bootstrap (--vm graal -XX:+BootstrapGraal -XX:+TieredCompilation +XX:+CompileTheWorld) (3) CTW with Graal, graal compiled by itself without bootstrap (--vm graal -XX:-BootstrapGraal -XX:-TieredCompilation -XX:+CompileTheWorld) (4) CTW with Graal, graal compiled by C1/itself aka. tiered without bootstrap (--vm graal -XX:-BootstrapGraal -XX:+TieredCompilation -XX:+CompileTheWorld) (5) CTW with Graal, graal compiled by C1/C2 aka. hosted (--vm server -XX:+CompileTheWorld)
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 21 Oct 2014 10:17:06 +0200
parents 52b4284cb496
children 104304a54b0c
comparison
equal deleted inserted replaced
18133:5c1bd485c54b 18134:6a2f814224b1
5197 JavaThread *thread = JavaThread::current(); 5197 JavaThread *thread = JavaThread::current();
5198 /* thread is thread_in_vm here */ 5198 /* thread is thread_in_vm here */
5199 *vm = (JavaVM *)(&main_vm); 5199 *vm = (JavaVM *)(&main_vm);
5200 *(JNIEnv**)penv = thread->jni_environment(); 5200 *(JNIEnv**)penv = thread->jni_environment();
5201 5201
5202 #if defined(GRAAL) && !defined(PRODUCT)
5203 // We turn off CompileTheWorld so that compilation requests are not ignored during bootstrap or that Graal can be compiled by C1/C2.
5204 bool doCTW = CompileTheWorld;
5205 CompileTheWorld = false;
5206 #endif
5207
5202 #ifdef COMPILERGRAAL 5208 #ifdef COMPILERGRAAL
5203 // Graal is initialized on a CompilerThread 5209 // Graal is initialized on a CompilerThread
5204 if (FLAG_IS_DEFAULT(BootstrapGraal) ? !TieredCompilation : BootstrapGraal) { 5210 if (FLAG_IS_DEFAULT(BootstrapGraal) ? !TieredCompilation : BootstrapGraal) {
5205 GraalCompiler::instance()->bootstrap(); 5211 GraalCompiler::instance()->bootstrap();
5206 } 5212 }
5213 #elif defined(GRAAL) && !defined(PRODUCT)
5214 if (doCTW) {
5215 // required for hosted CTW.
5216 CompilationPolicy::completed_vm_startup();
5217 }
5218 #endif
5219
5220 #if defined(GRAAL) && !defined(PRODUCT)
5221 if (doCTW) {
5222 GraalCompiler::instance()->compile_the_world();
5223 }
5207 #endif 5224 #endif
5208 5225
5209 // Tracks the time application was running before GC 5226 // Tracks the time application was running before GC
5210 RuntimeService::record_application_start(); 5227 RuntimeService::record_application_start();
5211 5228
5224 #ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED 5241 #ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
5225 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f() 5242 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
5226 #endif 5243 #endif
5227 5244
5228 // Check if we should compile all classes on bootclasspath 5245 // Check if we should compile all classes on bootclasspath
5229 #ifdef GRAAL
5230 #ifndef COMPILERGRAAL
5231 if (CompileTheWorld) {
5232 // Graal is considered as application code so we need to
5233 // stop the VM deferring compilation now.
5234 CompilationPolicy::completed_vm_startup();
5235
5236 GraalCompiler::instance()->compile_the_world();
5237 }
5238 #endif
5239 #else
5240 if (CompileTheWorld) ClassLoader::compile_the_world(); 5246 if (CompileTheWorld) ClassLoader::compile_the_world();
5241 #endif
5242 if (ReplayCompiles) ciReplay::replay(thread); 5247 if (ReplayCompiles) ciReplay::replay(thread);
5243 5248
5244 // Some platforms (like Win*) need a wrapper around these test 5249 // Some platforms (like Win*) need a wrapper around these test
5245 // functions in order to properly handle error conditions. 5250 // functions in order to properly handle error conditions.
5246 CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler); 5251 CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler);