# HG changeset patch # User morris # Date 1382123732 25200 # Node ID 252d541466eaf0d7ea125ba5f24d755e20f02d42 # Parent e3b736cf4fa3ddd8f0aefc6c350cb9946ca652e7 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 diff -r e3b736cf4fa3 -r 252d541466ea src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Oct 18 09:36:35 2013 +0000 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Oct 18 12:15:32 2013 -0700 @@ -2565,7 +2565,7 @@ Address receiver_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) - mdo_offset_bias); __ ld_ptr(receiver_addr, tmp1); - __ verify_oop(tmp1); + __ verify_klass_ptr(tmp1); __ 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)) - mdo_offset_bias); diff -r e3b736cf4fa3 -r 252d541466ea src/cpu/sparc/vm/c1_Runtime1_sparc.cpp --- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Oct 18 09:36:35 2013 +0000 +++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Oct 18 12:15:32 2013 -0700 @@ -404,7 +404,9 @@ if (id == fast_new_instance_init_check_id) { // make sure the klass is initialized __ 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 // assert object can be fast path allocated @@ -515,7 +517,9 @@ // check that array length is small enough for fast path __ 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 // refilling the TLAB or allocating directly from eden. diff -r e3b736cf4fa3 -r 252d541466ea src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Oct 18 09:36:35 2013 +0000 +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Oct 18 12:15:32 2013 -0700 @@ -3333,7 +3333,8 @@ if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { // 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); @@ -3358,7 +3359,8 @@ add(t2, 1, t2); stw(t2, G2_thread, in_bytes(JavaThread::tlab_slow_allocations_offset())); } - ba_short(try_eden); + ba(try_eden); + delayed()->nop(); bind(discard_tlab); if (TLABStats) { @@ -3420,7 +3422,8 @@ sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); verify_tlab(); - ba_short(retry); + ba(retry); + delayed()->nop(); } void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes, diff -r e3b736cf4fa3 -r 252d541466ea src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Oct 18 09:36:35 2013 +0000 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Oct 18 12:15:32 2013 -0700 @@ -1206,6 +1206,10 @@ LIR_Address* addr = src->as_address_ptr(); Address from_addr = as_Address(addr); + if (addr->base()->type() == T_OBJECT) { + __ verify_oop(addr->base()->as_pointer_register()); + } + switch (type) { case T_BOOLEAN: // fall through case T_BYTE: // fall through diff -r e3b736cf4fa3 -r 252d541466ea src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp Fri Oct 18 09:36:35 2013 +0000 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Fri Oct 18 12:15:32 2013 -0700 @@ -1265,6 +1265,7 @@ LIRItem rcvr(x->argument_at(0), this); rcvr.load_item(); + LIR_Opr temp = new_register(T_METADATA); LIR_Opr result = rlock_result(x); // need to perform the null check on the rcvr @@ -1272,8 +1273,11 @@ if (x->needs_null_check()) { 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); }