RFR: 8306767: Concurrent repacking of extra data in MethodData is potentially unsafe

Emanuel Peter epeter at openjdk.org
Tue Nov 28 17:23:23 UTC 2023


On Tue, 28 Nov 2023 16:29:19 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

>> src/hotspot/share/runtime/deoptimization.cpp line 2499:
>> 
>>> 2497:     // This will let us detect a repeated trap at this point.
>>> 2498:     {
>>> 2499:       MutexLocker ml(trap_mdo->extra_data_lock());
>> 
>> Doesn't the lock have to be held over the lifetime of the pdata variable?  Otherwise an intervening safepoint could repack the MDO rendering pdata invalid.
>
> Good point. That was done in a similar place above but not here.

Hmm. So is it that I just have to have a lock on `allocate_bci_to_data`, or do I have to protect `pdata`? Because `pdata` is returned from `Deoptimization::query_update_method_data`, and so I would have to make the lock take a wider scope than that function, right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16840#discussion_r1408123487


More information about the hotspot-dev mailing list