changeset 2691:c848b93a8598 default tip

PR3833: Update tapsets following JDK-8015774, which removes '_heap' 2021-02-21 Andrew John Hughes <gnu_andrew@member.fsf.org> PR3833: Update tapsets following JDK-8015774, which removes '_heap' * NEWS: Updated. * tapset/jstack.stp.in: Replace hardcoded libjvm.so paths from Severin's patch with @ABS_SERVER_LIBJVM_SO@. 2020-08-03 Severin Gehwolf <sgehwolf@redhat.com> PR3833: Update tapsets following JDK-8015774, which removes '_heap' * tapset/jstack.stp.in: Adapt to work with _heaps, following JDK-8015774.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Mon, 22 Feb 2021 02:08:05 +0000
parents 5fab595d64d9
children
files ChangeLog NEWS tapset/jstack.stp.in
diffstat 3 files changed, 55 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 22 01:27:10 2021 +0000
+++ b/ChangeLog	Mon Feb 22 02:08:05 2021 +0000
@@ -1,3 +1,20 @@
+2021-02-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+	PR3833: Update tapsets following JDK-8015774,
+	which removes '_heap'
+	* NEWS: Updated.
+	* tapset/jstack.stp.in:
+	Replace hardcoded libjvm.so paths
+	from Severin's patch with @ABS_SERVER_LIBJVM_SO@.
+
+2020-08-03  Severin Gehwolf  <sgehwolf@redhat.com>
+
+	PR3833: Update tapsets following JDK-8015774,
+	which removes '_heap'
+	* tapset/jstack.stp.in:
+	Adapt to work with _heaps, following
+	JDK-8015774.
+
 2021-02-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>
 
 	PR3832: Populate unique SystemTap suffix
--- a/NEWS	Mon Feb 22 01:27:10 2021 +0000
+++ b/NEWS	Mon Feb 22 02:08:05 2021 +0000
@@ -21,6 +21,7 @@
   - PR3828: Architectures unsupported by SystemTap tapsets throw a parse error
   - PR3829: arc_priority representation creates an implicit limit on character sequence within regexp
   - PR3831: Hotspot object_alloc tapset uses HeapWordSize incorrectly
+  - PR3833, RH1814915: Update tapsets following JDK-8015774, which removes '_heap'
 
 New in release 5.0.0 (2019-XX-XX):
 
--- a/tapset/jstack.stp.in	Mon Feb 22 01:27:10 2021 +0000
+++ b/tapset/jstack.stp.in	Mon Feb 22 02:08:05 2021 +0000
@@ -52,7 +52,7 @@
   %( systemtap_v < "3.2" && systemtap_v >= "3.0" %? if (pp() !~ "@prefix@") next %)
 %)
 
-@_private global CodeCache_heap;
+@_private global CodeCache_heaps;
 
 @_private global sp_register;
 /* On PowerPC there is a link register, but no frame pointer register.  */
@@ -90,8 +90,8 @@
    * the segment at index - N (which can be recursive if a block
    * contains more than 0xFE segments).
    */
-  CodeCache_heap[pid()] = %( systemtap_v >= "1.8"
-                            %? @var("_heap@codeCache.cpp")
+  CodeCache_heaps[pid()] = %( systemtap_v >= "1.8"
+                            %? @var("_heaps@codeCache.cpp")
                             %: $_heap %);
 
   // Should really check arch of user space (for 32bit jvm on 64bit kernel).
@@ -140,7 +140,7 @@
 
 probe hotspot.vm_shutdown
 {
-  delete(CodeCache_heap[pid()]);
+  delete(CodeCache_heaps[pid()]);
   delete(vm_inited[pid()]);
 }
 
@@ -269,19 +269,6 @@
         return frame;
     }
 
-  // Extract code bounds.
-  CodeCache_low = @cast(CodeCache_heap[pid()], "CodeHeap",
-                        "@ABS_SERVER_LIBJVM_SO@")->_memory->_low;
-  CodeCache_high =  @cast(CodeCache_heap[pid()], "CodeHeap",
-                          "@ABS_SERVER_LIBJVM_SO@")->_memory->_high;
-
-  CodeHeap_log2_segment_size = @cast(CodeCache_heap[pid()],
-                                     "CodeHeap",
-                                     "@ABS_SERVER_LIBJVM_SO@")->_log2_segment_size;
-  CodeCache_segmap_low = @cast(CodeCache_heap[pid()],
-                               "CodeHeap",
-                               "@ABS_SERVER_LIBJVM_SO@")->_segmap->_low;
-
   // Might want to sanity check above values.
 
   // Loop through all the frames. The program counter is the starting
@@ -309,8 +296,39 @@
       // Assume things are fine unless indicated otherwise.
       trust_fp = 1;
 
+      // Extract code bounds.
+      CodeHeaps_len = @cast(CodeCache_heaps[pid()], "GrowableArray<CodeHeap*>",
+                            "@ABS_SERVER_LIBJVM_SO@")->_len;
+      heapsPos = 0;
+      foundCodeHeap = 0;
+      while (heapsPos < CodeHeaps_len)
+        {
+          CodeHeap = &@cast(CodeCache_heaps[pid()], "GrowableArray<CodeHeap*>",
+                            "@ABS_SERVER_LIBJVM_SO@")->_data[heapsPos];
+          heapsPos++;
+
+          // Extract code bounds.
+          CodeCache_low = @cast(CodeHeap, "CodeHeap",
+                                "@ABS_SERVER_LIBJVM_SO@")->_memory->_low_boundary;
+          CodeCache_high =  @cast(CodeHeap, "CodeHeap",
+                                  "@ABS_SERVER_LIBJVM_SO@")->_memory->_high;
+
+          CodeHeap_log2_segment_size = @cast(CodeHeap,
+                                             "CodeHeap",
+                                             "@ABS_SERVER_LIBJVM_SO@")->_log2_segment_size;
+          CodeCache_segmap_low = @cast(CodeHeap,
+                                       "CodeHeap",
+                                       "@ABS_SERVER_LIBJVM_SO@")->_segmap->_low;
+          // break out of the loop if we've found the code heap
+          if (CodeCache_low <= pc && pc < CodeCache_high)
+            {
+              foundCodeHeap = 1;
+              break;
+            }
+        }
+
       // Generated code? (Interpreter and stub methods are also generated)
-      if (CodeCache_low <= pc && pc < CodeCache_high)
+      if (foundCodeHeap == 1)
         {
           // Find the start of the code segment and code block that
           // this pc is in.
@@ -357,7 +375,7 @@
               // For the interpreter (and other code blobs) it is on the
               // stack relative to the frame pointer.
               if (blob_name == "nmethod")
-                methodPtr = @cast(blob, "nmethod",
+                methodPtr = @cast(blob, "CompiledMethod",
                                      "@ABS_SERVER_LIBJVM_SO@")->_method
               else 
                 methodPtr = user_long(fp + (-3 * ptr_size)) & ptr_mask