RFR: 8365047: Remove exception handler stub code in C2 [v2]
Ruben
duke at openjdk.org
Thu Aug 28 13:34:44 UTC 2025
On Thu, 28 Aug 2025 13:02:33 GMT, Andrew Dinn <adinn at openjdk.org> wrote:
>>> Looks good! Thanks @ruben-arm!
>>
>> Thank you @dafedafe.
>>
>> In the meantime, I realized the AArch32 tests weren't run during my testing earlier - and attempted running them. I found that many of the tests are failing without this patch. Nevertheless, I noticed that more tests are failing with this patch. I've just identified the root cause - described below. This issue is caused by the current version of the patch - at least for AArch32.
>>
>> Once the exception handler stub code is removed, the deoptimization handler stub code can become adjacent to the main code. Occasionally the main code ends with a `BL` which is never meant to return. That `BL` - if adjacent to the stub code - writes the address of the deoptimization stub code into `LR`, causing an issue for subsequent frame processing, as the design assumption is: if a return address points to the deoptimization stub code, then deoptimization is in progress.
>> For this to apply, there should be no call instructions right before the deoptimization stub code.
>>
>> Presumably, the most straightforward fix could be to emit a `NOP` at the end of the main code if otherwise a `BL`/`BLR` would be the last instruction there. I'd appreciate feedback on whether this approach is acceptable.
>
> @ruben-arm BTW, what exactly do you mean by 'the main code'?
@adinn By the "main code" I mean the region of an `nmethod` between the entry point and the `nmethod`'s stub code.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3233523971
More information about the hotspot-dev
mailing list