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

8267791: [lworld][lw3] Support compiler blackholes for inline types #429

Closed

Conversation

shipilev
Copy link
Contributor

@shipilev shipilev commented May 26, 2021

JDK-8259316 added the support for compiler blackholes. We need to check and implement the support for inline type arguments for them. I am sure we would find more wrinkles with nano-benchmarks, but insofar sample benchmark work as they should:

public class PrimitiveClasses {
    static primitive class Value {
        long x;
        long y;
        public Value(long x, long y) {
            this.x = x;
            this.y = y;
        }
    }

    [volatile] Value v = Value.default;

    @Benchmark
    public Value test() {
        return v;
    }
}

Before: crash on assert, assert(vt->fast_out(i)->is_InlineTypeBase(), "Unexpected inline type user");

After, generated code in non-volatile case shows blackhole of individual components:

$ java -Djmh.blackhole.mode=COMPILER -jar target/benchmarks.jar PrimitiveClasses -prof perfasm
...
....[Hottest Region 1]..............................................................................
c2, level 4, org.openjdk.jmh_generated.PrimitiveClasses_test_jmhTest::test_avgt_jmhStub, version 641 (39 bytes) 
...
         ↗  0x00007f67bcc8eee0:   mov    0x18(%r8),%r10        ; read and blackhole MyValue.x
  0.02%  │  0x00007f67bcc8eee4:   mov    0x10(%r8),%r11        ; read and blackhole MyValue.y
  0.10%  │  0x00007f67bcc8eee8:   movzbl 0x94(%r14),%r11d      ; read isDone
  0.10%  │  0x00007f67bcc8eef0:   mov    0x3b0(%r15),%r10      ; TL handshake
  2.79%  │  0x00007f67bcc8eef7:   add    $0x1,%rbp             ; ops++
         │  0x00007f67bcc8eefb:   test   %eax,(%r10)           ; TL handshake
 86.74%  │  0x00007f67bcc8eefe:   test   %r11d,%r11d           ; isDone?
  2.31%  ╰  0x00007f67bcc8ef01:   je     0x00007f67bcc8eee0    

And generated code in volatile case shows blackhole of the box (with the null-check):

          ↗   0x00007f3948c8db70:   shl    $0x3,%r10            ; unpack and blackhole MyValue
  0.02%   │↗  0x00007f3948c8db74:   movzbl 0x94(%r14),%r8d      ; read isDone
  0.68%   ││  0x00007f3948c8db7c:   mov    0x3b0(%r15),%r9      ; TL handshake
  0.72%   ││  0x00007f3948c8db83:   add    $0x1,%rbp            ; ops++
          ││  0x00007f3948c8db87:   test   %eax,(%r9)           ; TL handshake
 92.30%   ││  0x00007f3948c8db8a:   test   %r8d,%r8d            ; isDone?
         ╭││  0x00007f3948c8db8d:   jne    0x00007f3948c8dba4   
         │││  0x00007f3948c8db8f:   mov    0xc(%r11),%r10d      ; load "v" (MyValue box)
  0.35%  │││  0x00007f3948c8db93:   test   %r10d,%r10d          ; null check it
         │╰│  0x00007f3948c8db96:   jne    0x00007f3948c8db70   

Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8267791: [lworld][lw3] Support compiler blackholes for inline types

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 429

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 26, 2021

👋 Welcome back shade! A progress list of the required criteria for merging this PR into lworld 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 openjdk bot commented May 26, 2021

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

8267791: [lworld][lw3] Support compiler blackholes for inline types

Reviewed-by: thartmann

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 4 new commits pushed to the lworld branch:

  • f1b3269: 8267923: [lworld] Javac's implementation differs from JEP401 in a few matters.
  • 44cb67e: 8267818: [lworld] [AArch64] Shenandoah barrier set build warnings and register conflict
  • 0871590: 8266890: [lworld] [AArch64] add support for InlineTypePassFieldsAsArgs
  • 0f1c33c: 8267710: [lworld][lw3] Hook AlwaysAtomicAccesses to primitive classes atomicity rules

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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.

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 (@TobiHartmann) 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 openjdk bot added the ready label May 26, 2021
@shipilev shipilev marked this pull request as ready for review May 26, 2021
@openjdk openjdk bot added the rfr label May 26, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 26, 2021

Webrevs

@shipilev
Copy link
Contributor Author

@shipilev shipilev commented May 31, 2021

/integrate

@openjdk openjdk bot added the sponsor label May 31, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 31, 2021

@shipilev
Your change (at version 20ecae3) is now ready to be sponsored by a Committer.

@TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented May 31, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented May 31, 2021

@TobiHartmann @shipilev Since your change was applied there have been 4 commits pushed to the lworld branch:

  • f1b3269: 8267923: [lworld] Javac's implementation differs from JEP401 in a few matters.
  • 44cb67e: 8267818: [lworld] [AArch64] Shenandoah barrier set build warnings and register conflict
  • 0871590: 8266890: [lworld] [AArch64] add support for InlineTypePassFieldsAsArgs
  • 0f1c33c: 8267710: [lworld][lw3] Hook AlwaysAtomicAccesses to primitive classes atomicity rules

Your commit was automatically rebased without conflicts.

Pushed as commit f931661.

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

@shipilev shipilev deleted the JDK-8267791-support-blackholes branch Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants