< prev index next >

src/hotspot/cpu/ppc/templateTable_ppc_64.cpp

Print this page
rev 50604 : imported patch jep181-rev1
rev 50607 : imported patch jep181-rev4


3566   generate_vtable_call(Rrecv_klass, Rmethod, Rret, Rscratch);
3567 }
3568 
3569 void TemplateTable::invokeinterface(int byte_no) {
3570   assert(byte_no == f1_byte, "use this argument");
3571   transition(vtos, vtos);
3572 
3573   const Register Rscratch1        = R11_scratch1,
3574                  Rscratch2        = R12_scratch2,
3575                  Rmethod          = R6_ARG4,
3576                  Rmethod2         = R9_ARG7,
3577                  Rinterface_klass = R5_ARG3,
3578                  Rret_addr        = R8_ARG6,
3579                  Rindex           = R10_ARG8,
3580                  Rreceiver        = R3_ARG1,
3581                  Rrecv_klass      = R4_ARG2,
3582                  Rflags           = R7_ARG5;
3583 
3584   prepare_invoke(byte_no, Rinterface_klass, Rret_addr, Rmethod, Rreceiver, Rflags, Rscratch1);
3585 
3586   // Get receiver klass.



3587   __ null_check_throw(Rreceiver, oopDesc::klass_offset_in_bytes(), Rscratch2);
3588   __ load_klass(Rrecv_klass, Rreceiver);
3589 
3590   // Check corner case object method.
3591   Label LobjectMethod, L_no_such_interface, Lthrow_ame;





3592   __ testbitdi(CCR0, R0, Rflags, ConstantPoolCacheEntry::is_forced_virtual_shift);
3593   __ btrue(CCR0, LobjectMethod);
























3594 
3595   __ lookup_interface_method(Rrecv_klass, Rinterface_klass, noreg, noreg, Rscratch1, Rscratch2,
3596                              L_no_such_interface, /*return_method=*/false);
3597 
3598   __ profile_virtual_call(Rrecv_klass, Rscratch1, Rscratch2, false);
3599 
3600   // Find entry point to call.
3601 
3602   // Get declaring interface class from method
3603   __ ld(Rinterface_klass, in_bytes(Method::const_offset()), Rmethod);
3604   __ ld(Rinterface_klass, in_bytes(ConstMethod::constants_offset()), Rinterface_klass);
3605   __ ld(Rinterface_klass, ConstantPool::pool_holder_offset_in_bytes(), Rinterface_klass);
3606 
3607   // Get itable index from method
3608   __ lwa(Rindex, in_bytes(Method::itable_index_offset()), Rmethod);
3609   __ subfic(Rindex, Rindex, Method::itable_index_max);
3610 
3611   __ lookup_interface_method(Rrecv_klass, Rinterface_klass, Rindex, Rmethod2, Rscratch1, Rscratch2,
3612                              L_no_such_interface);
3613 
3614   __ cmpdi(CCR0, Rmethod2, 0);
3615   __ beq(CCR0, Lthrow_ame);
3616   // Found entry. Jump off!
3617   // Argument and return type profiling.
3618   __ profile_arguments_type(Rmethod2, Rscratch1, Rscratch2, true);
3619   //__ profile_called_method(Rindex, Rscratch1);
3620   __ call_from_interpreter(Rmethod2, Rret_addr, Rscratch1, Rscratch2);
3621 
3622   // Vtable entry was NULL => Throw abstract method error.
3623   __ bind(Lthrow_ame);
3624   // Pass arguments for generating a verbose error message.
3625   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3626           Rrecv_klass, Rmethod);
3627 
3628   // Interface was not found => Throw incompatible class change error.
3629   __ bind(L_no_such_interface);
3630   // Pass arguments for generating a verbose error message.
3631   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3632           Rrecv_klass, Rinterface_klass);
3633   DEBUG_ONLY( __ should_not_reach_here(); )
3634 
3635   // Special case of invokeinterface called for virtual method of
3636   // java.lang.Object. See ConstantPoolCacheEntry::set_method() for details:
3637   // The invokeinterface was rewritten to a invokevirtual, hence we have
3638   // to handle this corner case. This code isn't produced by javac, but could
3639   // be produced by another compliant java compiler.
3640   __ bind(LobjectMethod);
3641   invokeinterface_object_method(Rrecv_klass, Rret_addr, Rflags, Rmethod, Rscratch1, Rscratch2);
3642 }
3643 
3644 void TemplateTable::invokedynamic(int byte_no) {
3645   transition(vtos, vtos);
3646 
3647   const Register Rret_addr = R3_ARG1,
3648                  Rflags    = R4_ARG2,
3649                  Rmethod   = R22_tmp2,
3650                  Rscratch1 = R11_scratch1,
3651                  Rscratch2 = R12_scratch2;
3652 
3653   prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, noreg, Rflags, Rscratch2);
3654 
3655   // Profile this call.
3656   __ profile_call(Rscratch1, Rscratch2);
3657 
3658   // Off we go. With the new method handles, we don't jump to a method handle
3659   // entry any more. Instead, we pushed an "appendix" in prepare invoke, which happens
3660   // to be the callsite object the bootstrap method returned. This is passed to a
3661   // "link" method which does the dispatch (Most likely just grabs the MH stored




