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

Use the dependency table as class loader fallback #20557

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cjjdespres
Copy link
Contributor

@cjjdespres cjjdespres commented Nov 11, 2024

The dependency table tracks currently-loaded RAM classes with valid class chains by their offset, so it can be used as a fallback during relocation if a class cannot be found in its associated loader or if the loader itself cannot be found.

Related: #20529

The dependency table tracks currently-loaded RAM classes with valid
class chains by their offset, so it can be used as a fallback during
relocation if a class cannot be found in its associated loader or if the
loader itself cannot be found.

Signed-off-by: Christian Despres <[email protected]>
@cjjdespres
Copy link
Contributor Author

Attn @mpirvu. This isn't directly related to the dependency tracking - it just happens to be possible with the dependencyTable. It fixes some relocation failures in acmeair caused by the fact that benchmark has a class loader whose first-loaded class is the same as that of a previous class loader.

@cjjdespres
Copy link
Contributor Author

It fixes some relocation failures in acmeair caused by the fact that benchmark has a class loader whose first-loaded class is the same as that of a previous class loader.

I went back in the acmeair logs to double-check that, and my recollection was wrong. I'm fairly sure that I have seen that kind of error, where the loader itself cannot be found, but from the logs of one of the tests I ran it looks like most of the times this actually succeeds as a fallback is when the class in question is a lambda.

For instance, the relocation records of java/util/regex/Pattern$CharProperty.match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z mention java/util/regex/Pattern$$Lambda/0x0000000000000000 several times, and that cannot be found in its associated loader (I think the bootstrap loader), but we can find it by offset in the dependency table map.

Those lookups happen by name in the loader, and I think it's known that we have a hard time finding these lambdas in that way.

@cjjdespres
Copy link
Contributor Author

I'm unsure about using rememberClass in the dependency table. Technically it could block some classes from being remembered, say if class A were loaded and unloaded, then class B with the same ROM class were loaded in its place, and AOT compilations tried to construct relocation records referencing B. I'm not sure how often that happens in practice.

Signed-off-by: Christian Despres <[email protected]>
@cjjdespres cjjdespres marked this pull request as draft November 15, 2024 13:25
@cjjdespres
Copy link
Contributor Author

I've had to pull one or two things from this PR, since it will only be going in after the main work has been merged. I'll fix this up after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants