Skip to content

Commit 76e1329

Browse files
feilongjiangRealFYang
authored andcommitted
8357968: RISC-V: Interpreter volatile reference stores with G1 are not sequentially consistent
Reviewed-by: rehn, fyang Backport-of: c5a1543ee3e68775f09ca29fb07efd9aebfdb33e
1 parent fb0a796 commit 76e1329

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/hotspot/cpu/riscv/templateTable_riscv.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ void TemplateTable::aastore() {
11291129
// Get the value we will store
11301130
__ ld(x10, at_tos());
11311131
// Now store using the appropriate barrier
1132+
// Clobbers: x11, x13, x29
11321133
do_oop_store(_masm, element_address, x10, IS_ARRAY);
11331134
__ j(done);
11341135

@@ -1137,6 +1138,7 @@ void TemplateTable::aastore() {
11371138
__ profile_null_seen(x12);
11381139

11391140
// Store a NULL
1141+
// Clobbers: x11, x13, x29
11401142
do_oop_store(_masm, element_address, noreg, IS_ARRAY);
11411143

11421144
// Pop stack arguments
@@ -2716,6 +2718,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
27162718
__ add(off, obj, off); // if static, obj from cache, else obj from stack.
27172719
const Address field(off, 0);
27182720
// Store into the field
2721+
// Clobbers: x11, x13, x29
27192722
do_oop_store(_masm, field, x10, IN_HEAP);
27202723
if (rc == may_rewrite) {
27212724
patch_bytecode(Bytecodes::_fast_aputfield, bc, x11, true, byte_no);
@@ -2950,16 +2953,16 @@ void TemplateTable::fast_storefield(TosState state)
29502953
// Must prevent reordering of the following cp cache loads with bytecode load
29512954
__ membar(MacroAssembler::LoadLoad);
29522955

2953-
// test for volatile with x13
2954-
__ lwu(x13, Address(x12, in_bytes(base +
2956+
// test for volatile with x15
2957+
__ lwu(x15, Address(x12, in_bytes(base +
29552958
ConstantPoolCacheEntry::flags_offset())));
29562959

29572960
// replace index with field offset from cache entry
29582961
__ ld(x11, Address(x12, in_bytes(base + ConstantPoolCacheEntry::f2_offset())));
29592962

29602963
{
29612964
Label notVolatile;
2962-
__ test_bit(t0, x13, ConstantPoolCacheEntry::is_volatile_shift);
2965+
__ test_bit(t0, x15, ConstantPoolCacheEntry::is_volatile_shift);
29632966
__ beqz(t0, notVolatile);
29642967
__ membar(MacroAssembler::StoreStore | MacroAssembler::LoadStore);
29652968
__ bind(notVolatile);
@@ -2975,6 +2978,7 @@ void TemplateTable::fast_storefield(TosState state)
29752978
// access field
29762979
switch (bytecode()) {
29772980
case Bytecodes::_fast_aputfield:
2981+
// Clobbers: x11, x13, x29
29782982
do_oop_store(_masm, field, x10, IN_HEAP);
29792983
break;
29802984
case Bytecodes::_fast_lputfield:
@@ -3007,7 +3011,7 @@ void TemplateTable::fast_storefield(TosState state)
30073011

30083012
{
30093013
Label notVolatile;
3010-
__ test_bit(t0, x13, ConstantPoolCacheEntry::is_volatile_shift);
3014+
__ test_bit(t0, x15, ConstantPoolCacheEntry::is_volatile_shift);
30113015
__ beqz(t0, notVolatile);
30123016
__ membar(MacroAssembler::StoreLoad | MacroAssembler::StoreStore);
30133017
__ bind(notVolatile);

0 commit comments

Comments
 (0)