< prev index next >

src/hotspot/cpu/s390/templateTable_s390.cpp

Print this page
rev 50942 : 8206459: [s390] Prevent restoring incorrect bcp and locals in interpreter and avoid incorrect size of partialSubtypeCheckNode in C2
Reviewed-by:


3619   // then regular interface method.
3620 
3621   // Special case of invokeinterface called for virtual method of
3622   // java.lang.Object. See cpCache.cpp for details.
3623   NearLabel notObjectMethod, no_such_method;
3624   __ testbit(flags, ConstantPoolCacheEntry::is_forced_virtual_shift);
3625   __ z_brz(notObjectMethod);
3626   invokevirtual_helper(method, receiver, flags);
3627   __ bind(notObjectMethod);
3628 
3629   // Check for private method invocation - indicated by vfinal
3630   NearLabel notVFinal;
3631   __ testbit(flags, ConstantPoolCacheEntry::is_vfinal_shift);
3632   __ z_brz(notVFinal);
3633 
3634   // Get receiver klass into klass - also a null check.
3635   __ load_klass(klass, receiver);
3636 
3637   NearLabel subtype, no_such_interface;
3638 
3639   __ check_klass_subtype(klass, interface, Z_tmp_2, Z_tmp_3, subtype);
3640   // If we get here the typecheck failed
3641   __ z_bru(no_such_interface);
3642   __ bind(subtype);
3643 
3644   // do the call
3645   __ profile_final_call(Z_tmp_2);
3646   __ profile_arguments_type(Z_tmp_2, method, Z_ARG5, true);
3647   __ jump_from_interpreted(method, Z_tmp_2);
3648 
3649   __ bind(notVFinal);
3650 
3651   // Get receiver klass into klass - also a null check.
3652   __ restore_locals();
3653   __ load_klass(klass, receiver);
3654 
3655   __ lookup_interface_method(klass, interface, noreg, noreg, /*temp*/Z_ARG1,
3656                              no_such_interface, /*return_method=*/false);
3657 
3658   // Profile this call.
3659   __ profile_virtual_call(klass, Z_ARG1/*mdp*/, flags/*scratch*/);
3660 
3661   // Find entry point to call.
3662 
3663   // Get declaring interface class from method
3664   __ z_lg(interface, Address(method, Method::const_offset()));
3665   __ z_lg(interface, Address(interface, ConstMethod::constants_offset()));
3666   __ z_lg(interface, Address(interface, ConstantPool::pool_holder_offset_in_bytes()));
3667 
3668   // Get itable index from method
3669   Register index   = receiver,
3670            method2 = flags;
3671   __ z_lgf(index, Address(method, Method::itable_index_offset()));
3672   __ z_aghi(index, -Method::itable_index_max);


