RFR: 8221404: C2: Convert RegMask and IndexSet to use uintptr_t
Claes Redestad
redestad at openjdk.java.net
Sun Nov 8 20:47:03 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.
-------------
Commit messages:
- 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.
- 32-bit compat: 63U -> BitsPerWord-1U
- 32-bit: Long -> Word
- C2: Convert RegMask and IndexSet to use uintptr_t
Changes: https://git.openjdk.java.net/jdk/pull/1102/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1102&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8221404
Stats: 477 lines in 5 files changed: 283 ins; 25 del; 169 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