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

Reset JNI Addresses if FSD on restore (0.48) #20122

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Sep 5, 2024

If debug is specified on restore, ensure that any proactively compiled JNI Methods are reset to their original address.

JNI methods are not compiled under FSD, but they are compiled proactively in the checkpoint hook. However, if debug is specified on restore, all proactively compiled methods, except for JNI thunks, get invalidated. Thus, the extra field of the J9Method of a JNI method needs to get reset to whatever the VM initialized them to originally.

This is necessary to ensure an environment that is consistent with FSD mode. The invalidation of proactively compiled non-JNI methods (which are non-FSD bodies) ensure that non-FSD code does not execute post-restore. At the checkpoint hook, only FSD bodies are on the stacks of the threads; although the compiler currently does not reuse these FSD bodies, they will continue to execute on restore until an OSR transition, but this is OK because they are already set up for involuntary OSR. The missing piece was the JNI methods, which this commit addresses.

cherry-pick of #20108 (with a merge conflict fixed).

If debug is specified on restore, ensure that any proactively compiled
JNI Methods are reset to their original address.

JNI methods are not compiled under FSD, but they are compiled
proactively in the checkpoint hook. However, if debug is specified on
restore, all proactively compiled methods, except for JNI thunks, get
invalidated. Thus, the extra field of the J9Method of a JNI method
needs to get reset to whatever the VM initialized them to originally.

This is necessary to ensure an environment that is consistent with FSD
mode. The invalidation of proactively compiled non-JNI methods (which
are non-FSD bodies) ensure that non-FSD code does not execute
post-restore. At the checkpoint hook, only FSD bodies are on the stacks
of the threads; although the compiler currently does not reuse these
FSD bodies, they will continue to execute on restore until an OSR
transition, but this is OK because they are already set up for
involuntary OSR. The missing piece was the JNI methods, which this
commit addresses.

Signed-off-by: Irwin D'Souza <[email protected]>
@dsouzai dsouzai added comp:jit criu Used to track CRIU snapshot related work labels Sep 5, 2024
@dsouzai
Copy link
Contributor Author

dsouzai commented Sep 5, 2024

@mpirvu this is the 0.48 backport.

fyi @TobiAjila

@mpirvu
Copy link
Contributor

mpirvu commented Sep 5, 2024

I will wait on this until tomorrow, so that the original fix goes through the nightly testing.

@mpirvu
Copy link
Contributor

mpirvu commented Sep 7, 2024

I verified that the this change is equivalent to the one in the master branch.

@mpirvu mpirvu merged commit f9be535 into eclipse-openj9:v0.48.0-release Sep 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jit criu Used to track CRIU snapshot related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants