From c8f3a97d465bc1ed4020df2786897f3ba786fe50 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Fri, 31 Mar 2023 08:59:02 +0000 Subject: [PATCH] 8305171: PPC: Should use IMA::load_resolved_indy_entry() in TIG::generate_return_entry_for() Reviewed-by: mdoerr --- src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp | 1 - .../cpu/ppc/templateInterpreterGenerator_ppc.cpp | 7 +------ src/hotspot/cpu/ppc/templateTable_ppc_64.cpp | 11 ++++++----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index f3b2a4ec300..e586c74ee5a 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -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::base_offset_in_bytes()); add(cache, cache, index); } diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index 3aa78d00d76..8511bc9efdb 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -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::base_offset_in_bytes() + in_bytes(ResolvedIndyEntry::num_parameters_offset()), cache); } else { __ get_cache_and_index_at_bcp(cache, 1, index_size); diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp index 9a691887745..79f81e23032 100644 --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp @@ -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::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); @@ -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"); @@ -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); @@ -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.