diff options
39 files changed, 117 insertions, 95 deletions
diff --git a/compiler/linker/arm/relative_patcher_arm_base.cc b/compiler/linker/arm/relative_patcher_arm_base.cc index 6e63bf8990..1c1b87701a 100644 --- a/compiler/linker/arm/relative_patcher_arm_base.cc +++ b/compiler/linker/arm/relative_patcher_arm_base.cc @@ -19,6 +19,7 @@ #include "base/stl_util.h" #include "compiled_method.h" #include "debug/method_debug_info.h" +#include "dex_file_types.h" #include "linker/output_stream.h" #include "oat.h" #include "oat_quick_method_header.h" @@ -169,7 +170,7 @@ uint32_t ArmBaseRelativePatcher::ReserveSpaceEnd(uint32_t offset) { // to place thunk will be soon enough, we need to reserve all needed thunks now. Code for // subsequent oat files can still call back to them. if (!unprocessed_method_call_patches_.empty()) { - ResolveMethodCalls(offset, MethodReference(nullptr, DexFile::kDexNoIndex)); + ResolveMethodCalls(offset, MethodReference(nullptr, dex::kDexNoIndex)); } for (ThunkData* data : unreserved_thunks_) { uint32_t thunk_offset = CompiledCode::AlignCode(offset, instruction_set_); diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 7ae3866bc1..4fcfdc058c 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -33,6 +33,7 @@ #include "debug/method_debug_info.h" #include "dex/verification_results.h" #include "dex_file-inl.h" +#include "dex_file_types.h" #include "dexlayout.h" #include "driver/compiler_driver-inl.h" #include "driver/compiler_options.h" @@ -667,11 +668,11 @@ class OatWriter::DexMethodVisitor { : writer_(writer), offset_(offset), dex_file_(nullptr), - class_def_index_(DexFile::kDexNoIndex) {} + class_def_index_(dex::kDexNoIndex) {} virtual bool StartClass(const DexFile* dex_file, size_t class_def_index) { DCHECK(dex_file_ == nullptr); - DCHECK_EQ(class_def_index_, DexFile::kDexNoIndex); + DCHECK_EQ(class_def_index_, dex::kDexNoIndex); dex_file_ = dex_file; class_def_index_ = class_def_index; return true; @@ -682,7 +683,7 @@ class OatWriter::DexMethodVisitor { virtual bool EndClass() { if (kIsDebugBuild) { dex_file_ = nullptr; - class_def_index_ = DexFile::kDexNoIndex; + class_def_index_ = dex::kDexNoIndex; } return true; } diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 6567a3a445..793e781bae 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -1236,7 +1236,7 @@ bool HInliner::TryInlineAndReplace(HInvoke* invoke_instruction, const DexFile& caller_dex_file = *caller_compilation_unit_.GetDexFile(); uint32_t dex_method_index = FindMethodIndexIn( method, caller_dex_file, invoke_instruction->GetDexMethodIndex()); - if (dex_method_index == DexFile::kDexNoIndex) { + if (dex_method_index == dex::kDexNoIndex) { return false; } HInvokeVirtual* new_invoke = new (graph_->GetArena()) HInvokeVirtual( diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc index 5de707a50f..2c856cd3d9 100644 --- a/compiler/optimizing/prepare_for_register_allocation.cc +++ b/compiler/optimizing/prepare_for_register_allocation.cc @@ -16,6 +16,7 @@ #include "prepare_for_register_allocation.h" +#include "dex_file_types.h" #include "jni_internal.h" #include "optimizing_compiler_stats.h" #include "well_known_classes.h" @@ -59,7 +60,7 @@ void PrepareForRegisterAllocation::VisitBoundsCheck(HBoundsCheck* check) { HEnvironment* environment = new (arena) HEnvironment(arena, /* number_of_vregs */ 0u, char_at_method, - /* dex_pc */ DexFile::kDexNoIndex, + /* dex_pc */ dex::kDexNoIndex, check); check->InsertRawEnvironment(environment); } diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc index b7840d73db..7eb2188a28 100644 --- a/compiler/optimizing/stack_map_stream.cc +++ b/compiler/optimizing/stack_map_stream.cc @@ -18,6 +18,7 @@ #include "art_method-inl.h" #include "base/stl_util.h" +#include "dex_file_types.h" #include "optimizing/optimizing_compiler.h" #include "runtime.h" #include "scoped_thread_state_change-inl.h" @@ -39,7 +40,7 @@ void StackMapStream::BeginStackMapEntry(uint32_t dex_pc, current_entry_.inlining_depth = inlining_depth; current_entry_.inline_infos_start_index = inline_infos_.size(); current_entry_.stack_mask_index = 0; - current_entry_.dex_method_index = DexFile::kDexNoIndex; + current_entry_.dex_method_index = dex::kDexNoIndex; current_entry_.dex_register_entry.num_dex_registers = num_dex_registers; current_entry_.dex_register_entry.locations_start_index = dex_register_locations_.size(); current_entry_.dex_register_entry.live_dex_registers_mask = (num_dex_registers != 0) @@ -226,7 +227,7 @@ void StackMapStream::ComputeInvokeInfoEncoding(CodeInfoEncoding* encoding) { size_t invoke_infos_count = 0; size_t invoke_type_max = 0; for (const StackMapEntry& entry : stack_maps_) { - if (entry.dex_method_index != DexFile::kDexNoIndex) { + if (entry.dex_method_index != dex::kDexNoIndex) { native_pc_max = std::max(native_pc_max, entry.native_pc_code_offset.CompressedValue()); method_index_max = std::max(method_index_max, static_cast<uint16_t>(entry.dex_method_index)); invoke_type_max = std::max(invoke_type_max, static_cast<size_t>(entry.invoke_type)); @@ -240,7 +241,7 @@ void StackMapStream::ComputeInvokeInfoEncoding(CodeInfoEncoding* encoding) { void StackMapStream::ComputeInlineInfoEncoding(InlineInfoEncoding* encoding, size_t dex_register_maps_bytes) { uint32_t method_index_max = 0; - uint32_t dex_pc_max = DexFile::kDexNoIndex; + uint32_t dex_pc_max = dex::kDexNoIndex; uint32_t extra_data_max = 0; uint32_t inline_info_index = 0; @@ -256,8 +257,8 @@ void StackMapStream::ComputeInlineInfoEncoding(InlineInfoEncoding* encoding, extra_data_max = std::max( extra_data_max, Low32Bits(reinterpret_cast<uintptr_t>(inline_entry.method))); } - if (inline_entry.dex_pc != DexFile::kDexNoIndex && - (dex_pc_max == DexFile::kDexNoIndex || dex_pc_max < inline_entry.dex_pc)) { + if (inline_entry.dex_pc != dex::kDexNoIndex && + (dex_pc_max == dex::kDexNoIndex || dex_pc_max < inline_entry.dex_pc)) { dex_pc_max = inline_entry.dex_pc; } } @@ -362,7 +363,7 @@ void StackMapStream::FillInCodeInfo(MemoryRegion region) { dex_register_locations_region); stack_map.SetDexRegisterMapOffset(encoding.stack_map.encoding, offset); - if (entry.dex_method_index != DexFile::kDexNoIndex) { + if (entry.dex_method_index != dex::kDexNoIndex) { InvokeInfo invoke_info(code_info.GetInvokeInfo(encoding, invoke_info_idx)); invoke_info.SetNativePcCodeOffset(encoding.invoke_info.encoding, entry.native_pc_code_offset); invoke_info.SetInvokeType(encoding.invoke_info.encoding, entry.invoke_type); @@ -561,7 +562,7 @@ void StackMapStream::PrepareMethodIndices() { for (StackMapEntry& stack_map : stack_maps_) { const size_t index = dedupe.size(); const uint32_t method_index = stack_map.dex_method_index; - if (method_index != DexFile::kDexNoIndex) { + if (method_index != dex::kDexNoIndex) { stack_map.dex_method_index_idx = dedupe.emplace(method_index, index).first->second; method_indices_[index] = method_index; } @@ -569,7 +570,7 @@ void StackMapStream::PrepareMethodIndices() { for (InlineInfoEntry& inline_info : inline_infos_) { const size_t index = dedupe.size(); const uint32_t method_index = inline_info.method_index; - CHECK_NE(method_index, DexFile::kDexNoIndex); + CHECK_NE(method_index, dex::kDexNoIndex); inline_info.dex_method_index_idx = dedupe.emplace(method_index, index).first->second; method_indices_[index] = method_index; } @@ -629,7 +630,7 @@ void StackMapStream::CheckCodeInfo(MemoryRegion region) const { DCHECK_EQ(stack_mask.LoadBit(b), 0u); } } - if (entry.dex_method_index != DexFile::kDexNoIndex) { + if (entry.dex_method_index != dex::kDexNoIndex) { InvokeInfo invoke_info = code_info.GetInvokeInfo(encoding, invoke_info_index); DCHECK_EQ(invoke_info.GetNativePcOffset(encoding.invoke_info.encoding, instruction_set_), entry.native_pc_code_offset.Uint32Value(instruction_set_)); diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index e6471e1bc5..a574566e33 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -126,7 +126,7 @@ class StackMapStream : public ValueObject { }; struct InlineInfoEntry { - uint32_t dex_pc; // DexFile::kDexNoIndex for intrinsified native methods. + uint32_t dex_pc; // dex::kDexNoIndex for intrinsified native methods. ArtMethod* method; uint32_t method_index; DexRegisterMapEntry dex_register_entry; diff --git a/dexlayout/dex_ir.h b/dexlayout/dex_ir.h index 9c887b9a17..362c08b918 100644 --- a/dexlayout/dex_ir.h +++ b/dexlayout/dex_ir.h @@ -26,6 +26,7 @@ #include "base/stl_util.h" #include "dex_file-inl.h" +#include "dex_file_types.h" #include "leb128.h" #include "utf.h" @@ -250,7 +251,7 @@ class Collections { } StringId* GetStringIdOrNullPtr(uint32_t index) { - return index == DexFile::kDexNoIndex ? nullptr : GetStringId(index); + return index == dex::kDexNoIndex ? nullptr : GetStringId(index); } TypeId* GetTypeIdOrNullPtr(uint16_t index) { return index == DexFile::kDexNoIndex16 ? nullptr : GetTypeId(index); diff --git a/dexlayout/dex_writer.cc b/dexlayout/dex_writer.cc index e1b828ca52..11ba2a6357 100644 --- a/dexlayout/dex_writer.cc +++ b/dexlayout/dex_writer.cc @@ -16,12 +16,14 @@ * Header file of an in-memory representation of DEX files. */ +#include "dex_writer.h" + #include <stdint.h> #include <queue> #include <vector> -#include "dex_writer.h" +#include "dex_file_types.h" #include "utf.h" namespace art { @@ -462,10 +464,10 @@ void DexWriter::WriteClasses() { for (std::unique_ptr<dex_ir::ClassDef>& class_def : header_->GetCollections().ClassDefs()) { class_def_buffer[0] = class_def->ClassType()->GetIndex(); class_def_buffer[1] = class_def->GetAccessFlags(); - class_def_buffer[2] = class_def->Superclass() == nullptr ? DexFile::kDexNoIndex : + class_def_buffer[2] = class_def->Superclass() == nullptr ? dex::kDexNoIndex : class_def->Superclass()->GetIndex(); class_def_buffer[3] = class_def->InterfacesOffset(); - class_def_buffer[4] = class_def->SourceFile() == nullptr ? DexFile::kDexNoIndex : + class_def_buffer[4] = class_def->SourceFile() == nullptr ? dex::kDexNoIndex : class_def->SourceFile()->GetIndex(); class_def_buffer[5] = class_def->Annotations() == nullptr ? 0 : class_def->Annotations()->GetOffset(); diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc index 401a3ee284..92a1366778 100644 --- a/dexlayout/dexlayout.cc +++ b/dexlayout/dexlayout.cc @@ -35,6 +35,7 @@ #include "dex_file-inl.h" #include "dex_file_layout.h" +#include "dex_file_types.h" #include "dex_file_verifier.h" #include "dex_instruction-inl.h" #include "dex_ir_builder.h" @@ -366,7 +367,7 @@ static std::unique_ptr<char[]> IndexString(dex_ir::Header* header, std::unique_ptr<char[]> buf(new char[buf_size]); // Determine index and width of the string. uint32_t index = 0; - uint32_t secondary_index = DexFile::kDexNoIndex; + uint32_t secondary_index = dex::kDexNoIndex; uint32_t width = 4; switch (Instruction::FormatOf(dec_insn->Opcode())) { // SOME NOT SUPPORTED: diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc index b0f8d8ac25..b406bd45cb 100644 --- a/openjdkjvmti/events.cc +++ b/openjdkjvmti/events.cc @@ -37,6 +37,7 @@ #include "art_jvmti.h" #include "art_method-inl.h" #include "base/logging.h" +#include "dex_file_types.h" #include "gc/allocation_listener.h" #include "gc/gc_pause_listener.h" #include "gc/heap.h" @@ -692,14 +693,14 @@ class JvmtiMethodTraceListener FINAL : public art::instrumentation::Instrumentat if (!method->IsNative()) { uint32_t cur_dex_pc = GetDexPc(); - if (cur_dex_pc == art::DexFile::kDexNoIndex) { + if (cur_dex_pc == art::dex::kDexNoIndex) { // This frame looks opaque. Just keep on going. return true; } bool has_no_move_exception = false; uint32_t found_dex_pc = method->FindCatchBlock( exception_class_, cur_dex_pc, &has_no_move_exception); - if (found_dex_pc != art::DexFile::kDexNoIndex) { + if (found_dex_pc != art::dex::kDexNoIndex) { // We found the catch. Store the result and return. *catch_method_ptr_ = method; *catch_dex_pc_ptr_ = found_dex_pc; diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc index 05943e70a4..62603aa187 100644 --- a/openjdkjvmti/ti_method.cc +++ b/openjdkjvmti/ti_method.cc @@ -38,6 +38,7 @@ #include "base/enums.h" #include "base/mutex-inl.h" #include "dex_file_annotations.h" +#include "dex_file_types.h" #include "events-inl.h" #include "jit/jit.h" #include "jni_internal.h" @@ -563,7 +564,7 @@ class CommonLocalVariableClosure : public art::Closure { } bool needs_instrument = !visitor.IsShadowFrame(); uint32_t pc = visitor.GetDexPc(/*abort_on_failure*/ false); - if (pc == art::DexFile::kDexNoIndex) { + if (pc == art::dex::kDexNoIndex) { // Cannot figure out current PC. result_ = ERR(OPAQUE_FRAME); return; diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc index e165187348..699f6952c4 100644 --- a/openjdkjvmti/ti_stack.cc +++ b/openjdkjvmti/ti_stack.cc @@ -46,6 +46,7 @@ #include "base/mutex.h" #include "dex_file.h" #include "dex_file_annotations.h" +#include "dex_file_types.h" #include "gc_root.h" #include "handle_scope-inl.h" #include "jni_env_ext.h" @@ -88,7 +89,7 @@ struct GetStackTraceVisitor : public art::StackVisitor { jmethodID id = art::jni::EncodeArtMethod(m); uint32_t dex_pc = GetDexPc(false); - jlong dex_location = (dex_pc == art::DexFile::kDexNoIndex) ? -1 : static_cast<jlong>(dex_pc); + jlong dex_location = (dex_pc == art::dex::kDexNoIndex) ? -1 : static_cast<jlong>(dex_pc); jvmtiFrameInfo info = { id, dex_location }; fn(info); @@ -819,7 +820,7 @@ jvmtiError StackUtil::GetFrameLocation(jvmtiEnv* env ATTRIBUTE_UNUSED, if (closure.method->IsNative()) { *location_ptr = -1; } else { - if (closure.dex_pc == art::DexFile::kDexNoIndex) { + if (closure.dex_pc == art::dex::kDexNoIndex) { return ERR(INTERNAL); } *location_ptr = static_cast<jlocation>(closure.dex_pc); diff --git a/profman/profman.cc b/profman/profman.cc index d0c99e0201..91061a691d 100644 --- a/profman/profman.cc +++ b/profman/profman.cc @@ -39,6 +39,7 @@ #include "boot_image_profile.h" #include "bytecode_utils.h" #include "dex_file.h" +#include "dex_file_types.h" #include "jit/profile_compilation_info.h" #include "profile_assistant.h" #include "runtime.h" @@ -668,14 +669,14 @@ class ProfMan FINAL { constexpr uint16_t kInvalidMethodIndex = std::numeric_limits<uint16_t>::max() - 1; return kInvalidMethodIndex >= dex_file->NumMethodIds() ? kInvalidMethodIndex - : DexFile::kDexNoIndex; + : dex::kDexNoIndex; } std::vector<std::string> name_and_signature; Split(method_spec, kProfileParsingFirstCharInSignature, &name_and_signature); if (name_and_signature.size() != 2) { LOG(ERROR) << "Invalid method name and signature " << method_spec; - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } const std::string& name = name_and_signature[0]; @@ -684,24 +685,24 @@ class ProfMan FINAL { const DexFile::StringId* name_id = dex_file->FindStringId(name.c_str()); if (name_id == nullptr) { LOG(WARNING) << "Could not find name: " << name; - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } dex::TypeIndex return_type_idx; std::vector<dex::TypeIndex> param_type_idxs; if (!dex_file->CreateTypeList(signature, &return_type_idx, ¶m_type_idxs)) { LOG(WARNING) << "Could not create type list" << signature; - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } const DexFile::ProtoId* proto_id = dex_file->FindProtoId(return_type_idx, param_type_idxs); if (proto_id == nullptr) { LOG(WARNING) << "Could not find proto_id: " << name; - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } const DexFile::MethodId* method_id = dex_file->FindMethodId( dex_file->GetTypeId(class_ref.type_index), *name_id, *proto_id); if (method_id == nullptr) { LOG(WARNING) << "Could not find method_id: " << name; - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } return dex_file->GetIndexForMethodId(*method_id); @@ -848,7 +849,7 @@ class ProfMan FINAL { } const uint32_t method_index = FindMethodIndex(class_ref, method_spec); - if (method_index == DexFile::kDexNoIndex) { + if (method_index == dex::kDexNoIndex) { return false; } diff --git a/runtime/art_field-inl.h b/runtime/art_field-inl.h index 2532db9082..fced9954a9 100644 --- a/runtime/art_field-inl.h +++ b/runtime/art_field-inl.h @@ -340,7 +340,7 @@ inline const DexFile* ArtField::GetDexFile() REQUIRES_SHARED(Locks::mutator_lock inline ObjPtr<mirror::String> ArtField::GetStringName(Thread* self, bool resolve) { auto dex_field_index = GetDexFieldIndex(); - CHECK_NE(dex_field_index, DexFile::kDexNoIndex); + CHECK_NE(dex_field_index, dex::kDexNoIndex); ObjPtr<mirror::DexCache> dex_cache = GetDexCache(); const auto* dex_file = dex_cache->GetDexFile(); const auto& field_id = dex_file->GetFieldId(dex_field_index); diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index 1588920e94..7ff35acf74 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -25,8 +25,8 @@ #include "class_linker-inl.h" #include "common_throws.h" #include "dex_file-inl.h" -#include "dex_file.h" #include "dex_file_annotations.h" +#include "dex_file_types.h" #include "gc_root-inl.h" #include "invoke_type.h" #include "jit/profiling_info.h" @@ -184,7 +184,7 @@ inline const DexFile* ArtMethod::GetDexFile() { inline const char* ArtMethod::GetDeclaringClassDescriptor() { uint32_t dex_method_idx = GetDexMethodIndex(); - if (UNLIKELY(dex_method_idx == DexFile::kDexNoIndex)) { + if (UNLIKELY(dex_method_idx == dex::kDexNoIndex)) { return "<runtime method>"; } DCHECK(!IsProxyMethod()); @@ -205,7 +205,7 @@ inline const char* ArtMethod::GetShorty(uint32_t* out_length) { inline const Signature ArtMethod::GetSignature() { uint32_t dex_method_idx = GetDexMethodIndex(); - if (dex_method_idx != DexFile::kDexNoIndex) { + if (dex_method_idx != dex::kDexNoIndex) { DCHECK(!IsProxyMethod()); const DexFile* dex_file = GetDexFile(); return dex_file->GetMethodSignature(dex_file->GetMethodId(dex_method_idx)); @@ -215,7 +215,7 @@ inline const Signature ArtMethod::GetSignature() { inline const char* ArtMethod::GetName() { uint32_t dex_method_idx = GetDexMethodIndex(); - if (LIKELY(dex_method_idx != DexFile::kDexNoIndex)) { + if (LIKELY(dex_method_idx != dex::kDexNoIndex)) { DCHECK(!IsProxyMethod()); const DexFile* dex_file = GetDexFile(); return dex_file->GetMethodName(dex_file->GetMethodId(dex_method_idx)); @@ -253,7 +253,7 @@ inline bool ArtMethod::IsResolvedTypeIdx(dex::TypeIndex type_idx) { inline int32_t ArtMethod::GetLineNumFromDexPC(uint32_t dex_pc) { DCHECK(!IsProxyMethod()); - if (dex_pc == DexFile::kDexNoIndex) { + if (dex_pc == dex::kDexNoIndex) { return IsNative() ? -2 : -1; } return annotations::GetLineNumFromPC(GetDexFile(), this, dex_pc); diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 7d8dedab6f..ece853f016 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -59,7 +59,7 @@ extern "C" void art_quick_invoke_static_stub(ArtMethod*, uint32_t*, uint32_t, Th DEFINE_RUNTIME_DEBUG_FLAG(ArtMethod, kCheckDeclaringClassState); // Enforce that we he have the right index for runtime methods. -static_assert(ArtMethod::kRuntimeMethodDexMethodIndex == DexFile::kDexNoIndex, +static_assert(ArtMethod::kRuntimeMethodDexMethodIndex == dex::kDexNoIndex, "Wrong runtime-method dex method index"); ArtMethod* ArtMethod::GetCanonicalMethod(PointerSize pointer_size) { @@ -258,7 +258,7 @@ uint32_t ArtMethod::FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfil return other_dexfile.GetIndexForMethodId(*other_mid); } } - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } uint32_t ArtMethod::FindCatchBlock(Handle<mirror::Class> exception_type, @@ -270,7 +270,7 @@ uint32_t ArtMethod::FindCatchBlock(Handle<mirror::Class> exception_type, Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException())); self->ClearException(); // Default to handler not found. - uint32_t found_dex_pc = DexFile::kDexNoIndex; + uint32_t found_dex_pc = dex::kDexNoIndex; // Iterate over the catch handlers associated with dex_pc. for (CatchHandlerIterator it(*code_item, dex_pc); it.HasNext(); it.Next()) { dex::TypeIndex iter_type_idx = it.GetHandlerTypeIndex(); @@ -296,7 +296,7 @@ uint32_t ArtMethod::FindCatchBlock(Handle<mirror::Class> exception_type, break; } } - if (found_dex_pc != DexFile::kDexNoIndex) { + if (found_dex_pc != dex::kDexNoIndex) { const Instruction* first_catch_instr = Instruction::At(&code_item->insns_[found_dex_pc]); *has_no_move_exception = (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION); diff --git a/runtime/art_method.h b/runtime/art_method.h index dab3f234e2..fbdc32d8ec 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -375,7 +375,7 @@ class ArtMethod FINAL { REQUIRES_SHARED(Locks::mutator_lock_); // Find the method index for this method within other_dexfile. If this method isn't present then - // return DexFile::kDexNoIndex. The name_and_signature_idx MUST refer to a MethodId with the same + // return dex::kDexNoIndex. The name_and_signature_idx MUST refer to a MethodId with the same // name and signature in the other_dexfile, such as the method index used to resolve this method // in the other_dexfile. uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile, diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h index f6c8fa9659..d9e89159f5 100644 --- a/runtime/check_reference_map_visitor.h +++ b/runtime/check_reference_map_visitor.h @@ -18,6 +18,7 @@ #define ART_RUNTIME_CHECK_REFERENCE_MAP_VISITOR_H_ #include "art_method-inl.h" +#include "dex_file_types.h" #include "oat_quick_method_header.h" #include "scoped_thread_state_change-inl.h" #include "stack.h" @@ -35,7 +36,7 @@ class CheckReferenceMapVisitor : public StackVisitor { bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* m = GetMethod(); if (m->IsCalleeSaveMethod() || m->IsNative()) { - CHECK_EQ(GetDexPc(), DexFile::kDexNoIndex); + CHECK_EQ(GetDexPc(), dex::kDexNoIndex); } if (m == nullptr || m->IsNative() || m->IsRuntimeMethod() || IsShadowFrame()) { diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 02183ef733..772f0420fd 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2771,11 +2771,11 @@ uint32_t ClassLinker::SizeOfClassWithoutEmbeddedTables(const DexFile& dex_file, if (class_data != nullptr) { // We allow duplicate definitions of the same field in a class_data_item // but ignore the repeated indexes here, b/21868015. - uint32_t last_field_idx = DexFile::kDexNoIndex; + uint32_t last_field_idx = dex::kDexNoIndex; for (ClassDataItemIterator it(dex_file, class_data); it.HasNextStaticField(); it.Next()) { uint32_t field_idx = it.GetMemberIndex(); // Ordering enforced by DexFileVerifier. - DCHECK(last_field_idx == DexFile::kDexNoIndex || last_field_idx <= field_idx); + DCHECK(last_field_idx == dex::kDexNoIndex || last_field_idx <= field_idx); if (UNLIKELY(field_idx == last_field_idx)) { continue; } @@ -3164,7 +3164,7 @@ void ClassLinker::LoadClassMembers(Thread* self, it.NumDirectMethods(), it.NumVirtualMethods()); size_t class_def_method_index = 0; - uint32_t last_dex_method_index = DexFile::kDexNoIndex; + uint32_t last_dex_method_index = dex::kDexNoIndex; size_t last_class_def_method_index = 0; // TODO These should really use the iterators. for (size_t i = 0; it.HasNextDirectMethod(); i++, it.Next()) { diff --git a/runtime/debugger.cc b/runtime/debugger.cc index ce751697d1..6daec72229 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -34,6 +34,7 @@ #include "class_linker.h" #include "dex_file-inl.h" #include "dex_file_annotations.h" +#include "dex_file_types.h" #include "dex_instruction.h" #include "entrypoints/runtime_asm_entrypoints.h" #include "gc/accounting/card_table-inl.h" @@ -2974,8 +2975,8 @@ class CatchLocationFinder : public StackVisitor { this_at_throw_(handle_scope_.NewHandle<mirror::Object>(nullptr)), catch_method_(nullptr), throw_method_(nullptr), - catch_dex_pc_(DexFile::kDexNoIndex), - throw_dex_pc_(DexFile::kDexNoIndex) { + catch_dex_pc_(dex::kDexNoIndex), + throw_dex_pc_(dex::kDexNoIndex) { } bool VisitFrame() OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) { @@ -2997,13 +2998,13 @@ class CatchLocationFinder : public StackVisitor { throw_dex_pc_ = dex_pc; } - if (dex_pc != DexFile::kDexNoIndex) { + if (dex_pc != dex::kDexNoIndex) { StackHandleScope<1> hs(GetThread()); uint32_t found_dex_pc; Handle<mirror::Class> exception_class(hs.NewHandle(exception_->GetClass())); bool unused_clear_exception; found_dex_pc = method->FindCatchBlock(exception_class, dex_pc, &unused_clear_exception); - if (found_dex_pc != DexFile::kDexNoIndex) { + if (found_dex_pc != dex::kDexNoIndex) { catch_method_ = method; catch_dex_pc_ = found_dex_pc; return false; // End stack walk. diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 6d1158260a..f70846bce0 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -1066,7 +1066,7 @@ bool DexFile::DecodeDebugLocalInfo(const CodeItem* code_item, bool is_static, ui uint32_t name_idx = DecodeUnsignedLeb128P1(&stream); uint16_t descriptor_idx = DecodeUnsignedLeb128P1(&stream); - uint32_t signature_idx = kDexNoIndex; + uint32_t signature_idx = dex::kDexNoIndex; if (opcode == DBG_START_LOCAL_EXTENDED) { signature_idx = DecodeUnsignedLeb128P1(&stream); } diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 5f81b981dd..e86d53815b 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -56,9 +56,6 @@ class DexFile { static const char* kClassesDex; // The value of an invalid index. - static const uint32_t kDexNoIndex = 0xFFFFFFFF; - - // The value of an invalid index. static const uint16_t kDexNoIndex16 = 0xFFFF; // The separator character in MultiDex locations. diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index ad65304fe5..f4214ff2fb 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -21,6 +21,7 @@ #include "common_throws.h" #include "debugger.h" #include "dex_file-inl.h" +#include "dex_file_types.h" #include "dex_instruction-inl.h" #include "entrypoints/entrypoint_utils-inl.h" #include "entrypoints/runtime_asm_entrypoints.h" diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc index 7d01af02a3..6a4e5b5f01 100644 --- a/runtime/fault_handler.cc +++ b/runtime/fault_handler.cc @@ -23,6 +23,7 @@ #include "art_method-inl.h" #include "base/safe_copy.h" #include "base/stl_util.h" +#include "dex_file_types.h" #include "mirror/class.h" #include "mirror/object_reference.h" #include "oat_quick_method_header.h" @@ -311,7 +312,7 @@ bool FaultManager::IsInGeneratedCode(siginfo_t* siginfo, void* context, bool che } uint32_t dexpc = method_header->ToDexPc(method_obj, return_pc, false); VLOG(signals) << "dexpc: " << dexpc; - return !check_dex_pc || dexpc != DexFile::kDexNoIndex; + return !check_dex_pc || dexpc != dex::kDexNoIndex; } FaultHandler::FaultHandler(FaultManager* manager) : manager_(manager) { diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index d7f6b83e8e..2c82cb1acd 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -26,6 +26,7 @@ #include "class_linker.h" #include "debugger.h" #include "dex_file-inl.h" +#include "dex_file_types.h" #include "dex_instruction-inl.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_entrypoints.h" @@ -245,7 +246,7 @@ static void InstrumentationInstallStack(Thread* thread, void* arg) // pushed when executing the instrumented interpreter bridge. So method // enter event must have been reported. However we need to push a DEX pc // into the dex_pcs_ list to match size of instrumentation stack. - uint32_t dex_pc = DexFile::kDexNoIndex; + uint32_t dex_pc = dex::kDexNoIndex; dex_pcs_.push_back(dex_pc); last_return_pc_ = frame.return_pc_; ++instrumentation_stack_depth_; @@ -290,7 +291,7 @@ static void InstrumentationInstallStack(Thread* thread, void* arg) instrumentation_stack_->insert(it, instrumentation_frame); SetReturnPc(instrumentation_exit_pc_); } - uint32_t dex_pc = DexFile::kDexNoIndex; + uint32_t dex_pc = dex::kDexNoIndex; if (last_return_pc_ != 0 && GetCurrentOatQuickMethodHeader() != nullptr) { dex_pc = GetCurrentOatQuickMethodHeader()->ToDexPc(m, last_return_pc_); @@ -1334,7 +1335,7 @@ TwoWordReturn Instrumentation::PopInstrumentationStackFrame(Thread* self, } // TODO: improve the dex pc information here, requires knowledge of current PC as opposed to // return_pc. - uint32_t dex_pc = DexFile::kDexNoIndex; + uint32_t dex_pc = dex::kDexNoIndex; mirror::Object* this_object = instrumentation_frame.this_object_; if (!method->IsRuntimeMethod() && !instrumentation_frame.interpreter_entry_) { MethodExitEvent(self, this_object, instrumentation_frame.method_, dex_pc, return_value); @@ -1403,7 +1404,7 @@ uintptr_t Instrumentation::PopMethodForUnwind(Thread* self, bool is_deoptimizati // Notify listeners of method unwind. // TODO: improve the dex pc information here, requires knowledge of current PC as opposed to // return_pc. - uint32_t dex_pc = DexFile::kDexNoIndex; + uint32_t dex_pc = dex::kDexNoIndex; if (!method->IsRuntimeMethod()) { MethodUnwindEvent(self, instrumentation_frame.this_object_, method, dex_pc); } diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index a1f212305f..68a75b0196 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -19,6 +19,7 @@ #include <limits> #include "common_throws.h" +#include "dex_file_types.h" #include "interpreter_common.h" #include "interpreter_mterp_impl.h" #include "interpreter_switch_impl.h" @@ -318,7 +319,7 @@ static inline JValue Execute( // Mterp didn't like that instruction. Single-step it with the reference interpreter. result_register = ExecuteSwitchImpl<false, false>(self, code_item, shadow_frame, result_register, true); - if (shadow_frame.GetDexPC() == DexFile::kDexNoIndex) { + if (shadow_frame.GetDexPC() == dex::kDexNoIndex) { // Single-stepped a return or an exception not handled locally. Return to caller. return result_register; } @@ -501,7 +502,7 @@ void EnterInterpreterFromDeoptimize(Thread* self, const instrumentation::Instrumentation* const instrumentation = first ? nullptr : Runtime::Current()->GetInstrumentation(); new_dex_pc = MoveToExceptionHandler( - self, *shadow_frame, instrumentation) ? shadow_frame->GetDexPC() : DexFile::kDexNoIndex; + self, *shadow_frame, instrumentation) ? shadow_frame->GetDexPC() : dex::kDexNoIndex; } else if (!from_code) { // Deoptimization is not called from code directly. const Instruction* instr = Instruction::At(&code_item->insns_[dex_pc]); @@ -558,7 +559,7 @@ void EnterInterpreterFromDeoptimize(Thread* self, DCHECK(first); DCHECK_EQ(new_dex_pc, dex_pc); } - if (new_dex_pc != DexFile::kDexNoIndex) { + if (new_dex_pc != dex::kDexNoIndex) { shadow_frame->SetDexPC(new_dex_pc); value = Execute(self, code_item, *shadow_frame, value); } diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 0028b21f94..c3450138eb 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -20,6 +20,7 @@ #include "base/enums.h" #include "debugger.h" +#include "dex_file_types.h" #include "entrypoints/runtime_asm_entrypoints.h" #include "jit/jit.h" #include "jvalue.h" @@ -438,7 +439,7 @@ bool MoveToExceptionHandler(Thread* self, bool clear_exception = false; uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock( hs.NewHandle(exception->GetClass()), shadow_frame.GetDexPC(), &clear_exception); - if (found_dex_pc == DexFile::kDexNoIndex) { + if (found_dex_pc == dex::kDexNoIndex) { if (instrumentation != nullptr) { if (shadow_frame.NeedsNotifyPop()) { instrumentation->WatchedFramePopped(self, shadow_frame); diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index 69e091b42d..850419bd9d 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -17,6 +17,7 @@ #include "interpreter_switch_impl.h" #include "base/enums.h" +#include "dex_file_types.h" #include "experimental_flags.h" #include "interpreter_common.h" #include "jit/jit.h" @@ -35,7 +36,7 @@ namespace interpreter { DoMonitorCheckOnExit<do_assignability_check>(self, &shadow_frame); \ if (interpret_one_instruction) { \ /* Signal mterp to return to caller */ \ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); \ + shadow_frame.SetDexPC(dex::kDexNoIndex); \ } \ return JValue(); /* Handled in caller. */ \ } else { \ @@ -88,7 +89,7 @@ namespace interpreter { if (jit::Jit::MaybeDoOnStackReplacement(self, method, dex_pc, offset, &result)) { \ if (interpret_one_instruction) { \ /* OSR has completed execution of the method. Signal mterp to return to caller */ \ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); \ + shadow_frame.SetDexPC(dex::kDexNoIndex); \ } \ return result; \ } \ @@ -303,7 +304,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } if (interpret_one_instruction) { /* Signal mterp to return to caller */ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); + shadow_frame.SetDexPC(dex::kDexNoIndex); } return result; } @@ -325,7 +326,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } if (interpret_one_instruction) { /* Signal mterp to return to caller */ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); + shadow_frame.SetDexPC(dex::kDexNoIndex); } return result; } @@ -348,7 +349,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } if (interpret_one_instruction) { /* Signal mterp to return to caller */ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); + shadow_frame.SetDexPC(dex::kDexNoIndex); } return result; } @@ -370,7 +371,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } if (interpret_one_instruction) { /* Signal mterp to return to caller */ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); + shadow_frame.SetDexPC(dex::kDexNoIndex); } return result; } @@ -414,7 +415,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, result.SetL(shadow_frame.GetVRegReference(ref_idx)); if (interpret_one_instruction) { /* Signal mterp to return to caller */ - shadow_frame.SetDexPC(DexFile::kDexNoIndex); + shadow_frame.SetDexPC(dex::kDexNoIndex); } return result; } diff --git a/runtime/monitor.cc b/runtime/monitor.cc index 051e015d80..d85479a40c 100644 --- a/runtime/monitor.cc +++ b/runtime/monitor.cc @@ -27,6 +27,7 @@ #include "base/time_utils.h" #include "class_linker.h" #include "dex_file-inl.h" +#include "dex_file_types.h" #include "dex_instruction-inl.h" #include "lock_word-inl.h" #include "mirror/class-inl.h" @@ -1344,7 +1345,7 @@ void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::O // find the dex pc, and instead return kDexNoIndex. Then bail out, as it indicates we have an // inconsistent stack anyways. uint32_t dex_pc = stack_visitor->GetDexPc(abort_on_failure); - if (!abort_on_failure && dex_pc == DexFile::kDexNoIndex) { + if (!abort_on_failure && dex_pc == dex::kDexNoIndex) { LOG(ERROR) << "Could not find dex_pc for " << m->PrettyMethod(); return; } diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index 075875b3f4..b2f6c036d1 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -1466,7 +1466,7 @@ const DexFile::ClassDef* OatFile::OatDexFile::FindClassDef(const DexFile& dex_fi DCHECK_EQ(ComputeModifiedUtf8Hash(descriptor), hash); if (LIKELY((oat_dex_file != nullptr) && (oat_dex_file->GetTypeLookupTable() != nullptr))) { const uint32_t class_def_idx = oat_dex_file->GetTypeLookupTable()->Lookup(descriptor, hash); - return (class_def_idx != DexFile::kDexNoIndex) ? &dex_file.GetClassDef(class_def_idx) : nullptr; + return (class_def_idx != dex::kDexNoIndex) ? &dex_file.GetClassDef(class_def_idx) : nullptr; } // Fast path for rare no class defs case. const uint32_t num_class_defs = dex_file.NumClassDefs(); diff --git a/runtime/oat_quick_method_header.cc b/runtime/oat_quick_method_header.cc index 8eef5867e2..aa28fd8c9b 100644 --- a/runtime/oat_quick_method_header.cc +++ b/runtime/oat_quick_method_header.cc @@ -17,6 +17,7 @@ #include "oat_quick_method_header.h" #include "art_method.h" +#include "dex_file_types.h" #include "scoped_thread_state_change-inl.h" #include "thread.h" @@ -49,7 +50,7 @@ uint32_t OatQuickMethodHeader::ToDexPc(ArtMethod* method, } } else { DCHECK(method->IsNative()); - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } if (abort_on_failure) { ScopedObjectAccess soa(Thread::Current()); @@ -59,7 +60,7 @@ uint32_t OatQuickMethodHeader::ToDexPc(ArtMethod* method, << " current entry_point=" << method->GetEntryPointFromQuickCompiledCode() << ") in " << method->PrettyMethod(); } - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } uintptr_t OatQuickMethodHeader::ToNativeQuickPc(ArtMethod* method, diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index b592247da3..d8b62370b8 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -19,6 +19,7 @@ #include "arch/context.h" #include "art_method-inl.h" #include "base/enums.h" +#include "dex_file_types.h" #include "dex_instruction.h" #include "entrypoints/entrypoint_utils.h" #include "entrypoints/quick/quick_entrypoints_enum.h" @@ -98,17 +99,17 @@ class CatchBlockStackVisitor FINAL : public StackVisitor { private: bool HandleTryItems(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) { - uint32_t dex_pc = DexFile::kDexNoIndex; + uint32_t dex_pc = dex::kDexNoIndex; if (!method->IsNative()) { dex_pc = GetDexPc(); } - if (dex_pc != DexFile::kDexNoIndex) { + if (dex_pc != dex::kDexNoIndex) { bool clear_exception = false; StackHandleScope<1> hs(GetThread()); Handle<mirror::Class> to_find(hs.NewHandle((*exception_)->GetClass())); uint32_t found_dex_pc = method->FindCatchBlock(to_find, dex_pc, &clear_exception); exception_handler_->SetClearException(clear_exception); - if (found_dex_pc != DexFile::kDexNoIndex) { + if (found_dex_pc != dex::kDexNoIndex) { exception_handler_->SetHandlerMethod(method); exception_handler_->SetHandlerDexPc(found_dex_pc); exception_handler_->SetHandlerQuickFramePc( diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 5888762fc6..34f8265e0c 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1904,7 +1904,7 @@ static ArtMethod* CreateRuntimeMethod(ClassLinker* class_linker, LinearAlloc* li 1); ArtMethod* method = &method_array->At(0, method_size, method_alignment); CHECK(method != nullptr); - method->SetDexMethodIndex(DexFile::kDexNoIndex); + method->SetDexMethodIndex(dex::kDexNoIndex); CHECK(method->IsRuntimeMethod()); return method; } diff --git a/runtime/stack.cc b/runtime/stack.cc index 2e0653666f..ab9fb0d73f 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -23,6 +23,7 @@ #include "base/callee_save_type.h" #include "base/enums.h" #include "base/hex_dump.h" +#include "dex_file_types.h" #include "entrypoints/entrypoint_utils-inl.h" #include "entrypoints/runtime_asm_entrypoints.h" #include "gc/space/image_space.h" @@ -120,7 +121,7 @@ uint32_t StackVisitor::GetDexPc(bool abort_on_failure) const { return GetCurrentInlineInfo(GetCurrentOatQuickMethodHeader(), cur_quick_frame_pc_). GetDexPcAtDepth(encoding.inline_info.encoding, depth_in_stack_map); } else if (cur_oat_quick_method_header_ == nullptr) { - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } else { return cur_oat_quick_method_header_->ToDexPc( GetMethod(), cur_quick_frame_pc_, abort_on_failure); diff --git a/runtime/thread.cc b/runtime/thread.cc index 57b3a75352..6e5594d620 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -48,6 +48,7 @@ #include "debugger.h" #include "dex_file-inl.h" #include "dex_file_annotations.h" +#include "dex_file_types.h" #include "entrypoints/entrypoint_utils.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "gc/accounting/card_table-inl.h" @@ -2421,7 +2422,7 @@ class FetchStackTraceVisitor : public StackVisitor { if (!m->IsRuntimeMethod()) { // Ignore runtime frames (in particular callee save). if (depth_ < max_saved_frames_) { saved_frames_[depth_].first = m; - saved_frames_[depth_].second = m->IsProxyMethod() ? DexFile::kDexNoIndex : GetDexPc(); + saved_frames_[depth_].second = m->IsProxyMethod() ? dex::kDexNoIndex : GetDexPc(); } ++depth_; } @@ -2507,7 +2508,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { if (m->IsRuntimeMethod()) { return true; // Ignore runtime frames (in particular callee save). } - AddFrame(m, m->IsProxyMethod() ? DexFile::kDexNoIndex : GetDexPc()); + AddFrame(m, m->IsProxyMethod() ? dex::kDexNoIndex : GetDexPc()); return true; } diff --git a/runtime/type_lookup_table.h b/runtime/type_lookup_table.h index fd68deb71c..780b3804e0 100644 --- a/runtime/type_lookup_table.h +++ b/runtime/type_lookup_table.h @@ -17,12 +17,14 @@ #ifndef ART_RUNTIME_TYPE_LOOKUP_TABLE_H_ #define ART_RUNTIME_TYPE_LOOKUP_TABLE_H_ -#include "dex_file.h" +#include "dex_file_types.h" #include "leb128.h" #include "utf.h" namespace art { +class DexFile; + /** * TypeLookupTable used to find class_def_idx by class descriptor quickly. * Implementation of TypeLookupTable is based on hash table. @@ -40,7 +42,7 @@ class TypeLookupTable { } // Method search class_def_idx by class descriptor and it's hash. - // If no data found then the method returns DexFile::kDexNoIndex + // If no data found then the method returns dex::kDexNoIndex. ALWAYS_INLINE uint32_t Lookup(const char* str, uint32_t hash) const { uint32_t pos = hash & GetSizeMask(); // Thanks to special insertion algorithm, the element at position pos can be empty or start of @@ -51,12 +53,12 @@ class TypeLookupTable { return GetClassDefIdx(entry->data); } if (entry->IsLast()) { - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } pos = (pos + entry->next_pos_delta) & GetSizeMask(); entry = &entries_[pos]; } - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } // Method creates lookup table for dex file diff --git a/runtime/type_lookup_table_test.cc b/runtime/type_lookup_table_test.cc index ac11871d19..0f8f2880fe 100644 --- a/runtime/type_lookup_table_test.cc +++ b/runtime/type_lookup_table_test.cc @@ -25,8 +25,6 @@ namespace art { -static const size_t kDexNoIndex = DexFile::kDexNoIndex; // Make copy to prevent linking errors. - using DescriptorClassDefIdxPair = std::pair<const char*, uint32_t>; class TypeLookupTableTest : public CommonRuntimeTestWithParam<DescriptorClassDefIdxPair> {}; @@ -56,7 +54,7 @@ INSTANTIATE_TEST_CASE_P(FindNonExistingClassWithoutCollisions, testing::Values(DescriptorClassDefIdxPair("LAB;", 1U))); INSTANTIATE_TEST_CASE_P(FindNonExistingClassWithCollisions, TypeLookupTableTest, - testing::Values(DescriptorClassDefIdxPair("LDA;", kDexNoIndex))); + testing::Values(DescriptorClassDefIdxPair("LDA;", dex::kDexNoIndex))); INSTANTIATE_TEST_CASE_P(FindClassNoCollisions, TypeLookupTableTest, testing::Values(DescriptorClassDefIdxPair("LC;", 2U))); diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index ce9deaf3cd..791af94bd3 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -554,7 +554,7 @@ MethodVerifier::MethodVerifier(Thread* self, arena_(&arena_stack_), reg_types_(can_load_classes, arena_), reg_table_(arena_), - work_insn_idx_(DexFile::kDexNoIndex), + work_insn_idx_(dex::kDexNoIndex), dex_method_idx_(dex_method_idx), mirror_method_(method), method_access_flags_(method_access_flags), @@ -928,7 +928,7 @@ std::ostream& MethodVerifier::Fail(VerifyError error) { // Note: this assumes that Fail is called before we do any work_line modifications. // Note: this can fail before we touch any instruction, for the signature of a method. So // add a check. - if (work_insn_idx_ < DexFile::kDexNoIndex) { + if (work_insn_idx_ < dex::kDexNoIndex) { const uint16_t* insns = code_item_->insns_ + work_insn_idx_; const Instruction* inst = Instruction::At(insns); int opcode_flags = Instruction::FlagsOf(inst->Opcode()); @@ -1992,7 +1992,7 @@ static uint32_t GetFirstFinalInstanceFieldIndex(const DexFile& dex_file, dex::Ty } it.Next(); } - return DexFile::kDexNoIndex; + return dex::kDexNoIndex; } // Setup a register line for the given return instruction. @@ -3377,7 +3377,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { // manually over the underlying dex file. uint32_t first_index = GetFirstFinalInstanceFieldIndex(*dex_file_, dex_file_->GetMethodId(dex_method_idx_).class_idx_); - if (first_index != DexFile::kDexNoIndex) { + if (first_index != dex::kDexNoIndex) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "return-void-no-barrier not expected for field " << first_index; } diff --git a/test/478-checker-clinit-check-pruning/src/Main.java b/test/478-checker-clinit-check-pruning/src/Main.java index 63e2b9503c..752e761f1f 100644 --- a/test/478-checker-clinit-check-pruning/src/Main.java +++ b/test/478-checker-clinit-check-pruning/src/Main.java @@ -529,7 +529,7 @@ public class Main { // TODO: Add a test for the case of a static method whose declaring // class type index is not available (i.e. when `storage_index` - // equals `DexFile::kDexNoIndex` in + // equals `dex::kDexNoIndex` in // art::HGraphBuilder::BuildInvoke). public static void main(String[] args) { |