diff -r f61cb5d6d39b tapset/jstack.stp.in --- a/tapset/jstack.stp.in Fri Jul 27 09:26:20 2012 +0100 +++ b/tapset/jstack.stp.in Fri Aug 03 08:59:30 2012 +0900 @@ -49,6 +49,7 @@ global Universe_collectedHeap; global HeapWordSize; global CodeCache_heap; +global NarrowOopStruct; global sp_register; global fp_register; @@ -109,6 +110,23 @@ %? @var("_heap@codeCache.cpp") %: $_heap %); + /** + * Does target process use CompressedOops ? + */ + NarrowOopStruct[pid()] = 0; + + %( systemtap_v >= "1.8" + + %? if(@var("UseCompressedOops@globals.cpp")){ + NarrowOopStruct[pid()] = &@var("_narrow_oop@universe.cpp"); + } + + %: if($UseCompressedOops){ + NarrowOopStruct[pid()] = $_narrow_oop; + } + + %) + // Should really check arch of user space (for 32bit jvm on 64bit kernel). %( arch == "i386" %? sp_register = "esp"; @@ -142,6 +160,7 @@ delete(Universe_collectedHeap[pid()]); delete(HeapWordSize[pid()]); delete(CodeCache_heap[pid()]); + delete(NarrowOopStruct[pid()]; delete(vm_inited[pid()]); } @@ -353,8 +372,18 @@ isMethodOop = 0 else { - methodOopKlass = @cast(methodOopPtr, "methodOopDesc", + methodOopKlass = 0; + + if(NarrowOopStruct[pid()]){ + methodOopKlass = @cast(methodOopPtr, "methodOopDesc", + "@ABS_SERVER_LIBJVM_SO@")->_metadata->_compressed_klass; + methodOopKlass = @cast(NarrowOopStruct[pid()], "NarrowOopStruct", "@ABS_SERVER_LIBJVM_SO@")->_base + (methodOopKlass << @cast(NarrowOopStruct[pid()], "NarrowOopStruct", "@ABS_SERVER_LIBJVM_SO@")->_shift); + } + else{ + methodOopKlass = @cast(methodOopPtr, "methodOopDesc", "@ABS_SERVER_LIBJVM_SO@")->_metadata->_klass; + } + isMethodOop = (methodOopKlass == Universe_methodKlassObj[pid()]); }