Skip to content

8339401: Optimize ClassFile load and store instructions#20739

Closed
wenshao wants to merge 5 commits intoopenjdk:masterfrom
wenshao:class_file_typekind_202408
Closed

8339401: Optimize ClassFile load and store instructions#20739
wenshao wants to merge 5 commits intoopenjdk:masterfrom
wenshao:class_file_typekind_202408

Conversation

@wenshao
Copy link
Contributor

@wenshao wenshao commented Aug 28, 2024

BytecodeHelpers' loadOpcode and storeOpcode are large methods with code size greater than 325, break it into multiple small methods and call them directly in DirectCodeBuilder


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-8339401: Optimize ClassFile load and store instructions (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20739

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 28, 2024

👋 Welcome back wenshao! 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 Aug 28, 2024

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

8339401: Optimize ClassFile load and store instructions

Reviewed-by: liach, redestad

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

  • 8ea6adc: 8339364: AIX build fails: various unused variable and function warnings
  • 7a418fc: 8338967: Improve performance for MemorySegment::fill
  • 633fad8: 8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
  • 6f3e3fd: 8339411: [PPC64] cmpxchgw/h/b doesn't handle external Label
  • ed422ed: 8338817: Wrong indent in API docs for java.lang.management.ManagementFactory
  • 288fa60: 8338891: HotSpotDiagnosticsMXBean missing @SInCE tag
  • dc4fd89: 8339359: RISC-V: Use auipc explicitly in far_jump and far_call macro assembler routines
  • 3a88fd4: 8334724: C2: remove PhaseIdealLoop::cast_incr_before_loop()
  • 62dad3a: 8339351: Remove duplicate line in FileMapHeader::print
  • 0e6bb51: 8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only
  • ... and 3 more: https://git.openjdk.org/jdk/compare/9d7d85a6aa20ed95166f5f2f951597bca1fde841...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@liach, @cl4es) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented Aug 28, 2024

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Aug 28, 2024
@wenshao wenshao marked this pull request as draft August 28, 2024 04:17
@wenshao wenshao force-pushed the class_file_typekind_202408 branch 2 times, most recently from 93ce58d to bfcbe78 Compare August 28, 2024 12:40
@wenshao
Copy link
Contributor Author

wenshao commented Aug 28, 2024

@cl4es @liach Is there a better way to ensure that Opcode has completed type initialization before calling arrayLoad?

@wenshao wenshao force-pushed the class_file_typekind_202408 branch from bfcbe78 to cebed82 Compare September 2, 2024 10:28
@wenshao wenshao changed the title TypeKind provides a series of methods for load/store/return Opcode Optimize ClassFile load and store instructions Sep 2, 2024
};
case VOID -> throw new IllegalArgumentException("void");
case INT, SHORT, BYTE, CHAR, BOOLEAN
-> iload(slot);
Copy link
Member

Choose a reason for hiding this comment

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

Can you do

switch (tk.asLoadable()) {
    case INT      -> iload(slot);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if that's better, because there's a getField and branch in the implementation of asLoadable

Copy link
Member

Choose a reason for hiding this comment

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

Logically I think asLoadable is clearer and reduces switch size.
And enum ordinal field is already constant-folded: https://bugs.openjdk.org/browse/JDK-81612454
So it can be elided by JIT if the enum argument is constant.

@wenshao wenshao changed the title Optimize ClassFile load and store instructions 8339401: Optimize ClassFile load and store instructions Sep 2, 2024
@wenshao wenshao marked this pull request as ready for review September 2, 2024 14:07
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 2, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 2, 2024

Webrevs

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 2, 2024
@wenshao
Copy link
Contributor Author

wenshao commented Sep 3, 2024

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 3, 2024
@openjdk
Copy link

openjdk bot commented Sep 3, 2024

@wenshao
Your change (at version 58a15b3) is now ready to be sponsored by a Committer.

@cl4es
Copy link
Member

cl4es commented Sep 3, 2024

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 3, 2024

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

  • 8ea6adc: 8339364: AIX build fails: various unused variable and function warnings
  • 7a418fc: 8338967: Improve performance for MemorySegment::fill
  • 633fad8: 8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
  • 6f3e3fd: 8339411: [PPC64] cmpxchgw/h/b doesn't handle external Label
  • ed422ed: 8338817: Wrong indent in API docs for java.lang.management.ManagementFactory
  • 288fa60: 8338891: HotSpotDiagnosticsMXBean missing @SInCE tag
  • dc4fd89: 8339359: RISC-V: Use auipc explicitly in far_jump and far_call macro assembler routines
  • 3a88fd4: 8334724: C2: remove PhaseIdealLoop::cast_incr_before_loop()
  • 62dad3a: 8339351: Remove duplicate line in FileMapHeader::print
  • 0e6bb51: 8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only
  • ... and 3 more: https://git.openjdk.org/jdk/compare/9d7d85a6aa20ed95166f5f2f951597bca1fde841...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 3, 2024
@openjdk openjdk bot closed this Sep 3, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 3, 2024
@openjdk
Copy link

openjdk bot commented Sep 3, 2024

@cl4es @wenshao Pushed as commit b94c3de.

💡 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

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants