diff src/cpu/x86/vm/interp_masm_x86_64.cpp @ 178:6d172e3548cb

6695819: verify_oopx rax: broken oop in decode_heap_oop Summary: Code in gen_subtype_check was encoding rax as an oop on a path where rax was not an oop. Reviewed-by: never, kvn
author coleenp
date Thu, 05 Jun 2008 17:02:54 -0400
parents ba764ed4b6f2
children d1605aabd0a1 6aae2f9d0294
line wrap: on
line diff
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu May 29 14:06:30 2008 -0400
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Jun 05 17:02:54 2008 -0400
@@ -233,7 +233,7 @@
   assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
   assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr");
 
-  Label not_subtype, loop;
+  Label not_subtype, not_subtype_pop, loop;
 
   // Profile the not-null value's klass.
   profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi
@@ -272,12 +272,13 @@
   // and we store values in objArrays always encoded, thus we need to encode value
   // before repne
   if (UseCompressedOops) {
+    pushq(rax);
     encode_heap_oop(rax);
     repne_scanl();
     // Not equal?
-    jcc(Assembler::notEqual, not_subtype);
-    // decode heap oop here for movq
-    decode_heap_oop(rax);
+    jcc(Assembler::notEqual, not_subtype_pop);
+    // restore heap oop here for movq
+    popq(rax);
   } else {
     repne_scanq();
     jcc(Assembler::notEqual, not_subtype);
@@ -287,9 +288,10 @@
                Klass::secondary_super_cache_offset_in_bytes()), rax);
   jmp(ok_is_subtype);
 
+  bind(not_subtype_pop);
+  // restore heap oop here for miss
+  if (UseCompressedOops) popq(rax);
   bind(not_subtype);
-  // decode heap oop here for miss
-  if (UseCompressedOops) decode_heap_oop(rax);
   profile_typecheck_failed(rcx); // blows rcx
 }