3678   // Check for abstract method error.
3679   // Note: This should be done more efficiently via a throw_abstract_method_error
3680   // interpreter entry point and a conditional jump to it in case of a null
3681   // method.
3682   __ compareU64_and_branch(method2, (intptr_t) 0,
3683                             Assembler::bcondZero, no_such_method);
3684 
3685   __ profile_arguments_type(Z_tmp_1, method2, Z_tmp_2, true);
3686 
3687   // Do the call.
3688   __ jump_from_interpreted(method2, Z_tmp_2);
3689   __ should_not_reach_here();
3690 
3691   // exception handling code follows...
3692   // Note: Must restore interpreter registers to canonical
3693   // state for exception handling to work correctly!
3694 
3695   __ bind(no_such_method);
3696 
3697   // Throw exception.
3698   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
3699   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
3700   // Pass arguments for generating a verbose error message.
3701   __ z_lgr(Z_tmp_1, method); // Prevent register clash.
3702   __ call_VM(noreg,
3703              CAST_FROM_FN_PTR(address,
3704                               InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3705                               klass, Z_tmp_1);
3706   // The call_VM checks for exception, so we should never return here.
3707   __ should_not_reach_here();
3708 
3709   __ bind(no_such_interface);
3710 
3711   // Throw exception.
3712   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
3713   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
3714   // Pass arguments for generating a verbose error message.
3715   __ call_VM(noreg,
3716              CAST_FROM_FN_PTR(address,
3717                               InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3718                               klass, interface);
3719   // The call_VM checks for exception, so we should never return here.
3720   __ should_not_reach_here();
3721 
3722   BLOCK_COMMENT("} invokeinterface");
3723   return;
3724 }
3725 
3726 void TemplateTable::invokehandle(int byte_no) {
3727   transition(vtos, vtos);
3728 
3729   const Register method = Z_tmp_2;
3730   const Register recv   = Z_ARG5;
3731   const Register mtype  = Z_tmp_1;
3732   prepare_invoke(byte_no,
3733                  method, mtype,   // Get f2 method, f1 MethodType.




3619   // then regular interface method.
3620 
3621   // Special case of invokeinterface called for virtual method of
3622   // java.lang.Object. See cpCache.cpp for details.
3623   NearLabel notObjectMethod, no_such_method;
3624   __ testbit(flags, ConstantPoolCacheEntry::is_forced_virtual_shift);
3625   __ z_brz(notObjectMethod);
3626   invokevirtual_helper(method, receiver, flags);
3627   __ bind(notObjectMethod);
3628 
3629   // Check for private method invocation - indicated by vfinal
3630   NearLabel notVFinal;
3631   __ testbit(flags, ConstantPoolCacheEntry::is_vfinal_shift);
3632   __ z_brz(notVFinal);
3633 
3634   // Get receiver klass into klass - also a null check.
3635   __ load_klass(klass, receiver);
3636 
3637   NearLabel subtype, no_such_interface;
3638 
3639   __ check_klass_subtype(klass, interface, Z_tmp_2, flags/*scratch*/, subtype);
3640   // If we get here the typecheck failed
3641   __ z_bru(no_such_interface);
3642   __ bind(subtype);
3643 
3644   // do the call
3645   __ profile_final_call(Z_tmp_2);
3646   __ profile_arguments_type(Z_tmp_2, method, Z_ARG5, true);
3647   __ jump_from_interpreted(method, Z_tmp_2);
3648 
3649   __ bind(notVFinal);
3650 
3651   // Get receiver klass into klass - also a null check.

3652   __ load_klass(klass, receiver);
3653 
3654   __ lookup_interface_method(klass, interface, noreg, noreg, /*temp*/Z_ARG1,
3655                              no_such_interface, /*return_method=*/false);
3656 
3657   // Profile this call.
3658   __ profile_virtual_call(klass, Z_ARG1/*mdp*/, flags/*scratch*/);
3659 
3660   // Find entry point to call.
3661 
3662   // Get declaring interface class from method
3663   __ z_lg(interface, Address(method, Method::const_offset()));
3664   __ z_lg(interface, Address(interface, ConstMethod::constants_offset()));
3665   __ z_lg(interface, Address(interface, ConstantPool::pool_holder_offset_in_bytes()));
3666 
3667   // Get itable index from method
3668   Register index   = receiver,
3669            method2 = flags;
3670   __ z_lgf(index, Address(method, Method::itable_index_offset()));
3671   __ z_aghi(index, -Method::itable_index_max);


3677   // Check for abstract method error.
3678   // Note: This should be done more efficiently via a throw_abstract_method_error
3679   // interpreter entry point and a conditional jump to it in case of a null
3680   // method.
3681   __ compareU64_and_branch(method2, (intptr_t) 0,
3682                            Assembler::bcondZero, no_such_method);
3683 
3684   __ profile_arguments_type(Z_tmp_1, method2, Z_tmp_2, true);
3685 
3686   // Do the call.
3687   __ jump_from_interpreted(method2, Z_tmp_2);
3688   __ should_not_reach_here();
3689 
3690   // exception handling code follows...
3691   // Note: Must restore interpreter registers to canonical
3692   // state for exception handling to work correctly!
3693 
3694   __ bind(no_such_method);
3695 
3696   // Throw exception.


3697   // Pass arguments for generating a verbose error message.
3698   __ z_lgr(Z_tmp_1, method); // Prevent register clash.
3699   __ call_VM(noreg,
3700              CAST_FROM_FN_PTR(address,
3701                               InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3702                               klass, Z_tmp_1);
3703   // The call_VM checks for exception, so we should never return here.
3704   __ should_not_reach_here();
3705 
3706   __ bind(no_such_interface);
3707 
3708   // Throw exception.


3709   // Pass arguments for generating a verbose error message.
3710   __ call_VM(noreg,
3711              CAST_FROM_FN_PTR(address,
3712                               InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3713                               klass, interface);
3714   // The call_VM checks for exception, so we should never return here.
3715   __ should_not_reach_here();
3716 
3717   BLOCK_COMMENT("} invokeinterface");
3718   return;
3719 }
3720 
3721 void TemplateTable::invokehandle(int byte_no) {
3722   transition(vtos, vtos);
3723 
3724   const Register method = Z_tmp_2;
3725   const Register recv   = Z_ARG5;
3726   const Register mtype  = Z_tmp_1;
3727   prepare_invoke(byte_no,
3728                  method, mtype,   // Get f2 method, f1 MethodType.


< prev index next >