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

Xin Liu xliu at openjdk.java.net
Tue Dec 15 07:12:10 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 incrementally with one additional commit since the last revision:

  allow C2 to "late" inline the overloaded methods.
  
  Compile::update_string_late_inline clones the callGenerator of the CallJavaNode and change
  the bound ciMethod of it. the function also update the callGenerator in _string_late_inlines.
  The new callnode will be handled in Compile::inline_string_calls.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/974/files
  - new: https://git.openjdk.java.net/jdk/pull/974/files/f96e87c7..c5a25bfb

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

  Stats: 46 lines in 6 files changed: 42 ins; 0 del; 4 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