Mercurial > hg > truffle
comparison src/share/vm/interpreter/bytecodeInterpreter.cpp @ 6926:a3e2f723f2a5
8000780: make Zero build and run with JDK8
Reviewed-by: coleenp, dholmes, twisti
Contributed-by: Roman Kennke <rkennke@redhat.com>
author | twisti |
---|---|
date | Mon, 29 Oct 2012 11:08:48 -0700 |
parents | d8ce2825b193 |
children | 070d523b96a7 |
comparison
equal
deleted
inserted
replaced
6915:a516debe2cee | 6926:a3e2f723f2a5 |
---|---|
233 continue; \ | 233 continue; \ |
234 } | 234 } |
235 #endif | 235 #endif |
236 #endif | 236 #endif |
237 | 237 |
238 // JavaStack Implementation | |
239 #define MORE_STACK(count) \ | |
240 (topOfStack -= ((count) * Interpreter::stackElementWords)) | |
241 | |
242 | 238 |
243 #define UPDATE_PC(opsize) {pc += opsize; } | 239 #define UPDATE_PC(opsize) {pc += opsize; } |
244 /* | 240 /* |
245 * UPDATE_PC_AND_TOS - Macro for updating the pc and topOfStack. | 241 * UPDATE_PC_AND_TOS - Macro for updating the pc and topOfStack. |
246 */ | 242 */ |
573 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 569 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
574 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 570 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
575 | 571 |
576 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 572 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
577 /* 0xE4 */ &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, &&opc_return_register_finalizer, | 573 /* 0xE4 */ &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, &&opc_return_register_finalizer, |
578 /* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 574 /* 0xE8 */ &&opc_invokehandle,&&opc_default, &&opc_default, &&opc_default, |
579 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 575 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
580 | 576 |
581 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 577 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
582 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 578 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
583 /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | 579 /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
1771 } | 1767 } |
1772 #endif /* VM_JVMTI */ | 1768 #endif /* VM_JVMTI */ |
1773 | 1769 |
1774 oop obj; | 1770 oop obj; |
1775 if ((Bytecodes::Code)opcode == Bytecodes::_getstatic) { | 1771 if ((Bytecodes::Code)opcode == Bytecodes::_getstatic) { |
1776 Klass* k = (Klass*) cache->f1(); | 1772 Klass* k = cache->f1_as_klass(); |
1777 obj = k->java_mirror(); | 1773 obj = k->java_mirror(); |
1778 MORE_STACK(1); // Assume single slot push | 1774 MORE_STACK(1); // Assume single slot push |
1779 } else { | 1775 } else { |
1780 obj = (oop) STACK_OBJECT(-1); | 1776 obj = (oop) STACK_OBJECT(-1); |
1781 CHECK_NULL(obj); | 1777 CHECK_NULL(obj); |
1883 count = -1; | 1879 count = -1; |
1884 if (tos_type == ltos || tos_type == dtos) { | 1880 if (tos_type == ltos || tos_type == dtos) { |
1885 --count; | 1881 --count; |
1886 } | 1882 } |
1887 if ((Bytecodes::Code)opcode == Bytecodes::_putstatic) { | 1883 if ((Bytecodes::Code)opcode == Bytecodes::_putstatic) { |
1888 Klass* k = (Klass*) cache->f1(); | 1884 Klass* k = cache->f1_as_klass(); |
1889 obj = k->java_mirror(); | 1885 obj = k->java_mirror(); |
1890 } else { | 1886 } else { |
1891 --count; | 1887 --count; |
1892 obj = (oop) STACK_OBJECT(count); | 1888 obj = (oop) STACK_OBJECT(count); |
1893 CHECK_NULL(obj); | 1889 CHECK_NULL(obj); |
2188 SET_STACK_OBJECT(result, 0); | 2184 SET_STACK_OBJECT(result, 0); |
2189 UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1); | 2185 UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1); |
2190 } | 2186 } |
2191 | 2187 |
2192 CASE(_invokedynamic): { | 2188 CASE(_invokedynamic): { |
2189 | |
2193 if (!EnableInvokeDynamic) { | 2190 if (!EnableInvokeDynamic) { |
2194 // We should not encounter this bytecode if !EnableInvokeDynamic. | 2191 // We should not encounter this bytecode if !EnableInvokeDynamic. |
2195 // The verifier will stop it. However, if we get past the verifier, | 2192 // The verifier will stop it. However, if we get past the verifier, |
2196 // this will stop the thread in a reasonable way, without crashing the JVM. | 2193 // this will stop the thread in a reasonable way, without crashing the JVM. |
2197 CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD), | 2194 CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD), |
2198 handle_exception); | 2195 handle_exception); |
2199 ShouldNotReachHere(); | 2196 ShouldNotReachHere(); |
2200 } | 2197 } |
2201 | 2198 |
2202 int index = Bytes::get_native_u4(pc+1); | 2199 u4 index = Bytes::get_native_u4(pc+1); |
2200 ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index); | |
2203 | 2201 |
2204 // We are resolved if the resolved_references field contains a non-null object (CallSite, etc.) | 2202 // We are resolved if the resolved_references field contains a non-null object (CallSite, etc.) |
2205 // This kind of CP cache entry does not need to match the flags byte, because | 2203 // This kind of CP cache entry does not need to match the flags byte, because |
2206 // there is a 1-1 relation between bytecode type and CP entry type. | 2204 // there is a 1-1 relation between bytecode type and CP entry type. |
2207 ConstantPool* constants = METHOD->constants(); | 2205 if (! cache->is_resolved((Bytecodes::Code) opcode)) { |
2208 oop result = constants->resolved_references()->obj_at(index); | |
2209 if (result == NULL) { | |
2210 CALL_VM(InterpreterRuntime::resolve_invokedynamic(THREAD), | 2206 CALL_VM(InterpreterRuntime::resolve_invokedynamic(THREAD), |
2211 handle_exception); | 2207 handle_exception); |
2212 result = THREAD->vm_result(); | 2208 cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index); |
2213 } | 2209 } |
2214 | 2210 |
2215 VERIFY_OOP(result); | 2211 Method* method = cache->f1_as_method(); |
2216 oop method_handle = java_lang_invoke_CallSite::target(result); | 2212 VERIFY_OOP(method); |
2217 CHECK_NULL(method_handle); | 2213 |
2218 | 2214 if (cache->has_appendix()) { |
2219 istate->set_msg(call_method_handle); | 2215 ConstantPool* constants = METHOD->constants(); |
2220 istate->set_callee((Method*) method_handle); | 2216 SET_STACK_OBJECT(cache->appendix_if_resolved(constants), 0); |
2217 MORE_STACK(1); | |
2218 } | |
2219 | |
2220 istate->set_msg(call_method); | |
2221 istate->set_callee(method); | |
2222 istate->set_callee_entry_point(method->from_interpreted_entry()); | |
2221 istate->set_bcp_advance(5); | 2223 istate->set_bcp_advance(5); |
2224 | |
2225 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2226 } | |
2227 | |
2228 CASE(_invokehandle): { | |
2229 | |
2230 if (!EnableInvokeDynamic) { | |
2231 ShouldNotReachHere(); | |
2232 } | |
2233 | |
2234 u2 index = Bytes::get_native_u2(pc+1); | |
2235 ConstantPoolCacheEntry* cache = cp->entry_at(index); | |
2236 | |
2237 if (! cache->is_resolved((Bytecodes::Code) opcode)) { | |
2238 CALL_VM(InterpreterRuntime::resolve_invokehandle(THREAD), | |
2239 handle_exception); | |
2240 cache = cp->entry_at(index); | |
2241 } | |
2242 | |
2243 Method* method = cache->f1_as_method(); | |
2244 | |
2245 VERIFY_OOP(method); | |
2246 | |
2247 if (cache->has_appendix()) { | |
2248 ConstantPool* constants = METHOD->constants(); | |
2249 SET_STACK_OBJECT(cache->appendix_if_resolved(constants), 0); | |
2250 MORE_STACK(1); | |
2251 } | |
2252 | |
2253 istate->set_msg(call_method); | |
2254 istate->set_callee(method); | |
2255 istate->set_callee_entry_point(method->from_interpreted_entry()); | |
2256 istate->set_bcp_advance(3); | |
2222 | 2257 |
2223 UPDATE_PC_AND_RETURN(0); // I'll be back... | 2258 UPDATE_PC_AND_RETURN(0); // I'll be back... |
2224 } | 2259 } |
2225 | 2260 |
2226 CASE(_invokeinterface): { | 2261 CASE(_invokeinterface): { |