RFR: 8256274: C2: Optimize copying of the shared type dictionary [v2]

Nils Eliasson neliasso at openjdk.java.net
Fri Nov 13 13:04:06 UTC 2020


On Thu, 12 Nov 2020 14:55:15 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> - Remove unused (and subtly broken) Dict deep copy constructors
>> - Add a fixed, deep copy constructor to Dict which also takes the arena to allocate the copy in
>> - Use this new deep copy constructor in Type::Initialize instead of copying by iterating over the shared dict
>> 
>> This reduce the overhead of each C2 compilation by ~32k instructions[1], with a noticeable gain on targeted micros such as `trivialMath_repeat_c2`. Baseline:
>> Benchmark                                      Mode  Cnt    Score   Error  Units
>> SimpleRepeatCompilation.trivialMath_repeat_c2    ss   10  396.004 ± 3.061  ms/op
>> Patch:
>> Benchmark                                      Mode  Cnt    Score   Error  Units
>> SimpleRepeatCompilation.trivialMath_repeat_c2    ss   10  354.639 ± 1.929  ms/op
>> 
>> (Each fork does 2000 repeated compilations, so the improvement is somewhere around 20us/compilation)
>> 
>> [1] when instrumenting with valgrind+callgrind
>
> 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 three additional commits since the last revision:
> 
>  - Merge branch 'master' into copy_shared_dict
>  - Clean-up, copyrights
>  - 8256274: C2: Optimize copying of the shared type dictionary on compilation setup

Marked as reviewed by neliasso (Reviewer).

src/hotspot/share/libadt/dict.cpp line 82:

> 80: 
> 81: // Deep copy into arena of choice
> 82: Dict::Dict(const Dict &d, Arena *arena)

Some minor formatting errors in this method: 
Arena * -> Arena*
void * -> void*
_cnt*2*sizeof -> _cnt * 2 * sizeof

Otherwise looks good!

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

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


More information about the hotspot-compiler-dev mailing list