8187315: [JVMCI] hosted use of JVMCI can crash VM under -Xint

Reviewed-by: kvn, dlong
This commit is contained in:
Doug Simon 2017-11-06 21:38:42 +01:00
parent 614fca959b
commit 40cdb9fd60
4 changed files with 8 additions and 5 deletions

View File

@ -55,10 +55,13 @@ private:
public:
JVMCICompiler();
static JVMCICompiler* instance(TRAPS) {
static JVMCICompiler* instance(bool require_non_null, TRAPS) {
if (!EnableJVMCI) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled")
}
if (_instance == NULL && require_non_null) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "The JVMCI compiler instance has not been created");
}
return _instance;
}

View File

@ -1018,7 +1018,7 @@ C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject
Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code));
Handle speculation_log_handle(THREAD, JNIHandles::resolve(speculation_log));
JVMCICompiler* compiler = JVMCICompiler::instance(CHECK_JNI_ERR);
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK_JNI_ERR);
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer());
bool is_immutable_PIC = HotSpotCompiledCode::isImmutablePIC(compiled_code_handle) > 0;
@ -1136,7 +1136,7 @@ C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject
C2V_END
C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
JVMCICompiler* compiler = JVMCICompiler::instance(CHECK);
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK);
CompilerStatistics* stats = compiler->stats();
stats->_standard.reset();
stats->_osr.reset();

View File

@ -821,7 +821,7 @@ void JVMCIRuntime::shutdown(TRAPS) {
}
CompLevel JVMCIRuntime::adjust_comp_level_inner(const methodHandle& method, bool is_osr, CompLevel level, JavaThread* thread) {
JVMCICompiler* compiler = JVMCICompiler::instance(thread);
JVMCICompiler* compiler = JVMCICompiler::instance(false, thread);
if (compiler != NULL && compiler->is_bootstrapping()) {
return level;
}

View File

@ -3949,7 +3949,7 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
// JVMCI is initialized on a CompilerThread
if (BootstrapJVMCI) {
JavaThread* THREAD = thread;
JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
JVMCICompiler* compiler = JVMCICompiler::instance(true, CATCH);
compiler->bootstrap(THREAD);
if (HAS_PENDING_EXCEPTION) {
HandleMark hm;