Skip to content
Permalink
Browse files
8266491: Remove resolve and obj_equals leftovers from BarrierSetAssem…
…bler

Reviewed-by: tschatzl
  • Loading branch information
rkennke committed May 5, 2021
1 parent a8046c9 commit 65ce4d20565b7152bc6c5ea18813ec62e638f7c6
Showing with 7 additions and 168 deletions.
  1. +0 −4 src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp
  2. +0 −5 src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
  3. +0 −7 src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp
  4. +1 −11 src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
  5. +0 −4 src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp
  6. +0 −4 src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
  7. +0 −5 src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
  8. +0 −4 src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
  9. +0 −4 src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp
  10. +0 −5 src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp
  11. +0 −7 src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp
  12. +1 −11 src/hotspot/cpu/arm/macroAssembler_arm.cpp
  13. +0 −5 src/hotspot/cpu/arm/macroAssembler_arm.hpp
  14. +0 −4 src/hotspot/cpu/arm/sharedRuntime_arm.cpp
  15. +0 −1 src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp
  16. +0 −4 src/hotspot/cpu/arm/templateTable_arm.cpp
  17. +0 −4 src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp
  18. +0 −21 src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
  19. +0 −16 src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp
  20. +5 −27 src/hotspot/cpu/x86/macroAssembler_x86.cpp
  21. +0 −6 src/hotspot/cpu/x86/macroAssembler_x86.hpp
  22. +0 −2 src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
  23. +0 −1 src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
  24. +0 −2 src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp
  25. +0 −4 src/hotspot/cpu/x86/templateTable_x86.cpp
@@ -2247,9 +2247,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
Register length = op->length()->as_register();
Register tmp = op->tmp()->as_register();

__ resolve(ACCESS_READ, src);
__ resolve(ACCESS_WRITE, dst);

CodeStub* stub = op->stub();
int flags = op->flags();
BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
@@ -2592,7 +2589,6 @@ void LIR_Assembler::emit_lock(LIR_OpLock* op) {
scratch = op->scratch_opr()->as_register();
}
assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
__ resolve(ACCESS_READ | ACCESS_WRITE, obj);
// add debug info for NullPointerException only if one is possible
int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
if (op->info() != NULL) {
@@ -119,11 +119,6 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
}
}

void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, Register obj2) {
__ cmp(obj1, obj2);
}

void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
Register obj, Register tmp, Label& slowpath) {
// If mask changes we need to ensure that the inverse is still encodable as an immediate
@@ -47,13 +47,6 @@ class BarrierSetAssembler: public CHeapObj<mtGC> {
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address dst, Register val, Register tmp1, Register tmp2);

virtual void obj_equals(MacroAssembler* masm,
Register obj1, Register obj2);

virtual void resolve(MacroAssembler* masm, DecoratorSet decorators, Register obj) {
// Default implementation does not need to do anything.
}

virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
Register obj, Register tmp, Label& slowpath);

@@ -3757,8 +3757,7 @@ void MacroAssembler::cmpptr(Register src1, Address src2) {
}

void MacroAssembler::cmpoop(Register obj1, Register obj2) {
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->obj_equals(this, obj1, obj2);
cmp(obj1, obj2);
}

void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
@@ -4160,15 +4159,6 @@ void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators,
}
}

void MacroAssembler::resolve(DecoratorSet decorators, Register obj) {
// Use stronger ACCESS_WRITE|ACCESS_READ by default.
if ((decorators & (ACCESS_READ | ACCESS_WRITE)) == 0) {
decorators |= ACCESS_READ | ACCESS_WRITE;
}
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
return bs->resolve(this, decorators, obj);
}

void MacroAssembler::load_heap_oop(Register dst, Address src, Register tmp1,
Register thread_tmp, DecoratorSet decorators) {
access_load_at(T_OBJECT, IN_HEAP | decorators, dst, src, tmp1, thread_tmp);
@@ -834,10 +834,6 @@ class MacroAssembler: public Assembler {
void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
Register tmp1, Register tmp_thread);

// Resolves obj for access. Result is placed in the same register.
// All other registers are preserved.
void resolve(DecoratorSet decorators, Register obj);

void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
Register thread_tmp = noreg, DecoratorSet decorators = 0);

@@ -1766,8 +1766,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// Load the oop from the handle
__ ldr(obj_reg, Address(oop_handle_reg, 0));

__ resolve(IS_NOT_NULL, obj_reg);

if (UseBiasedLocking) {
__ biased_locking_enter(lock_reg, obj_reg, swap_reg, tmp, false, lock_done, &slow_path_lock);
}
@@ -1918,8 +1916,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// Get locked oop from the handle we passed to jni
__ ldr(obj_reg, Address(oop_handle_reg, 0));

