diff src/cpu/x86/vm/assembler_x86_64.cpp @ 167:feeb96a45707

6696264: assert("narrow oop can never be zero") for GCBasher & ParNewGC Summary: decouple set_klass() with zeroing the gap when compressed. Reviewed-by: kvn, ysr, jrose
author coleenp
date Wed, 28 May 2008 21:06:24 -0700
parents c436414a719e
children 1f809e010142 44abbb0d4c18
line wrap: on
line diff
--- a/src/cpu/x86/vm/assembler_x86_64.cpp	Wed May 28 12:42:34 2008 -0700
+++ b/src/cpu/x86/vm/assembler_x86_64.cpp	Wed May 28 21:06:24 2008 -0700
@@ -4935,6 +4935,8 @@
   movq(Address(top, arrayOopDesc::length_offset_in_bytes()), t1);
   // set klass to intArrayKlass
   movptr(t1, ExternalAddress((address) Universe::intArrayKlassObj_addr()));
+  // store klass last.  concurrent gcs assumes klass length is valid if
+  // klass field is not null.
   store_klass(top, t1);
 
   // refill the tlab with an eden allocation
@@ -5159,9 +5161,17 @@
 void MacroAssembler::store_klass(Register dst, Register src) {
   if (UseCompressedOops) {
     encode_heap_oop_not_null(src);
-    // Store to the wide klass field to zero the gap.
+    movl(Address(dst, oopDesc::klass_offset_in_bytes()), src);
+  } else {
+    movq(Address(dst, oopDesc::klass_offset_in_bytes()), src);
   }
-  movq(Address(dst, oopDesc::klass_offset_in_bytes()), src);
+}
+
+void MacroAssembler::store_klass_gap(Register dst, Register src) {
+  if (UseCompressedOops) {
+    // Store to klass gap in destination
+    movl(Address(dst, oopDesc::klass_gap_offset_in_bytes()), src);
+  }
 }
 
 void MacroAssembler::load_heap_oop(Register dst, Address src) {