RFR: 8292591: Experimentally add back barrier-less Java thread transitions [v5]

Robbin Ehn rehn at openjdk.org
Mon Sep 12 07:20:56 UTC 2022


On Fri, 9 Sep 2022 18:54:18 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> add_operation() arms poll.
>> try_process() reads JavaThread state.
>> 
>> Since are allowing the CPU to do reordering of instructions, try_process() can see e.g. state in_native after arming the poll.
>> Normally this would be safe, but since we now allow reordering it's not.
>> By emitting the system membar we know that if we see in_native that thread will see the armed poll.
>> 
>> EDIT:
>> You can also see long comment from me above.
>> But yes it's not clear that add_operation() and try_process() are effected by this race when using system membar.
>
> How about a comment above the emit():
> // Separate the poll() in add_operation() above() from the read of JavaThread state
> // in the try_process() call below.

Fixed

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

PR: https://git.openjdk.org/jdk/pull/10123


More information about the hotspot-dev mailing list