hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
changeset 35606 d873b64009cc
parent 35495 e27da438fa13
parent 35548 8d3afe96ffea
child 35913 928548a43408
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Tue Jan 26 17:13:18 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Jan 28 09:49:17 2016 +0100
@@ -3469,11 +3469,27 @@
   add(top, t1, top); // t1 is tlab_size
   sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top);
   st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset()));
+
+  if (ZeroTLAB) {
+    // This is a fast TLAB refill, therefore the GC is not notified of it.
+    // So compiled code must fill the new TLAB with zeroes.
+    ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t2);
+    zero_memory(t2, t1);
+  }
   verify_tlab();
   ba(retry);
   delayed()->nop();
 }
 
+void MacroAssembler::zero_memory(Register base, Register index) {
+  assert_different_registers(base, index);
+  Label loop;
+  bind(loop);
+  subcc(index, HeapWordSize, index);
+  brx(Assembler::greaterEqual, true, Assembler::pt, loop);
+  delayed()->st_ptr(G0, base, index);
+}
+
 void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes,
                                           Register t1, Register t2) {
   // Bump total bytes allocated by this thread