< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp

Print this page

 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 extern "C" {
 31 
 32 
 33 static jvmtiEnv *jvmti = NULL;
 34 static jvmtiEventCallbacks callbacks;
 35 static jboolean wasFramePop = JNI_FALSE;
 36 static jmethodID mid_checkPoint, mid_chain4;
 37 static jbyteArray classBytes;
 38 static frame_info expected_platform_frames[] = {
 39     {"Lgetstacktr08$TestThread;", "checkPoint", "()V"},
 40     {"Lgetstacktr08$TestThread;", "chain5", "()V"},
 41     {"Lgetstacktr08$TestThread;", "chain4", "()V"},
 42     {"Lgetstacktr08;", "nativeChain", "(Ljava/lang/Class;)V"},
 43     {"Lgetstacktr08$TestThread;", "chain3", "()V"},
 44     {"Lgetstacktr08$TestThread;", "chain2", "()V"},
 45     {"Lgetstacktr08$TestThread;", "chain1", "()V"},
 46     {"Lgetstacktr08$TestThread;", "run", "()V"},

 47     {"Ljava/lang/Thread;", "run", "()V"},
 48 };
 49 
 50 static frame_info expected_virtual_frames[] = {
 51     {"Lgetstacktr08$TestThread;", "checkPoint", "()V"},
 52     {"Lgetstacktr08$TestThread;", "chain5", "()V"},
 53     {"Lgetstacktr08$TestThread;", "chain4", "()V"},
 54     {"Lgetstacktr08;", "nativeChain", "(Ljava/lang/Class;)V"},
 55     {"Lgetstacktr08$TestThread;", "chain3", "()V"},
 56     {"Lgetstacktr08$TestThread;", "chain2", "()V"},
 57     {"Lgetstacktr08$TestThread;", "chain1", "()V"},
 58     {"Lgetstacktr08$TestThread;", "run", "()V"},

 59     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 60     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 61     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 62     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 63     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 64 };
 65 
 66 int compare_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, int offset = 0) {
 67   frame_info *expected_frames = jni->IsVirtualThread(thread)
 68       ? expected_virtual_frames
 69       : expected_platform_frames;
 70   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)
 71       ? ((int) (sizeof(expected_virtual_frames) / sizeof(frame_info)))
 72       : ((int) (sizeof(expected_platform_frames) / sizeof(frame_info)));
 73   return compare_stack_trace(jvmti, jni, thread, expected_frames, expected_number_of_stack_frames, offset);
 74 }
 75 
 76 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmethodID method, jlocation location) {
 77   if (mid_checkPoint != method) {
 78     jni->FatalError("ERROR: don't know where we get called from");

 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 extern "C" {
 31 
 32 
 33 static jvmtiEnv *jvmti = NULL;
 34 static jvmtiEventCallbacks callbacks;
 35 static jboolean wasFramePop = JNI_FALSE;
 36 static jmethodID mid_checkPoint, mid_chain4;
 37 static jbyteArray classBytes;
 38 static frame_info expected_platform_frames[] = {
 39     {"Lgetstacktr08$TestThread;", "checkPoint", "()V"},
 40     {"Lgetstacktr08$TestThread;", "chain5", "()V"},
 41     {"Lgetstacktr08$TestThread;", "chain4", "()V"},
 42     {"Lgetstacktr08;", "nativeChain", "(Ljava/lang/Class;)V"},
 43     {"Lgetstacktr08$TestThread;", "chain3", "()V"},
 44     {"Lgetstacktr08$TestThread;", "chain2", "()V"},
 45     {"Lgetstacktr08$TestThread;", "chain1", "()V"},
 46     {"Lgetstacktr08$TestThread;", "run", "()V"},
 47     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 48     {"Ljava/lang/Thread;", "run", "()V"},
 49 };
 50 
 51 static frame_info expected_virtual_frames[] = {
 52     {"Lgetstacktr08$TestThread;", "checkPoint", "()V"},
 53     {"Lgetstacktr08$TestThread;", "chain5", "()V"},
 54     {"Lgetstacktr08$TestThread;", "chain4", "()V"},
 55     {"Lgetstacktr08;", "nativeChain", "(Ljava/lang/Class;)V"},
 56     {"Lgetstacktr08$TestThread;", "chain3", "()V"},
 57     {"Lgetstacktr08$TestThread;", "chain2", "()V"},
 58     {"Lgetstacktr08$TestThread;", "chain1", "()V"},
 59     {"Lgetstacktr08$TestThread;", "run", "()V"},
 60     {"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 61     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 62     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 63     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 64     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 65     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 66 };
 67 
 68 int compare_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, int offset = 0) {
 69   frame_info *expected_frames = jni->IsVirtualThread(thread)
 70       ? expected_virtual_frames
 71       : expected_platform_frames;
 72   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)
 73       ? ((int) (sizeof(expected_virtual_frames) / sizeof(frame_info)))
 74       : ((int) (sizeof(expected_platform_frames) / sizeof(frame_info)));
 75   return compare_stack_trace(jvmti, jni, thread, expected_frames, expected_number_of_stack_frames, offset);
 76 }
 77 
 78 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmethodID method, jlocation location) {
 79   if (mid_checkPoint != method) {
 80     jni->FatalError("ERROR: don't know where we get called from");
< prev index next >