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

8267870: Remove unnecessary char_converter during class loading #4173

Closed
wants to merge 3 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented May 24, 2021

We create a String object from a Symbol, then swap the '/' for '.' characters, and create another String object. Seems wasteful. Removed java_lang_String::char_converted and made externalize_classname take a Symbol.

Tested with tier1-3 in mach5.


Progress

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

Issue

  • JDK-8267870: Remove unnecessary char_converter during class loading

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4173

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

Using diff file

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

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 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
Copy link

openjdk bot commented May 24, 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.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label May 24, 2021
@coleenp coleenp changed the title Remove unnecessary char_converter 8267870: Remove unnecessary char_converter Jun 15, 2021
@openjdk openjdk bot changed the title 8267870: Remove unnecessary char_converter 8267870: Remove unnecessary char_converter during class loading Jun 15, 2021
@coleenp coleenp marked this pull request as ready for review June 15, 2021 00:35
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 15, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 15, 2021

Webrevs

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.

Hi Coleen,

Looks like a nice simplification if we never need a general purpose conversion utility.

I take it that Symbol::as_klass_external_name works correctly regardless of whether the name may be unicode or not? i.e that a / is always truly a slash and not part of some unicode sequence?

Thanks,
David

@@ -135,8 +136,8 @@ objArrayHandle names, typeArrayHandle enabled, TRAPS) {
int index;
for (index = len - 1; p != 0; p = p->next(), --index) {
assert(index >= 0, "length does not match list");
Handle s = java_lang_String::create_from_str(p->name(), CHECK);
s = java_lang_String::char_converter(s, JVM_SIGNATURE_SLASH, JVM_SIGNATURE_DOT, CHECK);
TempNewSymbol name = SymbolTable::new_symbol(p->name());
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a temp symbol?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the new_symbol call will increment the Symbol* refcount in the SymbolTable, it's then copied to the java.lang.String, so the name isn't needed after this.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see. The types were confusing me. We start with a char* convert to a Symbol, then convert that back to char* but with the externalized format. The irony there being that it seems these Options start in external format but then get stored in internal format!
No issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Ioi and I discussed this part of the change but since we substitute slashes for dots and then back again, it is correct. Thanks!

@openjdk
Copy link

openjdk bot commented Jun 15, 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:

8267870: Remove unnecessary char_converter during class loading

Reviewed-by: dholmes, 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 25 new commits pushed to the master branch:

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 Jun 15, 2021
@coleenp
Copy link
Contributor Author

coleenp commented Jun 15, 2021

Since Symbol* comes from class_name_symbol, it's verified to be valid UTF8 and not unicode, so I believe it's valid to translate '/' to '.' using char conversion.
Thanks for the review!

Copy link
Member

@iklam iklam 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 to me. I check the code paths and they seem to be equivalent to the existing code. A small nit with CHECK_NULL.

@coleenp
Copy link
Contributor Author

coleenp commented Jun 16, 2021

Thanks David and Ioi for the code reviews.
/integrate

@openjdk
Copy link

openjdk bot commented Jun 16, 2021

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jun 16, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 16, 2021
@openjdk
Copy link

openjdk bot commented Jun 16, 2021

@coleenp Pushed as commit af13fe1.

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

@coleenp coleenp deleted the random branch June 16, 2021 12:43
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.

None yet

3 participants