DTraceAllocProbes bug in interpreter

Jungwoo Ha jwha at google.com
Sat Feb 14 01:21:38 UTC 2015


I am not sure if DTraceAllocProbes is a live code, but I think this is a
bug.
dtrace_object_alloc has changed to receive size argument in JDK8.
This code only passes oop to dtrace_object_alloc. RDX has the size but it
needs to be saved.
I don't use DTrace, but it looks broken. If someone sponsor this is a right
fix, I'll create a webrev.

diff -r f06c7b654d63 src/cpu/x86/vm/templateTable_x86_32.cpp
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp Thu Jul 31 09:58:53 2014 +0100
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Feb 13 17:14:57 2015 -0800
@@ -3288,6 +3288,7 @@
     // The object is initialized before the header.  If the object size is
     // zero, go directly to the header initialization.
     __ bind(initialize_object);
+    __ push(rdx);  // save object size
     __ decrement(rdx, sizeof(oopDesc));
     __ jcc(Assembler::zero, initialize_header);

@@ -3328,13 +3329,14 @@
       __ pop(rcx);   // get saved klass back in the register.
     }
     __ store_klass(rax, rcx);  // klass
+    __ pop(rdx);  // restore object size to rdx

     {
       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
       // Trigger dtrace event for fastpath
       __ push(atos);
       __ call_VM_leaf(
-           CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
rax);
+           CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
rax, rdx);
       __ pop(atos);
     }

diff -r f06c7b654d63 src/cpu/x86/vm/templateTable_x86_64.cpp
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp Thu Jul 31 09:58:53 2014 +0100
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp Fri Feb 13 17:14:57 2015 -0800
@@ -3352,6 +3352,7 @@
     // The object is initialized before the header.  If the object size is
     // zero, go directly to the header initialization.
     __ bind(initialize_object);
+    __ movl(rbx, rdx);  // save object size to rbx
     __ decrementl(rdx, sizeof(oopDesc));
     __ jcc(Assembler::zero, initialize_header);

@@ -3386,7 +3387,7 @@
       // Trigger dtrace event for fastpath
       __ push(atos); // save the return value
       __ call_VM_leaf(
-           CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
rax);
+           CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
rax, rbx);
       __ pop(atos); // restore the return value

     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20150213/77cd0369/attachment.htm>


More information about the hotspot-gc-dev mailing list