RFR: JDK-8294947: Use 64bit atomics in patch_verified_entry on x86_64
Dmitry Samersoff
dsamersoff at openjdk.org
Fri Nov 11 09:21:07 UTC 2022
On Wed, 9 Nov 2022 17:36:05 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> In the void NativeJump::patch_verified_entry() we atomically patch first 4 bytes, then atomically patch 5th byte, then atomically patch first 4 bytes again. But from CMC (cross-modified code) point of view it's better to patch atomically 8 bytes at once.
>>
>> The patch was tested with hotspot jtreg tests in bare-metal and virtualized environments.
>
> src/hotspot/cpu/x86/nativeInst_x86.cpp line 532:
>
>> 530:
>> 531: #else
>> 532: unsigned char code_buffer[5];
>
> Should this be aligned?
I would prefer to keep original 32bit code, that is here for ages, as it is. Verified entry point is always aligned, so alignment shouldn't be a problem.
> src/hotspot/cpu/x86/nativeInst_x86.cpp line 562:
>
>> 560:
>> 561: // Patch bytes 0-3 (from jump instruction)
>> 562: *(int32_t*)verified_entry = *(int32_t *)code_buffer;
>
> Is this store and at line 552 atomic?
This code is also inherited.
On x86 pointer sized stores is atomic, I used Atomic::store in 64bit code above just to improve readability.
-------------
PR: https://git.openjdk.org/jdk/pull/11059
More information about the hotspot-compiler-dev
mailing list