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

8262046: Clean up parallel class loading code and comments #3200

Closed
wants to merge 6 commits into from

Conversation

@coleenp
Copy link

@coleenp coleenp commented Mar 25, 2021

This change reduces the length of SystemDictionary::resolve_instance_class_or_null, the main class loading function to 4 pages on my screen, down from ~6. Some functions are made static inside systemDictionary.hpp.

The only executable change is that handle_parallel_super_load used to have a wait while the class's superclass was being loaded after calling resolve_super_or_fail. It was similar to the subsequent code that waited for the LOAD_INSTANCE placeholder, immediately following the return from handle_parallel_super_load. I consolidated this code to wait for both conditions and kept the comment from handle_parallel_super_load. This wait is now in the function handle_parallel_loading.

I also added a new load_instance_class that calls load_instance_class_impl. The new load_instance_class does constraint checking and bookkeeping after it is called so that it can return with CHECK_NULL and not check pending exceptions. These functions aren't called outside of systemDictionary.cpp.

I added a test to show why handle_parallel_super_load is needed (see bug for details of the deadlock that this test would get if not for handle_parallel_super_load).

This updates comments to:

  1. rewrote ClassCircularityError detection above resolve_super_or_fail so that it made more sense to me (hope it does for others too).
  2. move comments to be near the code they describe
  3. removed some comments that referred to code somewhere else but not helpful at that location, or to describe code that was deleted or obsolete, or repetitive
  4. added a comment for resolve_instance_class_or_null

Ran tier1-3 testing, jck vm, jck lang and our internal parallel class loading tests. Retesting with tiers 4-8 in progress (I tested an earlier version of this with no failures).


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8262046: Clean up parallel class loading code and comments

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3200/head:pull/3200
$ git checkout pull/3200

Update a local copy of the PR:
$ git checkout pull/3200
$ git pull https://git.openjdk.java.net/jdk pull/3200/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3200

View PR using the GUI difftool:
$ git pr show -t 3200

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3200.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Mar 25, 2021

👋 Welcome back coleenp! 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.

@openjdk openjdk bot added the rfr label Mar 25, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 25, 2021

@coleenp The following label will be automatically applied to this pull request:

  • hotspot-runtime

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.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 25, 2021

@coleenp coleenp closed this Mar 29, 2021
@coleenp coleenp deleted the coleenp:pcl-cleanup branch Mar 29, 2021
@coleenp coleenp restored the coleenp:pcl-cleanup branch Mar 30, 2021
@coleenp coleenp reopened this Mar 30, 2021
Copy link
Author

@coleenp coleenp left a comment

Added some comments and questions for reviewers.

@coleenp
Copy link
Author

@coleenp coleenp commented Mar 30, 2021

I closed this by mistake also yesterday trying to purge pull request branches from my fork. I added some comments that explain the comments.

Copy link
Member

@lfoltan lfoltan left a comment

I think this is a good clean up to consolidate the 2 while loops Coleen into SystemDictionary::handle_parallel_loading(). A couple of minor review comments.

Thanks,
Lois

@iklam
iklam approved these changes Apr 1, 2021
Copy link
Member

@iklam iklam left a comment

LGTM.

I like the refactoring that combines two similar code paths into the single handle_parallel_loading function. The subtle change in behavior probably doesn't matter, but if it did we should be able to catch it with 2+ months of testing before 17 RDP1.

@openjdk
Copy link

@openjdk openjdk bot commented Apr 1, 2021

@coleenp This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8262046: Clean up parallel class loading code and comments

Reviewed-by: lfoltan, iklam

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 103 new commits pushed to the master branch:

  • 04f24fe: 8264403: [macos]: App names containing '.' characters results in an error message when launching
  • b953386: 8264609: Number.{byteValue, shortValue} spec should use @implSpec
  • 5858399: 8264285: Clean the modification of ccstr JVM flags
  • 6e0da99: 8263448: CTW: fatal error: meet not symmetric
  • 328e951: 8169629: Annotations with lambda expressions cause AnnotationFormatError
  • c04a743: 8264557: Incorrect copyright year for test/micro/org/openjdk/bench/java/lang/MathBench.java after JDK-8264054
  • 4b19771: 8264150: CDS dumping code calls TRAPS functions in VM thread
  • 1dc75e9: 8264538: Rename SystemDictionary::parse_stream
  • 80681b5: 8264546: Dependencies: Context class is always an InstanceKlass
  • fdfa1dd: 8264306: Non deterministic generation of java/lang/invoke/MemberName.class
  • ... and 93 more: https://git.openjdk.java.net/jdk/compare/8307aa6dcbb8f608c541e76800b340d1c678e0e2...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 1, 2021
@lfoltan
lfoltan approved these changes Apr 1, 2021
Copy link
Author

@coleenp coleenp left a comment

Thank you for the comments.

@coleenp
Copy link
Author

@coleenp coleenp commented Apr 1, 2021

Thanks Ioi for reviewing. I think the refactoring of the waiting loops will make it easier to work with if there is a subtle change in behavior. I could add a conditional to the function instead of the duplicated code.
Thanks!

coleenp added 2 commits Apr 1, 2021
…ch makes them one word.
@coleenp
Copy link
Author

@coleenp coleenp commented Apr 1, 2021

Thank you Lois and Ioi for reviewing this and discussions about these changes!
/integrate

@openjdk openjdk bot closed this Apr 1, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 1, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 1, 2021

@coleenp Since your change was applied there have been 103 commits pushed to the master branch:

  • 04f24fe: 8264403: [macos]: App names containing '.' characters results in an error message when launching
  • b953386: 8264609: Number.{byteValue, shortValue} spec should use @implSpec
  • 5858399: 8264285: Clean the modification of ccstr JVM flags
  • 6e0da99: 8263448: CTW: fatal error: meet not symmetric
  • 328e951: 8169629: Annotations with lambda expressions cause AnnotationFormatError
  • c04a743: 8264557: Incorrect copyright year for test/micro/org/openjdk/bench/java/lang/MathBench.java after JDK-8264054
  • 4b19771: 8264150: CDS dumping code calls TRAPS functions in VM thread
  • 1dc75e9: 8264538: Rename SystemDictionary::parse_stream
  • 80681b5: 8264546: Dependencies: Context class is always an InstanceKlass
  • fdfa1dd: 8264306: Non deterministic generation of java/lang/invoke/MemberName.class
  • ... and 93 more: https://git.openjdk.java.net/jdk/compare/8307aa6dcbb8f608c541e76800b340d1c678e0e2...master

Your commit was automatically rebased without conflicts.

Pushed as commit 5e59d28.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@coleenp coleenp deleted the coleenp:pcl-cleanup branch Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants