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

Force inlining of classloading instrumentations to prevent indy recursions #13282

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

JonasKunz
Copy link
Contributor

@JonasKunz JonasKunz commented Feb 12, 2025

Attempts to fix the problems uncovered by #13095. Also includes the changes from this PR to always run the full test matrix with indy.

OpenJ9 makes things hard for invokedynamic instrumentation in combination with our classloader instrumentations.
The problem is that in OpenJ9 the bootstrapclassloader is implemented in java and also calls / uses Classloader.loadClass from its superclass. Even if we prevent recursions from happening in the bootstrapping, the problem still remains: After the bootstrap method returns, the JDK will still execute some code to finalize the invokedynamic binding, which again involves classloading from the bootstrap classloader.

This PR forces classloader.loadClass instrumentations to be inlined, but without relying on the inlining-infrastructure we want to eventually remove. Instead it uses the TypeTransformer.applyTransformer escape hatch also used by the lambda instrumentation.

trask and others added 4 commits January 23, 2025 18:31
…g-fix

# Conflicts:
#	.github/workflows/build-daily-no-build-cache.yml
#	.github/workflows/build-daily.yml
#	.github/workflows/reusable-test-indy.yml
@JonasKunz JonasKunz added the test openj9 This label can be applied to PRs to trigger them to run openj9 tests label Feb 12, 2025
@JonasKunz
Copy link
Contributor Author

@trask this seems to be successful in fixing the underlying issue. The test failures just come from the fact that a new variable (indy) was added to the GH-actions matrix which isn't accounted for in the rest of the workflow. Do you want to move ahead with this addition to the test matrix or was it just an experiment?

@trask
Copy link
Member

trask commented Feb 13, 2025

@trask this seems to be successful in fixing the underlying issue. The test failures just come from the fact that a new variable (indy) was added to the GH-actions matrix which isn't accounted for in the rest of the workflow. Do you want to move ahead with this addition to the test matrix or was it just an experiment?

ya, I think it would be good to add this to our regular automated testing, as part of moving it towards the default mechanism

@JonasKunz JonasKunz marked this pull request as ready for review February 17, 2025 13:35
@JonasKunz JonasKunz requested a review from a team as a code owner February 17, 2025 13:35
Comment on lines +39 to +40
public List<String> injectedClassNames() {
return getAdditionalHelperClassNames();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, do the classes are injected in the target CL or is it only their proxies that happen to have the same name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to use proxies here, because then we'd go through the same invokedynamic recursions again. Therefore the classes are directly injected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test openj9 This label can be applied to PRs to trigger them to run openj9 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants