RFR: JDK-8262994: Refactor String.split to help method inlining [v2]

Christian Wimmer cwimmer at openjdk.org
Mon Jan 9 20:04:34 UTC 2023


> The method `String.split` contains a fast-path when the regular expression parameter is not really a regular expression, but just a single split character.
> This fast path vs. slow path check can be constant folded when the regular expression parameter is a literal constant - a quite frequent pattern (for example, all JDK usages of `String.split` have a constant expression parameter). But method inlining in JIT and AOT compilers can usually not inline `String.split` because the method body is too large. Factoring out the actual fast-path splitting logic into a separate method solves this problem: the JIT or AOT compiler can inline `String.split`, constant-fold the fast/slow path check, and then only the invoke of either the fast path or the slow path remains.

Christian Wimmer has updated the pull request incrementally with one additional commit since the last revision:

  Add comment about method inlining

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11791/files
  - new: https://git.openjdk.org/jdk/pull/11791/files/f06be05b..72667c4e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11791&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11791&range=00-01

  Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/11791.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11791/head:pull/11791

PR: https://git.openjdk.org/jdk/pull/11791


More information about the core-libs-dev mailing list