[webkit-changes] [WebKit/WebKit] 3abcc5: [JSC] Fix conflict when newValue is eax in AtomicS...
Yijia Huang
noreply at github.com
Tue Jul 30 08:26:52 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3abcc59cf54142dbdfaccaf3fe4d9fc91a1a3b0b
https://github.com/WebKit/WebKit/commit/3abcc59cf54142dbdfaccaf3fe4d9fc91a1a3b0b
Author: Yijia Huang <yijia_huang at apple.com>
Date: 2024-07-30 (Tue, 30 Jul 2024)
Changed paths:
A JSTests/stress/atomics-sub.js
M Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
Log Message:
-----------
[JSC] Fix conflict when newValue is eax in AtomicStrongCAS for X86_64
https://bugs.webkit.org/show_bug.cgi?id=276777
rdar://132482715
Reviewed by Keith Miller.
The cmpxchg instruction requires the `al` register (lower 8 bits of `eax`)
for the comparison and also updates the `al` register based on the
comparison result.
To perform the cmpxchg operation correctly in `AtomicStrongCAS`, the
`expectedAndResult` value must be in the `al` register. After the operation,
the result (either the original memory value or the new swapped value) must
be stored back in `expectedAndResult`.
The current implementation of `AtomicStrongCAS` already handles the cases where
`expectedAndResult`, `address.base`, or `address.index` might be aliases of `eax`.
This patch ensures proper handling when `newValue` is `eax` to avoid register
conflicts during the `AtomicStrongCAS` operations.
[1] https://www.felixcloutier.com/x86/cmpxchg
* JSTests/stress/atomics-sub.js: Added.
* Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::atomicStrongCAS8):
(JSC::MacroAssemblerX86Common::atomicStrongCAS16):
(JSC::MacroAssemblerX86Common::atomicStrongCAS32):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS8):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS16):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS32):
Canonical link: https://commits.webkit.org/281565@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list