-
Notifications
You must be signed in to change notification settings - Fork 720
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-free JNI #2576
Comments
@gacholio are we keeping this issue open until ARM and OSX are addressed? |
Ask @DanHeidinga - he made me open it. |
This should stay open until all the PRs for the Atomic Free JNI work have been listed in this item so that there's a way to find the implementation. ARM / OSX support can be added under separate issues when those platforms get added to the build system. |
@gacholio as per #2576 (comment) can you please add the list of PRs so we can close this. |
I assume its something like https://github.com/eclipse/openj9/pulls?utf8=%E2%9C%93&q=is%3Apr+atomic+author%3Agacholio |
Close enough |
Prior to this work, all synchronization of entering and exitting the VM was performed by using atomic compare-and-swap operations, which are extremely heavyweight. A single machine word contained the state of each thread (in or out of the VM) and any requests from other threads (e.g. exit the VM to allow the GC to run).
This feature replaces the VM entry/exit for JNI natives with a modified Dekker algorithm to avoid the use of atomic operations. Along with the existing state field, a new "inNative" field is added to each thread to indicate whether the thread is cooperating with the VM (inNative == false) or executing native code (inNative == true). Memory barriers are used to ensure the ordering visibility of the two fields. Where possible, the explicit memory barriers on the mutator threads are replaced by system calls to force ordering of execution on all threads in the process (see https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-flushprocesswritebuffers).
The text was updated successfully, but these errors were encountered: