Integrated: 8283541: Add Statical counters and some comments in PhaseStringOpts

Xin Liu xliu at openjdk.java.net
Wed Apr 20 17:41:29 UTC 2022


On Thu, 24 Mar 2022 00:05:40 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)
> ...

This pull request has now been integrated.

Changeset: cb16e410
Author:    Xin Liu <xliu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/cb16e4108922a141a1bf101af2d604d5f1eec661
Stats:     94 lines in 3 files changed: 49 ins; 37 del; 8 mod

8283541: Add Statical counters and some comments in PhaseStringOpts

Reviewed-by: thartmann, kvn

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

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


More information about the hotspot-compiler-dev mailing list