提交 a71954d9 编写于 作者: C coleenp

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
上级 15e34168
...@@ -3622,6 +3622,7 @@ void MacroAssembler::store_heap_oop(Register d, const Address& a, int offset) { ...@@ -3622,6 +3622,7 @@ void MacroAssembler::store_heap_oop(Register d, const Address& a, int offset) {
void MacroAssembler::encode_heap_oop(Register src, Register dst) { void MacroAssembler::encode_heap_oop(Register src, Register dst) {
assert (UseCompressedOops, "must be compressed"); assert (UseCompressedOops, "must be compressed");
verify_oop(src);
Label done; Label done;
if (src == dst) { if (src == dst) {
// optimize for frequent case src == dst // optimize for frequent case src == dst
...@@ -3643,12 +3644,14 @@ void MacroAssembler::encode_heap_oop(Register src, Register dst) { ...@@ -3643,12 +3644,14 @@ void MacroAssembler::encode_heap_oop(Register src, Register dst) {
void MacroAssembler::encode_heap_oop_not_null(Register r) { void MacroAssembler::encode_heap_oop_not_null(Register r) {
assert (UseCompressedOops, "must be compressed"); assert (UseCompressedOops, "must be compressed");
verify_oop(r);
sub(r, G6_heapbase, r); sub(r, G6_heapbase, r);
srlx(r, LogMinObjAlignmentInBytes, r); srlx(r, LogMinObjAlignmentInBytes, r);
} }
void MacroAssembler::encode_heap_oop_not_null(Register src, Register dst) { void MacroAssembler::encode_heap_oop_not_null(Register src, Register dst) {
assert (UseCompressedOops, "must be compressed"); assert (UseCompressedOops, "must be compressed");
verify_oop(src);
sub(src, G6_heapbase, dst); sub(src, G6_heapbase, dst);
srlx(dst, LogMinObjAlignmentInBytes, dst); srlx(dst, LogMinObjAlignmentInBytes, dst);
} }
...@@ -3661,11 +3664,13 @@ void MacroAssembler::decode_heap_oop(Register src, Register dst) { ...@@ -3661,11 +3664,13 @@ void MacroAssembler::decode_heap_oop(Register src, Register dst) {
bpr(rc_nz, true, Assembler::pt, dst, done); bpr(rc_nz, true, Assembler::pt, dst, done);
delayed() -> add(dst, G6_heapbase, dst); // annuled if not taken delayed() -> add(dst, G6_heapbase, dst); // annuled if not taken
bind(done); bind(done);
verify_oop(dst);
} }
void MacroAssembler::decode_heap_oop_not_null(Register r) { void MacroAssembler::decode_heap_oop_not_null(Register r) {
// Do not add assert code to this unless you change vtableStubs_sparc.cpp // Do not add assert code to this unless you change vtableStubs_sparc.cpp
// pd_code_size_limit. // pd_code_size_limit.
// Also do not verify_oop as this is called by verify_oop.
assert (UseCompressedOops, "must be compressed"); assert (UseCompressedOops, "must be compressed");
sllx(r, LogMinObjAlignmentInBytes, r); sllx(r, LogMinObjAlignmentInBytes, r);
add(r, G6_heapbase, r); add(r, G6_heapbase, r);
...@@ -3674,6 +3679,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register r) { ...@@ -3674,6 +3679,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register r) {
void MacroAssembler::decode_heap_oop_not_null(Register src, Register dst) { void MacroAssembler::decode_heap_oop_not_null(Register src, Register dst) {
// Do not add assert code to this unless you change vtableStubs_sparc.cpp // Do not add assert code to this unless you change vtableStubs_sparc.cpp
// pd_code_size_limit. // pd_code_size_limit.
// Also do not verify_oop as this is called by verify_oop.
assert (UseCompressedOops, "must be compressed"); assert (UseCompressedOops, "must be compressed");
sllx(src, LogMinObjAlignmentInBytes, dst); sllx(src, LogMinObjAlignmentInBytes, dst);
add(dst, G6_heapbase, dst); add(dst, G6_heapbase, dst);
......
...@@ -5265,6 +5265,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register r) { ...@@ -5265,6 +5265,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register r) {
assert (UseCompressedOops, "should only be used for compressed headers"); assert (UseCompressedOops, "should only be used for compressed headers");
// Cannot assert, unverified entry point counts instructions (see .ad file) // Cannot assert, unverified entry point counts instructions (see .ad file)
// vtableStubs also counts instructions in pd_code_size_limit. // vtableStubs also counts instructions in pd_code_size_limit.
// Also do not verify_oop as this is called by verify_oop.
assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong"); assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong");
leaq(r, Address(r12_heapbase, r, Address::times_8, 0)); leaq(r, Address(r12_heapbase, r, Address::times_8, 0));
} }
...@@ -5273,6 +5274,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) { ...@@ -5273,6 +5274,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
assert (UseCompressedOops, "should only be used for compressed headers"); assert (UseCompressedOops, "should only be used for compressed headers");
// Cannot assert, unverified entry point counts instructions (see .ad file) // Cannot assert, unverified entry point counts instructions (see .ad file)
// vtableStubs also counts instructions in pd_code_size_limit. // vtableStubs also counts instructions in pd_code_size_limit.
// Also do not verify_oop as this is called by verify_oop.
assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong"); assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong");
leaq(dst, Address(r12_heapbase, src, Address::times_8, 0)); leaq(dst, Address(r12_heapbase, src, Address::times_8, 0));
} }
......
...@@ -233,7 +233,7 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, ...@@ -233,7 +233,7 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
assert(Rsub_klass != rcx, "rcx holds 2ndary super array length"); assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr"); 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 the not-null value's klass.
profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi
...@@ -272,12 +272,13 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, ...@@ -272,12 +272,13 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
// and we store values in objArrays always encoded, thus we need to encode value // and we store values in objArrays always encoded, thus we need to encode value
// before repne // before repne
if (UseCompressedOops) { if (UseCompressedOops) {
pushq(rax);
encode_heap_oop(rax); encode_heap_oop(rax);
repne_scanl(); repne_scanl();
// Not equal? // Not equal?
jcc(Assembler::notEqual, not_subtype); jcc(Assembler::notEqual, not_subtype_pop);
// decode heap oop here for movq // restore heap oop here for movq
decode_heap_oop(rax); popq(rax);
} else { } else {
repne_scanq(); repne_scanq();
jcc(Assembler::notEqual, not_subtype); jcc(Assembler::notEqual, not_subtype);
...@@ -287,9 +288,10 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, ...@@ -287,9 +288,10 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
Klass::secondary_super_cache_offset_in_bytes()), rax); Klass::secondary_super_cache_offset_in_bytes()), rax);
jmp(ok_is_subtype); jmp(ok_is_subtype);
bind(not_subtype_pop);
// restore heap oop here for miss
if (UseCompressedOops) popq(rax);
bind(not_subtype); bind(not_subtype);
// decode heap oop here for miss
if (UseCompressedOops) decode_heap_oop(rax);
profile_typecheck_failed(rcx); // blows rcx profile_typecheck_failed(rcx); // blows rcx
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册