From b226cf2207e7d31b1d2054489618e31adf62906c Mon Sep 17 00:00:00 2001 From: zhaoziming Date: Fri, 6 Jun 2025 19:51:45 +0800 Subject: [PATCH] tmp commit for POC Change-Id: I0b67e606ffd9b9c7d2800fe7be289bd2956169ea --- static_core/plugins/ets/irtoc_scripts/string.irt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/static_core/plugins/ets/irtoc_scripts/string.irt b/static_core/plugins/ets/irtoc_scripts/string.irt index 664527fc90..232bd46b96 100644 --- a/static_core/plugins/ets/irtoc_scripts/string.irt +++ b/static_core/plugins/ets/irtoc_scripts/string.irt @@ -33,6 +33,17 @@ module Constants WRONG_CHAR_FLAG_MASK = "0x10000UL" end +macro(:call_runtime_slowpath_for_nonline_string) { |e, str, *args| + + klass := load_class(str) + type := get_string_type(klass) + IfImm(Compare(type, Constants:LINE_STRIGN_TYPE).NE.Unlikely.b { + entry := LoadI(%tr).Imm(e).ptr + CallIndirect(entry, *args) + } +} + + # It is assumed that _begin_index and _end_index are safe and does not check/normalize them. # The range is [_begin_index, _end_index). # Note, a caller of this macro must provide a corresponding 'SlowPathEntrypoint' @@ -270,6 +281,8 @@ function(:StringTrimLeftBase, next end + call_runtime_slowpath_for_nonline_string("StringTrimLeftBase", str, unused1, unused2).void + length_packed := LoadI(str).Imm(Constants::STRING_LENGTH_OFFSET).u32 str_data := Add(Cast(str).SrcType(Constants::COMPILER_REFERENCE).ptr, Cast(Constants::STRING_DATA_OFFSET).word).ptr not_compressed := AndI(length_packed).Imm(1).i32 -- Gitee