Integrated: 8256827: C2: Avoid reallocations by pre-sizing lists in post_allocate_copy_removal
Claes Redestad
redestad at openjdk.java.net
Mon Nov 23 10:21:59 UTC 2020
On Sun, 22 Nov 2020 01:05:28 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: b450e7c1
Author: Claes Redestad <redestad at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/b450e7c1
Stats: 51 lines in 3 files changed: 13 ins; 14 del; 24 mod
8256827: C2: Avoid reallocations by pre-sizing lists in post_allocate_copy_removal
Reviewed-by: kvn, thartmann
-------------
PR: https://git.openjdk.java.net/jdk/pull/1370
More information about the hotspot-compiler-dev
mailing list