[PATCH 1 of 5] * tapset/jstack.stp.in: Don't hard code constantPoolOopDesc_size

Mark Wielaard mjw at redhat.com
Wed Mar 14 03:07:00 PDT 2012


# HG changeset patch
# User Mark Wielaard <mark at klomp.org>
# Date 1331652550 -3600
# Node ID c354196308a582c0801a30ea84f80d8d93450e9e
# Parent  b8d810f20366bdfecfa2354f2e15af7f92b97838
* tapset/jstack.stp.in: Don't hard code constantPoolOopDesc_size.

The size of constantPoolOopDesc had changed, but it was hard coded.
We use a trick now to calculate it from the DWARF data. Pretend we have
an array at address zero and take address of second element and we have
the size.

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-13  Mark Wielaard  <mjw at redhat.com>
+
+	* tapset/jstack.stp.in: Don't hard code constantPoolOopDesc_size.
+
 2012-03-02  Xerxes Rånby  <xerxes at zafena.se>
 	    Andrew Haley  <aph at redhat.com>
 
diff --git a/tapset/jstack.stp.in b/tapset/jstack.stp.in
--- a/tapset/jstack.stp.in
+++ b/tapset/jstack.stp.in
@@ -1,5 +1,5 @@
 /* jstack systemtap tapset, for extracting hotspot java backtraces.
-   Copyright (C) 2009, Red Hat Inc.
+   Copyright (C) 2009, 2012 Red Hat Inc.
 
 This file is part of IcedTea.
 
@@ -110,17 +110,19 @@
      pc_register = "eip";
      ptr_size = 4;
      ptr_mask = 0xFFFFFFFF;
-     constantPoolOopDesc_size = 32; // Should use dwarf @size
   %: %(arch == "x86_64" %?
      sp_register = "rsp";
      fp_register = "rbp";
      pc_register = "rip";
      ptr_size = 8; // XXX - might be probing 32-on-64 jvm.
      ptr_mask = 0xFFFFFFFFFFFFFFFF;
-     constantPoolOopDesc_size = 56; // Should use dwarf @size
   %: **ERROR** unknown architecture
   %) %)
 
+  // Pretend we have an array at address zero and take address of second
+  // element and we have the size.
+  constantPoolOopDesc_size = &@cast(0, "constantPoolOopDesc")[1];
+
   // Really should get from dwarf: @size("HeapBlock::Header"), @size("oopDesc")
   HeapBlock_Header_size = 2 * ptr_size;
   oopDesc_size = 2 * ptr_size;


More information about the distro-pkg-dev mailing list