diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/constant_folding.cc | 3 | ||||
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 17 | ||||
-rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/intrinsics_arm64.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/intrinsics_arm_vixl.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/sharpening.cc | 12 |
6 files changed, 18 insertions, 20 deletions
diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc index 52cbfe8322..e31de9e1da 100644 --- a/compiler/optimizing/constant_folding.cc +++ b/compiler/optimizing/constant_folding.cc @@ -596,7 +596,8 @@ void HConstantFoldingVisitor::VisitArrayLength(HArrayLength* inst) { HLoadString* load_string = input->AsLoadString(); const DexFile& dex_file = load_string->GetDexFile(); const dex::StringId& string_id = dex_file.GetStringId(load_string->GetStringIndex()); - inst->ReplaceWith(GetGraph()->GetIntConstant(dex_file.GetStringLength(string_id))); + inst->ReplaceWith(GetGraph()->GetIntConstant( + dchecked_integral_cast<int32_t>(dex_file.GetStringUtf16Length(string_id)))); } } diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index c3918683ce..3e9c42ba70 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -60,7 +60,7 @@ class SamePackageCompare { const DexFile* dex_file = dex_compilation_unit_.GetDexFile(); uint32_t referrers_method_idx = dex_compilation_unit_.GetDexMethodIndex(); referrers_descriptor_ = - dex_file->StringByTypeIdx(dex_file->GetMethodId(referrers_method_idx).class_idx_); + dex_file->GetMethodDeclaringClassDescriptor(dex_file->GetMethodId(referrers_method_idx)); referrers_package_length_ = PackageLength(referrers_descriptor_); } std::string temp; @@ -2439,7 +2439,7 @@ HNewArray* HInstructionBuilder::BuildFilledNewArray(uint32_t dex_pc, HInstruction* length = graph_->GetIntConstant(number_of_operands, dex_pc); HNewArray* new_array = BuildNewArray(dex_pc, type_index, length); - const char* descriptor = dex_file_->StringByTypeIdx(type_index); + const char* descriptor = dex_file_->GetTypeDescriptor(type_index); DCHECK_EQ(descriptor[0], '[') << descriptor; char primitive = descriptor[1]; DCHECK(primitive == 'I' @@ -2657,14 +2657,11 @@ bool HInstructionBuilder::LoadClassNeedsAccessCheck(dex::TypeIndex type_index, return true; } } else { - uint32_t outer_utf16_length; - const char* outer_descriptor = - outer_dex_file->StringByTypeIdx(outer_class_def.class_idx_, &outer_utf16_length); - uint32_t target_utf16_length; - const char* target_descriptor = - inner_dex_file->StringByTypeIdx(type_index, &target_utf16_length); - if (outer_utf16_length != target_utf16_length || - strcmp(outer_descriptor, target_descriptor) != 0) { + const std::string_view outer_descriptor = + outer_dex_file->GetTypeDescriptorView(outer_class_def.class_idx_); + const std::string_view target_descriptor = + inner_dex_file->GetTypeDescriptorView(type_index); + if (outer_descriptor != target_descriptor) { return true; } } 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); diff --git a/compiler/optimizing/intrinsics_arm64.cc b/compiler/optimizing/intrinsics_arm64.cc index 4de6d5d582..3dde811958 100644 --- a/compiler/optimizing/intrinsics_arm64.cc +++ b/compiler/optimizing/intrinsics_arm64.cc @@ -2053,7 +2053,7 @@ static const char* GetConstString(HInstruction* candidate, uint32_t* utf16_lengt if (candidate->IsLoadString()) { HLoadString* load_string = candidate->AsLoadString(); const DexFile& dex_file = load_string->GetDexFile(); - return dex_file.StringDataAndUtf16LengthByIdx(load_string->GetStringIndex(), utf16_length); + return dex_file.GetStringDataAndUtf16Length(load_string->GetStringIndex(), utf16_length); } return nullptr; } diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc index c763721aec..ea7b65181a 100644 --- a/compiler/optimizing/intrinsics_arm_vixl.cc +++ b/compiler/optimizing/intrinsics_arm_vixl.cc @@ -838,7 +838,7 @@ static const char* GetConstString(HInstruction* candidate, uint32_t* utf16_lengt if (candidate->IsLoadString()) { HLoadString* load_string = candidate->AsLoadString(); const DexFile& dex_file = load_string->GetDexFile(); - return dex_file.StringDataAndUtf16LengthByIdx(load_string->GetStringIndex(), utf16_length); + return dex_file.GetStringDataAndUtf16Length(load_string->GetStringIndex(), utf16_length); } return nullptr; } diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index 5a697e32a1..e900b3ef3a 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -54,7 +54,7 @@ static bool BootImageAOTCanEmbedMethod(ArtMethod* method, const CompilerOptions& ObjPtr<mirror::Class> klass = method->GetDeclaringClass(); DCHECK(klass != nullptr); const DexFile& dex_file = klass->GetDexFile(); - return compiler_options.IsImageClass(dex_file.StringByTypeIdx(klass->GetDexTypeIndex())); + return compiler_options.IsImageClass(dex_file.GetTypeDescriptor(klass->GetDexTypeIndex())); } HInvokeStaticOrDirect::DispatchInfo HSharpening::SharpenLoadMethod( @@ -173,7 +173,7 @@ HLoadClass::LoadKind HSharpening::ComputeLoadClassKind( auto is_class_in_current_boot_image = [&]() { return (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) && - compiler_options.IsImageClass(dex_file.StringByTypeIdx(type_index)); + compiler_options.IsImageClass(dex_file.GetTypeDescriptor(type_index)); }; bool is_in_boot_image = false; @@ -210,12 +210,12 @@ HLoadClass::LoadKind HSharpening::ComputeLoadClassKind( const char* slash_pos = strrchr(descriptor, '/'); return (slash_pos != nullptr) ? static_cast<size_t>(slash_pos - descriptor) : 0u; }; - const char* klass_descriptor = dex_file.StringByTypeIdx(type_index); + const char* klass_descriptor = dex_file.GetTypeDescriptor(type_index); const uint32_t klass_package_length = package_length(klass_descriptor); const DexFile* referrer_dex_file = dex_compilation_unit.GetDexFile(); const dex::TypeIndex referrer_type_index = referrer_dex_file->GetClassDef(dex_compilation_unit.GetClassDefIndex()).class_idx_; - const char* referrer_descriptor = referrer_dex_file->StringByTypeIdx(referrer_type_index); + const char* referrer_descriptor = referrer_dex_file->GetTypeDescriptor(referrer_type_index); const uint32_t referrer_package_length = package_length(referrer_descriptor); bool same_package = (referrer_package_length == klass_package_length) && @@ -240,7 +240,7 @@ HLoadClass::LoadKind HSharpening::ComputeLoadClassKind( is_in_boot_image = true; desired_load_kind = HLoadClass::LoadKind::kBootImageRelRo; } else if ((klass != nullptr) && - compiler_options.IsImageClass(dex_file.StringByTypeIdx(type_index))) { + compiler_options.IsImageClass(dex_file.GetTypeDescriptor(type_index))) { is_in_boot_image = true; desired_load_kind = HLoadClass::LoadKind::kBootImageLinkTimePcRelative; } else { @@ -317,7 +317,7 @@ static inline bool CanUseTypeCheckBitstring(ObjPtr<mirror::Class> klass, CodeGen if (compiler_options.IsJitCompiler()) { // If we're JITting, try to assign a type check bitstring (fall through). } else if (codegen->GetCompilerOptions().IsBootImage()) { - const char* descriptor = klass->GetDexFile().StringByTypeIdx(klass->GetDexTypeIndex()); + const char* descriptor = klass->GetDexFile().GetTypeDescriptor(klass->GetDexTypeIndex()); if (!codegen->GetCompilerOptions().IsImageClass(descriptor)) { return false; } |