RFR: 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:56 UTC 2020
On Sun, 22 Nov 2020 17:06:13 GMT, Vladimir Kozlov <kvn 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
>
> Nice.
@vnkozlov @TobiHartmann - thank you for reviewing!
-------------
PR: https://git.openjdk.java.net/jdk/pull/1370
More information about the hotspot-compiler-dev
mailing list