Remove portable.

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h
index c29276a..91dd525 100644
--- a/runtime/mirror/art_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -24,6 +24,7 @@
 #include "class_linker.h"
 #include "dex_cache.h"
 #include "dex_file.h"
+#include "dex_file-inl.h"
 #include "object-inl.h"
 #include "object_array.h"
 #include "oat.h"
@@ -72,12 +73,7 @@
 }
 
 inline uint32_t ArtMethod::GetDexMethodIndex() {
-#ifdef ART_SEA_IR_MODE
-  // TODO: Re-add this check for (PORTABLE + SMALL + ) SEA IR when PORTABLE IS fixed!
-  // DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
-#else
   DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
-#endif
   return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_method_index_));
 }
 
@@ -187,21 +183,11 @@
   return PointerToLowMemUInt32(GetEntryPointFromQuickCompiledCode());
 }
 
-inline uint32_t ArtMethod::GetPortableOatCodeOffset() {
-  DCHECK(!Runtime::Current()->IsStarted());
-  return PointerToLowMemUInt32(GetEntryPointFromPortableCompiledCode());
-}
-
 inline void ArtMethod::SetQuickOatCodeOffset(uint32_t code_offset) {
   DCHECK(!Runtime::Current()->IsStarted());
   SetEntryPointFromQuickCompiledCode(reinterpret_cast<void*>(code_offset));
 }
 
