Skip to content

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

Merged
mpirvu merged 1 commit into
eclipse-openj9:v0.48.0-releasefrom
dsouzai:resetjni_0.48
Sep 7, 2024
Merged

Reset JNI Addresses if FSD on restore (0.48)#20122
mpirvu merged 1 commit into
eclipse-openj9:v0.48.0-releasefrom
dsouzai:resetjni_0.48

Conversation

@dsouzai

@dsouzai dsouzai commented Sep 5, 2024

Copy link
Copy Markdown
Contributor

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 <dsouzai.gh@gmail.com>
@dsouzai dsouzai added comp:jit criu Used to track CRIU snapshot related work labels Sep 5, 2024
@dsouzai

dsouzai commented Sep 5, 2024

Copy link
Copy Markdown
Contributor Author

@mpirvu this is the 0.48 backport.

fyi @TobiAjila

@mpirvu

mpirvu commented Sep 5, 2024

Copy link
Copy Markdown
Contributor

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

@mpirvu

mpirvu commented Sep 7, 2024

Copy link
Copy Markdown
Contributor

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