26 #include "asm/macroAssembler.hpp" |
26 #include "asm/macroAssembler.hpp" |
27 #include "asm/macroAssembler.inline.hpp" |
27 #include "asm/macroAssembler.inline.hpp" |
28 #include "compiler/disassembler.hpp" |
28 #include "compiler/disassembler.hpp" |
29 #include "interpreter/bytecodeHistogram.hpp" |
29 #include "interpreter/bytecodeHistogram.hpp" |
30 #include "interpreter/bytecodeInterpreter.hpp" |
30 #include "interpreter/bytecodeInterpreter.hpp" |
|
31 #include "interpreter/bytecodeStream.hpp" |
31 #include "interpreter/interpreter.hpp" |
32 #include "interpreter/interpreter.hpp" |
32 #include "interpreter/interpreterRuntime.hpp" |
33 #include "interpreter/interpreterRuntime.hpp" |
33 #include "interpreter/interp_masm.hpp" |
34 #include "interpreter/interp_masm.hpp" |
34 #include "interpreter/templateTable.hpp" |
35 #include "interpreter/templateTable.hpp" |
35 #include "memory/allocation.inline.hpp" |
36 #include "memory/allocation.inline.hpp" |
36 #include "memory/metaspaceShared.hpp" |
37 #include "memory/metaspaceShared.hpp" |
37 #include "memory/resourceArea.hpp" |
38 #include "memory/resourceArea.hpp" |
38 #include "oops/arrayOop.hpp" |
39 #include "oops/arrayOop.hpp" |
|
40 #include "oops/constantPool.hpp" |
|
41 #include "oops/cpCache.inline.hpp" |
39 #include "oops/methodData.hpp" |
42 #include "oops/methodData.hpp" |
40 #include "oops/method.hpp" |
43 #include "oops/method.hpp" |
41 #include "oops/oop.inline.hpp" |
44 #include "oops/oop.inline.hpp" |
42 #include "prims/forte.hpp" |
45 #include "prims/forte.hpp" |
43 #include "prims/jvmtiExport.hpp" |
46 #include "prims/jvmtiExport.hpp" |
238 } |
241 } |
239 |
242 |
240 // Return true if the interpreter can prove that the given bytecode has |
243 // Return true if the interpreter can prove that the given bytecode has |
241 // not yet been executed (in Java semantics, not in actual operation). |
244 // not yet been executed (in Java semantics, not in actual operation). |
242 bool AbstractInterpreter::is_not_reached(const methodHandle& method, int bci) { |
245 bool AbstractInterpreter::is_not_reached(const methodHandle& method, int bci) { |
243 Bytecodes::Code code = method()->code_at(bci); |
246 BytecodeStream s(method, bci); |
244 |
247 Bytecodes::Code code = s.next(); |
245 if (!Bytecodes::must_rewrite(code)) { |
248 |
|
249 if (Bytecodes::is_invoke(code)) { |
|
250 assert(!Bytecodes::must_rewrite(code), "invokes aren't rewritten"); |
|
251 ConstantPool* cpool = method()->constants(); |
|
252 |
|
253 Bytecode invoke_bc(s.bytecode()); |
|
254 |
|
255 switch (code) { |
|
256 case Bytecodes::_invokedynamic: { |
|
257 assert(invoke_bc.has_index_u4(code), "sanity"); |
|
258 int method_index = invoke_bc.get_index_u4(code); |
|
259 return cpool->invokedynamic_cp_cache_entry_at(method_index)->is_f1_null(); |
|
260 } |
|
261 case Bytecodes::_invokevirtual: // fall-through |
|
262 case Bytecodes::_invokeinterface: // fall-through |
|
263 case Bytecodes::_invokespecial: // fall-through |
|
264 case Bytecodes::_invokestatic: { |
|
265 if (cpool->has_preresolution()) { |
|
266 return false; // might have been reached |
|
267 } |
|
268 assert(!invoke_bc.has_index_u4(code), "sanity"); |
|
269 int method_index = invoke_bc.get_index_u2_cpcache(code); |
|
270 Method* resolved_method = ConstantPool::method_at_if_loaded(cpool, method_index); |
|
271 return (resolved_method == NULL); |
|
272 } |
|
273 default: ShouldNotReachHere(); |
|
274 } |
|
275 } else if (!Bytecodes::must_rewrite(code)) { |
246 // might have been reached |
276 // might have been reached |
247 return false; |
277 return false; |
248 } |
278 } |
249 |
279 |
250 // the bytecode might not be rewritten if the method is an accessor, etc. |
280 // the bytecode might not be rewritten if the method is an accessor, etc. |