-
Notifications
You must be signed in to change notification settings - Fork 397
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
Codegen Support for atomic method symbols #2958
Comments
Do we have tests added which exercise these symbols? How exactly do we know we've implemented them correctly? |
Unfortunately we don't have tests now. They are only being tested in OpenJ9 through OpenJ9's tests. |
I think we need to push the tests down into OMR then. If we wish to support an OMR API we should also have tests written against the respective API, otherwise the semantics of the APIs will diverge between codegens and non-OpenJ9 users of the APIs could potentially introduce changes which will break OpenJ9. |
Not related to the discussion of adding test, but to show an idea of how large the item will be. Calls with the atomic method symbols share the same evaluator helper on X, which is https://github.com/eclipse/omr/blob/master/compiler/x/codegen/OMRTreeEvaluator.cpp#L2981 |
Although the existing evaluators for Unsafe.CAS or JUC's Atomic classes methods can be largely reused, |
That raised a very interesting point. I was looking at this problem more from the Java side. I think we can or need to have different versions of the atomic symbols. C++ has acquire, release, weak and strong version for their atomics to enforce different memory orders. Java has also added variations to Unsafe methods since Java9 (the newly added methods call to the strong version so we do nothing about them currently). For the method symbols listed in this issue, I would say they are the strong ones, so we can reuse what we have for Java. |
Implement inlined intrinsic support for the following symbols as defined in eclipse-omr#2958: - atomicAdd32BitSymbol - atomicAdd64BitSymbol - atomicFetchAndAdd32BitSymbol - atomicFetchAndAdd64BitSymbol - atomicSwap32BitSymbol - atomicSwap64BitSymbol Signed-off-by: Filip Jeremic <[email protected]>
Implement inlined intrinsic support for the following symbols as defined in eclipse-omr#2958: - atomicAdd32BitSymbol - atomicAdd64BitSymbol - atomicFetchAndAdd32BitSymbol - atomicFetchAndAdd64BitSymbol - atomicSwap32BitSymbol - atomicSwap64BitSymbol Signed-off-by: Filip Jeremic <[email protected]>
Implement inlined intrinsic support for the following symbols as defined in eclipse-omr#2958: - atomicAdd32BitSymbol - atomicAdd64BitSymbol - atomicFetchAndAdd32BitSymbol - atomicFetchAndAdd64BitSymbol - atomicSwap32BitSymbol - atomicSwap64BitSymbol Signed-off-by: Filip Jeremic <[email protected]>
As code evolves, we're going to deprecate
|
x86 now supports atomic method symbols whose semantics are equivalent to common atomic operations such as fetch-and-add.
Currently we have the following method symbols
Four more symbols @0dvictor is trying to add on x86 are (see #2174)
They should be supported on all platforms. FYI @fjeremic @gita-omr @JamesKingdon
Edit:
Current implementation of atomicSwap* doesn't work on reference types because the lack of write bar and read bar. The support should be added.
Edit on October 5, 2018:
We also need to have separate symbols for object types. Object types are different because write barrier and read barrier might be required. They can be implemented the same as the primitive ones on OMR but having separate symbols allow the downstream projects to override the OMR implementation.
The text was updated successfully, but these errors were encountered: