Skip to content

JDK-8304820: Statically allocate ObjectSynchronizer mutexes #13160

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

Closed
wants to merge 4 commits into from

Conversation

jcking
Copy link
Contributor

@jcking jcking commented Mar 23, 2023

Similar to https://git.openjdk.org/jdk/pull/13143, statically allocate mutexes which live for the lifetime of the process.


Progress

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

Issue

  • JDK-8304820: Statically allocate ObjectSynchronizer mutexes

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13160

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

Using diff file

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

Signed-off-by: Justin King <jcking@google.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 23, 2023

👋 Welcome back jcking! 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 Mar 23, 2023
@openjdk
Copy link

openjdk bot commented Mar 23, 2023

@jcking 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 Mar 23, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 23, 2023

Webrevs

@dcubed-ojdk
Copy link
Member

Thumbs up.

@openjdk
Copy link

openjdk bot commented Mar 23, 2023

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

8304820: Statically allocate ObjectSynchronizer mutexes

Reviewed-by: dcubed, dholmes

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

  • 50a995f: 8304927: Update java/net/httpclient/BasicAuthTest.java to check basic auth over HTTP/2
  • ca745cb: 8291598: Matcher.appendReplacement should not create new StringBuilder instances
  • 1683a63: 8305098: [Backout] JDK-8303912 Clean up JavadocTokenizer
  • fab2357: 8304498: JShell does not switch to raw mode when there is no /bin/test
  • 1fc218c: 8303912: Clean up JavadocTokenizer
  • c1f5ca1: 8303623: Compiler should disallow non-standard UTF-8 string encodings
  • 695683b: 8304880: [PPC64] VerifyOops code in C1 doesn't work with ZGC
  • 83ce65e: 8305004: add @SPEC tags to langtools modules
  • 32ef452: 8304884: Update Bytecodes data to be mostly compile time constants
  • 927e674: 8300977: Retire java.io.ExpiringCache
  • ... and 57 more: https://git.openjdk.org/jdk/compare/bf917ba6af9a69859f469a1e8056fbd32396cae4...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 Mar 23, 2023
@jcking
Copy link
Contributor Author

jcking commented Mar 23, 2023

/reviewers 2

@openjdk
Copy link

openjdk bot commented Mar 23, 2023

@jcking
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

Signed-off-by: Justin King <jcking@google.com>
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 23, 2023
@jcking
Copy link
Contributor Author

jcking commented Mar 23, 2023

Hm. We may want to try placing each mutex on separate cache lines if necessary. Can be done by creating a lightweight wrapper struct which uses alignas(DEFAULT_CACHE_LINE_SIZE). Thoughts?

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Seems fine.

Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 24, 2023
@jcking
Copy link
Contributor Author

jcking commented Mar 27, 2023

Looking into the macOS odd build errors before moving forward.

Signed-off-by: Justin King <jcking@google.com>
Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

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

Still thumbs up.

@jcking
Copy link
Contributor Author

jcking commented Mar 27, 2023

Yeah, sorry had to fix how the storage was declared. Forgot that the compiler inserts the default constructor if you use a typed array. Should be good now, waiting on GHA to confirm.

// Static storage for an array of PlatformMutex. Each entry is aligned to `alignas(PlatformMutex)`
// by property of the storage itself being aligned to that requirement and each entry storage being
// `sizeof(PlatformMutex)` aligned up to `alignof(PlatformMutex)`.
alignas(PlatformMutex) static uint8_t _inflation_locks[inflation_lock_count()][align_up(sizeof(PlatformMutex), alignof(PlatformMutex))];
Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid you lost me here. Why does this have to be so convoluted/obscure?

Copy link
Member

Choose a reason for hiding this comment

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

I thought sizeof(T) always was a multiple of alignof(T). Is there some case where this is not true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I had assumed it wasn't required. But a quick glance says it is. So I'll remove the align_up. Should be more simple now.

Signed-off-by: Justin King <jcking@google.com>
Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

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

Still good.

@jcking
Copy link
Contributor Author

jcking commented Mar 30, 2023

Last call for complaints/concerns/etc. I'll wait until roughly 24 hours from now.

@jcking
Copy link
Contributor Author

jcking commented Mar 31, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Mar 31, 2023

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

  • 2f36eb0: 8305323: Update java/net/httpclient/ContentLengthHeaderTest.java to use new HttpTestServer factory methods
  • 049b953: 8305223: IGV: mark osr compiled graphs with [OSR] in the name
  • 345669c: 8302738: IGV: refine 'Simplify graph' filter
  • dea9db2: 8305055: IR check fails on some aarch64 platforms
  • c8f3a97: 8305171: PPC: Should use IMA::load_resolved_indy_entry() in TIG::generate_return_entry_for()
  • 7fe5bd2: 8305174: disable dtrace for s390x builds
  • 787832a: 8304988: unnecessary dash in @param gives double-dash in docs
  • a144c71: 8305008: RISC-V: Factor out immediate checking functions from assembler_riscv.inline.hpp
  • d815889: 8304993: bad sentence break in DateFormat
  • 5f7b4b8: 8305111: Locale.lookupTag has typo in parameter
  • ... and 97 more: https://git.openjdk.org/jdk/compare/bf917ba6af9a69859f469a1e8056fbd32396cae4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 31, 2023
@openjdk openjdk bot closed this Mar 31, 2023
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 31, 2023
@jcking jcking deleted the objectsynchronizer-static branch March 31, 2023 14:28
@openjdk openjdk bot removed the rfr Pull request is ready for review label Mar 31, 2023
@openjdk
Copy link

openjdk bot commented Mar 31, 2023

@jcking Pushed as commit fe42312.

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

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.

4 participants