Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomics #171

Merged
merged 11 commits into from
Feb 24, 2024
Merged

Atomics #171

merged 11 commits into from
Feb 24, 2024

Conversation

Maqrkk
Copy link
Member

@Maqrkk Maqrkk commented Nov 1, 2023

Add support for atomics

llvm/include/llvm/Cheerp/Writer.h Show resolved Hide resolved
llvm/lib/CheerpUtils/CheerpLowerAtomic.cpp Outdated Show resolved Hide resolved
@Maqrkk Maqrkk force-pushed the atomics branch 2 times, most recently from 126a70d to 5b7aa99 Compare December 13, 2023 11:22
Copy link
Member

@yuri91 yuri91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Waiting for the tests to pass before merging

llvm/lib/CheerpUtils/TypeOptimizer.cpp Show resolved Hide resolved
llvm/lib/CheerpUtils/TypeOptimizer.cpp Outdated Show resolved Hide resolved
This pass is meant to remove atomics by invoking the existing LowerAtomicPass
only on genericjs functions.
TypeOptimizer would create new named structs as copies of literal structs. This caused a problem in the case of literal structs that are the result of a cmpxchg instruction. During inlining, these create their original return types, and those would conflict with the ones that went through TypeOptimizer.
In turn, we needed a tiny fix in isJSExportedType in order for the literal structs not to cause a crash.
The Mutex uses a 64-bit value to store it's state. It then does atomic operations on this value, resulting in 64-bit atomic operations. These are not supported in AsmJS, so for now we've disabled the Mutex.
@alexp-sssup alexp-sssup merged commit c245c83 into master Feb 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants