ART: Forward declarations for InvokeType

Use forward declarations in other header files.

Test: m
Change-Id: I8ef4492b6c48ff20d4d77d0516eacd362ed210bc
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 5043884..46aaba4 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -34,7 +34,6 @@
 #include "dex_file.h"
 #include "dex_file_types.h"
 #include "driver/compiled_method_storage.h"
-#include "invoke_type.h"
 #include "jit/profile_compilation_info.h"
 #include "method_reference.h"
 #include "mirror/class.h"  // For mirror::Class::Status.
@@ -62,6 +61,7 @@
 struct InlineIGetIPutData;
 class InstructionSetFeatures;
 class InternTable;
+enum InvokeType : uint32_t;
 class ParallelCompilationManager;
 class ScopedObjectAccess;
 template <class Allocator> class SrcMap;
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 5c097da..56c9615 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -23,7 +23,7 @@
 #include "compiler_callbacks.h"
 #include "dex/verification_results.h"
 #include "dex/verified_method.h"
-#include "dex_file.h"
+#include "dex_file-inl.h"
 #include "dex_file_types.h"
 #include "driver/compiler_driver-inl.h"
 #include "driver/compiler_options.h"
diff --git a/runtime/common_throws.h b/runtime/common_throws.h
index 4afef79..2fc2016 100644
--- a/runtime/common_throws.h
+++ b/runtime/common_throws.h
@@ -18,7 +18,6 @@
 #define ART_RUNTIME_COMMON_THROWS_H_
 
 #include "base/mutex.h"
-#include "invoke_type.h"
 #include "obj_ptr.h"
 
 namespace art {
@@ -30,6 +29,7 @@
 class ArtField;
 class ArtMethod;
 class DexFile;
+enum InvokeType : uint32_t;
 class Signature;
 class StringPiece;
 
diff --git a/runtime/dex_file-inl.h b/runtime/dex_file-inl.h
index b163cdb..1b7c318 100644
--- a/runtime/dex_file-inl.h
+++ b/runtime/dex_file-inl.h
@@ -21,6 +21,7 @@
 #include "base/logging.h"
 #include "base/stringpiece.h"
 #include "dex_file.h"
+#include "invoke_type.h"
 #include "leb128.h"
 
 namespace art {
@@ -199,6 +200,25 @@
   return true;
 }
 
+inline
+InvokeType ClassDataItemIterator::GetMethodInvokeType(const DexFile::ClassDef& class_def) const {
+  if (HasNextDirectMethod()) {
+    if ((GetRawMemberAccessFlags() & kAccStatic) != 0) {
+      return kStatic;
+    } else {
+      return kDirect;
+    }
+  } else {
+    DCHECK_EQ(GetRawMemberAccessFlags() & kAccStatic, 0U);
+    if ((class_def.access_flags_ & kAccInterface) != 0) {
+      return kInterface;
+    } else if ((GetRawMemberAccessFlags() & kAccConstructor) != 0) {
+      return kSuper;
+    } else {
+      return kVirtual;
+    }
+  }
+}
 
 }  // namespace art
 
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index e86d538..9167108 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -25,12 +25,12 @@
 #include "base/value_object.h"
 #include "dex_file_types.h"
 #include "globals.h"
