26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/compiledIC.hpp"
30 #include "code/icBuffer.hpp"
31 #include "code/nmethod.hpp"
32 #include "code/pcDesc.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "compiler/compileBroker.hpp"
36 #include "compiler/oopMap.hpp"
37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
38 #include "gc/g1/heapRegion.hpp"
39 #include "gc/shared/barrierSet.hpp"
40 #include "gc/shared/collectedHeap.hpp"
41 #include "gc/shared/gcLocker.inline.hpp"
42 #include "interpreter/bytecode.hpp"
43 #include "interpreter/interpreter.hpp"
44 #include "interpreter/linkResolver.hpp"
45 #include "logging/log.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "oops/objArrayKlass.hpp"
49 #include "oops/oop.inline.hpp"
50 #include "oops/typeArrayOop.inline.hpp"
51 #include "opto/ad.hpp"
52 #include "opto/addnode.hpp"
53 #include "opto/callnode.hpp"
54 #include "opto/cfgnode.hpp"
55 #include "opto/graphKit.hpp"
56 #include "opto/machnode.hpp"
57 #include "opto/matcher.hpp"
58 #include "opto/memnode.hpp"
59 #include "opto/mulnode.hpp"
60 #include "opto/runtime.hpp"
61 #include "opto/subnode.hpp"
62 #include "runtime/atomic.hpp"
63 #include "runtime/fprofiler.hpp"
64 #include "runtime/handles.inline.hpp"
65 #include "runtime/interfaceSupport.hpp"
1270 // directly from compiled code. Compiled code will call the C++ method following.
1271 // We can't allow async exception to be installed during exception processing.
1272 JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* thread, nmethod* &nm))
1273
1274 // Do not confuse exception_oop with pending_exception. The exception_oop
1275 // is only used to pass arguments into the method. Not for general
1276 // exception handling. DO NOT CHANGE IT to use pending_exception, since
1277 // the runtime stubs checks this on exit.
1278 assert(thread->exception_oop() != NULL, "exception oop is found");
1279 address handler_address = NULL;
1280
1281 Handle exception(thread, thread->exception_oop());
1282 address pc = thread->exception_pc();
1283
1284 // Clear out the exception oop and pc since looking up an
1285 // exception handler can cause class loading, which might throw an
1286 // exception and those fields are expected to be clear during
1287 // normal bytecode execution.
1288 thread->clear_exception_oop_and_pc();
1289
1290 if (log_is_enabled(Info, exceptions)) {
1291 ResourceMark rm;
1292 trace_exception(Log(exceptions)::info_stream(), exception(), pc, "");
1293 }
1294
1295 // for AbortVMOnException flag
1296 Exceptions::debug_check_abort(exception);
1297
1298 #ifdef ASSERT
1299 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
1300 // should throw an exception here
1301 ShouldNotReachHere();
1302 }
1303 #endif
1304
1305 // new exception handling: this method is entered only from adapters
1306 // exceptions from compiled java methods are handled in compiled code
1307 // using rethrow node
1308
1309 nm = CodeCache::find_nmethod(pc);
1310 assert(nm != NULL, "No NMethod found");
1311 if (nm->is_native_method()) {
1312 fatal("Native method should not have path to exception handling");
|
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/compiledIC.hpp"
30 #include "code/icBuffer.hpp"
31 #include "code/nmethod.hpp"
32 #include "code/pcDesc.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "compiler/compileBroker.hpp"
36 #include "compiler/oopMap.hpp"
37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
38 #include "gc/g1/heapRegion.hpp"
39 #include "gc/shared/barrierSet.hpp"
40 #include "gc/shared/collectedHeap.hpp"
41 #include "gc/shared/gcLocker.inline.hpp"
42 #include "interpreter/bytecode.hpp"
43 #include "interpreter/interpreter.hpp"
44 #include "interpreter/linkResolver.hpp"
45 #include "logging/log.hpp"
46 #include "logging/logStream.hpp"
47 #include "memory/oopFactory.hpp"
48 #include "memory/resourceArea.hpp"
49 #include "oops/objArrayKlass.hpp"
50 #include "oops/oop.inline.hpp"
51 #include "oops/typeArrayOop.inline.hpp"
52 #include "opto/ad.hpp"
53 #include "opto/addnode.hpp"
54 #include "opto/callnode.hpp"
55 #include "opto/cfgnode.hpp"
56 #include "opto/graphKit.hpp"
57 #include "opto/machnode.hpp"
58 #include "opto/matcher.hpp"
59 #include "opto/memnode.hpp"
60 #include "opto/mulnode.hpp"
61 #include "opto/runtime.hpp"
62 #include "opto/subnode.hpp"
63 #include "runtime/atomic.hpp"
64 #include "runtime/fprofiler.hpp"
65 #include "runtime/handles.inline.hpp"
66 #include "runtime/interfaceSupport.hpp"
1271 // directly from compiled code. Compiled code will call the C++ method following.
1272 // We can't allow async exception to be installed during exception processing.
1273 JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* thread, nmethod* &nm))
1274
1275 // Do not confuse exception_oop with pending_exception. The exception_oop
1276 // is only used to pass arguments into the method. Not for general
1277 // exception handling. DO NOT CHANGE IT to use pending_exception, since
1278 // the runtime stubs checks this on exit.
1279 assert(thread->exception_oop() != NULL, "exception oop is found");
1280 address handler_address = NULL;
1281
1282 Handle exception(thread, thread->exception_oop());
1283 address pc = thread->exception_pc();
1284
1285 // Clear out the exception oop and pc since looking up an
1286 // exception handler can cause class loading, which might throw an
1287 // exception and those fields are expected to be clear during
1288 // normal bytecode execution.
1289 thread->clear_exception_oop_and_pc();
1290
1291 LogTarget(Info, exceptions) lt;
1292 if (lt.is_enabled()) {
1293 ResourceMark rm;
1294 LogStream ls(lt);
1295 trace_exception(&ls, exception(), pc, "");
1296 }
1297
1298 // for AbortVMOnException flag
1299 Exceptions::debug_check_abort(exception);
1300
1301 #ifdef ASSERT
1302 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
1303 // should throw an exception here
1304 ShouldNotReachHere();
1305 }
1306 #endif
1307
1308 // new exception handling: this method is entered only from adapters
1309 // exceptions from compiled java methods are handled in compiled code
1310 // using rethrow node
1311
1312 nm = CodeCache::find_nmethod(pc);
1313 assert(nm != NULL, "No NMethod found");
1314 if (nm->is_native_method()) {
1315 fatal("Native method should not have path to exception handling");
|