< prev index next >

src/hotspot/cpu/sparc/templateTable_sparc.cpp

Print this page
rev 49028 : 8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
Reviewed-by: coleenp, dholmes, mdoerr


3120                              L_no_such_interface,
3121                              /*return_method=*/false);
3122 
3123   __ profile_virtual_call(O2_Klass, O4);
3124 
3125   //
3126   // find entry point to call
3127   //
3128 
3129   // Get declaring interface class from method
3130   __ ld_ptr(Rmethod, Method::const_offset(), Rinterface);
3131   __ ld_ptr(Rinterface, ConstMethod::constants_offset(), Rinterface);
3132   __ ld_ptr(Rinterface, ConstantPool::pool_holder_offset_in_bytes(), Rinterface);
3133 
3134   // Get itable index from method
3135   const Register Rindex = G5_method;
3136   __ ld(Rmethod, Method::itable_index_offset(), Rindex);
3137   __ sub(Rindex, Method::itable_index_max, Rindex);
3138   __ neg(Rindex);
3139 


3140   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3141                              O2_Klass, Rinterface, Rindex,
3142                              // outputs: method, scan temp reg, temp reg
3143                              G5_method, Rscratch, Rtemp,
3144                              L_no_such_interface);
3145 
3146   // Check for abstract method error.
3147   {
3148     Label ok;
3149     __ br_notnull_short(G5_method, Assembler::pt, ok);
3150     call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError));


3151     __ should_not_reach_here();
3152     __ bind(ok);
3153   }
3154 
3155   Register Rcall = Rinterface;
3156   assert_different_registers(Rcall, G5_method, Gargs, Rret);
3157 
3158   __ profile_arguments_type(G5_method, Rcall, Gargs, true);
3159   __ profile_called_method(G5_method, Rscratch);
3160   __ call_from_interpreter(Rcall, Gargs, Rret);
3161 
3162   __ bind(L_no_such_interface);
3163   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));


