-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8330802: Desugar switch in Locale::createLocale #18882
Conversation
👋 Welcome back redestad! A progress list of the required criteria for merging this PR into |
@cl4es 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:
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 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
} else if (key instanceof LocaleKey lk) { | ||
return new Locale(lk.base, lk.exts); | ||
} else { | ||
throw new InternalError("should not happen"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default branch was required in the switch. Can we simply drop this branch and have a ClassCastException to LocalKey instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like so:
private static Locale createLocale(Object key) {
if (key instanceof BaseLocale base) {
return new Locale(base, null);
}
LocaleKey lk = (LocaleKey)key;
return new Locale(lk.base, lk.exts);
}
?
I think this should be alright. The type of the "impossibly" thrown exception would differ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just like how jli handles the Class/MethodType union type arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the CCE is the equivalent of should-not-reach-here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix, Claes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Thanks for reviewing, everyone! /integrate |
Going to push as commit daa5a4b.
Your commit was automatically rebased without conflicts. |
This switch expression in
Locale::createLocale
is causing a somewhat large startup regression on my local system. Desugaring to if statements seem like the right thing to do while we investigate ways to further reduce overheads inSwitchBootstraps
.These numbers are against a baseline which include #18865 and #18845, which already improved the situation:
Comparing to a baseline without those recent improvements the overhead was almost the double:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18882/head:pull/18882
$ git checkout pull/18882
Update a local copy of the PR:
$ git checkout pull/18882
$ git pull https://git.openjdk.org/jdk.git pull/18882/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18882
View PR using the GUI difftool:
$ git pr show -t 18882
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18882.diff
Webrev
Link to Webrev Comment