8357968: RISC-V: Interpreter volatile reference stores with G1 are not sequentially consistent

Reviewed-by: eosterlund, fbredberg, shade, fyang
This commit is contained in:
Robbin Ehn 2025-06-02 05:43:20 +00:00
parent 90d6ad0157
commit c5a1543ee3

View File

@ -125,24 +125,6 @@ static inline Address at_tos_p5() {
return Address(esp, Interpreter::expr_offset_in_bytes(5));
}
// Miscellaneous helper routines
// Store an oop (or null) at the Address described by obj.
// If val == noreg this means store a null
static void do_oop_store(InterpreterMacroAssembler* _masm,
Address dst,
Register val,
DecoratorSet decorators) {
assert(val == noreg || val == x10, "parameter is just for looks");
__ store_heap_oop(dst, val, x28, x29, x13, decorators);
}
static void do_oop_load(InterpreterMacroAssembler* _masm,
Address src,
Register dst,
DecoratorSet decorators) {
__ load_heap_oop(dst, src, x28, x29, decorators);
}
Address TemplateTable::at_bcp(int offset) {
assert(_desc->uses_bcp(), "inconsistent uses_bcp information");
return Address(xbcp, offset);
@ -787,7 +769,7 @@ void TemplateTable::aaload() {
index_check(x10, x11); // leaves index in x11
__ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
__ shadd(x10, x11, x10, t0, LogBytesPerHeapOop);
do_oop_load(_masm, Address(x10), x10, IS_ARRAY);
__ load_heap_oop(x10, Address(x10), x28, x29, IS_ARRAY);
}
void TemplateTable::baload() {
@ -1099,7 +1081,7 @@ void TemplateTable::aastore() {
// Get the value we will store
__ ld(x10, at_tos());
// Now store using the appropriate barrier
do_oop_store(_masm, element_address, x10, IS_ARRAY);
__ store_heap_oop(element_address, x10, x28, x29, x13, IS_ARRAY);
__ j(done);
// Have a null in x10, x13=array, x12=index. Store null at ary[idx]
@ -1107,7 +1089,7 @@ void TemplateTable::aastore() {
__ profile_null_seen(x12);
// Store a null
do_oop_store(_masm, element_address, noreg, IS_ARRAY);
__ store_heap_oop(element_address, noreg, x28, x29, x13, IS_ARRAY);
// Pop stack arguments
__ bind(done);
@ -2565,7 +2547,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ subi(t0, tos_state, (u1)atos);
__ bnez(t0, notObj);
// atos
do_oop_load(_masm, field, x10, IN_HEAP);
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
__ push(atos);
if (rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_agetfield, bc, x11);
@ -2809,7 +2791,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ add(off, obj, off); // if static, obj from cache, else obj from stack.
const Address field(off, 0);
// Store into the field
do_oop_store(_masm, field, x10, IN_HEAP);
__ store_heap_oop(field, x10, x28, x29, x13, IN_HEAP);
if (rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_aputfield, bc, x11, true, byte_no);
}
@ -3051,10 +3033,10 @@ void TemplateTable::fast_storefield(TosState state) {
__ add(x11, x12, x11);
const Address field(x11, 0);
// access field
// access field, must not clobber x13 - flags
switch (bytecode()) {
case Bytecodes::_fast_aputfield:
do_oop_store(_masm, field, x10, IN_HEAP);
__ store_heap_oop(field, x10, x28, x29, x15, IN_HEAP);
break;
case Bytecodes::_fast_lputfield:
__ access_store_at(T_LONG, IN_HEAP, field, x10, noreg, noreg, noreg);
@ -3133,7 +3115,7 @@ void TemplateTable::fast_accessfield(TosState state) {
// access field
switch (bytecode()) {
case Bytecodes::_fast_agetfield:
do_oop_load(_masm, field, x10, IN_HEAP);
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
__ verify_oop(x10);
break;
case Bytecodes::_fast_lgetfield:
@ -3191,7 +3173,7 @@ void TemplateTable::fast_xaccess(TosState state) {
break;
case atos:
__ add(x10, x10, x11);
do_oop_load(_masm, Address(x10, 0), x10, IN_HEAP);
__ load_heap_oop(x10, Address(x10, 0), x28, x29, IN_HEAP);
__ verify_oop(x10);
break;
case ftos: