提交 215e5b2c 编写于 作者: M morris

8008242: VerifyOops is broken on SPARC

Summary: Fixed displacement issues in SPARC macroassembler and ensure that getClass intrinsic temporary result is T_METADATA
Reviewed-by: kvn, twisti
上级 fea20961
...@@ -2565,7 +2565,7 @@ void LIR_Assembler::type_profile_helper(Register mdo, int mdo_offset_bias, ...@@ -2565,7 +2565,7 @@ void LIR_Assembler::type_profile_helper(Register mdo, int mdo_offset_bias,
Address receiver_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) - Address receiver_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) -
mdo_offset_bias); mdo_offset_bias);
__ ld_ptr(receiver_addr, tmp1); __ ld_ptr(receiver_addr, tmp1);
__ verify_oop(tmp1); __ verify_klass_ptr(tmp1);
__ cmp_and_brx_short(recv, tmp1, Assembler::notEqual, Assembler::pt, next_test); __ cmp_and_brx_short(recv, tmp1, Assembler::notEqual, Assembler::pt, next_test);
Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) - Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) -
mdo_offset_bias); mdo_offset_bias);
......
...@@ -404,7 +404,9 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { ...@@ -404,7 +404,9 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
if (id == fast_new_instance_init_check_id) { if (id == fast_new_instance_init_check_id) {
// make sure the klass is initialized // make sure the klass is initialized
__ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1); __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1);
__ cmp_and_br_short(G3_t1, InstanceKlass::fully_initialized, Assembler::notEqual, Assembler::pn, slow_path); __ cmp(G3_t1, InstanceKlass::fully_initialized);
__ br(Assembler::notEqual, false, Assembler::pn, slow_path);
__ delayed()->nop();
} }
#ifdef ASSERT #ifdef ASSERT
// assert object can be fast path allocated // assert object can be fast path allocated
...@@ -515,7 +517,9 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { ...@@ -515,7 +517,9 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
// check that array length is small enough for fast path // check that array length is small enough for fast path
__ set(C1_MacroAssembler::max_array_allocation_length, G3_t1); __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1);
__ cmp_and_br_short(G4_length, G3_t1, Assembler::greaterUnsigned, Assembler::pn, slow_path); __ cmp(G4_length, G3_t1);
__ br(Assembler::greaterUnsigned, false, Assembler::pn, slow_path);
__ delayed()->nop();
// if we got here then the TLAB allocation failed, so try // if we got here then the TLAB allocation failed, so try
// refilling the TLAB or allocating directly from eden. // refilling the TLAB or allocating directly from eden.
......
...@@ -3333,7 +3333,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case ...@@ -3333,7 +3333,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
// No allocation in the shared eden. // No allocation in the shared eden.
ba_short(slow_case); ba(slow_case);
delayed()->nop();
} }
ld_ptr(G2_thread, in_bytes(JavaThread::tlab_top_offset()), top); ld_ptr(G2_thread, in_bytes(JavaThread::tlab_top_offset()), top);
...@@ -3358,7 +3359,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case ...@@ -3358,7 +3359,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
add(t2, 1, t2); add(t2, 1, t2);
stw(t2, G2_thread, in_bytes(JavaThread::tlab_slow_allocations_offset())); stw(t2, G2_thread, in_bytes(JavaThread::tlab_slow_allocations_offset()));
} }
ba_short(try_eden); ba(try_eden);
delayed()->nop();
bind(discard_tlab); bind(discard_tlab);
if (TLABStats) { if (TLABStats) {
...@@ -3420,7 +3422,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case ...@@ -3420,7 +3422,8 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top);
st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset()));
verify_tlab(); verify_tlab();
ba_short(retry); ba(retry);
delayed()->nop();
} }
void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes, void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes,
......
...@@ -1206,6 +1206,10 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch ...@@ -1206,6 +1206,10 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
LIR_Address* addr = src->as_address_ptr(); LIR_Address* addr = src->as_address_ptr();
Address from_addr = as_Address(addr); Address from_addr = as_Address(addr);
if (addr->base()->type() == T_OBJECT) {
__ verify_oop(addr->base()->as_pointer_register());
}
switch (type) { switch (type) {
case T_BOOLEAN: // fall through case T_BOOLEAN: // fall through
case T_BYTE: // fall through case T_BYTE: // fall through
......
...@@ -1265,6 +1265,7 @@ void LIRGenerator::do_getClass(Intrinsic* x) { ...@@ -1265,6 +1265,7 @@ void LIRGenerator::do_getClass(Intrinsic* x) {
LIRItem rcvr(x->argument_at(0), this); LIRItem rcvr(x->argument_at(0), this);
rcvr.load_item(); rcvr.load_item();
LIR_Opr temp = new_register(T_METADATA);
LIR_Opr result = rlock_result(x); LIR_Opr result = rlock_result(x);
// need to perform the null check on the rcvr // need to perform the null check on the rcvr
...@@ -1272,8 +1273,11 @@ void LIRGenerator::do_getClass(Intrinsic* x) { ...@@ -1272,8 +1273,11 @@ void LIRGenerator::do_getClass(Intrinsic* x) {
if (x->needs_null_check()) { if (x->needs_null_check()) {
info = state_for(x); info = state_for(x);
} }
__ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), result, info);
__ move_wide(new LIR_Address(result, in_bytes(Klass::java_mirror_offset()), T_OBJECT), result); // FIXME T_ADDRESS should actually be T_METADATA but it can't because the
// meaning of these two is mixed up (see JDK-8026837).
__ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), temp, info);
__ move_wide(new LIR_Address(temp, in_bytes(Klass::java_mirror_offset()), T_OBJECT), result);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册