< prev index next >

src/hotspot/share/interpreter/bytecodeInterpreter.cpp

Print this page
@  rev 50381 : 8203188: Add JEP-181 support to the Zero interpreter
|  Reviewed-by: dholmes, chrisphi
o  rev 50380 : Aphs' tracer code for JDK 11.
|
~


2555 
2556         UPDATE_PC_AND_RETURN(0); // I'll be back...
2557       }
2558 
2559       CASE(_invokeinterface): {
2560         u2 index = Bytes::get_native_u2(pc+1);
2561 
2562         // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases
2563         // out so c++ compiler has a chance for constant prop to fold everything possible away.
2564 
2565         ConstantPoolCacheEntry* cache = cp->entry_at(index);
2566         if (!cache->is_resolved((Bytecodes::Code)opcode)) {
2567           CALL_VM(InterpreterRuntime::resolve_from_cache(THREAD, (Bytecodes::Code)opcode),
2568                   handle_exception);
2569           cache = cp->entry_at(index);
2570         }
2571 
2572         istate->set_msg(call_method);
2573 
2574         // Special case of invokeinterface called for virtual method of
2575         // java.lang.Object.  See cpCacheOop.cpp for details.
2576         // This code isn't produced by javac, but could be produced by
2577         // another compliant java compiler.
2578         if (cache->is_forced_virtual()) {
2579           Method* callee;
2580           CHECK_NULL(STACK_OBJECT(-(cache->parameter_size())));
2581           if (cache->is_vfinal()) {
2582             callee = cache->f2_as_vfinal_method();
2583             // Profile 'special case of invokeinterface' final call.
2584             BI_PROFILE_UPDATE_FINALCALL();
2585           } else {
2586             // Get receiver.
2587             int parms = cache->parameter_size();
2588             // Same comments as invokevirtual apply here.
2589             oop rcvr = STACK_OBJECT(-parms);
2590             VERIFY_OOP(rcvr);
2591             Klass* rcvrKlass = rcvr->klass();
2592             callee = (Method*) rcvrKlass->method_at_vtable(cache->f2_as_index());
2593             // Profile 'special case of invokeinterface' virtual call.
2594             BI_PROFILE_UPDATE_VIRTUALCALL(rcvrKlass);
2595           }























2596           istate->set_callee(callee);
2597           istate->set_callee_entry_point(callee->from_interpreted_entry());
2598 #ifdef VM_JVMTI
2599           if (JvmtiExport::can_post_interpreter_events() && THREAD->is_interp_only_mode()) {
2600             istate->set_callee_entry_point(callee->interpreter_entry());
2601           }
2602 #endif /* VM_JVMTI */
2603           istate->set_bcp_advance(5);
2604           UPDATE_PC_AND_RETURN(0); // I'll be back...
2605         }
2606 
2607         // this could definitely be cleaned up QQQ
2608         Method* callee;
2609         Method *interface_method = cache->f2_as_interface_method();
2610         InstanceKlass* iclass = interface_method->method_holder();
2611 
2612         // get receiver
2613         int parms = cache->parameter_size();
2614         oop rcvr = STACK_OBJECT(-parms);
2615         CHECK_NULL(rcvr);
2616         InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
2617 
2618         // Receiver subtype check against resolved interface klass (REFC).
2619         {
2620           Klass* refc = cache->f1_as_klass();
2621           itableOffsetEntry* scan;
2622           for (scan = (itableOffsetEntry*) int2->start_of_itable();
2623                scan->interface_klass() != NULL;
2624                scan++) {
2625             if (scan->interface_klass() == refc) {
2626               break;
2627             }
2628           }




2555 
2556         UPDATE_PC_AND_RETURN(0); // I'll be back...
2557       }
2558 
2559       CASE(_invokeinterface): {
2560         u2 index = Bytes::get_native_u2(pc+1);
2561 
2562         // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases
2563         // out so c++ compiler has a chance for constant prop to fold everything possible away.
2564 
2565         ConstantPoolCacheEntry* cache = cp->entry_at(index);
2566         if (!cache->is_resolved((Bytecodes::Code)opcode)) {
2567           CALL_VM(InterpreterRuntime::resolve_from_cache(THREAD, (Bytecodes::Code)opcode),
2568                   handle_exception);
2569           cache = cp->entry_at(index);
2570         }
2571 
2572         istate->set_msg(call_method);
2573 
2574         // Special case of invokeinterface called for virtual method of
2575         // java.lang.Object.  See cpCache.cpp for details.
2576         Method* callee = NULL;

2577         if (cache->is_forced_virtual()) {

2578           CHECK_NULL(STACK_OBJECT(-(cache->parameter_size())));
2579           if (cache->is_vfinal()) {
2580             callee = cache->f2_as_vfinal_method();
2581             // Profile 'special case of invokeinterface' final call.
2582             BI_PROFILE_UPDATE_FINALCALL();
2583           } else {
2584             // Get receiver.
2585             int parms = cache->parameter_size();
2586             // Same comments as invokevirtual apply here.
2587             oop rcvr = STACK_OBJECT(-parms);
2588             VERIFY_OOP(rcvr);
2589             Klass* rcvrKlass = rcvr->klass();
2590             callee = (Method*) rcvrKlass->method_at_vtable(cache->f2_as_index());
2591             // Profile 'special case of invokeinterface' virtual call.
2592             BI_PROFILE_UPDATE_VIRTUALCALL(rcvrKlass);
2593           }
2594         } else if (cache->is_vfinal()) {
2595           // private interface method invocations
2596           //
2597           // Ensure receiver class actually implements
2598           // the resolved interface class. The link resolver
2599           // does this, but only for the first time this
2600           // interface is being called.
2601           int parms = cache->parameter_size();
2602           oop rcvr = STACK_OBJECT(-parms);
2603           CHECK_NULL(rcvr);
2604           Klass* recv_klass = rcvr->klass();
2605           Klass* resolved_klass = cache->f1_as_klass();
2606           if (!recv_klass->is_subtype_of(resolved_klass)) {
2607             ResourceMark rm(THREAD);
2608             char buf[200];
2609             jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
2610               recv_klass->external_name(),
2611               resolved_klass->external_name());
2612             VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), buf, note_no_trap);
2613           }
2614           callee = cache->f2_as_vfinal_method();
2615         }
2616         if (callee != NULL) {
2617           istate->set_callee(callee);
2618           istate->set_callee_entry_point(callee->from_interpreted_entry());
2619 #ifdef VM_JVMTI
2620           if (JvmtiExport::can_post_interpreter_events() && THREAD->is_interp_only_mode()) {
2621             istate->set_callee_entry_point(callee->interpreter_entry());
2622           }
2623 #endif /* VM_JVMTI */
2624           istate->set_bcp_advance(5);
2625           UPDATE_PC_AND_RETURN(0); // I'll be back...
2626         }
2627 
2628         // this could definitely be cleaned up QQQ

2629         Method *interface_method = cache->f2_as_interface_method();
2630         InstanceKlass* iclass = interface_method->method_holder();
2631 
2632         // get receiver
2633         int parms = cache->parameter_size();
2634         oop rcvr = STACK_OBJECT(-parms);
2635         CHECK_NULL(rcvr);
2636         InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
2637 
2638         // Receiver subtype check against resolved interface klass (REFC).
2639         {
2640           Klass* refc = cache->f1_as_klass();
2641           itableOffsetEntry* scan;
2642           for (scan = (itableOffsetEntry*) int2->start_of_itable();
2643                scan->interface_klass() != NULL;
2644                scan++) {
2645             if (scan->interface_klass() == refc) {
2646               break;
2647             }
2648           }


< prev index next >