RFR: 8283541: Add Statical counters and some comments in PhaseStringOpts [v2]
Tobias Hartmann
thartmann at openjdk.java.net
Tue Apr 19 08:20:27 UTC 2022
On Fri, 1 Apr 2022 18:08:30 GMT, Xin Liu <xliu at openjdk.org> wrote:
>> Add 3 counters for `OptimizeStringConcat`. Total is the total number of StringBuilder/Buffer.toString() encountered. if it matches, it is either merged or replaced.
>>
>> 1. For each StringConcat, increase `total` counter.
>> 2. merged: this phase realizes that it can coalesce 2 StringConcats, or
>> 3. replaced: this phase replace a StringConcat with a new String.
>>
>> In the following example, javac encounters 79 StringConcats, 4 of them are merged with their successors. 41 have been replaced. The remaining 34 are mismatched in `build_candidate`.
>>
>> $./build/linux-x86_64-server-fastdebug/images/jdk/bin/javac -J-Xcomp -J-XX:+PrintOptoStatistics
>>
>> --- Compiler Statistics ---
>> Methods seen: 13873 Methods parsed: 13873 Nodes created: 3597636
>> Blocks parsed: 42441 Blocks seen: 46403
>> 50086 original NULL checks - 41382 elided (82%); optimizer leaves 13545,
>> 3671 made implicit (27%)
>> 36 implicit null exceptions at runtime
>> StringConcat: 41/ 4/ 79(replaced/merged/total)
>> ...
>
> Xin Liu 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 JDK-8283541
> - bring back multiple. further simplify the interface.
> - 8283541: Add Statical counters and some comments in PhaseStringOpts
Looks good to me.
src/hotspot/share/opto/stringopts.cpp line 428:
> 426: // sb.toString();
> 427: //
> 428: // The receiver of toString method is the result of Allocation Node(CheckedCastPP).
Suggestion:
// The receiver of toString method is the result of Allocation Node(CheckCastPP).
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7933
More information about the hotspot-compiler-dev
mailing list