Skip to content

Conversation

@shipilev
Copy link
Member

@shipilev shipilev commented Jul 18, 2022

We have ResourceMark scopes where we either do not resource-allocate at all (see the bug for the example), or we do not allocate a lot in the arena. Still, in debug builds, we are zapping the entirety of ResourceArea chunk in those cases. This wastes testing cycles unnecessarily. Doing this in a bit smarter way -- zapping only the parts that were actually allocated in the chunk -- makes testing significantly faster.

Linux x86_64 fastdebug, tier1:

# Before
real 26m33.621s
user 1156m56.676s
sys 52m18.291s

# After
real 25m29.573s  ; -4.0%
user 1089m27.179s ; -5.8%
sys 52m17.630s

Additional testing:

  • Linux x86_64 fastdebug, FieldSetAccessibleTest (~12% faster)
  • Linux x86_64 release, FieldSetAccessibleTest (no regressions)
  • Linux x86_64 fastdebug, hotspot:tier1 (~6% faster)
  • Linux x86_64 release, hotspot:tier1 (no regressions)
  • Linux x86_64 fastdebug, tier1 (~4% faster)
  • Linux x86_64 release, tier1 (no regressions)

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8290464: Optimize ResourceArea zapping on ResourceMark release

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9543/head:pull/9543
$ git checkout pull/9543

Update a local copy of the PR:
$ git checkout pull/9543
$ git pull https://git.openjdk.org/jdk pull/9543/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9543

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9543.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 18, 2022

👋 Welcome back shade! 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 Pull request is ready for review label Jul 18, 2022
@openjdk
Copy link

openjdk bot commented Jul 18, 2022

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

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Jul 18, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 18, 2022

Webrevs

@shipilev shipilev changed the title 8290464: Optimize ResourceArea zapping 8290464: Optimize ResourceArea zapping on ResourceMark release Jul 18, 2022
@iklam
Copy link
Member

iklam commented Jul 18, 2022

I think the placement of ResourceMark should be moved as well (maybe in a separate PR). I wonder if we have more cases like the one you found inside Method::can_be_statically_bound. Maybe we can use a new macro like this to allocate the ResourceMark only when the test fails:

assert_with_resource(is_nonv == is_static() || is_nonv == is_private(),
             "nonvirtual unexpected for non-static, non-private: %s",
             name_and_sig_as_C_string());

@shipilev
Copy link
Member Author

I think the placement of ResourceMark should be moved as well (maybe in a separate PR).

All right, that would be #9548.

I actually thought about introducing assert_with_resources too, but reckoned if we want to have a global change, we better off optimizing the ResourceMark itself. Otherwise we would have to remember to use assert_with_resource every time...

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@openjdk
Copy link

openjdk bot commented Jul 19, 2022

@shipilev 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:

8290464: Optimize ResourceArea zapping on ResourceMark release

Reviewed-by: stuefe, zgu, coleenp

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 82 new commits pushed to the master branch:

  • 4c1cd66: 8288368: simplify code in ValueTaglet, remove redundant code
  • 6346c33: 8290826: validate-source failures after JDK-8290016
  • 604a115: 8290016: IGV: Fix graph panning when mouse dragged outside of window
  • 59e495e: 8290704: x86: TemplateTable::_new should not call eden_allocate() without contiguous allocs enabled
  • 799a2c8: 8276561: URL$DefaultFactory::PREFIX should be static final
  • 52cc6cd: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time
  • 3582fd9: 8290359: Ensure that all directory streams are closed in jdk.link
  • 53fc495: 8290316: Ensure that all directory streams are closed in java.base
  • db1e44c: 8290353: ModuleReader::list specification should suggest closing the returned stream
  • 2c73a1f: 8290324: Move atomic operations outside of os_xxx.hpp
  • ... and 72 more: https://git.openjdk.org/jdk/compare/87340fd5408d89d9343541ff4fcabde83548a598...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 Pull request is ready to be integrated label Jul 19, 2022
@shipilev
Copy link
Member Author

Thanks! Any other reviews/opinions?

Copy link
Contributor

@zhengyu123 zhengyu123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shipilev
Copy link
Member Author

@coleenp, you would be interested in this as well, I think.

@coleenp
Copy link
Contributor

coleenp commented Jul 21, 2022

Thanks @shipilev it does look very nice. Edit: this seems fine. The other PR you have is very nice that I have to read.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, looks fine. The comments help. "replaced" didn't help me that much but can't think of a better name for it.

@shipilev
Copy link
Member Author

Ok, looks fine. The comments help. "replaced" didn't help me that much but can't think of a better name for it.

Had it like "old" originally, but it feels even more confusing: is it "old" that was before RM acquisition, or "old" that would be after RM release?

@coleenp
Copy link
Contributor

coleenp commented Jul 21, 2022

yeah, keep "replaced" the comments tell you what it means.

@shipilev
Copy link
Member Author

I ran tier1..3 with Linux x86_64 release/fastdebug, and they pass. So, I am integrating.

/integrate

@openjdk
Copy link

openjdk bot commented Jul 22, 2022

Going to push as commit 7841e5c.
Since your change was applied there have been 90 commits pushed to the master branch:

  • e9f97b2: 8290489: Initial nroff manpage generation for JDK 20
  • 59d85ba: 8290687: serviceability/sa/TestClassDump.java could leave files owned by root on macOS
  • 66f59c2: 8290731: Clean up CDS handling of LambdaForm Species classes
  • 0dda3c1: 8289275: Remove incorrect __declspec(dllimport) attributes from pointers in jdk.crypto.cryptoki
  • 620c8a0: 8289643: File descriptor leak with ProcessBuilder.startPipeline
  • 7ec0132: 8286844: com/sun/jdi/RedefineCrossEvent.java failed with 1 threads completed while VM suspended
  • 80bd8c3: 8290504: Close streams returned by ModuleReader::list
  • 15f4b30: 8290115: ArrayCopyObject JMH has wrong package
  • 4c1cd66: 8288368: simplify code in ValueTaglet, remove redundant code
  • 6346c33: 8290826: validate-source failures after JDK-8290016
  • ... and 80 more: https://git.openjdk.org/jdk/compare/87340fd5408d89d9343541ff4fcabde83548a598...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 22, 2022
@openjdk openjdk bot closed this Jul 22, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 22, 2022
@openjdk
Copy link

openjdk bot commented Jul 22, 2022

@shipilev Pushed as commit 7841e5c.

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

@shipilev shipilev deleted the JDK-8290464-resourcearea-zapping branch September 5, 2022 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants