Integrated: JDK-8262994: Refactor String.split to help method inlining

Christian Wimmer cwimmer at openjdk.org
Mon Jan 30 23:36:03 UTC 2023


On Tue, 27 Dec 2022 20:12:51 GMT, Christian Wimmer <cwimmer at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 622b6594
Author:    Christian Wimmer <cwimmer at openjdk.org>
Committer: Peter Levart <plevart at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/622b6594d1435e8773ec16d00d48e1f582065bd8
Stats:     43 lines in 1 file changed: 11 ins; 2 del; 30 mod

8262994: Refactor String.split to help method inlining

Reviewed-by: plevart

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

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


More information about the core-libs-dev mailing list