Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/hotspot/cpu/ppc/interp_masm_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ class InterpreterMacroAssembler: public MacroAssembler {

void get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size);

void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2));
void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2),
bool for_fast_bytecode = false);

void get_u4(Register Rdst, Register Rsrc, int offset, signedOrNot is_signed);

Expand Down
10 changes: 9 additions & 1 deletion src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,18 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_of
}

void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset,
size_t index_size) {
size_t index_size, bool for_fast_bytecode) {
get_cache_index_at_bcp(cache, bcp_offset, index_size);
sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord));
add(cache, R27_constPoolCache, cache);

if (for_fast_bytecode) {
// Prevent speculative loading from ConstantPoolCacheEntry as it can miss the info written by another thread.
// TemplateTable::patch_bytecode uses release-store.
// We reached here via control dependency (Bytecode dispatch has used the rewritten Bytecode).
// So, we can use control-isync based ordering.
isync();
}
}

// Load 4-byte signed or unsigned integer in Java format (that is, big-endian format)
Expand Down
13 changes: 8 additions & 5 deletions src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
__ bind(L_fast_patch);
}

// Patch bytecode.
// Patch bytecode with release store to coordinate with ConstantPoolCacheEntry
// loads in fast bytecode codelets.
__ release();
__ stb(Rnew_bc, 0, R14_bcp);

__ bind(L_patch_done);
Expand Down Expand Up @@ -310,6 +312,7 @@ void TemplateTable::fast_aldc(bool wide) {
// We are resolved if the resolved reference cache entry contains a
// non-null object (CallSite, etc.)
__ get_cache_index_at_bcp(R31, 1, index_size); // Load index.
// Only rewritten during link time. So, no need for memory barriers for accessing resolved info.
__ load_resolved_reference_at_index(R17_tos, R31, R11_scratch1, R12_scratch2, &is_null);

// Convert null sentinel to NULL
Expand Down Expand Up @@ -2309,7 +2312,7 @@ void TemplateTable::load_invoke_cp_cache_entry(int byte_no,
if (is_invokevfinal) {
assert(Ritable_index == noreg, "register not used");
// Already resolved.
__ get_cache_and_index_at_bcp(Rcache, 1);
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
} else {
resolve_cache_and_index(byte_no, Rcache, /* temp */ Rmethod, is_invokedynamic ? sizeof(u4) : sizeof(u2));
}
Expand Down Expand Up @@ -3016,7 +3019,7 @@ void TemplateTable::fast_storefield(TosState state) {
const ConditionRegister CR_is_vol = CCR2; // Non-volatile condition register (survives runtime call in do_oop_store).

// Constant pool already resolved => Load flags and offset of field.
__ get_cache_and_index_at_bcp(Rcache, 1);
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
jvmti_post_field_mod(Rcache, Rscratch, false /* not static */);
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12

Expand Down Expand Up @@ -3097,7 +3100,7 @@ void TemplateTable::fast_accessfield(TosState state) {
// R12_scratch2 used by load_field_cp_cache_entry

// Constant pool already resolved. Get the field offset.
__ get_cache_and_index_at_bcp(Rcache, 1);
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12

// JVMTI support
Expand Down Expand Up @@ -3236,7 +3239,7 @@ void TemplateTable::fast_xaccess(TosState state) {
__ ld(Rclass_or_obj, 0, R18_locals);

// Constant pool already resolved. Get the field offset.
__ get_cache_and_index_at_bcp(Rcache, 2);
__ get_cache_and_index_at_bcp(Rcache, 2, sizeof(u2), /* for_fast_bytecode */ true);
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12

// JVMTI support not needed, since we switch back to single bytecode as soon as debugger attaches.
Expand Down