RFR: 8261671: X86 I2L conversion can be skipped for certain masked positive values [v7]

Marcus G K Williams github.com+168222+mgkwill at openjdk.java.net
Thu Mar 11 03:36:06 UTC 2021


On Thu, 11 Mar 2021 00:36:32 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> I think you become "victim" of JTREG's feature which removes middle of long output:
> 
> ```
> ...
> Output overflow:
> JT Harness has limited the test output to the text
> at the beginning and the end, so that you can see how the
> test began, and how it completed.
> ```
> 
> You need to remove `-XX:+PrintAssembly` option which prints code for ALL compiled method and overflow jtreg output.
> You only need `-XX:CompileCommand=print,class::method` which prints assembler for specified method.
> 
> An other issue is that `make test` "eats" `$` in class name. I ran command you used:
> `make test TEST="jtreg:test/hotspot/jtreg/compiler/codegen/BMI2.java" JTREG="VM_OPTIONS=-XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -Xbatch -XX:CompileCommand=print,compiler.codegen.BMI2$BMITests::*"`
> 
> and got next message in output .jtr file:
> 
> ```
> ----------System.out:(2/154)----------
> CompileCommand: print compiler/codegen/BMI2MITests.* bool print = true
> CompileCommand: dontinline compiler/codegen/BMI2$BMITests.* bool dontinline = true
> ```
> 
> `dontinline` line comes from test `@run` command and it is correct. But class name for `print` is wrong. I tried to use `$` - did not help.
> 
> I ran the test with `jtreg`:
> 
> ```
> jtreg -testjdk:my_jdk -va -javaoptions:'-server -XX:CompileCommand=print,compiler.codegen.BMI2$BMITests::* -XX:-TieredCompilation -Xbatch' compiler/codegen/BMI2.java
> ```
> 
> And got nice code for
> 
> ```
> 04c     B4: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 04c     bzhiq RAX, RSI, #32767  # using R10 as TEMP, int & immI_bitmask -> long
> 057     jmp     B20
> 
> 05c     B5: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 05c     bzhiq RAX, RSI, #16383  # using R10 as TEMP, int & immI_bitmask -> long
> 067     jmp     B20
> 
> 06c     B6: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 06c     bzhiq RAX, RSI, #8191   # using R10 as TEMP, int & immI_bitmask -> long
> 077     jmp     B20
> 
> 07c     B7: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 07c     bzhiq RAX, RSI, #4095   # using R10 as TEMP, int & immI_bitmask -> long
> 087     jmp     B20
> 
> 08c     B8: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 08c     bzhiq RAX, RSI, #2047   # using R10 as TEMP, int & immI_bitmask -> long
> 097     jmp,s   B20
> 
> 099     B9: #   out( B20 ) <- in( B2 )  Freq: 0.0624999
> 099     bzhiq RAX, RSI, #1023   # using R10 as TEMP, int & immI_bitmask -> long
> 0a4     jmp,s   B20
> 
> 0a6     B10: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0a6     bzhiq RAX, RSI, #511    # using R10 as TEMP, int & immI_bitmask -> long
> 0b1     jmp,s   B20
> 
> 0b3     B11: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0b3     movzbl  RAX, RSI        # int & 0xFF -> long
> 0b7     jmp,s   B20
> 
> 0b9     B12: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0b9     bzhiq RAX, RSI, #127    # using R10 as TEMP, int & immI_bitmask -> long
> 0c4     jmp,s   B20
> 
> 0c6     B13: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0c6     bzhiq RAX, RSI, #63     # using R10 as TEMP, int & immI_bitmask -> long
> 0d1     jmp,s   B20
> 
> 0d3     B14: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0d3     bzhiq RAX, RSI, #31     # using R10 as TEMP, int & immI_bitmask -> long
> 0de     jmp,s   B20
> 
> 0e0     B15: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0e0     bzhiq RAX, RSI, #15     # using R10 as TEMP, int & immI_bitmask -> long
> 0eb     jmp,s   B20
> 
> 0ed     B16: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0ed     bzhiq RAX, RSI, #7      # using R10 as TEMP, int & immI_bitmask -> long
> 0f8     jmp,s   B20
> 
> 0fa     B17: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 0fa     bzhiq RAX, RSI, #3      # using R10 as TEMP, int & immI_bitmask -> long
> 105     jmp,s   B20
> 
> 107     B18: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 107     bzhiq RAX, RSI, #1      # using R10 as TEMP, int & immI_bitmask -> long
> 112     jmp,s   B20
> 
> 114     B19: #  out( B20 ) <- in( B2 )  Freq: 0.0624999
> 114     movzwl  RAX, RSI        # int & 0xFFFF -> long
> 
> 117     B20: #  out( N1 ) <- in( B19 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16 B17 B18 )  Freq: 0.999999
> 117     addq    rsp, 32 # Destroy frame
>         popq    rbp
>         cmpq     rsp, poll_offset[r15_thread]
>         ja       #safepoint_stub        # Safepoint: poll for GC
> 
> 129     ret
> ```
> 
> You patch and test are good!

Thanks @vnkozlov Vladimir. That is really helpful! I'll keep in mind jtreg's output limiter and the 'make test' issue with class specifier in the future.

I will wait for another approval before integrating.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2590


More information about the hotspot-compiler-dev mailing list