src/hotspot/share/services/threadService.cpp
changeset 47592 68d46cb9be45
parent 47216 71c04702a3d5
child 48105 8d15b1369c7a
--- a/src/hotspot/share/services/threadService.cpp	Wed Sep 20 18:30:32 2017 +0800
+++ b/src/hotspot/share/services/threadService.cpp	Thu Oct 05 01:31:53 2017 -0700
@@ -562,6 +562,10 @@
     vframe* start_vf = _thread->last_java_vframe(&reg_map);
     int count = 0;
     for (vframe* f = start_vf; f; f = f->sender() ) {
+      if (maxDepth >= 0 && count == maxDepth) {
+        // Skip frames if more than maxDepth
+        break;
+      }
       if (f->is_java_frame()) {
         javaVFrame* jvf = javaVFrame::cast(f);
         add_stack_frame(jvf);
@@ -569,10 +573,6 @@
       } else {
         // Ignore non-Java frames
       }
-      if (maxDepth > 0 && count == maxDepth) {
-        // Skip frames if more than maxDepth
-        break;
-      }
     }
   }