Skip to content

Commit f2614cc

Browse files
feilongjiangRealFYang
authored andcommitted
8357968: RISC-V: Interpreter volatile reference stores with G1 are not sequentially consistent
Backport-of: c5a1543ee3e68775f09ca29fb07efd9aebfdb33e
1 parent 8e68eb1 commit f2614cc

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

src/hotspot/cpu/riscv/templateTable_riscv.cpp

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,6 @@ static inline Address at_tos_p5() {
123123
return Address(esp, Interpreter::expr_offset_in_bytes(5));
124124
}
125125

126-
// Miscellaneous helper routines
127-
// Store an oop (or null) at the Address described by obj.
128-
// If val == noreg this means store a null
129-
static void do_oop_store(InterpreterMacroAssembler* _masm,
130-
Address dst,
131-
Register val,
132-
DecoratorSet decorators) {
133-
assert(val == noreg || val == x10, "parameter is just for looks");
134-
__ store_heap_oop(dst, val, x28, x29, x13, decorators);
135-
}
136-
137-
static void do_oop_load(InterpreterMacroAssembler* _masm,
138-
Address src,
139-
Register dst,
140-
DecoratorSet decorators) {
141-
__ load_heap_oop(dst, src, x28, x29, decorators);
142-
}
143-
144126
Address TemplateTable::at_bcp(int offset) {
145127
assert(_desc->uses_bcp(), "inconsistent uses_bcp information");
146128
return Address(xbcp, offset);
@@ -770,7 +752,7 @@ void TemplateTable::aaload() {
770752
index_check(x10, x11); // leaves index in x11
771753
__ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
772754
__ shadd(x10, x11, x10, t0, LogBytesPerHeapOop);
773-
do_oop_load(_masm, Address(x10), x10, IS_ARRAY);
755+
__ load_heap_oop(x10, Address(x10), x28, x29, IS_ARRAY);
774756
}
775757

776758
void TemplateTable::baload() {
@@ -1082,15 +1064,15 @@ void TemplateTable::aastore() {
10821064
// Get the value we will store
10831065
__ ld(x10, at_tos());
10841066
// Now store using the appropriate barrier
1085-
do_oop_store(_masm, element_address, x10, IS_ARRAY);
1067+
__ store_heap_oop(element_address, x10, x28, x29, x13, IS_ARRAY);
10861068
__ j(done);
10871069

10881070
// Have a null in x10, x13=array, x12=index. Store null at ary[idx]
10891071
__ bind(is_null);
10901072
__ profile_null_seen(x12);
10911073

10921074
// Store a null
1093-
do_oop_store(_masm, element_address, noreg, IS_ARRAY);
1075+
__ store_heap_oop(element_address, noreg, x28, x29, x13, IS_ARRAY);
10941076

10951077
// Pop stack arguments
10961078
__ bind(done);
@@ -2429,7 +2411,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
24292411
__ sub(t0, flags, (u1)atos);
24302412
__ bnez(t0, notObj);
24312413
// atos
2432-
do_oop_load(_masm, field, x10, IN_HEAP);
2414+
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
24332415
__ push(atos);
24342416
if (rc == may_rewrite) {
24352417
patch_bytecode(Bytecodes::_fast_agetfield, bc, x11);
@@ -2689,7 +2671,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
26892671
__ add(off, obj, off); // if static, obj from cache, else obj from stack.
26902672
const Address field(off, 0);
26912673
// Store into the field
2692-
do_oop_store(_masm, field, x10, IN_HEAP);
2674+
__ store_heap_oop(field, x10, x28, x29, x13, IN_HEAP);
26932675
if (rc == may_rewrite) {
26942676
patch_bytecode(Bytecodes::_fast_aputfield, bc, x11, true, byte_no);
26952677
}
@@ -2942,10 +2924,10 @@ void TemplateTable::fast_storefield(TosState state) {
29422924
__ add(x11, x12, x11);
29432925
const Address field(x11, 0);
29442926

2945-
// access field
2927+
// access field, must not clobber x13 - flags
29462928
switch (bytecode()) {
29472929
case Bytecodes::_fast_aputfield:
2948-
do_oop_store(_masm, field, x10, IN_HEAP);
2930+
__ store_heap_oop(field, x10, x28, x29, x15, IN_HEAP);
29492931
break;
29502932
case Bytecodes::_fast_lputfield:
29512933
__ access_store_at(T_LONG, IN_HEAP, field, x10, noreg, noreg, noreg);
@@ -3033,7 +3015,7 @@ void TemplateTable::fast_accessfield(TosState state) {
30333015
// access field
30343016
switch (bytecode()) {
30353017
case Bytecodes::_fast_agetfield:
3036-
do_oop_load(_masm, field, x10, IN_HEAP);
3018+
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
30373019
__ verify_oop(x10);
30383020
break;
30393021
case Bytecodes::_fast_lgetfield:
@@ -3092,7 +3074,7 @@ void TemplateTable::fast_xaccess(TosState state) {
30923074
break;
30933075
case atos:
30943076
__ add(x10, x10, x11);
3095-
do_oop_load(_masm, Address(x10, 0), x10, IN_HEAP);
3077+
__ load_heap_oop(x10, Address(x10, 0), x28, x29, IN_HEAP);
30963078
__ verify_oop(x10);
30973079
break;
30983080
case ftos:

0 commit comments

Comments
 (0)