@@ -147,7 +147,9 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
147147 __ bind (L_fast_patch);
148148 }
149149
150- // Patch bytecode.
150+ // Patch bytecode with release store to coordinate with ConstantPoolCacheEntry
151+ // loads in fast bytecode codelets.
152+ __ release ();
151153 __ stb (Rnew_bc, 0 , R14_bcp);
152154
153155 __ bind (L_patch_done);
@@ -311,6 +313,7 @@ void TemplateTable::fast_aldc(LdcType type) {
311313 // We are resolved if the resolved reference cache entry contains a
312314 // non-null object (CallSite, etc.)
313315 __ get_cache_index_at_bcp (R31, 1 , index_size); // Load index.
316+ // Only rewritten during link time. So, no need for memory barriers for accessing resolved info.
314317 __ load_resolved_reference_at_index (R17_tos, R31, R11_scratch1, R12_scratch2, &is_null);
315318
316319 // Convert null sentinel to null
@@ -2377,7 +2380,7 @@ void TemplateTable::load_invoke_cp_cache_entry(int byte_no,
23772380 if (is_invokevfinal) {
23782381 assert (Ritable_index == noreg, " register not used" );
23792382 // Already resolved.
2380- __ get_cache_and_index_at_bcp (Rcache, 1 );
2383+ __ get_cache_and_index_at_bcp (Rcache, 1 , sizeof (u2), /* for_fast_bytecode */ true );
23812384 } else {
23822385 resolve_cache_and_index (byte_no, Rcache, /* temp */ Rmethod, sizeof (u2));
23832386 }
@@ -3084,7 +3087,7 @@ void TemplateTable::fast_storefield(TosState state) {
30843087 const ConditionRegister CR_is_vol = CCR2; // Non-volatile condition register (survives runtime call in do_oop_store).
30853088
30863089 // Constant pool already resolved => Load flags and offset of field.
3087- __ get_cache_and_index_at_bcp (Rcache, 1 );
3090+ __ get_cache_and_index_at_bcp (Rcache, 1 , sizeof (u2), /* for_fast_bytecode */ true );
30883091 jvmti_post_field_mod (Rcache, Rscratch, false /* not static */ );
30893092 load_field_cp_cache_entry (noreg, Rcache, noreg, Roffset, Rflags, false ); // Uses R11, R12
30903093
@@ -3165,7 +3168,7 @@ void TemplateTable::fast_accessfield(TosState state) {
31653168 // R12_scratch2 used by load_field_cp_cache_entry
31663169
31673170 // Constant pool already resolved. Get the field offset.
3168- __ get_cache_and_index_at_bcp (Rcache, 1 );
3171+ __ get_cache_and_index_at_bcp (Rcache, 1 , sizeof (u2), /* for_fast_bytecode */ true );
31693172 load_field_cp_cache_entry (noreg, Rcache, noreg, Roffset, Rflags, false ); // Uses R11, R12
31703173
31713174 // JVMTI support
@@ -3304,7 +3307,7 @@ void TemplateTable::fast_xaccess(TosState state) {
33043307 __ ld (Rclass_or_obj, 0 , R18_locals);
33053308
33063309 // Constant pool already resolved. Get the field offset.
3307- __ get_cache_and_index_at_bcp (Rcache, 2 );
3310+ __ get_cache_and_index_at_bcp (Rcache, 2 , sizeof (u2), /* for_fast_bytecode */ true );
33083311 load_field_cp_cache_entry (noreg, Rcache, noreg, Roffset, Rflags, false ); // Uses R11, R12
33093312
33103313 // JVMTI support not needed, since we switch back to single bytecode as soon as debugger attaches.
0 commit comments