-#include "invoke_type.h"
 #include "jni.h"
 #include "modifiers.h"
 
 namespace art {
 
+enum InvokeType : uint32_t;
 class MemMap;
 class OatDexFile;
 class Signature;
@@ -1424,24 +1424,7 @@
   bool MemberIsFinal() const {
     return GetRawMemberAccessFlags() & kAccFinal;
   }
-  InvokeType GetMethodInvokeType(const DexFile::ClassDef& class_def) const {
-    if (HasNextDirectMethod()) {
-      if ((GetRawMemberAccessFlags() & kAccStatic) != 0) {
-        return kStatic;
-      } else {
-        return kDirect;
-      }
-    } else {
-      DCHECK_EQ(GetRawMemberAccessFlags() & kAccStatic, 0U);
-      if ((class_def.access_flags_ & kAccInterface) != 0) {
-        return kInterface;
-      } else if ((GetRawMemberAccessFlags() & kAccConstructor) != 0) {
-        return kSuper;
-      } else {
-        return kVirtual;
-      }
-    }
-  }
+  ALWAYS_INLINE InvokeType GetMethodInvokeType(const DexFile::ClassDef& class_def) const;
   const DexFile::CodeItem* GetMethodCodeItem() const {
     return dex_file_.GetCodeItem(method_.code_off_);
   }
diff --git a/runtime/dex_file_types.h b/runtime/dex_file_types.h
index bd779c4..acca7c0 100644
--- a/runtime/dex_file_types.h
+++ b/runtime/dex_file_types.h
@@ -23,6 +23,8 @@
 namespace art {
 namespace dex {
 
+constexpr uint32_t kDexNoIndex = 0xFFFFFFFF;
+
 class StringIndex {
  public:
   uint32_t index_;
diff --git a/runtime/dex_method_iterator.h b/runtime/dex_method_iterator.h
index 8a4bed3..a44bc16 100644
--- a/runtime/dex_method_iterator.h
+++ b/runtime/dex_method_iterator.h
@@ -19,7 +19,7 @@
 
 #include <vector>
 
-#include "dex_file.h"
+#include "dex_file-inl.h"
 
 namespace art {
 
diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h
index 4f90908..d2c98e1 100644
--- a/runtime/entrypoints/entrypoint_utils.h
+++ b/runtime/entrypoints/entrypoint_utils.h
@@ -27,7 +27,6 @@
 #include "dex_instruction.h"
 #include "gc/allocator_type.h"
 #include "handle.h"
-#include "invoke_type.h"
 #include "jvalue.h"
 
 namespace art {
@@ -41,6 +40,7 @@
 
 class ArtField;
 class ArtMethod;
+enum InvokeType : uint32_t;
 class OatQuickMethodHeader;
 class ScopedObjectAccessAlreadyRunnable;
 class Thread;
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 67aeeff..77a5b55 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -30,6 +30,7 @@
 #include "dex_file-inl.h"
 #include "gc/heap-inl.h"
 #include "iftable.h"
+#include "invoke_type.h"
 #include "object-inl.h"
 #include "object_array.h"
 #include "read_barrier-inl.h"
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 4c9b146..c44b616 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -27,7 +27,6 @@
 #include "gc/allocator_type.h"
 #include "gc_root.h"
 #include "imtable.h"
-#include "invoke_type.h"
 #include "modifiers.h"
 #include "object.h"
 #include "object_array.h"
@@ -43,6 +42,7 @@
 class ArtMethod;
 struct ClassOffsets;
 template<class T> class Handle;
+enum InvokeType : uint32_t;
 template<typename T> class LengthPrefixedArray;
 template<typename T> class ArraySlice;
 class Signature;
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 3931b62..db776ea 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -23,8 +23,8 @@
 #include "base/bit_utils.h"
 #include "base/bit_vector.h"
 #include "bit_memory_region.h"
-#include "dex_file.h"
 #include "leb128.h"
+#include "dex_file_types.h"
 #include "memory_region.h"
 #include "method_info.h"
 
@@ -906,7 +906,7 @@
     dex_pc_bit_offset_ = dchecked_integral_cast<uint8_t>(total_bit_size_);
     // Note: We're not encoding the dex pc if there is none. That's the case
     // for an intrinsified native method, such as String.charAt().
-    if (dex_pc_max != DexFile::kDexNoIndex) {
+    if (dex_pc_max != dex::kDexNoIndex) {
       total_bit_size_ += MinimumBitsToStore(1 /* kNoDexPc */ + dex_pc_max);
     }