8210465: ARM: Object equals abstraction for BarrierSetAssembler

Reviewed-by: rkennke, dsamersoff
This commit is contained in:
Aleksei Voitylov 2018-09-24 16:39:02 +03:00
parent fa1ced20b5
commit 5fa8dfe0f8
7 changed files with 26 additions and 4 deletions

View File

@ -2359,8 +2359,11 @@ void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2,
ShouldNotReachHere(); ShouldNotReachHere();
} }
} else if (opr2->is_single_cpu()) { } else if (opr2->is_single_cpu()) {
if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY || opr1->type() == T_METADATA || opr1->type() == T_ADDRESS) { if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
assert(opr2->type() == T_OBJECT || opr2->type() == T_ARRAY || opr2->type() == T_METADATA || opr2->type() == T_ADDRESS, "incompatibe type"); assert(opr2->type() == T_OBJECT || opr2->type() == T_ARRAY, "incompatibe type");
__ cmpoop(opr1->as_register(), opr2->as_register());
} else if (opr1->type() == T_METADATA || opr1->type() == T_ADDRESS) {
assert(opr2->type() == T_METADATA || opr2->type() == T_ADDRESS, "incompatibe type");
__ cmp(opr1->as_register(), opr2->as_register()); __ cmp(opr1->as_register(), opr2->as_register());
} else { } else {
assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY && opr2->type() != T_METADATA && opr2->type() != T_ADDRESS, "incompatibe type"); assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY && opr2->type() != T_METADATA && opr2->type() != T_ADDRESS, "incompatibe type");

View File

@ -162,3 +162,7 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
} }
} }
void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
Register obj1, Register obj2) {
__ cmp(obj1, obj2);
}

View File

@ -41,6 +41,9 @@ public:
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null); 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 barrier_stubs_init() {} virtual void barrier_stubs_init() {}
}; };

View File

@ -1037,6 +1037,11 @@ void MacroAssembler::sign_extend(Register rd, Register rn, int bits) {
#ifndef AARCH64 #ifndef AARCH64
void MacroAssembler::cmpoop(Register obj1, Register obj2) {
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->obj_equals(this, obj1, obj2);
}
void MacroAssembler::long_move(Register rd_lo, Register rd_hi, void MacroAssembler::long_move(Register rd_lo, Register rd_hi,
Register rn_lo, Register rn_hi, Register rn_lo, Register rn_hi,
AsmCondition cond) { AsmCondition cond) {
@ -2269,6 +2274,11 @@ void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
Register chr1, Register chr2, Label& Ldone) { Register chr1, Register chr2, Label& Ldone) {
Label Lvector, Lloop; Label Lvector, Lloop;
// if (ary1 == ary2)
// return true;
cmpoop(ary1, ary2);
b(Ldone, eq);
// Note: limit contains number of bytes (2*char_elements) != 0. // Note: limit contains number of bytes (2*char_elements) != 0.
tst(limit, 0x2); // trailing character ? tst(limit, 0x2); // trailing character ?
b(Lvector, eq); b(Lvector, eq);

View File

@ -1246,6 +1246,8 @@ public:
} }
#ifndef AARCH64 #ifndef AARCH64
void cmpoop(Register obj1, Register obj2);
void long_move(Register rd_lo, Register rd_hi, void long_move(Register rd_lo, Register rd_hi,
Register rn_lo, Register rn_hi, Register rn_lo, Register rn_hi,
AsmCondition cond = al); AsmCondition cond = al);

View File

@ -173,7 +173,7 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
Label L; Label L;
__ ldr(tmp, __ receiver_argument_address(Rparams, tmp, tmp)); __ ldr(tmp, __ receiver_argument_address(Rparams, tmp, tmp));
__ cmp(tmp, recv); __ cmpoop(tmp, recv);
__ b(L, eq); __ b(L, eq);
__ stop("receiver not on stack"); __ stop("receiver not on stack");
__ bind(L); __ bind(L);

View File

@ -2559,7 +2559,7 @@ void TemplateTable::if_acmp(Condition cc) {
// assume branch is more often taken than not (loops use backward branches) // assume branch is more often taken than not (loops use backward branches)
Label not_taken; Label not_taken;
__ pop_ptr(R1_tmp); __ pop_ptr(R1_tmp);
__ cmp(R1_tmp, R0_tos); __ cmpoop(R1_tmp, R0_tos);
__ b(not_taken, convNegCond(cc)); __ b(not_taken, convNegCond(cc));
branch(false, false); branch(false, false);
__ bind(not_taken); __ bind(not_taken);