RFR: 8254807: Optimize startsWith() for String.substring() [v4]

Xin Liu xliu at openjdk.java.net
Sat Dec 12 21:02:36 UTC 2020


> The optimization transforms code from s=substring(base, beg, end); s.startsWith(prefix)
> to substring(base, beg, end) | base.startsWith(prefix, beg). 
> 
> it reduces uses of substring. hopefully c2 optimizer can remove the used substring.

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 10 additional commits since the last revision:

 - Merge branch 'master' into JDK-8254807
 - use a brand new CallNode instead of overloading the startsWith.
   
   set_bci to -1 so we skip symbolic info validation
 - 8254807: Optimize startsWith() for String.substring()
   
   improve microbenchmark based on the PR feedback.
 - fix a regression test on x86_32
 - 8254807: Optimize startsWith() for String.substring()
   
   add more comments
 - 8254807: Optimize startsWith() for String.substring()
   
   invoke uncommon_trap if the index is out of bound before startsWith
 - 8254807: Optimize startsWith() for String.substring()
   
   add a regression test to verify that OptimizeSubstirng works
 - 8254807: Optimize startsWith() for String.substring()
   
   add a microbench to show performance improvement
 - 8254807: Optimize startsWith() for String.substring()
   
   bugfix
 - 8254807: Optimize startsWith() for String.substring()

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/974/files
  - new: https://git.openjdk.java.net/jdk/pull/974/files/b8ef8ce7..60491ffc

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

  Stats: 374366 lines in 3672 files changed: 235058 ins; 101841 del; 37467 mod
  Patch: https://git.openjdk.java.net/jdk/pull/974.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/974/head:pull/974

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


More information about the hotspot-compiler-dev mailing list