comparison src/share/vm/interpreter/bytecodeInterpreter.cpp @ 2480:4b95bbb36464

7035870: JSR 292: Zero support Summary: This adds support for JSR 292 to Zero. Reviewed-by: twisti Contributed-by: Gary Benson <gbenson@redhat.com>
author twisti
date Tue, 12 Apr 2011 02:40:23 -0700
parents e863062e521d
children f08d439fab8c
comparison
equal deleted inserted replaced
2479:15c9a0e16269 2480:4b95bbb36464
552 /* 0xA8 */ &&opc_jsr, &&opc_ret, &&opc_tableswitch,&&opc_lookupswitch, 552 /* 0xA8 */ &&opc_jsr, &&opc_ret, &&opc_tableswitch,&&opc_lookupswitch,
553 /* 0xAC */ &&opc_ireturn, &&opc_lreturn, &&opc_freturn, &&opc_dreturn, 553 /* 0xAC */ &&opc_ireturn, &&opc_lreturn, &&opc_freturn, &&opc_dreturn,
554 554
555 /* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic, 555 /* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic,
556 /* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial, 556 /* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial,
557 /* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_default, &&opc_new, 557 /* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_invokedynamic,&&opc_new,
558 /* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow, 558 /* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow,
559 559
560 /* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit, 560 /* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit,
561 /* 0xC4 */ &&opc_wide, &&opc_multianewarray, &&opc_ifnull, &&opc_ifnonnull, 561 /* 0xC4 */ &&opc_wide, &&opc_multianewarray, &&opc_ifnull, &&opc_ifnonnull,
562 /* 0xC8 */ &&opc_goto_w, &&opc_jsr_w, &&opc_breakpoint, &&opc_default, 562 /* 0xC8 */ &&opc_goto_w, &&opc_jsr_w, &&opc_breakpoint, &&opc_default,
566 /* 0xD4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 566 /* 0xD4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
567 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 567 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
568 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 568 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
569 569
570 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 570 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
571 /* 0xE4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_return_register_finalizer, 571 /* 0xE4 */ &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, &&opc_return_register_finalizer,
572 /* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 572 /* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
573 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 573 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
574 574
575 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 575 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
576 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, 576 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
1716 } 1716 }
1717 most_recent++; 1717 most_recent++;
1718 } 1718 }
1719 // Need to throw illegal monitor state exception 1719 // Need to throw illegal monitor state exception
1720 CALL_VM(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD), handle_exception); 1720 CALL_VM(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD), handle_exception);
1721 // Should never reach here... 1721 ShouldNotReachHere();
1722 assert(false, "Should have thrown illegal monitor exception");
1723 } 1722 }
1724 1723
1725 /* All of the non-quick opcodes. */ 1724 /* All of the non-quick opcodes. */
1726 1725
1727 /* -Set clobbersCpIndex true if the quickened opcode clobbers the 1726 /* -Set clobbersCpIndex true if the quickened opcode clobbers the
2145 default: ShouldNotReachHere(); 2144 default: ShouldNotReachHere();
2146 } 2145 }
2147 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2); 2146 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2);
2148 } 2147 }
2149 2148
2149 CASE(_fast_aldc_w):
2150 CASE(_fast_aldc): {
2151 if (!EnableInvokeDynamic) {
2152 // We should not encounter this bytecode if !EnableInvokeDynamic.
2153 // The verifier will stop it. However, if we get past the verifier,
2154 // this will stop the thread in a reasonable way, without crashing the JVM.
2155 CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
2156 handle_exception);
2157 ShouldNotReachHere();
2158 }
2159
2160 u2 index;
2161 int incr;
2162 if (opcode == Bytecodes::_fast_aldc) {
2163 index = pc[1];
2164 incr = 2;
2165 } else {
2166 index = Bytes::get_native_u2(pc+1);
2167 incr = 3;
2168 }
2169
2170 // We are resolved if the f1 field contains a non-null object (CallSite, etc.)
2171 // This kind of CP cache entry does not need to match the flags byte, because
2172 // there is a 1-1 relation between bytecode type and CP entry type.
2173 ConstantPoolCacheEntry* cache = cp->entry_at(index);
2174 if (cache->is_f1_null()) {
2175 CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode),
2176 handle_exception);
2177 }
2178
2179 VERIFY_OOP(cache->f1());
2180 SET_STACK_OBJECT(cache->f1(), 0);
2181 UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
2182 }
2183
2184 CASE(_invokedynamic): {
2185 if (!EnableInvokeDynamic) {
2186 // We should not encounter this bytecode if !EnableInvokeDynamic.
2187 // The verifier will stop it. However, if we get past the verifier,
2188 // this will stop the thread in a reasonable way, without crashing the JVM.
2189 CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
2190 handle_exception);
2191 ShouldNotReachHere();
2192 }
2193
2194 int index = Bytes::get_native_u4(pc+1);
2195
2196 // We are resolved if the f1 field contains a non-null object (CallSite, etc.)
2197 // This kind of CP cache entry does not need to match the flags byte, because
2198 // there is a 1-1 relation between bytecode type and CP entry type.
2199 assert(constantPoolCacheOopDesc::is_secondary_index(index), "incorrect format");
2200 ConstantPoolCacheEntry* cache = cp->secondary_entry_at(index);
2201 if (cache->is_f1_null()) {
2202 CALL_VM(InterpreterRuntime::resolve_invokedynamic(THREAD),
2203 handle_exception);
2204 }
2205
2206 VERIFY_OOP(cache->f1());
2207 oop method_handle = java_lang_invoke_CallSite::target(cache->f1());
2208 CHECK_NULL(method_handle);
2209
2210 istate->set_msg(call_method_handle);
2211 istate->set_callee((methodOop) method_handle);
2212 istate->set_bcp_advance(5);
2213
2214 UPDATE_PC_AND_RETURN(0); // I'll be back...
2215 }
2216
2150 CASE(_invokeinterface): { 2217 CASE(_invokeinterface): {
2151 u2 index = Bytes::get_native_u2(pc+1); 2218 u2 index = Bytes::get_native_u2(pc+1);
2152 2219
2153 // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases 2220 // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases
2154 // out so c++ compiler has a chance for constant prop to fold everything possible away. 2221 // out so c++ compiler has a chance for constant prop to fold everything possible away.