Skip to content

Commit c5a1543

Browse files
committed
8357968: RISC-V: Interpreter volatile reference stores with G1 are not sequentially consistent
Reviewed-by: eosterlund, fbredberg, shade, fyang
1 parent 90d6ad0 commit c5a1543

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
@@ -125,24 +125,6 @@ static inline Address at_tos_p5() {
125125
return Address(esp, Interpreter::expr_offset_in_bytes(5));
126126
}
127127

128-
// Miscellaneous helper routines
129-
// Store an oop (or null) at the Address described by obj.
130-
// If val == noreg this means store a null
131-
static void do_oop_store(InterpreterMacroAssembler* _masm,
132-
Address dst,
133-
Register val,
134-
DecoratorSet decorators) {
135-
assert(val == noreg || val == x10, "parameter is just for looks");
136-
__ store_heap_oop(dst, val, x28, x29, x13, decorators);
137-
}
138-
139-
static void do_oop_load(InterpreterMacroAssembler* _masm,
140-
Address src,
141-
Register dst,
142-
DecoratorSet decorators) {
143-
__ load_heap_oop(dst, src, x28, x29, decorators);
144-
}
145-
146128
Address TemplateTable::at_bcp(int offset) {
147129
assert(_desc->uses_bcp(), "inconsistent uses_bcp information");
148130
return Address(xbcp, offset);
@@ -787,7 +769,7 @@ void TemplateTable::aaload() {
787769
index_check(x10, x11); // leaves index in x11
788770
__ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
789771
__ shadd(x10, x11, x10, t0, LogBytesPerHeapOop);
790-
do_oop_load(_masm, Address(x10), x10, IS_ARRAY);
772+
__ load_heap_oop(x10, Address(x10), x28, x29, IS_ARRAY);
791773
}
792774

793775
void TemplateTable::baload() {
@@ -1099,15 +1081,15 @@ void TemplateTable::aastore() {
10991081
// Get the value we will store
11001082
__ ld(x10, at_tos());
11011083
// Now store using the appropriate barrier
1102-
do_oop_store(_masm, element_address, x10, IS_ARRAY);
1084+
__ store_heap_oop(element_address, x10, x28, x29, x13, IS_ARRAY);
11031085
__ j(done);
11041086

11051087
// Have a null in x10, x13=array, x12=index. Store null at ary[idx]
11061088
__ bind(is_null);
11071089
__ profile_null_seen(x12);
11081090

11091091
// Store a null
1110-
do_oop_store(_masm, element_address, noreg, IS_ARRAY);
1092+
__ store_heap_oop(element_address, noreg, x28, x29, x13, IS_ARRAY);
11111093

11121094
// Pop stack arguments
11131095
__ bind(done);
@@ -2565,7 +2547,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
25652547
__ subi(t0, tos_state, (u1)atos);
25662548
__ bnez(t0, notObj);
25672549
// atos
2568-
do_oop_load(_masm, field, x10, IN_HEAP);
2550+
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
25692551
__ push(atos);
25702552
if (rc == may_rewrite) {
25712553
patch_bytecode(Bytecodes::_fast_agetfield, bc, x11);
@@ -2809,7 +2791,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
28092791
__ add(off, obj, off); // if static, obj from cache, else obj from stack.
28102792
const Address field(off, 0);
28112793
// Store into the field
2812-
do_oop_store(_masm, field, x10, IN_HEAP);
2794+
__ store_heap_oop(field, x10, x28, x29, x13, IN_HEAP);
28132795
if (rc == may_rewrite) {
28142796
patch_bytecode(Bytecodes::_fast_aputfield, bc, x11, true, byte_no);
28152797
}
@@ -3051,10 +3033,10 @@ void TemplateTable::fast_storefield(TosState state) {
30513033
__ add(x11, x12, x11);
30523034
const Address field(x11, 0);
30533035

3054-
// access field
3036+
// access field, must not clobber x13 - flags
30553037
switch (bytecode()) {
30563038
case Bytecodes::_fast_aputfield:
3057-
do_oop_store(_masm, field, x10, IN_HEAP);
3039+
__ store_heap_oop(field, x10, x28, x29, x15, IN_HEAP);
30583040
break;
30593041
case Bytecodes::_fast_lputfield:
30603042
__ access_store_at(T_LONG, IN_HEAP, field, x10, noreg, noreg, noreg);
@@ -3133,7 +3115,7 @@ void TemplateTable::fast_accessfield(TosState state) {
31333115
// access field
31343116
switch (bytecode()) {
31353117
case Bytecodes::_fast_agetfield:
3136-
do_oop_load(_masm, field, x10, IN_HEAP);
3118+
__ load_heap_oop(x10, field, x28, x29, IN_HEAP);
31373119
__ verify_oop(x10);
31383120
break;
31393121
case Bytecodes::_fast_lgetfield:
@@ -3191,7 +3173,7 @@ void TemplateTable::fast_xaccess(TosState state) {
31913173
break;
31923174
case atos:
31933175
__ add(x10, x10, x11);
3194-
do_oop_load(_masm, Address(x10, 0), x10, IN_HEAP);
3176+
__ load_heap_oop(x10, Address(x10, 0), x28, x29, IN_HEAP);
31953177
__ verify_oop(x10);
31963178
break;
31973179
case ftos:

0 commit comments

Comments
 (0)