< prev index next >

src/cpu/x86/vm/templateTable_x86.cpp

Print this page

        

@@ -3925,10 +3925,11 @@
 
   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
     // The object is initialized before the header.  If the object size is
     // zero, go directly to the header initialization.
     __ bind(initialize_object);
+    __ movq(rbx, rdx);    // Save the size for HeapMonitoring
     __ decrement(rdx, sizeof(oopDesc));
     __ jcc(Assembler::zero, initialize_header);
 
     // Initialize topmost object field, divide rdx by 8, check if odd and
     // test if zero.

@@ -3955,10 +3956,14 @@
     __ jcc(Assembler::notZero, loop);
     }
 
     // initialize object header only.
     __ bind(initialize_header);
+
+    // Restore size for HeapMonitoring
+    __ movq(rdx, rbx);
+
     if (UseBiasedLocking) {
       __ pop(rcx);   // get saved klass back in the register.
       __ movptr(rbx, Address(rcx, Klass::prototype_header_offset()));
       __ movptr(Address(rax, oopDesc::mark_offset_in_bytes ()), rbx);
     } else {

@@ -3975,14 +3980,24 @@
     {
       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);
     }
 
+    HEAP_MONITORING(_masm, noreg, rdx, 0, rax, rcx, noreg, \
+      { \
+        __ push(atos); \
+        __ call_VM_leaf( \
+            CAST_FROM_FN_PTR(address, HeapMonitoring::object_alloc), \
+            rax, rdx); \
+        __ pop(atos); \
+      });
+
     __ jmp(done);
   }
 
   // slow case
   __ bind(slow_case);
< prev index next >