Skip to content

Commit

Permalink
Libgraal does not allow _can_call_java.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Zezula committed Oct 3, 2024
1 parent fc960a8 commit dfd7249
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/hotspot/share/compiler/compilerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ CompilerThread::~CompilerThread() {
}

void CompilerThread::set_compiler(AbstractCompiler* c) {
// Only jvmci compiler threads can call Java
_can_call_java = c != nullptr && c->is_jvmci();
/*
* For compiler threads using the JVMCI jargraal compiler,
* we need to enable Java calls for upcalls to the jargraal compiler.
* Java calls are also needed by InterpreterRuntime when running the jargraal compiler.
*/
_can_call_java = c != nullptr && c->is_jvmci() && !UseJVMCINativeLibrary;
_compiler = c;
}

Expand Down
14 changes: 11 additions & 3 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,15 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) {
JVMCI_VM_ENTRY_MARK; \
ResourceMark rm; \
bool __is_hotspot = env == thread->jni_environment(); \
CompilerThreadCanCallJava ccj(thread, __is_hotspot); \
bool __block_can_call_java; \
if (__is_hotspot) { \
__block_can_call_java = true; \
} else if (thread->is_Compiler_thread()) { \
__block_can_call_java = CompilerThread::cast(thread)->can_call_java(); \
} else { \
__block_can_call_java = false; \
} \
CompilerThreadCanCallJava ccj(thread, __block_can_call_java); \
JVMCIENV_FROM_JNI(JVMCI::compilation_tick(thread), env); \

// Entry to native method implementation that transitions
Expand Down Expand Up @@ -401,8 +409,8 @@ C2V_VMENTRY_NULL(jobject, asResolvedJavaMethod, (JNIEnv* env, jobject, jobject e
return JVMCIENV->get_jobject(result);
}

C2V_VMENTRY_0(jboolean, updateCompilerThreadCanCallJava, (JNIEnv* env, jobject, jboolean newState))
return CompilerThreadCanCallJava::update(THREAD, newState) != nullptr;
C2V_VMENTRY_PREFIX(jboolean, updateCompilerThreadCanCallJava, (JNIEnv* env, jobject, jboolean newState))
return CompilerThreadCanCallJava::update(thread, newState) != nullptr;
C2V_END


Expand Down

0 comments on commit dfd7249

Please sign in to comment.