3164   __ should_not_reach_here();
3165 }
3166 
3167 void TemplateTable::invokehandle(int byte_no) {
3168   transition(vtos, vtos);
3169   assert(byte_no == f1_byte, "use this argument");
3170 
3171   const Register Rret       = Lscratch;
3172   const Register G4_mtype   = G4_scratch;
3173   const Register O0_recv    = O0;
3174   const Register Rscratch   = G3_scratch;
3175 
3176   prepare_invoke(byte_no, G5_method, Rret, G4_mtype, O0_recv);
3177   __ null_check(O0_recv);
3178 
3179   // G4: MethodType object (from cpool->resolved_references[f1], if necessary)
3180   // G5: MH.invokeExact_MT method (from f2)
3181 
3182   // Note:  G4_mtype is already pushed (if necessary) by prepare_invoke
3183 


3519   __ load_klass(Otos_i, RobjKlass); // get value klass
3520 
3521   // Generate a fast subtype check.  Branch to cast_ok if no
3522   // failure.  Return 0 if failure.
3523   __ or3(G0, 1, Otos_i);      // set result assuming quick tests succeed
3524   __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, done );
3525   // Not a subtype; return 0;
3526   __ clr( Otos_i );
3527 
3528   if (ProfileInterpreter) {
3529     __ ba_short(done);
3530   }
3531   __ bind(is_null);
3532   __ profile_null_seen(G3_scratch);
3533   __ bind(done);
3534 }
3535 
3536 void TemplateTable::_breakpoint() {
3537 
3538    // Note: We get here even if we are single stepping..
3539    // jbug inists on setting breakpoints at every bytecode
3540    // even if we are in single step mode.
3541 
3542    transition(vtos, vtos);
3543    // get the unpatched byte code
3544    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::get_original_bytecode_at), Lmethod, Lbcp);
3545    __ mov(O0, Lbyte_code);
3546 
3547    // post the breakpoint event
3548    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::_breakpoint), Lmethod, Lbcp);
3549 
3550    // complete the execution of original bytecode
3551    __ dispatch_normal(vtos);
3552 }
3553 
3554 
3555 //----------------------------------------------------------------------------------------------------
3556 // Exceptions
3557 
3558 void TemplateTable::athrow() {
3559   transition(atos, vtos);




3120                              L_no_such_interface,
3121                              /*return_method=*/false);
3122 
3123   __ profile_virtual_call(O2_Klass, O4);
3124 
3125   //
3126   // find entry point to call
3127   //
3128 
3129   // Get declaring interface class from method
3130   __ ld_ptr(Rmethod, Method::const_offset(), Rinterface);
3131   __ ld_ptr(Rinterface, ConstMethod::constants_offset(), Rinterface);
3132   __ ld_ptr(Rinterface, ConstantPool::pool_holder_offset_in_bytes(), Rinterface);
3133 
3134   // Get itable index from method
3135   const Register Rindex = G5_method;
3136   __ ld(Rmethod, Method::itable_index_offset(), Rindex);
3137   __ sub(Rindex, Method::itable_index_max, Rindex);
3138   __ neg(Rindex);
3139 
3140   // Preserve O2_Klass for throw_AbstractMethodErrorVerbose
3141   __ mov(O2_Klass, O4);
3142   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3143                              O4, Rinterface, Rindex,
3144                              // outputs: method, scan temp reg, temp reg
3145                              G5_method, Rscratch, Rtemp,
3146                              L_no_such_interface);
3147 
3148   // Check for abstract method error.
3149   {
3150     Label ok;
3151     __ br_notnull_short(G5_method, Assembler::pt, ok);
3152     // Pass arguments for generating a verbose error message.
3153     call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3154             O2_Klass, Rmethod);
3155     __ should_not_reach_here();
3156     __ bind(ok);
3157   }
3158 
3159   Register Rcall = Rinterface;
3160   assert_different_registers(Rcall, G5_method, Gargs, Rret);
3161 
3162   __ profile_arguments_type(G5_method, Rcall, Gargs, true);
3163   __ profile_called_method(G5_method, Rscratch);
3164   __ call_from_interpreter(Rcall, Gargs, Rret);
3165 
3166   __ bind(L_no_such_interface);
3167   // Pass arguments for generating a verbose error message.
3168   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3169           O2_Klass, Rinterface);
3170   __ should_not_reach_here();
3171 }
3172 
3173 void TemplateTable::invokehandle(int byte_no) {
3174   transition(vtos, vtos);
3175   assert(byte_no == f1_byte, "use this argument");
3176 
3177   const Register Rret       = Lscratch;
3178   const Register G4_mtype   = G4_scratch;
3179   const Register O0_recv    = O0;
3180   const Register Rscratch   = G3_scratch;
3181 
3182   prepare_invoke(byte_no, G5_method, Rret, G4_mtype, O0_recv);
3183   __ null_check(O0_recv);
3184 
3185   // G4: MethodType object (from cpool->resolved_references[f1], if necessary)
3186   // G5: MH.invokeExact_MT method (from f2)
3187 
3188   // Note:  G4_mtype is already pushed (if necessary) by prepare_invoke
3189 


3525   __ load_klass(Otos_i, RobjKlass); // get value klass
3526 
3527   // Generate a fast subtype check.  Branch to cast_ok if no
3528   // failure.  Return 0 if failure.
3529   __ or3(G0, 1, Otos_i);      // set result assuming quick tests succeed
3530   __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, done );
3531   // Not a subtype; return 0;
3532   __ clr( Otos_i );
3533 
3534   if (ProfileInterpreter) {
3535     __ ba_short(done);
3536   }
3537   __ bind(is_null);
3538   __ profile_null_seen(G3_scratch);
3539   __ bind(done);
3540 }
3541 
3542 void TemplateTable::_breakpoint() {
3543 
3544    // Note: We get here even if we are single stepping..
3545    // jbug insists on setting breakpoints at every bytecode
3546    // even if we are in single step mode.
3547 
3548    transition(vtos, vtos);
3549    // get the unpatched byte code
3550    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::get_original_bytecode_at), Lmethod, Lbcp);
3551    __ mov(O0, Lbyte_code);
3552 
3553    // post the breakpoint event
3554    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::_breakpoint), Lmethod, Lbcp);
3555 
3556    // complete the execution of original bytecode
3557    __ dispatch_normal(vtos);
3558 }
3559 
3560 
3561 //----------------------------------------------------------------------------------------------------
3562 // Exceptions
3563 
3564 void TemplateTable::athrow() {
3565   transition(atos, vtos);


< prev index next >