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