ART: Move kDexNoIndex to dex_file_types.h

Define the constant with the types to allow lowering the dependency
on DexFile.

Test: m
Change-Id: I3c61421db45be96d2057e01b1a7825883d8bd178
diff --git a/runtime/art_field-inl.h b/runtime/art_field-inl.h
index 2532db9..fced995 100644
--- a/runtime/art_field-inl.h
+++ b/runtime/art_field-inl.h
@@ -340,7 +340,7 @@
 
 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 1588920..7ff35ac 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 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 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 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 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 7d8deda..ece853f 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -59,7 +59,7 @@
 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 @@
       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 @@
   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 @@
       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 dab3f23..fbdc32d 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -375,7 +375,7 @@
       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 f6c8fa9..d9e8915 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 @@
   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 02183ef..772f042 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2771,11 +2771,11 @@
   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 @@
         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 ce75169..6daec72 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 @@
       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 @@
       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 6d11582..f70846b 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -1066,7 +1066,7 @@
 
         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 5f81b98..e86d538 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -56,9 +56,6 @@
   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 ad65304..f4214ff 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 7d01af0..6a4e5b5 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 @@
   }
   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 d7f6b83..2c82cb1 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 @@
             // 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 @@
         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 @@
   }
   // 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 @@
     // 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 a1f2123..68a75b0 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 @@
             // 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 @@
       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 @@
       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 0028b21..c345013 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 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 69e091b..850419b 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 @@
       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 @@
     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 @@
         }
         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 @@
         }
         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 @@
         }
         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 @@
         }
         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 @@
         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 051e015..d85479a 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 @@
   // 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 075875b..b2f6c03 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1466,7 +1466,7 @@
   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 8eef586..aa28fd8 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 @@
     }
   } else {
     DCHECK(method->IsNative());
-    return DexFile::kDexNoIndex;
+    return dex::kDexNoIndex;
   }
   if (abort_on_failure) {
     ScopedObjectAccess soa(Thread::Current());
@@ -59,7 +60,7 @@
            << " 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 b592247..d8b6237 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 @@
  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 5888762..34f8265 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1904,7 +1904,7 @@
       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 2e06536..ab9fb0d 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 @@
       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 57b3a75..6e5594d 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 @@
       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 @@
     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 fd68deb..780b380 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 @@
   }
 
   // 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 @@
         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 ac11871..0f8f288 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 @@
                         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 ce9deaf..791af94 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -554,7 +554,7 @@
       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 @@
         // 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 @@
     }
     it.Next();
   }
-  return DexFile::kDexNoIndex;
+  return dex::kDexNoIndex;
 }
 
 // Setup a register line for the given return instruction.
@@ -3377,7 +3377,7 @@
           // 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;
           }