-inline void ArtMethod::SetPortableOatCodeOffset(uint32_t code_offset) {
-  DCHECK(!Runtime::Current()->IsStarted());
-  SetEntryPointFromPortableCompiledCode(reinterpret_cast<void*>(code_offset));
-}
-
 inline const uint8_t* ArtMethod::GetMappingTable(size_t pointer_size) {
   const void* code_pointer = GetQuickOatCodePointer(pointer_size);
   if (code_pointer == nullptr) {
diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc
index 1a13f93..ff3822a 100644
--- a/runtime/mirror/art_method.cc
+++ b/runtime/mirror/art_method.cc
@@ -39,7 +39,6 @@
 namespace art {
 namespace mirror {
 
-extern "C" void art_portable_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*, char);
 extern "C" void art_quick_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*,
                                       const char*);
 #if defined(__LP64__) || defined(__arm__)
@@ -200,11 +199,6 @@
 }
 
 uint32_t ArtMethod::ToDexPc(const uintptr_t pc, bool abort_on_failure) {
-  if (IsPortableCompiled()) {
-    // Portable doesn't use the machine pc, we just use dex pc instead.
-    return static_cast<uint32_t>(pc);
-  }
-
   const void* entry_point = GetQuickOatEntryPoint(sizeof(void*));
   uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(entry_point);
   if (IsOptimized(sizeof(void*))) {
@@ -353,19 +347,12 @@
 
 bool ArtMethod::IsEntrypointInterpreter() {
   ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
-  if (!IsPortableCompiled()) {  // Quick.
-    const void* oat_quick_code = class_linker->GetOatMethodQuickCodeFor(this);
-    return oat_quick_code == nullptr ||
-        oat_quick_code != GetEntryPointFromQuickCompiledCode();
-  } else {  // Portable.
-    const void* oat_portable_code = class_linker->GetOatMethodPortableCodeFor(this);
-    return oat_portable_code == nullptr ||
-        oat_portable_code != GetEntryPointFromPortableCompiledCode();
-  }
+  const void* oat_quick_code = class_linker->GetOatMethodQuickCodeFor(this);
+  return oat_quick_code == nullptr || oat_quick_code != GetEntryPointFromQuickCompiledCode();
 }
 
 const void* ArtMethod::GetQuickOatEntryPoint(size_t pointer_size) {
-  if (IsPortableCompiled() || IsAbstract() || IsRuntimeMethod() || IsProxyMethod()) {
+  if (IsAbstract() || IsRuntimeMethod() || IsProxyMethod()) {
     return nullptr;
   }
   Runtime* runtime = Runtime::Current();
@@ -418,34 +405,27 @@
   } else {
     const bool kLogInvocationStartAndReturn = false;
     bool have_quick_code = GetEntryPointFromQuickCompiledCode() != nullptr;
-    bool have_portable_code = GetEntryPointFromPortableCompiledCode() != nullptr;
-    if (LIKELY(have_quick_code || have_portable_code)) {
+    if (LIKELY(have_quick_code)) {
       if (kLogInvocationStartAndReturn) {
-        LOG(INFO) << StringPrintf("Invoking '%s' %s code=%p", PrettyMethod(this).c_str(),
-                                  have_quick_code ? "quick" : "portable",
-                                  have_quick_code ? GetEntryPointFromQuickCompiledCode()
-                                                  : GetEntryPointFromPortableCompiledCode());
+        LOG(INFO) << StringPrintf("Invoking '%s' quick code=%p", PrettyMethod(this).c_str(),
+                                  GetEntryPointFromQuickCompiledCode());
       }
 
-      // Ensure that we won't be accidentally calling quick/portable compiled code when -Xint.
+      // Ensure that we won't be accidentally calling quick compiled code when -Xint.
       if (kIsDebugBuild && Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly()) {
         CHECK(IsEntrypointInterpreter())
             << "Don't call compiled code when -Xint " << PrettyMethod(this);
       }
 
-      if (!IsPortableCompiled()) {
 #if defined(__LP64__) || defined(__arm__)
-        if (!IsStatic()) {
-          (*art_quick_invoke_stub)(this, args, args_size, self, result, shorty);
-        } else {
-          (*art_quick_invoke_static_stub)(this, args, args_size, self, result, shorty);
-        }
-#else
+      if (!IsStatic()) {
         (*art_quick_invoke_stub)(this, args, args_size, self, result, shorty);
-#endif
       } else {
-        (*art_portable_invoke_stub)(this, args, args_size, self, result, shorty[0]);
+        (*art_quick_invoke_static_stub)(this, args, args_size, self, result, shorty);
       }
+#else
+      (*art_quick_invoke_stub)(this, args, args_size, self, result, shorty);
+#endif
       if (UNLIKELY(self->GetException(nullptr) == Thread::GetDeoptimizationException())) {
         // Unusual case where we were running generated code and an
         // exception was thrown to force the activations to be removed from the
@@ -457,10 +437,8 @@
         interpreter::EnterInterpreterFromDeoptimize(self, shadow_frame, result);
       }
       if (kLogInvocationStartAndReturn) {
-        LOG(INFO) << StringPrintf("Returned '%s' %s code=%p", PrettyMethod(this).c_str(),
-                                  have_quick_code ? "quick" : "portable",
-                                  have_quick_code ? GetEntryPointFromQuickCompiledCode()
-                                                  : GetEntryPointFromPortableCompiledCode());
+        LOG(INFO) << StringPrintf("Returned '%s' quick code=%p", PrettyMethod(this).c_str(),
+                                  GetEntryPointFromQuickCompiledCode());
       }
     } else {
       LOG(INFO) << "Not invoking '" << PrettyMethod(this) << "' code=null";
@@ -490,10 +468,6 @@
 }
 
 QuickMethodFrameInfo ArtMethod::GetQuickFrameInfo() {
-  if (UNLIKELY(IsPortableCompiled())) {
-    // Portable compiled dex bytecode or jni stub.
-    return QuickMethodFrameInfo(kStackAlignment, 0u, 0u);
-  }
   Runtime* runtime = Runtime::Current();
 
   if (UNLIKELY(IsAbstract())) {
diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h
index 9b982b7..29e061a 100644
--- a/runtime/mirror/art_method.h
+++ b/runtime/mirror/art_method.h
@@ -158,20 +158,6 @@
         && GetNativeGcMap(pointer_size) == nullptr;
   }
 
-  bool IsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return (GetAccessFlags() & kAccPortableCompiled) != 0;
-  }
-
-  void SetIsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    DCHECK(!IsPortableCompiled());
-    SetAccessFlags(GetAccessFlags() | kAccPortableCompiled);
-  }
-
-  void ClearIsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    DCHECK(IsPortableCompiled());
-    SetAccessFlags(GetAccessFlags() & ~kAccPortableCompiled);
-  }
-
   bool CheckIncompatibleClassChange(InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   uint16_t GetMethodIndex() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -284,42 +270,6 @@
         EntryPointFromInterpreterOffset(pointer_size), entry_point_from_interpreter, pointer_size);
   }
 
-  ALWAYS_INLINE static MemberOffset EntryPointFromPortableCompiledCodeOffset(size_t pointer_size) {
-    return MemberOffset(PtrSizedFieldsOffset(pointer_size) + OFFSETOF_MEMBER(
-        PtrSizedFields, entry_point_from_portable_compiled_code_) / sizeof(void*) * pointer_size);
-  }
-
-  template <VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
-  const void* GetEntryPointFromPortableCompiledCode()
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    CheckObjectSizeEqualsMirrorSize();
-    return GetEntryPointFromPortableCompiledCodePtrSize(sizeof(void*));
-  }
-
-  template <VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
-  ALWAYS_INLINE const void* GetEntryPointFromPortableCompiledCodePtrSize(size_t pointer_size)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return GetFieldPtrWithSize<const void*, kVerifyFlags>(
-        EntryPointFromPortableCompiledCodeOffset(pointer_size), pointer_size);
-  }
-
-  template <VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
-  void SetEntryPointFromPortableCompiledCode(const void* entry_point_from_portable_compiled_code)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    CheckObjectSizeEqualsMirrorSize();
-    return SetEntryPointFromPortableCompiledCodePtrSize(entry_point_from_portable_compiled_code,
-                                                        sizeof(void*));
-  }
-
-  template <VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
-  void SetEntryPointFromPortableCompiledCodePtrSize(
-      const void* entry_point_from_portable_compiled_code, size_t pointer_size)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    SetFieldPtrWithSize<false, true, kVerifyFlags>(
-        EntryPointFromPortableCompiledCodeOffset(pointer_size),
-        entry_point_from_portable_compiled_code, pointer_size);
-  }
-
   template <VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
   const void* GetEntryPointFromQuickCompiledCode() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     CheckObjectSizeEqualsMirrorSize();
