RFR: 8256827: C2: Avoid reallocations by pre-sizing lists in post_allocate_copy_removal
Claes Redestad
redestad at openjdk.java.net
Sun Nov 22 15:39:34 UTC 2020
By pre-sizing the Node_Lists created in PhaseChaitin::post_allocate_copy_removal we avoid all re-allocations.
As lists are allocated to the size we need we might also reduce memory waste, which reduce memory used by these structures by up to 50%
Throughput wise this is also a gain and saves about 10,000 instructions per C2 compilation in SimpleRepeatCompilation.trivialMath. By using bulk clearing, avoiding redundant clearing of newly created lists and adding a shallow copy routine to Node_List we save another ~9,500 instructions per compilation in the same benchmark. This corresponds with a small but statistically significant gain:
Benchmark Mode Cnt Score Error Units
SimpleRepeatCompilation.trivialMath_repeat_c2 ss 50 355.342 ± 2.069 ms/op # baseline
SimpleRepeatCompilation.trivialMath_repeat_c2 ss 50 350.705 ± 1.577 ms/op # patch
Testing: tier1-4
-------------
Commit messages:
- Minor cleanup
- Merge branch 'master' of https://github.com/openjdk/jdk into postaloc_presize
- Bulk clear/copy, avoid unnecessary clearing
- C2: Avoid reallocations by pre-sizing lists in post_allocate_copy_removal
Changes: https://git.openjdk.java.net/jdk/pull/1370/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1370&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8256827
Stats: 51 lines in 3 files changed: 13 ins; 14 del; 24 mod
Patch: https://git.openjdk.java.net/jdk/pull/1370.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1370/head:pull/1370
PR: https://git.openjdk.java.net/jdk/pull/1370
More information about the hotspot-compiler-dev
mailing list