--- old/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp 2017-05-12 16:18:30.655566323 -0700 +++ new/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp 2017-05-12 16:18:30.539566745 -0700 @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "assembler_x86.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" #include "classfile/systemDictionary.hpp" @@ -201,6 +202,10 @@ try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case); initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2, UseTLAB); + + HEAP_MONITORING(this, noreg, noreg, object_size * HeapWordSize, obj, + t1, t2, call(RuntimeAddress(Runtime1::entry_for( + Runtime1::heap_object_sample_id)));); } void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, bool is_tlab_allocated) { @@ -277,13 +282,19 @@ // clear rest of allocated space const Register len_zero = len; + // Initialize body destroys arr_size so remember it. + push(arr_size); initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero); + pop(arr_size); if (CURRENT_ENV->dtrace_alloc_probes()) { assert(obj == rax, "must be"); call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id))); } + HEAP_MONITORING(this, noreg, arr_size, 0, obj, t1, noreg, + call(RuntimeAddress(Runtime1::entry_for( + Runtime1::heap_object_sample_id)));); verify_oop(obj); }