Skip to content

Commit

Permalink
remove useless codes and refactor the testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
jia-wei-tang committed Aug 1, 2024
1 parent 1b0de48 commit 6041129
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 56 deletions.
4 changes: 1 addition & 3 deletions src/hotspot/share/prims/jvmtiExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,9 +1090,7 @@ bool JvmtiExport::post_class_file_load_hook(Symbol* h_name,
if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) {
return false;
}
if (JavaThread::current()->is_in_tmp_VTMS_transition()) {
return false; // skip CFLH events in tmp VTMS transition
}

if (JavaThread::current()->is_in_any_VTMS_transition()) {
return false; // no events should be posted if thread is in any VTMS transition
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
* @build TestPinCaseWithCFLH
* @run driver jdk.test.lib.util.JavaAgentBuilder
* TestPinCaseWithCFLH TestPinCaseWithCFLH.jar
* @run main/othervm/timeout=100 -Djdk.virtualThreadScheduler.maxPoolSize=1 -Djdk.tracePinnedThreads=full -javaagent:TestPinCaseWithCFLH.jar TestPinCaseWithCFLH
* @run main/othervm/timeout=100 -Djdk.virtualThreadScheduler.maxPoolSize=1 -Djdk.tracePinnedThreads=full --enable-native-access=ALL-UNNAMED -javaagent:TestPinCaseWithCFLH.jar TestPinCaseWithCFLH
*/
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
import java.security.ProtectionDomain;
import jdk.test.lib.thread.VThreadPinner;

public class TestPinCaseWithCFLH {

Expand All @@ -55,25 +56,15 @@ public static void premain(String agentArgs, Instrumentation instrumentation) th

public static void main(String[] args) throws Exception{
Thread t1 = Thread.ofVirtual().name("vthread-1").start(() -> {
result = nativeFuncPin(1);
VThreadPinner.runPinned(() -> {
try {
Thread.sleep(500); // try yield, will pin, javaagent + tracePinnedThreads should not lead to crash (because of the class `PinnedThreadPrinter`)
} catch (Exception e) {
e.printStackTrace();
}
});
});
t1.join();
assert result == 4;
}

static int native2Java(int b) {
try {
Thread.sleep(500); // try yield, will pin, javaagent + tracePinnedThreads should not lead to crash (because of the class `PinnedThreadPrinter`)
} catch (Exception e) {
e.printStackTrace();
}

return b+1;
}

private static native int nativeFuncPin(int x);

static {
System.loadLibrary("TestPinCaseWithCFLH");
}
}

This file was deleted.

0 comments on commit 6041129

Please sign in to comment.