8210465: ARM: Object equals abstraction for BarrierSetAssembler
Reviewed-by: rkennke, dsamersoff
--- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp Mon Sep 24 16:39:02 2018 +0300
@@ -2359,8 +2359,11 @@
ShouldNotReachHere();
}
} else if (opr2->is_single_cpu()) {
- if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY || opr1->type() == T_METADATA || opr1->type() == T_ADDRESS) {
- assert(opr2->type() == T_OBJECT || opr2->type() == T_ARRAY || opr2->type() == T_METADATA || opr2->type() == T_ADDRESS, "incompatibe type");
+ if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
+ 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());
} else {
assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY && opr2->type() != T_METADATA && opr2->type() != T_ADDRESS, "incompatibe type");
--- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp Mon Sep 24 16:39:02 2018 +0300
@@ -162,3 +162,7 @@
}
}
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+ Register obj1, Register obj2) {
+ __ cmp(obj1, obj2);
+}
--- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp Mon Sep 24 16:39:02 2018 +0300
@@ -41,6 +41,9 @@
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 barrier_stubs_init() {}
};
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp Mon Sep 24 16:39:02 2018 +0300
@@ -1037,6 +1037,11 @@
#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,
Register rn_lo, Register rn_hi,
AsmCondition cond) {
@@ -2269,6 +2274,11 @@
Register chr1, Register chr2, Label& Ldone) {
Label Lvector, Lloop;
+ // if (ary1 == ary2)
+ // return true;
+ cmpoop(ary1, ary2);
+ b(Ldone, eq);
+
// Note: limit contains number of bytes (2*char_elements) != 0.
tst(limit, 0x2); // trailing character ?
b(Lvector, eq);
--- a/src/hotspot/cpu/arm/macroAssembler_arm.hpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.hpp Mon Sep 24 16:39:02 2018 +0300
@@ -1246,6 +1246,8 @@
}
#ifndef AARCH64
+ void cmpoop(Register obj1, Register obj2);
+
void long_move(Register rd_lo, Register rd_hi,
Register rn_lo, Register rn_hi,
AsmCondition cond = al);
--- a/src/hotspot/cpu/arm/methodHandles_arm.cpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp Mon Sep 24 16:39:02 2018 +0300
@@ -173,7 +173,7 @@
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
Label L;
__ ldr(tmp, __ receiver_argument_address(Rparams, tmp, tmp));
- __ cmp(tmp, recv);
+ __ cmpoop(tmp, recv);
__ b(L, eq);
__ stop("receiver not on stack");
__ bind(L);
--- a/src/hotspot/cpu/arm/templateTable_arm.cpp Mon Sep 24 00:13:02 2018 -0700
+++ b/src/hotspot/cpu/arm/templateTable_arm.cpp Mon Sep 24 16:39:02 2018 +0300
@@ -2559,7 +2559,7 @@
// assume branch is more often taken than not (loops use backward branches)
Label not_taken;
__ pop_ptr(R1_tmp);
- __ cmp(R1_tmp, R0_tos);
+ __ cmpoop(R1_tmp, R0_tos);
__ b(not_taken, convNegCond(cc));
branch(false, false);
__ bind(not_taken);