__ resolve(IS_NOT_NULL, obj_reg);

Label done;

if (UseBiasedLocking) {
@@ -775,7 +775,6 @@ void TemplateInterpreterGenerator::lock_method() {
#endif // ASSERT

__ bind(done);
__ resolve(IS_NOT_NULL, r0);
}

// add space for monitor & lock
@@ -1001,7 +1000,6 @@ address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractI
__ ldrw(crc, Address(esp, 4*wordSize)); // Initial CRC
} else {
__ ldr(buf, Address(esp, 2*wordSize)); // byte[] array
__ resolve(IS_NOT_NULL | ACCESS_READ, buf);
__ add(buf, buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
__ ldrw(off, Address(esp, wordSize)); // offset
__ add(buf, buf, off); // + offset
@@ -1046,9 +1044,6 @@ address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(Abstract
__ ldrw(off, Address(esp, wordSize)); // int offset
__ sub(len, end, off);
__ ldr(buf, Address(esp, 2*wordSize)); // byte[] buf | long buf
if (kind == Interpreter::java_util_zip_CRC32C_updateBytes) {
__ resolve(IS_NOT_NULL | ACCESS_READ, buf);
}
__ add(buf, buf, off); // + offset
if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
__ ldrw(crc, Address(esp, 4*wordSize)); // long crc
@@ -3784,8 +3784,6 @@ void TemplateTable::monitorenter()
// check for NULL object
__ null_check(r0);

__ resolve(IS_NOT_NULL, r0);

const Address monitor_block_top(
rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
const Address monitor_block_bot(
@@ -3885,8 +3883,6 @@ void TemplateTable::monitorexit()
// check for NULL object
__ null_check(r0);

__ resolve(IS_NOT_NULL, r0);

const Address monitor_block_top(
rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
const Address monitor_block_bot(
@@ -2101,9 +2101,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {

assert(src == R0 && src_pos == R1 && dst == R2 && dst_pos == R3, "code assumption");

__ resolve(ACCESS_READ, src);
__ resolve(ACCESS_WRITE, dst);

CodeStub* stub = op->stub();

int flags = op->flags();
@@ -2443,7 +2440,6 @@ void LIR_Assembler::emit_lock(LIR_OpLock* op) {
__ b(*op->stub()->entry());
} else if (op->code() == lir_lock) {
assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
__ resolve(ACCESS_READ | ACCESS_WRITE, obj);
int null_check_offset = __ lock_object(hdr, obj, lock, tmp, *op->stub()->entry());
if (op->info() != NULL) {
add_debug_info_for_null_check(null_check_offset, op->info());
@@ -142,11 +142,6 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
}
}

void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, Register obj2) {
__ cmp(obj1, obj2);
}

// Puts address of allocated object into register `obj` and end of allocated object into register `obj_end`.
void BarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register obj, Register obj_end, Register tmp1, Register tmp2,
RegisterOrConstant size_expression, Label& slow_case) {
@@ -47,9 +47,6 @@ class BarrierSetAssembler: public CHeapObj<mtGC> {
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null);

virtual void obj_equals(MacroAssembler* masm,
Register obj1, Register obj2);

virtual void eden_allocate(MacroAssembler* masm,
Register obj, // result: pointer to object after successful allocation
Register obj_end, // result: pointer to end of object after successful allocation
@@ -68,10 +65,6 @@ class BarrierSetAssembler: public CHeapObj<mtGC> {
);

virtual void barrier_stubs_init() {}

virtual void resolve(MacroAssembler* masm, DecoratorSet decorators, Register obj) {
// Default implementation does not need to do anything.
}
};

#endif // CPU_ARM_GC_SHARED_BARRIERSETASSEMBLER_ARM_HPP
@@ -735,8 +735,7 @@ void MacroAssembler::sign_extend(Register rd, Register rn, int bits) {


void MacroAssembler::cmpoop(Register obj1, Register obj2) {
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->obj_equals(this, obj1, obj2);
cmp(obj1, obj2);
}

void MacroAssembler::long_move(Register rd_lo, Register rd_hi,
@@ -1888,15 +1887,6 @@ void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators,
}
}

void MacroAssembler::resolve(DecoratorSet decorators, Register obj) {
// Use stronger ACCESS_WRITE|ACCESS_READ by default.
if ((decorators & (ACCESS_READ | ACCESS_WRITE)) == 0) {
decorators |= ACCESS_READ | ACCESS_WRITE;
}
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
return bs->resolve(this, decorators, obj);
}

void MacroAssembler::safepoint_poll(Register tmp1, Label& slow_path) {
ldr_u32(tmp1, Address(Rthread, JavaThread::polling_word_offset()));
tst(tmp1, exact_log2(SafepointMechanism::poll_bit()));
@@ -878,11 +878,6 @@ class MacroAssembler: public Assembler {
void access_load_at(BasicType type, DecoratorSet decorators, Address src, Register dst, Register tmp1, Register tmp2, Register tmp3);
void access_store_at(BasicType type, DecoratorSet decorators, Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null);

// Resolves obj for access. Result is placed in the same register.
// All other registers are preserved.
void resolve(DecoratorSet decorators, Register obj);


void ldr_global_ptr(Register reg, address address_of_global);
void ldr_global_s32(Register reg, address address_of_global);
void ldrb_global(Register reg, address address_of_global);
@@ -1152,8 +1152,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// Remember the handle for the unlocking code
__ mov(sync_handle, R1);

__ resolve(IS_NOT_NULL, sync_obj);

if(UseBiasedLocking) {
__ biased_locking_enter(sync_obj, tmp, disp_hdr/*scratched*/, false, Rtemp, lock_done, slow_lock_biased);
}
@@ -1238,8 +1236,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
if (method->is_synchronized()) {
__ ldr(sync_obj, Address(sync_handle));

__ resolve(IS_NOT_NULL, sync_obj);

if(UseBiasedLocking) {
__ biased_locking_exit(sync_obj, Rtemp, unlock_done);
// disp_hdr may not have been saved on entry with biased locking
@@ -483,7 +483,6 @@ void TemplateInterpreterGenerator::lock_method() {
__ b(done, eq);
__ load_mirror(R0, Rmethod, Rtemp);
__ bind(done);
__ resolve(IS_NOT_NULL, R0);
}

// add space for monitor & lock
@@ -4249,8 +4249,6 @@ void TemplateTable::monitorenter() {
// check for NULL object
__ null_check(Robj, Rtemp);

__ resolve(IS_NOT_NULL, Robj);

const int entry_size = (frame::interpreter_frame_monitor_size() * wordSize);
assert (entry_size % StackAlignmentInBytes == 0, "keep stack alignment");
Label allocate_monitor, allocated;
@@ -4362,8 +4360,6 @@ void TemplateTable::monitorexit() {
// check for NULL object
__ null_check(Robj, Rtemp);

__ resolve(IS_NOT_NULL, Robj);

const int entry_size = (frame::interpreter_frame_monitor_size() * wordSize);
Label found, throw_exception;

@@ -3094,9 +3094,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
Register tmp = op->tmp()->as_register();
Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);

__ resolve(ACCESS_READ, src);
__ resolve(ACCESS_WRITE, dst);

CodeStub* stub = op->stub();
int flags = op->flags();
BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
@@ -3534,7 +3531,6 @@ void LIR_Assembler::emit_lock(LIR_OpLock* op) {
scratch = op->scratch_opr()->as_register();
}
assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
__ resolve(ACCESS_READ | ACCESS_WRITE, obj);
// add debug info for NullPointerException only if one is possible
int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
if (op->info() != NULL) {
@@ -195,27 +195,6 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
}
}

#ifndef _LP64
void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Address obj1, jobject obj2) {
__ cmpoop_raw(obj1, obj2);
}

void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, jobject obj2) {
__ cmpoop_raw(obj1, obj2);
}
#endif
void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, Address obj2) {
__ cmpptr(obj1, obj2);
}

void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, Register obj2) {
__ cmpptr(obj1, obj2);
}

void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
Register obj, Register tmp, Label& slowpath) {
__ clear_jweak_tag(obj);
@@ -49,22 +49,6 @@ class BarrierSetAssembler: public CHeapObj<mtGC> {
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address dst, Register val, Register tmp1, Register tmp2);

#ifndef _LP64
virtual void obj_equals(MacroAssembler* masm,
Address obj1, jobject obj2);
virtual void obj_equals(MacroAssembler* masm,
Register obj1, jobject obj2);
#endif

virtual void obj_equals(MacroAssembler* masm,
Register obj1, Register obj2);
virtual void obj_equals(MacroAssembler* masm,
Register obj1, Address obj2);

virtual void resolve(MacroAssembler* masm, DecoratorSet decorators, Register obj) {
// Default implementation does not need to do anything.
}

// Support for jniFastGetField to try resolving a jobject/jweak in native
virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
Register obj, Register tmp, Label& slowpath);

0 comments on commit 65ce4d2

Please sign in to comment.