jstack.stp should work with -XX:+UseCompressedOops

Yasumasa Suenaga suenaga.yasumasa at lab.ntt.co.jp
Thu Aug 2 17:26:24 PDT 2012


Hi Mark,

Thanks for your comment.

I forgot about @var statement at CompressedOops detection.
So, I've rewrite a patch and attach on this email.

Testcase is also attached. Please run Simple.java and test.stp .


Not patched:
-------------------
# stap -c 'java -XX:+DTraceMethodProbes Simple' test.stp
     :
method_entry(thread_id=1,class='java/lang/System',method='gc',sig='()V')
method_entry(thread_id=1,class='java/lang/Runtime',method='gc',sig='()V')
-------------------
Stack trace is not available.


Patched:
-------------------
# stap -c 'java -XX:+DTraceMethodProbes Simple' test.stp
     :
method_entry(thread_id=1,class='java/lang/System',method='gc',sig='()V')
java/lang/System.gc()V
Simple.main([Ljava/lang/String;)V
method_entry(thread_id=1,class='java/lang/Runtime',method='gc',sig='()V')
java/lang/Runtime.gc()V
java/lang/System.gc()V
Simple.main([Ljava/lang/String;)V
-------------------
We can get correct stack trace.


Thanks,

Yasumasa

On 2012/08/03 5:15, Mark Wielaard wrote:
> On Thu, Aug 02, 2012 at 05:30:11PM +0900, Yasumasa Suenaga wrote:
>> I've made a patch for Icedtea7 which is attached this email, and
>> it works fine on my environment on above.
>
> Thanks. At first glance it looks OK.
> Small comment below about the systemtap_v>= "1.8" placement.
>
> None of our testcases caught this (but we only have two).
> Do you happen to have an example where compressed oops is
> triggered and jstack() gives a wrong stack? I couldn't get
> it to trigger with a simple test.
>
>> +  /**
>> +   * Does target process use CompressedOops ?
>> +   */
>> +  if(@var("UseCompressedOops at globals.cpp")){
>> +    NarrowOopStruct[pid()] = %( systemtap_v>= "1.8"
>> +                               %?&@var("_narrow_oop at universe.cpp")
>> +                               %: $_narrow_oop %);
>> +  }
>> +  else{
>> +    NarrowOopStruct[pid()] = 0;
>> +  }
>
> Since @var only works with systemtap_v>= 1.8 the whole check should
> be inside the version check:
>
>    %( systemtap_v>= "1.8"
>      %? if (@var("UseCompressedOops at globals.cpp")) {
>           NarrowOopStruct[pid()] =&@var("_narrow_oop at universe.cpp");
>         } else {
>           NarrowOopStruct[pid()] = 0;
>         }
>      %: NarrowOopStruct[pid()] = 0;
>    %)
>
> That means CompressedOops detection doesn't work against older systemtap
> versions, but people having such a new hotspot version will normally
> also have a new systemtap version.
>
> Cheers,
>
> Mark

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jstack_2.patch
Url: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120803/b5f70681/jstack_2.patch 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Simple.java
Url: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120803/b5f70681/Simple.java 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.stp
Url: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120803/b5f70681/test.stp 


More information about the distro-pkg-dev mailing list