Thu, 05 Jun 2008 17:02:54 -0400
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
1.1 --- a/src/cpu/sparc/vm/assembler_sparc.cpp Thu May 29 14:06:30 2008 -0400 1.2 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp Thu Jun 05 17:02:54 2008 -0400 1.3 @@ -3622,6 +3622,7 @@ 1.4 1.5 void MacroAssembler::encode_heap_oop(Register src, Register dst) { 1.6 assert (UseCompressedOops, "must be compressed"); 1.7 + verify_oop(src); 1.8 Label done; 1.9 if (src == dst) { 1.10 // optimize for frequent case src == dst 1.11 @@ -3643,12 +3644,14 @@ 1.12 1.13 void MacroAssembler::encode_heap_oop_not_null(Register r) { 1.14 assert (UseCompressedOops, "must be compressed"); 1.15 + verify_oop(r); 1.16 sub(r, G6_heapbase, r); 1.17 srlx(r, LogMinObjAlignmentInBytes, r); 1.18 } 1.19 1.20 void MacroAssembler::encode_heap_oop_not_null(Register src, Register dst) { 1.21 assert (UseCompressedOops, "must be compressed"); 1.22 + verify_oop(src); 1.23 sub(src, G6_heapbase, dst); 1.24 srlx(dst, LogMinObjAlignmentInBytes, dst); 1.25 } 1.26 @@ -3661,11 +3664,13 @@ 1.27 bpr(rc_nz, true, Assembler::pt, dst, done); 1.28 delayed() -> add(dst, G6_heapbase, dst); // annuled if not taken 1.29 bind(done); 1.30 + verify_oop(dst); 1.31 } 1.32 1.33 void MacroAssembler::decode_heap_oop_not_null(Register r) { 1.34 // Do not add assert code to this unless you change vtableStubs_sparc.cpp 1.35 // pd_code_size_limit. 1.36 + // Also do not verify_oop as this is called by verify_oop. 1.37 assert (UseCompressedOops, "must be compressed"); 1.38 sllx(r, LogMinObjAlignmentInBytes, r); 1.39 add(r, G6_heapbase, r); 1.40 @@ -3674,6 +3679,7 @@ 1.41 void MacroAssembler::decode_heap_oop_not_null(Register src, Register dst) { 1.42 // Do not add assert code to this unless you change vtableStubs_sparc.cpp 1.43 // pd_code_size_limit. 1.44 + // Also do not verify_oop as this is called by verify_oop. 1.45 assert (UseCompressedOops, "must be compressed"); 1.46 sllx(src, LogMinObjAlignmentInBytes, dst); 1.47 add(dst, G6_heapbase, dst);
2.1 --- a/src/cpu/x86/vm/assembler_x86_64.cpp Thu May 29 14:06:30 2008 -0400 2.2 +++ b/src/cpu/x86/vm/assembler_x86_64.cpp Thu Jun 05 17:02:54 2008 -0400 2.3 @@ -5265,6 +5265,7 @@ 2.4 assert (UseCompressedOops, "should only be used for compressed headers"); 2.5 // Cannot assert, unverified entry point counts instructions (see .ad file) 2.6 // vtableStubs also counts instructions in pd_code_size_limit. 2.7 + // Also do not verify_oop as this is called by verify_oop. 2.8 assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong"); 2.9 leaq(r, Address(r12_heapbase, r, Address::times_8, 0)); 2.10 } 2.11 @@ -5273,6 +5274,7 @@ 2.12 assert (UseCompressedOops, "should only be used for compressed headers"); 2.13 // Cannot assert, unverified entry point counts instructions (see .ad file) 2.14 // vtableStubs also counts instructions in pd_code_size_limit. 2.15 + // Also do not verify_oop as this is called by verify_oop. 2.16 assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong"); 2.17 leaq(dst, Address(r12_heapbase, src, Address::times_8, 0)); 2.18 }
3.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp Thu May 29 14:06:30 2008 -0400 3.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp Thu Jun 05 17:02:54 2008 -0400 3.3 @@ -233,7 +233,7 @@ 3.4 assert(Rsub_klass != rcx, "rcx holds 2ndary super array length"); 3.5 assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr"); 3.6 3.7 - Label not_subtype, loop; 3.8 + Label not_subtype, not_subtype_pop, loop; 3.9 3.10 // Profile the not-null value's klass. 3.11 profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi 3.12 @@ -272,12 +272,13 @@ 3.13 // and we store values in objArrays always encoded, thus we need to encode value 3.14 // before repne 3.15 if (UseCompressedOops) { 3.16 + pushq(rax); 3.17 encode_heap_oop(rax); 3.18 repne_scanl(); 3.19 // Not equal? 3.20 - jcc(Assembler::notEqual, not_subtype); 3.21 - // decode heap oop here for movq 3.22 - decode_heap_oop(rax); 3.23 + jcc(Assembler::notEqual, not_subtype_pop); 3.24 + // restore heap oop here for movq 3.25 + popq(rax); 3.26 } else { 3.27 repne_scanq(); 3.28 jcc(Assembler::notEqual, not_subtype); 3.29 @@ -287,9 +288,10 @@ 3.30 Klass::secondary_super_cache_offset_in_bytes()), rax); 3.31 jmp(ok_is_subtype); 3.32 3.33 + bind(not_subtype_pop); 3.34 + // restore heap oop here for miss 3.35 + if (UseCompressedOops) popq(rax); 3.36 bind(not_subtype); 3.37 - // decode heap oop here for miss 3.38 - if (UseCompressedOops) decode_heap_oop(rax); 3.39 profile_typecheck_failed(rcx); // blows rcx 3.40 } 3.41