@@ -376,9 +326,7 @@
   bool IsEntrypointInterpreter() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   uint32_t GetQuickOatCodeOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-  uint32_t GetPortableOatCodeOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
   void SetQuickOatCodeOffset(uint32_t code_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-  void SetPortableOatCodeOffset(uint32_t code_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   ALWAYS_INLINE static const void* EntryPointToCodePointer(const void* entry_point) {
     uintptr_t code = reinterpret_cast<uintptr_t>(entry_point);
@@ -648,12 +596,8 @@
     void* entry_point_from_jni_;
 
     // Method dispatch from quick compiled code invokes this pointer which may cause bridging into
-    // portable compiled code or the interpreter.
+    // the interpreter.
     void* entry_point_from_quick_compiled_code_;
-
-    // Method dispatch from portable compiled code invokes this pointer which may cause bridging
-    // into quick compiled code or the interpreter. Last to simplify entrypoint logic.
-    void* entry_point_from_portable_compiled_code_;
   } ptr_sized_fields_;
 
   static GcRoot<Class> java_lang_reflect_ArtMethod_;
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index 65d6ade..8bccd9e 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -24,6 +24,7 @@
 #include "class.h"
 #include "class-inl.h"
 #include "class_linker-inl.h"
+#include "dex_file-inl.h"
 #include "gc/accounting/card_table-inl.h"
 #include "gc/heap.h"
 #include "iftable-inl.h"
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 9d789cd..ae5f60a 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -77,10 +77,6 @@
 TEST_F(ObjectTest, Constants) {
   EXPECT_EQ(kObjectReferenceSize, sizeof(HeapReference<Object>));
   EXPECT_EQ(kObjectHeaderSize, sizeof(Object));
-  EXPECT_EQ(MIRROR_ART_METHOD_PORTABLE_CODE_OFFSET_32,
-            ArtMethod::EntryPointFromPortableCompiledCodeOffset(4).Int32Value());
-  EXPECT_EQ(MIRROR_ART_METHOD_PORTABLE_CODE_OFFSET_64,
-            ArtMethod::EntryPointFromPortableCompiledCodeOffset(8).Int32Value());
   EXPECT_EQ(MIRROR_ART_METHOD_QUICK_CODE_OFFSET_32,
             ArtMethod::EntryPointFromQuickCompiledCodeOffset(4).Int32Value());
   EXPECT_EQ(MIRROR_ART_METHOD_QUICK_CODE_OFFSET_64,