RFR: 8365047: Remove exception handler stub code in C2 [v10]

Ruben duke at openjdk.org
Fri Nov 7 00:20:19 UTC 2025


On Thu, 6 Nov 2025 23:58:46 GMT, Dean Long <dlong at openjdk.org> wrote:

> We are seeing some new crashes ([JDK-8371388](https://bugs.openjdk.org/browse/JDK-8371388)) trying to access a PC that is just past the end of the nmethod and the page is unmapped because it also happens to be the last page of the CodeHeap. Could it be related to the changes in this PR?

Yes, I think it could be similar to the case fixed for AArch64 post-call NOP check earlier: https://github.com/openjdk/jdk/blob/e34a831814996be3e0a2df86b11b1718a76ea558/src/hotspot/cpu/x86/nativeInst_x86.hpp#L584 reads a 32-bit integer from the perceived call site. In case of the deoptimization handler, which is potentially located at the end of the code blob, the read would happen past the end of the code blob - which might cause the access to an unmapped page.

It could be replaced with the two-step comparison: first the comparison matching size of the `jmp` instruction (I believe that's 2 bytes), and if that's successful then comparison of the third byte as the second step. Alternatively, the specific deoptimization stub code could be extended by a `nop` in the `emit_deopt_handler`.

Would either of these options be suitable?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3499929974


More information about the hotspot-dev mailing list