1 /* |
1 /* |
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
1232 |
1232 |
1233 handler_address = |
1233 handler_address = |
1234 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); |
1234 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); |
1235 |
1235 |
1236 if (handler_address == NULL) { |
1236 if (handler_address == NULL) { |
1237 Handle original_exception(thread, exception()); |
1237 bool recursive_exception = false; |
1238 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); |
1238 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception); |
1239 assert (handler_address != NULL, "must have compiled handler"); |
1239 assert (handler_address != NULL, "must have compiled handler"); |
1240 // Update the exception cache only when the unwind was not forced |
1240 // Update the exception cache only when the unwind was not forced |
1241 // and there didn't happen another exception during the computation of the |
1241 // and there didn't happen another exception during the computation of the |
1242 // compiled exception handler. |
1242 // compiled exception handler. Checking for exception oop equality is not |
1243 if (!force_unwind && original_exception() == exception()) { |
1243 // sufficient because some exceptions are pre-allocated and reused. |
|
1244 if (!force_unwind && !recursive_exception) { |
1244 nm->add_handler_for_exception_and_pc(exception,pc,handler_address); |
1245 nm->add_handler_for_exception_and_pc(exception,pc,handler_address); |
1245 } |
1246 } |
1246 } else { |
1247 } else { |
1247 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); |
1248 #ifdef ASSERT |
|
1249 bool recursive_exception = false; |
|
1250 address computed_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception); |
|
1251 assert(recursive_exception || (handler_address == computed_address), err_msg("Handler address inconsistency: " PTR_FORMAT " != " PTR_FORMAT, |
|
1252 p2i(handler_address), p2i(computed_address))); |
|
1253 #endif |
1248 } |
1254 } |
1249 } |
1255 } |
1250 |
1256 |
1251 thread->set_exception_pc(pc); |
1257 thread->set_exception_pc(pc); |
1252 thread->set_exception_handler_pc(handler_address); |
1258 thread->set_exception_handler_pc(handler_address); |