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

(0.45) ScopedMemoryAccess closeScope0 Updates #19433

Merged

Conversation

babsingh
Copy link
Contributor

@babsingh babsingh commented May 2, 2024

In JDK22, the definition has changed to

native void
closeScope0(MemorySessionImpl session, ScopedAccessError error);

The return type has changed from boolean to void, and a second
parameter is re-introduced: "ScopedAccessError error".

Previously, closeScope0 would be retried until it returned true,
which suggested that the scope/session was not found on any thread's
stack.

The new behaviour sets an asynchronous exception for all threads,
which have the scope/session on their stack. The second parameter,
error, is the asynchronous exception, which is thrown. Before
throwing the error, the thread verifies if the scope/session is
still on the stack. If not, the asynchronous exception is cleared
and not thrown.

Related: eclipse-openj9#13211 (comment)

Signed-off-by: Babneet Singh <[email protected]>
There are gaps where async exceptions are not processed in time (e.g.
JIT compiled code in a loop). Threads will wait in closeScope0 until
J9VMThread->scopedError (async exception) is transferred to
J9VMThread->currentException. The wait prevents a MemorySession to be
closed until no more operations are being performed on it.

Related: eclipse-openj9#13211

Signed-off-by: Babneet Singh <[email protected]>
@babsingh babsingh changed the title (0.45) ScopedMemoryAccess closeScope0 updates (0.45) ScopedMemoryAccess closeScope0 Updates May 2, 2024
@babsingh babsingh requested a review from pshipton May 2, 2024 13:39
@pshipton pshipton merged commit 8c94893 into eclipse-openj9:v0.45.0-release May 2, 2024
2 checks 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.

2 participants