3566   generate_vtable_call(Rrecv_klass, Rmethod, Rret, Rscratch);
3567 }
3568 
3569 void TemplateTable::invokeinterface(int byte_no) {
3570   assert(byte_no == f1_byte, "use this argument");
3571   transition(vtos, vtos);
3572 
3573   const Register Rscratch1        = R11_scratch1,
3574                  Rscratch2        = R12_scratch2,
3575                  Rmethod          = R6_ARG4,
3576                  Rmethod2         = R9_ARG7,
3577                  Rinterface_klass = R5_ARG3,
3578                  Rret_addr        = R8_ARG6,
3579                  Rindex           = R10_ARG8,
3580                  Rreceiver        = R3_ARG1,
3581                  Rrecv_klass      = R4_ARG2,
3582                  Rflags           = R7_ARG5;
3583 
3584   prepare_invoke(byte_no, Rinterface_klass, Rret_addr, Rmethod, Rreceiver, Rflags, Rscratch1);
3585 
3586   // First check for Object case, then private interface method,
3587   // then regular interface method.
3588 
3589   // Get receiver klass - this is also a null check
3590   __ null_check_throw(Rreceiver, oopDesc::klass_offset_in_bytes(), Rscratch2);
3591   __ load_klass(Rrecv_klass, Rreceiver);
3592 
3593   // Check corner case object method.
3594   // Special case of invokeinterface called for virtual method of
3595   // java.lang.Object. See ConstantPoolCacheEntry::set_method() for details:
3596   // The invokeinterface was rewritten to a invokevirtual, hence we have
3597   // to handle this corner case.
3598 
3599   Label LnotObjectMethod, Lthrow_ame;
3600   __ testbitdi(CCR0, R0, Rflags, ConstantPoolCacheEntry::is_forced_virtual_shift);
3601   __ bfalse(CCR0, LnotObjectMethod);
3602   invokeinterface_object_method(Rrecv_klass, Rret_addr, Rflags, Rmethod, Rscratch1, Rscratch2);
3603   __ bind(LnotObjectMethod);
3604 
3605   // Check for private method invocation - indicated by vfinal
3606   Label LnotVFinal, L_no_such_interface, L_subtype;
3607 
3608   __ testbitdi(CCR0, R0, Rflags, ConstantPoolCacheEntry::is_vfinal_shift);
3609   __ bfalse(CCR0, LnotVFinal);
3610 
3611   __ check_klass_subtype(Rrecv_klass, Rinterface_klass, Rscratch1, Rscratch2, L_subtype);
3612   // If we get here the typecheck failed
3613   __ b(L_no_such_interface);
3614   __ bind(L_subtype);
3615 
3616   // do the call
3617 
3618   Register Rscratch = Rflags; // Rflags is dead now.
3619 
3620   __ profile_final_call(Rscratch1, Rscratch);
3621   __ profile_arguments_type(Rindex, Rscratch, Rrecv_klass /* scratch */, true);
3622 
3623   __ call_from_interpreter(Rindex, Rret_addr, Rscratch, Rrecv_klass /* scratch */);
3624 
3625   __ bind(LnotVFinal);
3626 
3627   __ lookup_interface_method(Rrecv_klass, Rinterface_klass, noreg, noreg, Rscratch1, Rscratch2,
3628                              L_no_such_interface, /*return_method=*/false);
3629 
3630   __ profile_virtual_call(Rrecv_klass, Rscratch1, Rscratch2, false);
3631 
3632   // Find entry point to call.
3633 
3634   // Get declaring interface class from method
3635   __ ld(Rinterface_klass, in_bytes(Method::const_offset()), Rmethod);
3636   __ ld(Rinterface_klass, in_bytes(ConstMethod::constants_offset()), Rinterface_klass);
3637   __ ld(Rinterface_klass, ConstantPool::pool_holder_offset_in_bytes(), Rinterface_klass);
3638 
3639   // Get itable index from method
3640   __ lwa(Rindex, in_bytes(Method::itable_index_offset()), Rmethod);
3641   __ subfic(Rindex, Rindex, Method::itable_index_max);
3642 
3643   __ lookup_interface_method(Rrecv_klass, Rinterface_klass, Rindex, Rmethod2, Rscratch1, Rscratch2,
3644                              L_no_such_interface);
3645 
3646   __ cmpdi(CCR0, Rmethod2, 0);
3647   __ beq(CCR0, Lthrow_ame);
3648   // Found entry. Jump off!
3649   // Argument and return type profiling.
3650   __ profile_arguments_type(Rmethod2, Rscratch1, Rscratch2, true);
3651   //__ profile_called_method(Rindex, Rscratch1);
3652   __ call_from_interpreter(Rmethod2, Rret_addr, Rscratch1, Rscratch2);
3653 
3654   // Vtable entry was NULL => Throw abstract method error.
3655   __ bind(Lthrow_ame);
3656   // Pass arguments for generating a verbose error message.
3657   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3658           Rrecv_klass, Rmethod);
3659 
3660   // Interface was not found => Throw incompatible class change error.
3661   __ bind(L_no_such_interface);
3662   // Pass arguments for generating a verbose error message.
3663   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3664           Rrecv_klass, Rinterface_klass);
3665   DEBUG_ONLY( __ should_not_reach_here(); )








3666 }
3667 
3668 void TemplateTable::invokedynamic(int byte_no) {
3669   transition(vtos, vtos);
3670 
3671   const Register Rret_addr = R3_ARG1,
3672                  Rflags    = R4_ARG2,
3673                  Rmethod   = R22_tmp2,
3674                  Rscratch1 = R11_scratch1,
3675                  Rscratch2 = R12_scratch2;
3676 
3677   prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, noreg, Rflags, Rscratch2);
3678 
3679   // Profile this call.
3680   __ profile_call(Rscratch1, Rscratch2);
3681 
3682   // Off we go. With the new method handles, we don't jump to a method handle
3683   // entry any more. Instead, we pushed an "appendix" in prepare invoke, which happens
3684   // to be the callsite object the bootstrap method returned. This is passed to a
3685   // "link" method which does the dispatch (Most likely just grabs the MH stored


< prev index next >