3185 __ profile_virtual_call(RKlass, O4);
3186 generate_vtable_call(RKlass, Rindex, Rret);
3187 }
3188
3189
3190 void TemplateTable::invokeinterface(int byte_no) {
3191 transition(vtos, vtos);
3192 assert(byte_no == f1_byte, "use this argument");
3193
3194 const Register Rinterface = G1_scratch;
3195 const Register Rmethod = Lscratch;
3196 const Register Rret = G3_scratch;
3197 const Register O0_recv = O0;
3198 const Register O1_flags = O1;
3199 const Register O2_Klass = O2;
3200 const Register Rscratch = G4_scratch;
3201 assert_different_registers(Rscratch, G5_method);
3202
3203 prepare_invoke(byte_no, Rinterface, Rret, Rmethod, O0_recv, O1_flags);
3204
3205 // get receiver klass
3206 __ null_check(O0_recv, oopDesc::klass_offset_in_bytes());
3207 __ load_klass(O0_recv, O2_Klass);
3208
3209 // Special case of invokeinterface called for virtual method of
3210 // java.lang.Object. See cpCacheOop.cpp for details.
3211 // This code isn't produced by javac, but could be produced by
3212 // another compliant java compiler.
3213 Label notMethod;
3214 __ set((1 << ConstantPoolCacheEntry::is_forced_virtual_shift), Rscratch);
3215 __ btst(O1_flags, Rscratch);
3216 __ br(Assembler::zero, false, Assembler::pt, notMethod);
3217 __ delayed()->nop();
3218
3219 invokeinterface_object_method(O2_Klass, Rinterface, Rret, O1_flags);
3220
3221 __ bind(notMethod);
3222
3223 Register Rtemp = O1_flags;
3224
3225 Label L_no_such_interface;
3226
3227 // Receiver subtype check against REFC.
3228 __ lookup_interface_method(// inputs: rec. class, interface, itable index
3229 O2_Klass, Rinterface, noreg,
3230 // outputs: temp reg1, temp reg2, temp reg3
3231 G5_method, Rscratch, Rtemp,
3232 L_no_such_interface,
3233 /*return_method=*/false);
3234
3235 __ profile_virtual_call(O2_Klass, O4);
3236
3237 //
3238 // find entry point to call
3239 //
3240
3241 // Get declaring interface class from method
3242 __ ld_ptr(Rmethod, Method::const_offset(), Rinterface);
3243 __ ld_ptr(Rinterface, ConstMethod::constants_offset(), Rinterface);
3244 __ ld_ptr(Rinterface, ConstantPool::pool_holder_offset_in_bytes(), Rinterface);
3245
|
3185 __ profile_virtual_call(RKlass, O4);
3186 generate_vtable_call(RKlass, Rindex, Rret);
3187 }
3188
3189
3190 void TemplateTable::invokeinterface(int byte_no) {
3191 transition(vtos, vtos);
3192 assert(byte_no == f1_byte, "use this argument");
3193
3194 const Register Rinterface = G1_scratch;
3195 const Register Rmethod = Lscratch;
3196 const Register Rret = G3_scratch;
3197 const Register O0_recv = O0;
3198 const Register O1_flags = O1;
3199 const Register O2_Klass = O2;
3200 const Register Rscratch = G4_scratch;
3201 assert_different_registers(Rscratch, G5_method);
3202
3203 prepare_invoke(byte_no, Rinterface, Rret, Rmethod, O0_recv, O1_flags);
3204
3205 // First check for Object case, then private interface method,
3206 // then regular interface method.
3207
3208 // get receiver klass - this is also a null check
3209 __ null_check(O0_recv, oopDesc::klass_offset_in_bytes());
3210 __ load_klass(O0_recv, O2_Klass);
3211
3212 // Special case of invokeinterface called for virtual method of
3213 // java.lang.Object. See cpCache.cpp for details.
3214 Label notObjectMethod;
3215 __ set((1 << ConstantPoolCacheEntry::is_forced_virtual_shift), Rscratch);
3216 __ btst(O1_flags, Rscratch);
3217 __ br(Assembler::zero, false, Assembler::pt, notObjectMethod);
3218 __ delayed()->nop();
3219
3220 invokeinterface_object_method(O2_Klass, Rinterface, Rret, O1_flags);
3221
3222 __ bind(notObjectMethod);
3223
3224 Label L_no_such_interface;
3225
3226 // Check for private method invocation - indicated by vfinal
3227 Label notVFinal;
3228 {
3229 __ set((1 << ConstantPoolCacheEntry::is_vfinal_shift), Rscratch);
3230 __ btst(O1_flags, Rscratch);
3231 __ br(Assembler::zero, false, Assembler::pt, notVFinal);
3232 __ delayed()->nop();
3233
3234 Label subtype;
3235 Register Rtemp = O1_flags;
3236 __ check_klass_subtype(O2_Klass, Rinterface, Rscratch, Rtemp, subtype);
3237 // If we get here the typecheck failed
3238 __ ba(L_no_such_interface);
3239 __ delayed()->nop();
3240 __ bind(subtype);
3241
3242 // do the call
3243 Register Rcall = Rinterface;
3244 __ mov(Rmethod, G5_method);
3245 assert_different_registers(Rcall, G5_method, Gargs, Rret);
3246
3247 __ profile_arguments_type(G5_method, Rcall, Gargs, true);
3248 __ profile_final_call(Rscratch);
3249 __ call_from_interpreter(Rcall, Gargs, Rret);
3250 }
3251 __ bind(notVFinal);
3252
3253 Register Rtemp = O1_flags;
3254
3255 // Receiver subtype check against REFC.
3256 __ lookup_interface_method(// inputs: rec. class, interface, itable index
3257 O2_Klass, Rinterface, noreg,
3258 // outputs: temp reg1, temp reg2, temp reg3
3259 G5_method, Rscratch, Rtemp,
3260 L_no_such_interface,
3261 /*return_method=*/false);
3262
3263 __ profile_virtual_call(O2_Klass, O4);
3264
3265 //
3266 // find entry point to call
3267 //
3268
3269 // Get declaring interface class from method
3270 __ ld_ptr(Rmethod, Method::const_offset(), Rinterface);
3271 __ ld_ptr(Rinterface, ConstMethod::constants_offset(), Rinterface);
3272 __ ld_ptr(Rinterface, ConstantPool::pool_holder_offset_in_bytes(), Rinterface);
3273
|