jdk
jdk copied to clipboard
8286849: Use @Stable for generic repositories
Generic repositories, the implementation detail for generic information in core reflection, can be updated to use the @Stable annotation to replace their volatile access. Their existing accessor code is already safe, reading the cache fields only once.
In addition, fixed potentially non-thread-safe genericInfo access in Method, Field, and RecordComponent.
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8286849: Use @Stable for generic repositories
Reviewers
- @stsypanov (no known github.com user name / role)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/8742/head:pull/8742
$ git checkout pull/8742
Update a local copy of the PR:
$ git checkout pull/8742
$ git pull https://git.openjdk.org/jdk pull/8742/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8742
View PR using the GUI difftool:
$ git pr show -t 8742
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/8742.diff
:wave: Welcome back liach! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@liach The following label will be automatically applied to this pull request:
core-libs
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.
Just curious about any performance benefits of this patch?
This should offer slight performance benefit if a reflection object has its generic information accessed frequently, as reading a stable field is faster than reading a volatile field for cached objects. If the genericInfo fields are updated by JVMTI then they need to be declared volatile instead. In addition, some of the genericInfo fields may have been not thread-safe for their multiple field reads.
@liach This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
I should probably split the patch fixing thread safety of some generic information container off.
@liach This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
@liach This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.