-
Notifications
You must be signed in to change notification settings - Fork 155
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
Atomic operations. #523
Atomic operations. #523
Conversation
I don't think this requires some specific opcodes, especially since the C version - which is supposed to be faster - is based on library function calls. |
Good point about library calls on MSVC, I should replace those with the intrinsics. But for GCC/Clang it already uses instrinsics, which do not call library functions: Godbolt |
dc23476
to
1df79d8
Compare
What's the status here? I'm willing to merge the hxcpp PR, but I'm unsure where we're at for HL. |
That's a lot of code. I'm curious what's the rationale for supporting all 8/16/32/64 bits int values ? I think 32 + ptr only would be good enough. |
Hashlink has 8/16/32/64 bit int types, so I thought it made sense to already implement atomic operations for all of them even though there are no AtomicI8/16/64 types (yet).
Having them in hl.h could be useful if someone needs atomic operations when, for example, writing a hdll. |
I think we should keep things more simple with only int32 atomics and using primitives instead of opcodes. |
1df79d8
to
6c990be
Compare
I've removed the 8/16/64 bit atomics, and switched everything to primitives. |
@ncannasse Should this be merged? I'm happy to handle the hxcpp and Haxe side of this, but we need a decision for HL first. |
I could merge the PR but it still contains some JIT support leftovers. |
The leftovers from JIT support have been removed. |
Last change before merge : I think we should directly add atomics to threads.c ;) |
9a276ac
to
c5f64d7
Compare
Thanks ! |
The JIT implementation is based on what GCC emits for it's intrinsics.
The C implementation is copy pasted from what I did for hxcpp.
See HaxeFoundation/haxe#10610