Skip to content

Commit

Permalink
8344727: [JVMCI] Export the CompileBroker compilation activity mode f…
Browse files Browse the repository at this point in the history
…or Truffle compiler control

Reviewed-by: dnsimon
  • Loading branch information
simonis committed Nov 29, 2024
1 parent 8858de3 commit 6bea1b6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,6 +3223,10 @@ C2V_VMENTRY(void, getOopMapAt, (JNIEnv* env, jobject, ARGUMENT_PAIR(method),
JVMCIENV->copy_longs_from((jlong*)oop_map_buf, oop_map, 0, nwords);
C2V_END

C2V_VMENTRY_0(jint, getCompilationActivityMode, (JNIEnv* env, jobject))
return CompileBroker::get_compilation_activity_mode();
}

#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))

Expand Down Expand Up @@ -3385,6 +3389,7 @@ JNINativeMethod CompilerToVM::methods[] = {
{CC "notifyCompilerInliningEvent", CC "(I" HS_METHOD2 HS_METHOD2 "ZLjava/lang/String;I)V", FN_PTR(notifyCompilerInliningEvent)},
{CC "getOopMapAt", CC "(" HS_METHOD2 "I[J)V", FN_PTR(getOopMapAt)},
{CC "updateCompilerThreadCanCallJava", CC "(Z)Z", FN_PTR(updateCompilerThreadCanCallJava)},
{CC "getCompilationActivityMode", CC "()I", FN_PTR(getCompilationActivityMode)},
};

int CompilerToVM::methods_count() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1522,4 +1522,10 @@ void getOopMapAt(HotSpotResolvedJavaMethodImpl method, int bci, long[] oopMap) {
* @returns false if no change was made, otherwise true
*/
native boolean updateCompilerThreadCanCallJava(boolean newState);

/**
* Returns the current {@code CompileBroker} compilation activity mode which is one of:
* {@code stop_compilation = 0}, {@code run_compilation = 1} or {@code shutdown_compilation = 2}
*/
native int getCompilationActivityMode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -1488,4 +1488,12 @@ JVMCIError exitHotSpotWithMessage(int status, String format, Object... args) {
exitHotSpot(status);
throw JVMCIError.shouldNotReachHere();
}

/**
* Returns HotSpot's {@code CompileBroker} compilation activity mode which is one of:
* {@code stop_compilation = 0}, {@code run_compilation = 1} or {@code shutdown_compilation = 2}
*/
public int getCompilationActivityMode() {
return compilerToVm.getCompilationActivityMode();
}
}

1 comment on commit 6bea1b6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.