< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/framecnt01.java

Print this page
*** 59,11 ***
  
      public static void main(String args[]) throws Exception {
  
          // Test GetFrameCount on virtual live thread
          Thread vThread = Thread.ofVirtual().name("VirtualThread-Live").start(() -> {
!            checkFrames(Thread.currentThread(), false, 9);
          });
          vThread.join();
  
          // Test GetFrameCount on virtual frozen thread
          Thread vThread1 = Thread.ofVirtual().name("VirtualThread-Frozen").start(() -> {
--- 59,11 ---
  
      public static void main(String args[]) throws Exception {
  
          // Test GetFrameCount on virtual live thread
          Thread vThread = Thread.ofVirtual().name("VirtualThread-Live").start(() -> {
!            checkFrames(Thread.currentThread(), false, 10);
          });
          vThread.join();
  
          // Test GetFrameCount on virtual frozen thread
          Thread vThread1 = Thread.ofVirtual().name("VirtualThread-Frozen").start(() -> {

*** 77,17 ***
          while(vThread1.getState() != Thread.State.WAITING) {
              Thread.sleep(1);
          }
  
          // this is too fragile, implementation can change at any time.
!         checkFrames(vThread1, false, 14);
          LockSupport.unpark(vThread1);
          vThread1.join();
  
          // Test GetFrameCount on live platform thread
          Thread pThread = Thread.ofPlatform().name("PlatformThread-Live").start(() -> {
!             checkFrames(Thread.currentThread(), false, 5);
          });
          pThread.join();
  
          // Test GetFrameCount on parked platform thread
          Thread pThread1 = Thread.ofPlatform().name("PlatformThread-Parked").start(() -> {
--- 77,17 ---
          while(vThread1.getState() != Thread.State.WAITING) {
              Thread.sleep(1);
          }
  
          // this is too fragile, implementation can change at any time.
!         checkFrames(vThread1, false, 15);
          LockSupport.unpark(vThread1);
          vThread1.join();
  
          // Test GetFrameCount on live platform thread
          Thread pThread = Thread.ofPlatform().name("PlatformThread-Live").start(() -> {
!             checkFrames(Thread.currentThread(), false, 6);
          });
          pThread.join();
  
          // Test GetFrameCount on parked platform thread
          Thread pThread1 = Thread.ofPlatform().name("PlatformThread-Parked").start(() -> {

*** 99,11 ***
          }
  
          while(pThread1.getState() != Thread.State.WAITING) {
              Thread.sleep(1);
          }
!         checkFrames(pThread1, false, 5);
          LockSupport.unpark(pThread1);
          pThread1.join();
  
  
          // Test GetFrameCount on some depth stack fixed by sync
--- 99,11 ---
          }
  
          while(pThread1.getState() != Thread.State.WAITING) {
              Thread.sleep(1);
          }
!         checkFrames(pThread1, false, 6);
          LockSupport.unpark(pThread1);
          pThread1.join();
  
  
          // Test GetFrameCount on some depth stack fixed by sync

*** 116,14 ***
      int depth;
      Object startedFlag;
      Object checkFlag;
      Thread thread;
  
!     // Each stack has 2 frames additional to expected depth
      // 0: FixedDepthThread: run()V
      // 1: java/lang/Thread: run()V
!     static final int ADDITIONAL_STACK_COUNT = 2;
  
      private FixedDepthThread(String name, int depth, Object checkFlag) {
          this.thread = Thread.ofPlatform().name(name).unstarted(this);
          this.depth = depth;
          this.startedFlag = new Object();
--- 116,15 ---
      int depth;
      Object startedFlag;
      Object checkFlag;
      Thread thread;
  
!     // Each stack has 3 frames additional to expected depth
      // 0: FixedDepthThread: run()V
      // 1: java/lang/Thread: run()V
!     // 2: java/lang/Thread: runWith()V
+     static final int ADDITIONAL_STACK_COUNT = 3;
  
      private FixedDepthThread(String name, int depth, Object checkFlag) {
          this.thread = Thread.ofPlatform().name(name).unstarted(this);
          this.depth = depth;
          this.startedFlag = new Object();
< prev index next >