Revert "Revert "Use the quickened metadata to compile -QUICK opcodes.""
This reverts commit 8ab9a9010f3929acbb6c671008b8885b762b01e1.
Change-Id: I1e654d5010ea2112982c3055fcb8c8f9c10e9ac8
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index c78a851..7673418 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -35,6 +35,7 @@
#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
#include "mirror/string.h"
+#include "oat_file-inl.h"
#include "scoped_thread_state_change.h"
#include "well_known_classes.h"
@@ -561,4 +562,14 @@
return true;
}
+const uint8_t* ArtMethod::GetQuickenedInfo() {
+ bool found = false;
+ OatFile::OatMethod oat_method =
+ Runtime::Current()->GetClassLinker()->FindOatMethodFor(this, &found);
+ if (!found || (oat_method.GetQuickCode() != nullptr)) {
+ return nullptr;
+ }
+ return oat_method.GetVmapTable();
+}
+
} // namespace art
diff --git a/runtime/art_method.h b/runtime/art_method.h
index e8c47d9..4169c5e 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -336,6 +336,8 @@
const uint8_t* GetVmapTable(const void* code_pointer, size_t pointer_size)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ const uint8_t* GetQuickenedInfo() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
CodeInfo GetOptimizedCodeInfo() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Callers should wrap the uint8_t* in a GcMap instance for convenient access.
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index e4f7b7a..b60cba4 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -406,6 +406,9 @@
const void* GetOatMethodQuickCodeFor(ArtMethod* method)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, bool* found)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
pid_t GetClassesLockOwner(); // For SignalCatcher.
pid_t GetDexLockOwner(); // For SignalCatcher.
@@ -484,9 +487,6 @@
void DropFindArrayClassCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
private:
- const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, bool* found)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
OatFile& GetImageOatFile(gc::space::ImageSpace* space)
LOCKS_EXCLUDED(dex_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
diff --git a/runtime/dex_instruction.h b/runtime/dex_instruction.h
index 0ddbf7c..df2d379 100644
--- a/runtime/dex_instruction.h
+++ b/runtime/dex_instruction.h
@@ -488,6 +488,12 @@
// Returns true if the instruction allows control flow to go to the following instruction.
bool CanFlowThrough() const;
+ // Returns true if the instruction is a quickened instruction.
+ bool IsQuickened() const {
+ return (kInstructionIndexTypes[Opcode()] == kIndexFieldOffset) ||
+ (kInstructionIndexTypes[Opcode()] == kIndexVtableOffset);
+ }
+
// Returns true if this instruction is a switch.
bool IsSwitch() const {
return (kInstructionFlags[Opcode()] & kSwitch) != 0;