Skip to content

Commit

Permalink
8305171: PPC: Should use IMA::load_resolved_indy_entry() in TIG::gene…
Browse files Browse the repository at this point in the history
…rate_return_entry_for()

Reviewed-by: mdoerr
  • Loading branch information
reinrich committed Mar 31, 2023
1 parent 7fe5bd2 commit c8f3a97
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ void InterpreterMacroAssembler::load_resolved_indy_entry(Register cache, Registe
ld_ptr(cache, in_bytes(ConstantPoolCache::invokedynamic_entries_offset()), R27_constPoolCache);
// Scale the index to be the entry index * sizeof(ResolvedInvokeDynamicInfo)
sldi(index, index, log2i_exact(sizeof(ResolvedIndyEntry)));
addi(index, index, Array<ResolvedIndyEntry>::base_offset_in_bytes());
add(cache, cache, index);
}

Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,7 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
const Register cache = R11_scratch1;
const Register size = R12_scratch2;
if (index_size == sizeof(u4)) {
__ get_cache_index_at_bcp(size, 1, index_size); // Load index.
// Get address of invokedynamic array
__ ld_ptr(cache, in_bytes(ConstantPoolCache::invokedynamic_entries_offset()), R27_constPoolCache);
// Scale the index to be the entry index * sizeof(ResolvedInvokeDynamicInfo)
__ sldi(size, size, log2i_exact(sizeof(ResolvedIndyEntry)));
__ add(cache, cache, size);
__ load_resolved_indy_entry(cache, size /* tmp */);
__ lhz(size, Array<ResolvedIndyEntry>::base_offset_in_bytes() + in_bytes(ResolvedIndyEntry::num_parameters_offset()), cache);
} else {
__ get_cache_and_index_at_bcp(cache, 1, index_size);
Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2286,12 +2286,13 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
const Register cache = R31;
const Register index = R21_tmp1;
const Register tmp = R11_scratch1;
const int array_base_offset = Array<ResolvedIndyEntry>::base_offset_in_bytes();
assert_different_registers(method, appendix, cache, index, tmp);

Label resolved;

__ load_resolved_indy_entry(cache, index);
__ ld_ptr(method, in_bytes(ResolvedIndyEntry::method_offset()), cache);
__ ld_ptr(method, array_base_offset + in_bytes(ResolvedIndyEntry::method_offset()), cache);

// The invokedynamic is unresolved iff method is NULL
__ cmpdi(CCR0, method, 0);
Expand All @@ -2305,7 +2306,7 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
__ call_VM(noreg, entry, R4_ARG2, true);
// Update registers with resolved info
__ load_resolved_indy_entry(cache, index);
__ ld_ptr(method, in_bytes(ResolvedIndyEntry::method_offset()), cache);
__ ld_ptr(method, array_base_offset + in_bytes(ResolvedIndyEntry::method_offset()), cache);

DEBUG_ONLY(__ cmpdi(CCR0, method, 0));
__ asm_assert_ne("Should be resolved by now");
Expand All @@ -2314,12 +2315,12 @@ void TemplateTable::load_invokedynamic_entry(Register method) {

Label L_no_push;
// Check if there is an appendix
__ lbz(index, in_bytes(ResolvedIndyEntry::flags_offset()), cache);
__ lbz(index, array_base_offset + in_bytes(ResolvedIndyEntry::flags_offset()), cache);
__ rldicl_(R0, index, 64-ResolvedIndyEntry::has_appendix_shift, 63);
__ beq(CCR0, L_no_push);

// Get appendix
__ lhz(index, in_bytes(ResolvedIndyEntry::resolved_references_index_offset()), cache);
__ lhz(index, array_base_offset + in_bytes(ResolvedIndyEntry::resolved_references_index_offset()), cache);
// Push the appendix as a trailing parameter
assert(cache->is_nonvolatile(), "C-call in resolve_oop_handle");
__ load_resolved_reference_at_index(appendix, index, /* temp */ ret_addr, tmp);
Expand All @@ -2333,7 +2334,7 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);

// compute return type
__ lbz(index, in_bytes(ResolvedIndyEntry::result_type_offset()), cache);
__ lbz(index, array_base_offset + in_bytes(ResolvedIndyEntry::result_type_offset()), cache);
__ load_dispatch_table(Rtable_addr, (address*)table_addr);
__ sldi(index, index, LogBytesPerWord);
// Get return address.
Expand Down

1 comment on commit c8f3a97

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.