-
Notifications
You must be signed in to change notification settings - Fork 712
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
Getting JRebel to work with -agentpath on openJ9 #2751
Comments
Reference to the JVMTI spec's VMStart event: https://docs.oracle.com/javase/10/docs/specs/jvmti.html#VMStart
We'll need to check when OpenJ9 sends the event and check the RI's behaviour to see if all classes loaded before this event are loaded into |
I played around some more: Finally we got a new idea for an integration. Maybe we could use the jvmti extensions mechanism? |
This is a great idea! Much better than trying to match undocumented behaviour of the RI. |
working on this. |
Note: #2839 (comment)
Please check with @hangshao0 if his WIP PR is going to cover this issue as well. |
JRebel needs to add additional classes, #2839 won't fix this. |
The proposed fix to #2839 fixed our issues described in here. |
Closing since #2845 resolves this. |
We are having some issues to get JRebel to work with openJ9 as with a native agent bootstrap (-agentpath)
The current main question is: Is there some way to define a class into the 'java.base' module very early on; by early I mean so it can be used as a super-type to String.
Potentially something equivalent of '--patch-module', but accessible at 'Agent_OnLoad' time. I know the equivalent system properties have already been read at that time, and none of the JVM-TI or JNI spec functions allows for setting patch module paths.
When I use a plain javaagent and --patch-module then I am able to get our stuff working. Because classes from --patch-module java.base path are defined into java.base.
I got it working on my machine with a hack for createramclass.cpp~2800
I played around with hardcoded positions of javaBaseModule and unamedModuleForSystemLoader in J9JavaVM before defining a class.
e.g. Before defining one of our classes, that is suppoesd to go into java.base, I sat J9JavaVM->unamedModuleForSystemLoader=J9JavaVM->javaBaseModule in our agent and reverted if after define was done.
I know now that the pointer offset of javaBaseModule from the beginning of J9JavaVM is 18800 in my local openJ9 build.
But this has the problem that the relative locations of those modules probably changes from JVM version to JVM version.
We would need some reliable way to get the classes we need into java.base.
If possible maybe a new internal JVM property? That we could set in our native agent using the default jni APIs and that is read in createramclass.cpp~2800? to return javaBaseModule instead of unamedModuleForSystemLoader etc?
Some differences open JDK:
After the Object is loaded open JDK does not have the concept of a module so all the classes defined there will go to java.base.
The text was updated successfully, but these errors were encountered: