Add an abstraction over a compiled code.
That's just step 1, moving code-related functions of ArtMethod to
another class. That class is only a wrapper on an ArtMethod, but will
be changed to be a wrapper around compiled code.
Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
diff --git a/runtime/utils.h b/runtime/utils.h
index 19cc462..b67f273 100644
--- a/runtime/utils.h
+++ b/runtime/utils.h
@@ -33,6 +33,7 @@
namespace art {
+class ArtCode;
class ArtField;
class ArtMethod;
class DexFile;
@@ -221,7 +222,7 @@
// Dumps the native stack for thread 'tid' to 'os'.
void DumpNativeStack(std::ostream& os, pid_t tid, const char* prefix = "",
- ArtMethod* current_method = nullptr, void* ucontext = nullptr)
+ ArtMethod* current_method = nullptr, ArtCode* current_code = nullptr, void* ucontext = nullptr)
NO_THREAD_SAFETY_ANALYSIS;
// Dumps the kernel stack for thread 'tid' to 'os'. Note that this is only available on linux-x86.
@@ -306,6 +307,14 @@
void DumpMethodCFG(ArtMethod* method, std::ostream& os) SHARED_REQUIRES(Locks::mutator_lock_);
void DumpMethodCFG(const DexFile* dex_file, uint32_t dex_method_idx, std::ostream& os);
+static inline const void* EntryPointToCodePointer(const void* entry_point) {
+ uintptr_t code = reinterpret_cast<uintptr_t>(entry_point);
+ // TODO: Make this Thumb2 specific. It is benign on other architectures as code is always at
+ // least 2 byte aligned.
+ code &= ~0x1;
+ return reinterpret_cast<const void*>(code);
+}
+
} // namespace art
#endif // ART_RUNTIME_UTILS_H_