src/hotspot/cpu/s390/templateTable_s390.cpp
changeset 48585 d9fcb7ba8133
parent 48415 bae005a497a2
child 48965 be873d8c0114
child 56095 97689d6b0494
equal deleted inserted replaced
48584:6cc53a4de27e 48585:d9fcb7ba8133
  3555 
  3555 
  3556 void TemplateTable::invokeinterface(int byte_no) {
  3556 void TemplateTable::invokeinterface(int byte_no) {
  3557   transition(vtos, vtos);
  3557   transition(vtos, vtos);
  3558 
  3558 
  3559   assert(byte_no == f1_byte, "use this argument");
  3559   assert(byte_no == f1_byte, "use this argument");
  3560   Register interface = Z_tos;
  3560   Register klass     = Z_ARG2,
  3561   Register index = Z_ARG3;
  3561            method    = Z_ARG3,
  3562   Register receiver = Z_tmp_1;
  3562            interface = Z_ARG4,
  3563   Register flags = Z_ARG5;
  3563            flags     = Z_ARG5,
       
  3564            receiver  = Z_tmp_1;
  3564 
  3565 
  3565   BLOCK_COMMENT("invokeinterface {");
  3566   BLOCK_COMMENT("invokeinterface {");
  3566 
  3567 
  3567   // Destroys Z_ARG1 and Z_ARG2, thus use Z_ARG4 and copy afterwards.
  3568   prepare_invoke(byte_no, interface, method,  // Get f1 klassOop, f2 itable index.
  3568   prepare_invoke(byte_no, Z_ARG4, index,  // Get f1 klassOop, f2 itable index.
       
  3569                  receiver, flags);
  3569                  receiver, flags);
  3570 
  3570 
  3571   // Z_R14 (== Z_bytecode) : return entry
  3571   // Z_R14 (== Z_bytecode) : return entry
  3572 
       
  3573   __ z_lgr(interface, Z_ARG4);
       
  3574 
  3572 
  3575   // Special case of invokeinterface called for virtual method of
  3573   // Special case of invokeinterface called for virtual method of
  3576   // java.lang.Object. See cpCacheOop.cpp for details.
  3574   // java.lang.Object. See cpCacheOop.cpp for details.
  3577   // This code isn't produced by javac, but could be produced by
  3575   // This code isn't produced by javac, but could be produced by
  3578   // another compliant java compiler.
  3576   // another compliant java compiler.
  3579   Label notMethod;
  3577   NearLabel notMethod, no_such_interface, no_such_method;
  3580   __ testbit(flags, ConstantPoolCacheEntry::is_forced_virtual_shift);
  3578   __ testbit(flags, ConstantPoolCacheEntry::is_forced_virtual_shift);
  3581   __ z_brz(notMethod);
  3579   __ z_brz(notMethod);
  3582   invokevirtual_helper(index, receiver, flags);
  3580   invokevirtual_helper(method, receiver, flags);
  3583   __ bind(notMethod);
  3581   __ bind(notMethod);
  3584 
  3582 
  3585   // Get receiver klass into klass - also a null check.
  3583   // Get receiver klass into klass - also a null check.
  3586   Register klass = flags;
       
  3587 
       
  3588   __ restore_locals();
  3584   __ restore_locals();
  3589   __ load_klass(klass, receiver);
  3585   __ load_klass(klass, receiver);
  3590 
  3586 
       
  3587   __ lookup_interface_method(klass, interface, noreg, noreg, /*temp*/Z_ARG1,
       
  3588                              no_such_interface, /*return_method=*/false);
       
  3589 
  3591   // Profile this call.
  3590   // Profile this call.
  3592   __ profile_virtual_call(klass, Z_ARG2/*mdp*/, Z_ARG4/*scratch*/);
  3591   __ profile_virtual_call(klass, Z_ARG1/*mdp*/, flags/*scratch*/);
  3593 
  3592 
  3594   NearLabel  no_such_interface, no_such_method;
  3593   // Find entry point to call.
  3595   Register   method = Z_tmp_2;
  3594 
  3596 
  3595   // Get declaring interface class from method
  3597   // TK 2010-08-24: save the index to Z_ARG4. needed in case of an error
  3596   __ z_lg(interface, Address(method, Method::const_offset()));
  3598   //                in throw_AbstractMethodErrorByTemplateTable
  3597   __ z_lg(interface, Address(interface, ConstMethod::constants_offset()));
  3599   __ z_lgr(Z_ARG4, index);
  3598   __ z_lg(interface, Address(interface, ConstantPool::pool_holder_offset_in_bytes()));
  3600   // TK 2011-03-24: copy also klass because it could be changed in
  3599 
  3601   //                lookup_interface_method
  3600   // Get itable index from method
  3602   __ z_lgr(Z_ARG2, klass);
  3601   Register index   = receiver,
  3603   __ lookup_interface_method(// inputs: rec. class, interface, itable index
  3602            method2 = flags;
  3604                               klass, interface, index,
  3603   __ z_lgf(index, Address(method, Method::itable_index_offset()));
  3605                               // outputs: method, scan temp. reg
  3604   __ z_aghi(index, -Method::itable_index_max);
  3606                               method, Z_tmp_2, Z_R1_scratch,
  3605   __ z_lcgr(index, index);
  3607                               no_such_interface);
  3606 
       
  3607   __ lookup_interface_method(klass, interface, index, method2, Z_tmp_2,
       
  3608                              no_such_interface);
  3608 
  3609 
  3609   // Check for abstract method error.
  3610   // Check for abstract method error.
  3610   // Note: This should be done more efficiently via a throw_abstract_method_error
  3611   // Note: This should be done more efficiently via a throw_abstract_method_error
  3611   // interpreter entry point and a conditional jump to it in case of a null
  3612   // interpreter entry point and a conditional jump to it in case of a null
  3612   // method.
  3613   // method.
  3613   __ compareU64_and_branch(method, (intptr_t) 0,
  3614   __ compareU64_and_branch(method2, (intptr_t) 0,
  3614                             Assembler::bcondZero, no_such_method);
  3615                             Assembler::bcondZero, no_such_method);
  3615 
  3616 
  3616   __ profile_arguments_type(Z_ARG3, method, Z_ARG5, true);
  3617   __ profile_arguments_type(Z_tmp_1, method2, Z_tmp_2, true);
  3617 
  3618 
  3618   // Do the call.
  3619   // Do the call.
  3619   __ jump_from_interpreted(method, Z_ARG5);
  3620   __ jump_from_interpreted(method2, Z_tmp_2);
  3620   __ should_not_reach_here();
  3621   __ should_not_reach_here();
  3621 
  3622 
  3622   // exception handling code follows...
  3623   // exception handling code follows...
  3623   // Note: Must restore interpreter registers to canonical
  3624   // Note: Must restore interpreter registers to canonical
  3624   // state for exception handling to work correctly!
  3625   // state for exception handling to work correctly!
  3626   __ bind(no_such_method);
  3627   __ bind(no_such_method);
  3627 
  3628 
  3628   // Throw exception.
  3629   // Throw exception.
  3629   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
  3630   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
  3630   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
  3631   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
  3631   // TK 2010-08-24: Call throw_AbstractMethodErrorByTemplateTable now with the
       
  3632   //                relevant information for generating a better error message
       
  3633   __ call_VM(noreg,
  3632   __ call_VM(noreg,
  3634               CAST_FROM_FN_PTR(address,
  3633              CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError));
  3635                                InterpreterRuntime::throw_AbstractMethodError),
       
  3636               Z_ARG2, interface, Z_ARG4);
       
  3637   // The call_VM checks for exception, so we should never return here.
  3634   // The call_VM checks for exception, so we should never return here.
  3638   __ should_not_reach_here();
  3635   __ should_not_reach_here();
  3639 
  3636 
  3640   __ bind(no_such_interface);
  3637   __ bind(no_such_interface);
  3641 
  3638 
  3642   // Throw exception.
  3639   // Throw exception.
  3643   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
  3640   __ restore_bcp();      // Bcp must be correct for exception handler   (was destroyed).
  3644   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
  3641   __ restore_locals();   // Make sure locals pointer is correct as well (was destroyed).
  3645   // TK 2010-08-24: Call throw_IncompatibleClassChangeErrorByTemplateTable now with the
       
  3646   //                relevant information for generating a better error message
       
  3647   __ call_VM(noreg,
  3642   __ call_VM(noreg,
  3648              CAST_FROM_FN_PTR(address,
  3643              CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
  3649                               InterpreterRuntime::throw_IncompatibleClassChangeError),
       
  3650              Z_ARG2, interface);
       
  3651   // The call_VM checks for exception, so we should never return here.
  3644   // The call_VM checks for exception, so we should never return here.
  3652   __ should_not_reach_here();
  3645   __ should_not_reach_here();
  3653 
  3646 
  3654   BLOCK_COMMENT("} invokeinterface");
  3647   BLOCK_COMMENT("} invokeinterface");
  3655   return;
  3648   return;