jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8286849: Use @Stable for generic repositories

Open liach opened this issue 3 years ago • 8 comments

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

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

liach avatar May 17 '22 04:05 liach

: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.

bridgekeeper[bot] avatar May 17 '22 04:05 bridgekeeper[bot]

@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.

openjdk[bot] avatar May 17 '22 04:05 openjdk[bot]

Webrevs

mlbridge[bot] avatar May 17 '22 04:05 mlbridge[bot]

Just curious about any performance benefits of this patch?

mrserb avatar May 24 '22 00:05 mrserb

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 avatar May 24 '22 01:05 liach

@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!

bridgekeeper[bot] avatar Jul 15 '22 08:07 bridgekeeper[bot]

I should probably split the patch fixing thread safety of some generic information container off.

liach avatar Jul 15 '22 08:07 liach

@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!

bridgekeeper[bot] avatar Aug 12 '22 15:08 bridgekeeper[bot]

@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.

bridgekeeper[bot] avatar Sep 09 '22 15:09 bridgekeeper[bot]