Skip to content

Commit 06fd4b9

Browse files
committed
Disable current thread workaround for JDK 20.
1 parent 2cf0de1 commit 06fd4b9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

substratevm/src/com.oracle.svm.agent/src/com/oracle/svm/agent/BreakpointInterceptor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private static boolean forName(JNIEnvironment jni, JNIObjectHandle thread, Break
217217
boolean classLoaderValid = true;
218218
WordPointer classLoaderPtr = StackValue.get(WordPointer.class);
219219
if (bp.method == agent.handles().javaLangClassForName3) {
220-
assert thread.notEqual(nullHandle()) : "JDK-8292657: must not use NULL for the current thread because it does not apply to virtual threads on JDK 19";
220+
assert thread.notEqual(nullHandle()) || Support.jvmtiVersion() != JvmtiInterface.JVMTI_VERSION_19 : "JDK-8292657";
221221
classLoaderValid = (jvmtiFunctions().GetLocalObject().invoke(jvmtiEnv(), thread, 0, 2, classLoaderPtr) == JvmtiError.JVMTI_ERROR_NONE);
222222
} else {
223223
classLoaderPtr.write(nullHandle());
@@ -1288,15 +1288,15 @@ private static void onBreakpoint(@SuppressWarnings("unused") JvmtiEnv jvmti, JNI
12881288
* used to properly read the locals in the breakpoint.
12891289
*/
12901290
private static JNIObjectHandle rectifyCurrentThread(JNIObjectHandle thread) {
1291-
if (Support.jvmtiVersion() < JvmtiInterface.JVMTI_VERSION_19) {
1291+
if (Support.jvmtiVersion() != JvmtiInterface.JVMTI_VERSION_19) {
12921292
return thread;
12931293
}
1294+
12941295
WordPointer threadPtr = StackValue.get(WordPointer.class);
12951296
JvmtiError error = jvmtiFunctions().GetCurrentThread().invoke(jvmtiEnv(), threadPtr);
12961297
if (error == JvmtiError.JVMTI_ERROR_WRONG_PHASE) {
12971298
return nullHandle();
12981299
}
1299-
13001300
check(error);
13011301
return threadPtr.read();
13021302
}

substratevm/src/com.oracle.svm.jvmtiagentbase/src/com/oracle/svm/jvmtiagentbase/Support.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static JNIMethodId getCallerMethod(int depth) {
185185
}
186186

187187
public static JNIObjectHandle getObjectArgument(JNIObjectHandle thread, int slot) {
188-
assert thread.notEqual(nullHandle()) : "JDK-8292657: must not use NULL for the current thread because it does not apply to virtual threads on JDK 19";
188+
assert thread.notEqual(nullHandle()) || jvmtiVersion() != JvmtiInterface.JVMTI_VERSION_19 : "JDK-8292657";
189189
WordPointer handlePtr = StackValue.get(WordPointer.class);
190190
if (jvmtiFunctions().GetLocalObject().invoke(jvmtiEnv(), thread, 0, slot, handlePtr) != JvmtiError.JVMTI_ERROR_NONE) {
191191
return nullHandle();
@@ -198,7 +198,7 @@ public static JNIObjectHandle getObjectArgument(JNIObjectHandle thread, int slot
198198
* for instance methods, not static methods.
199199
*/
200200
public static JNIObjectHandle getReceiver(JNIObjectHandle thread) {
201-
assert thread.notEqual(nullHandle()) : "JDK-8292657: must not use NULL for the current thread because it does not apply to virtual threads on JDK 19";
201+
assert thread.notEqual(nullHandle()) || jvmtiVersion() != JvmtiInterface.JVMTI_VERSION_19 : "JDK-8292657";
202202
WordPointer handlePtr = StackValue.get(WordPointer.class);
203203
JvmtiError result = jvmtiFunctions().GetLocalInstance().invoke(jvmtiEnv(), thread, 0, handlePtr);
204204
if (result != JvmtiError.JVMTI_ERROR_NONE) {

0 commit comments

Comments
 (0)