-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8358890: VM option -XX:AllowRedefinitionToAddDeleteMethods should be obsoleted then expired #26232
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
base: master
Are you sure you want to change the base?
Conversation
…obsoleted then expired
👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into |
@sspitsyn This change is no longer ready for integration - check the PR body for details. |
@sspitsyn The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This involved a lot more code than I had envisaged.
The test situation seems problematic as it suggests to me that we have required functionality (redefine a method containing a lambda expression) that is not possible without the flag. And it seems this flag is also being used in the wild e.g.
https://blog.picnic.nl/embracing-java-17-heres-what-we-learned-69779d95fdf2
As of Java 16, JDK internals are strongly encapsulated by default (JEP 396). These and other changes mean that some dependencies now require additional JVM flags such as --add-opens and -XX:+AllowRedefinitionToAddDeleteMethods to function properly. We updated our shared build system such that teams can configure these flags in a single place, ensuring that test and production runtimes remain in sync.
With more info in reactor/BlockHound#33
So I am quite concerned that this "workaround" has become entrenched.
@@ -4114,18 +4050,14 @@ void VM_RedefineClasses::flush_dependent_code() { | |||
JvmtiExport::set_all_dependencies_are_recorded(true); | |||
} | |||
|
|||
void VM_RedefineClasses::compute_added_deleted_matching_methods() { | |||
void VM_RedefineClasses::compute_matching_methods() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see that this method actually still does anything useful. ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does:
- has asserts on added/deleted methods
- collects
_matching_old_methods
and_matching_new_methods
It seems that the _old_methods
is same as _matching_old_methods
and _new_methods
is same as _matching_new_methods
. But I do not want to make a deeper refactoring at this point until we have a decision on the full removal of added/deleted methods support. It feels like we may need to keep some support for lambda expression changes in class redefinitions/retransformations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this does now is that the redefined class can have matching method names in a different order because of the signature. So this sorts this out. I don't know why we don't sort methods according to name and signature when creating the klass though. That would make this just a method to check that the methods match.
/label remove core-libs |
@AlanBateman |
Thank you for the comments and concern! I'll check what can be done here. Need to investigate it a little bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to be able to clean this code out but I also think it's being used. Was there another mechanism that we suggest for instrumenting native methods? And there was code once to prefix native methods so this adding private method mechanism worked.
Edit: I seem to remember TransferNativeFunctionRegistration code was for instrumenting native methods that used adding and deleting static private methods. So maybe this should be removed also as a follow-up?
@@ -4114,18 +4050,14 @@ void VM_RedefineClasses::flush_dependent_code() { | |||
JvmtiExport::set_all_dependencies_are_recorded(true); | |||
} | |||
|
|||
void VM_RedefineClasses::compute_added_deleted_matching_methods() { | |||
void VM_RedefineClasses::compute_matching_methods() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this does now is that the redefined class can have matching method names in a different order because of the signature. So this sorts this out. I don't know why we don't sort methods according to name and signature when creating the klass though. That would make this just a method to check that the methods match.
In fact, I have a big doubt we really want to get rid of this approach to instrument native methods calls. |
The VM option -XX:AllowRedefinitionToAddDeleteMethods was added in JDK 13 as a temporary backward compatibility flag under JDK-8192936 and was immediately marked as Deprecate. The fix is to obsolete this option in JDK 26 and expire in JDK 27.
TBD: Need to submit a related CSR.
There are two concerns which may require some negotiation with the Runtime (@coleenp @dcubed-ojdk @dholmes-ora) and SQE (@lmesnik) teams:
Testing:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26232/head:pull/26232
$ git checkout pull/26232
Update a local copy of the PR:
$ git checkout pull/26232
$ git pull https://git.openjdk.org/jdk.git pull/26232/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26232
View PR using the GUI difftool:
$ git pr show -t 26232
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26232.diff
Using Webrev
Link to Webrev Comment