RFR: 8221404: C2: Convert RegMask and IndexSet to use uintptr_t [v3]

Claes Redestad redestad at openjdk.java.net
Tue Nov 10 16:52:20 UTC 2020


> This patch refactors RegMask and IndexSet to use uintptr_t rather than int for storage, which may shorten some code paths and loops on 64-bit VMs. Making storage unsigned further allows for a few simplification, e.g. is_bound_set where there was logic to deal with sign extension that can no longer happen.
> 
> To evaluate performance impact I created the included JMH microbenchmark which uses the RepeatCompilation command to repeat the compilation of a few methods: One trivial (`trivialMath`), one "regular" (`mixHashCode`), and one largish ( `largeMethod`..) with a lot of locals. These are designed to put no stress, some stress and quite a bit of stress on register allocation:
> 
> Baseline:
> Benchmark                                      Mode  Cnt     Score    Error  Units
> SimpleRepeatCompilation.largeMethod_baseline     ss   10   168.919 ±  2.839  ms/op
> SimpleRepeatCompilation.largeMethod_repeat       ss   10  8920.305 ± 40.531  ms/op
> SimpleRepeatCompilation.largeMethod_repeat_c1    ss   10   153.961 ±  2.762  ms/op
> SimpleRepeatCompilation.largeMethod_repeat_c2    ss   10  8242.061 ± 71.989  ms/op
> SimpleRepeatCompilation.mixHashCode_baseline     ss   10    69.526 ±  7.098  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat       ss   10  6733.627 ± 63.689  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat_c1    ss   10   316.862 ± 29.682  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat_c2    ss   10  4544.604 ± 57.439  ms/op
> SimpleRepeatCompilation.trivialMath_baseline     ss   10    21.757 ±  1.553  ms/op
> SimpleRepeatCompilation.trivialMath_repeat       ss   10   499.214 ± 35.984  ms/op
> SimpleRepeatCompilation.trivialMath_repeat_c1    ss   10   100.345 ±  2.168  ms/op
> SimpleRepeatCompilation.trivialMath_repeat_c2    ss   10   398.528 ±  4.718  ms/op
> 
> Patched:
> Benchmark                                      Mode  Cnt     Score    Error  Units
> SimpleRepeatCompilation.largeMethod_baseline     ss   10   164.355 ±  3.531  ms/op
> SimpleRepeatCompilation.largeMethod_repeat       ss   10  8516.033 ± 22.408  ms/op
> SimpleRepeatCompilation.largeMethod_repeat_c1    ss   10   151.181 ± 12.869  ms/op
> SimpleRepeatCompilation.largeMethod_repeat_c2    ss   10  7857.373 ± 52.826  ms/op
> SimpleRepeatCompilation.mixHashCode_baseline     ss   10    65.085 ±  5.643  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat       ss   10  6601.693 ± 57.898  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat_c1    ss   10   315.845 ± 27.474  ms/op
> SimpleRepeatCompilation.mixHashCode_repeat_c2    ss   10  4456.847 ± 30.459  ms/op
> SimpleRepeatCompilation.trivialMath_baseline     ss   10    21.273 ±  2.115  ms/op
> SimpleRepeatCompilation.trivialMath_repeat       ss   10   506.873 ± 18.994  ms/op
> SimpleRepeatCompilation.trivialMath_repeat_c1    ss   10   100.184 ±  3.008  ms/op
> SimpleRepeatCompilation.trivialMath_repeat_c2    ss   10   397.010 ±  4.531  ms/op
> 
> This shows that there's no significant change on `trivialMath`, `mixHashCode` see a small improvement (~2%) and `largeMethod` see a larger improvement (~4-5%) on C2 and Tiered tests with compiler repetition.
> 
> Testing: tier 1-7 on all Oracle platforms, local testing and verification of linux-x86.

Claes Redestad has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:

 - Merge branch 'master' into c2_uintptr_t
 - Copyrights
 - Merge branch 'master' into c2_uintptr_t
 - Avoid using ULL
 - unsigned overflow in find_last_elem (found by some tier6 tests)
 - Fix and clarify low_bits
 - Merge branch 'master' into c2_uintptr_t
 - Improve bitfield comments
 - ALL_BITS clash, rename constants.
 - Fix comments from Vladimir and Mikael. A few additional cleanups.
 - ... and 3 more: https://git.openjdk.java.net/jdk/compare/e9af71d3...3e29c4e1

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1102/files
  - new: https://git.openjdk.java.net/jdk/pull/1102/files/38c60560..3e29c4e1

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1102&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1102&range=01-02

  Stats: 48818 lines in 390 files changed: 26968 ins; 14479 del; 7371 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1102.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1102/head:pull/1102

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


More information about the hotspot-compiler-dev mailing list