RFR: 8283541: Add Statical counters and some comments in PhaseStringOpts [v3]

Xin Liu xliu at openjdk.java.net
Tue Apr 19 17:16:07 UTC 2022


> 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 incrementally with one additional commit since the last revision:

  Update typo
  
  Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7933/files
  - new: https://git.openjdk.java.net/jdk/pull/7933/files/62a5f9ff..93cf8f27

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7933&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7933&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7933.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7933/head:pull/7933

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


More information about the hotspot-compiler-dev mailing list