8320418: PPC64: invokevfinal_helper duplicates code to handle ResolvedMethodEntry

Reviewed-by: rrich, lucy
This commit is contained in:
Martin Doerr 2023-11-22 16:08:54 +00:00
parent 5d4a54bccd
commit 524da141e7
3 changed files with 22 additions and 33 deletions

View File

@ -27,7 +27,7 @@
#define CPU_PPC_TEMPLATETABLE_PPC_HPP #define CPU_PPC_TEMPLATETABLE_PPC_HPP
static void prepare_invoke(Register Rcache, Register Rret_addr, Register Rrecv, Register Rscratch); static void prepare_invoke(Register Rcache, Register Rret_addr, Register Rrecv, Register Rscratch);
static void invokevfinal_helper(Register Rcache, Register Rscratch1, Register Rscratch2, Register Rscratch3); static void invokevfinal_helper(Register Rcache, Register Rscratch1, Register Rscratch2, Register Rscratch3, Register Rscratch4);
static void generate_vtable_call(Register Rrecv_klass, Register Rindex, Register Rret, Register Rtemp); static void generate_vtable_call(Register Rrecv_klass, Register Rindex, Register Rret, Register Rtemp);
static void invokeinterface_object_method(Register Rrecv_klass, Register Rret, Register Rflags, Register Rcache, Register Rtemp, Register Rtemp2); static void invokeinterface_object_method(Register Rrecv_klass, Register Rret, Register Rflags, Register Rcache, Register Rtemp, Register Rtemp2);

View File

