8231955: ARM32: Address displacement is 0 for volatile field access because of Unsafe field access.
Reviewed-by: dlong
Contributed-by: christoph.goettschkes@microdoc.com
--- a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp Wed Nov 06 19:27:15 2019 +0300
+++ b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp Wed Nov 06 19:37:52 2019 +0300
@@ -1310,9 +1310,16 @@
CodeEmitInfo* info) {
if (value->is_double_cpu()) {
assert(address->index()->is_illegal(), "should have a constant displacement");
- LIR_Opr tmp = new_pointer_register();
- add_large_constant(address->base(), address->disp(), tmp);
- __ volatile_store_mem_reg(value, new LIR_Address(tmp, (intx)0, address->type()), info);
+ LIR_Address* store_addr = NULL;
+ if (address->disp() != 0) {
+ LIR_Opr tmp = new_pointer_register();
+ add_large_constant(address->base(), address->disp(), tmp);
+ store_addr = new LIR_Address(tmp, (intx)0, address->type());
+ } else {
+ // address->disp() can be 0, if the address is referenced using the unsafe intrinsic
+ store_addr = address;
+ }
+ __ volatile_store_mem_reg(value, store_addr, info);
return;
}
__ store(value, address, info, lir_patch_none);
@@ -1322,9 +1329,16 @@
CodeEmitInfo* info) {
if (result->is_double_cpu()) {
assert(address->index()->is_illegal(), "should have a constant displacement");
- LIR_Opr tmp = new_pointer_register();
- add_large_constant(address->base(), address->disp(), tmp);
- __ volatile_load_mem_reg(new LIR_Address(tmp, (intx)0, address->type()), result, info);
+ LIR_Address* load_addr = NULL;
+ if (address->disp() != 0) {
+ LIR_Opr tmp = new_pointer_register();
+ add_large_constant(address->base(), address->disp(), tmp);
+ load_addr = new LIR_Address(tmp, (intx)0, address->type());
+ } else {
+ // address->disp() can be 0, if the address is referenced using the unsafe intrinsic
+ load_addr = address;
+ }
+ __ volatile_load_mem_reg(load_addr, result, info);
return;
}
__ load(address, result, info, lir_patch_none);