From e8da7cd1d0e7d3535c82f8d05adcef3edd43cd40 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 9 Apr 2024 12:49:48 +0000 Subject: Clean up string data access in `DexFile`. The `*ByIdx()` and `*ByTypeIdx()` functions were doing validity checks that were needed only for processing the debug data, so move the checks to these callers. Replace these functions with new overloads of other functions to provide consistent naming. In a few cases, rewrite calls to these functions to fetch and work with a `string_view` instead. Rename `GetStringLength()` to `GetStringUtf16Length()` and change its return type to `uint32_t`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I561899606f6e5ec5f23aa4be617349dacdb376e3 --- compiler/optimizing/instruction_simplifier.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/optimizing/instruction_simplifier.cc') diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index ae778b421a..2710f49ef2 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -2716,7 +2716,7 @@ void InstructionSimplifierVisitor::SimplifyStringIndexOf(HInvoke* invoke) { const DexFile& dex_file = load_string->GetDexFile(); uint32_t utf16_length; const char* data = - dex_file.StringDataAndUtf16LengthByIdx(load_string->GetStringIndex(), &utf16_length); + dex_file.GetStringDataAndUtf16Length(load_string->GetStringIndex(), &utf16_length); if (utf16_length == 0) { invoke->ReplaceWith(GetGraph()->GetIntConstant(-1)); invoke->GetBlock()->RemoveInstruction(invoke); -- cgit v1.2.3-59-g8ed1b