@ -3487,7 +3487,7 @@ void TemplateTable::invokevirtual(int byte_no) {
if (RewriteBytecodes && !UseSharedSpaces && !CDSConfig::is_dumping_static_archive()) { if (RewriteBytecodes && !UseSharedSpaces && !CDSConfig::is_dumping_static_archive()) {
patch_bytecode(Bytecodes::_fast_invokevfinal, Rnew_bc, R12_scratch2); patch_bytecode(Bytecodes::_fast_invokevfinal, Rnew_bc, R12_scratch2);
} }
invokevfinal_helper(Rcache, R11_scratch1, R12_scratch2, Rflags /* tmp */); invokevfinal_helper(Rcache, R11_scratch1, R12_scratch2, Rflags /* tmp */, Rrecv /* tmp */);
__ align(32, 12); __ align(32, 12);
__ bind(LnotFinal); __ bind(LnotFinal);
@ -3510,36 +3510,24 @@ void TemplateTable::fast_invokevfinal(int byte_no) {
assert(byte_no == f2_byte, "use this argument"); assert(byte_no == f2_byte, "use this argument");
Register Rcache = R31; Register Rcache = R31;
__ load_method_entry(Rcache, R11_scratch1); __ load_method_entry(Rcache, R11_scratch1);
invokevfinal_helper(Rcache, R11_scratch1, R12_scratch2, R22_tmp2); invokevfinal_helper(Rcache, R11_scratch1, R12_scratch2, R22_tmp2, R23_tmp3);
} }
void TemplateTable::invokevfinal_helper(Register Rcache, Register Rscratch1, Register Rscratch2, Register Rscratch3) { void TemplateTable::invokevfinal_helper(Register Rcache,
Register Rscratch1, Register Rscratch2, Register Rscratch3, Register Rscratch4) {
assert_different_registers(Rcache, Rscratch1, Rscratch2, Rscratch3); assert_different_registers(Rcache, Rscratch1, Rscratch2, Rscratch3, Rscratch4);
// Load receiver from stack slot. Register Rrecv = Rscratch2,
Register Rmethod = Rscratch3; Rmethod = Rscratch3,
__ ld(Rmethod, in_bytes(ResolvedMethodEntry::method_offset()), Rcache); Rret_addr = Rscratch4;
prepare_invoke(Rcache, Rret_addr, Rrecv, Rscratch1);
// Get return address. // Receiver null check.
Register Rtable_addr = Rscratch2,
Rret_addr = Rcache,
Rret_type = Rscratch1;
// Get return type. It's coded into the upper 4 bits of the lower half of the 64 bit value.
__ lbz(Rret_type, in_bytes(ResolvedMethodEntry::type_offset()), Rcache);
__ load_dispatch_table(Rtable_addr, Interpreter::invoke_return_entry_table());
__ sldi(Rret_type, Rret_type, LogBytesPerWord);
__ ldx(Rret_addr, Rret_type, Rtable_addr); // kills Rcache
Register Rnum_params = Rscratch2,
Rrecv = Rscratch2;
__ ld(Rnum_params, in_bytes(Method::const_offset()), Rmethod);
__ lhz(Rnum_params /* number of params */, in_bytes(ConstMethod::size_of_parameters_offset()), Rnum_params);
// Load receiver and receiver null check.
__ load_receiver(Rnum_params, Rrecv);
__ null_check_throw(Rrecv, -1, Rscratch1); __ null_check_throw(Rrecv, -1, Rscratch1);
__ ld(Rmethod, in_bytes(ResolvedMethodEntry::method_offset()), Rcache);
__ profile_final_call(Rrecv, Rscratch1); __ profile_final_call(Rrecv, Rscratch1);
// Argument and return type profiling. // Argument and return type profiling.
__ profile_arguments_type(Rmethod, Rscratch1, Rscratch2, true); __ profile_arguments_type(Rmethod, Rscratch1, Rscratch2, true);
@ -3558,9 +3546,9 @@ void TemplateTable::invokespecial(int byte_no) {
Rmethod = R31; Rmethod = R31;
load_resolved_method_entry_special_or_static(Rcache, // ResolvedMethodEntry* load_resolved_method_entry_special_or_static(Rcache, // ResolvedMethodEntry*
Rmethod, // Method* or itable index Rmethod, // Method*
noreg); // flags noreg); // flags
prepare_invoke(Rcache, Rret_addr, Rreceiver, R11_scratch1); // recv prepare_invoke(Rcache, Rret_addr, Rreceiver, R11_scratch1);
// Receiver null check. // Receiver null check.
__ null_check_throw(Rreceiver, -1, R11_scratch1); __ null_check_throw(Rreceiver, -1, R11_scratch1);
@ -3578,10 +3566,10 @@ void TemplateTable::invokestatic(int byte_no) {
Register Rcache = R3_ARG1, Register Rcache = R3_ARG1,
Rret_addr = R4_ARG2; Rret_addr = R4_ARG2;
load_resolved_method_entry_special_or_static(Rcache, // ResolvedMethodEntry* load_resolved_method_entry_special_or_static(Rcache, // ResolvedMethodEntry*
R19_method, // Method* or itable index R19_method, // Method*
noreg); // flags noreg); // flags
prepare_invoke(Rcache, Rret_addr, noreg, R11_scratch1); // recv prepare_invoke(Rcache, Rret_addr, noreg, R11_scratch1);
__ profile_call(R11_scratch1, R12_scratch2); __ profile_call(R11_scratch1, R12_scratch2);
// Argument and return type profiling. // Argument and return type profiling.
@ -3639,7 +3627,7 @@ void TemplateTable::invokeinterface(int byte_no) {
Rcache = R31; Rcache = R31;
load_resolved_method_entry_interface(Rcache, noreg, noreg, Rflags); load_resolved_method_entry_interface(Rcache, noreg, noreg, Rflags);
prepare_invoke(Rcache, Rret_addr, Rreceiver, Rscratch1); // recv prepare_invoke(Rcache, Rret_addr, Rreceiver, Rscratch1);
// First check for Object case, then private interface method, // First check for Object case, then private interface method,
// then regular interface method. // then regular interface method.
@ -3757,7 +3745,7 @@ void TemplateTable::invokehandle(int byte_no) {
Rcache = R31; Rcache = R31;
load_resolved_method_entry_handle(Rcache, // ResolvedMethodEntry* load_resolved_method_entry_handle(Rcache, // ResolvedMethodEntry*
Rmethod, // Method* or itable index Rmethod, // Method*
Rscratch1, Rscratch1,
Rflags); Rflags);
prepare_invoke(Rcache, Rret_addr, Rrecv, Rscratch1); prepare_invoke(Rcache, Rret_addr, Rrecv, Rscratch1);

View File

@ -244,6 +244,7 @@ address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code
case Bytecodes::_invokespecial: case Bytecodes::_invokespecial:
case Bytecodes::_invokevirtual: case Bytecodes::_invokevirtual:
case Bytecodes::_invokehandle: case Bytecodes::_invokehandle:
case Bytecodes::_fast_invokevfinal:
return Interpreter::invoke_return_entry_table(); return Interpreter::invoke_return_entry_table();
case Bytecodes::_invokeinterface: case Bytecodes::_invokeinterface:
return Interpreter::invokeinterface_return_entry_table(); return Interpreter::invokeinterface_return_entry_table();