[jdk18] RFR: 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!

Coleen Phillimore coleenp at openjdk.java.net
Mon Jan 10 22:55:38 UTC 2022


On Mon, 10 Jan 2022 07:46:24 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> Adapter creation during method linking may fail due to a lack of code cache space which leads to a `VirtualMachineError` being thrown and thus a bail out from linking the holder klass:
> https://github.com/openjdk/jdk18/blob/d65c665839c0a564c422ef685f2673fac37315d7/src/hotspot/share/oops/method.cpp#L1239-L1247
> 
> If the `VirtualMachineError` is handled/ignored by the application, we may later attempt to link the same klass and therefore also the same method again. We then incorrectly bail out from adapter creation because the `_i2i_entry` is set, assuming that this can only happen if adapters have already been created. However, that is not guaranteed because the interpreter entry is set right **before** adapters are created:
> https://github.com/openjdk/jdk18/blob/d65c665839c0a564c422ef685f2673fac37315d7/src/hotspot/share/oops/method.cpp#L1213-L1230
> 
> I propose to instead check if adapters have been created.
> 
> This is an old bug that was just recently triggered by an unrelated change.
> 
> Thanks,
> Tobias

Looks good.  You should update the copyrights to 2022 though.

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

Marked as reviewed by coleenp (Reviewer).

PR: https://git.openjdk.java.net/jdk18/pull/88


More information about the hotspot-dev mailing list