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

Atomic-free JNI #2576

Closed
gacholio opened this issue Aug 9, 2018 · 7 comments
Closed

Atomic-free JNI #2576

gacholio opened this issue Aug 9, 2018 · 7 comments
Assignees

Comments

@gacholio
Copy link
Contributor

gacholio commented Aug 9, 2018

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).

@gacholio gacholio self-assigned this Aug 9, 2018
@pshipton pshipton added this to the Release 0.10.0 milestone Sep 4, 2018
@pshipton
Copy link
Member

pshipton commented Sep 4, 2018

@gacholio are we keeping this issue open until ARM and OSX are addressed?

@gacholio
Copy link
Contributor Author

gacholio commented Sep 4, 2018

Ask @DanHeidinga - he made me open it.

@DanHeidinga
Copy link
Member

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.

@pshipton
Copy link
Member

pshipton commented Sep 5, 2018

@gacholio as per #2576 (comment) can you please add the list of PRs so we can close this.

@pshipton
Copy link
Member

pshipton commented Sep 5, 2018

@gacholio
Copy link
Contributor Author

gacholio commented Sep 5, 2018

Close enough

@gacholio gacholio closed this as completed Sep 5, 2018
@pshipton
Copy link
Member

pshipton commented Sep 5, 2018

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

No branches or pull requests

3 participants