Remove mterp reliance on code item layout
Pass dex instruction pointer intead of code item pointer to the mterp
entry code. This removes a dependency on the code item layout since it
may change in the future for compact dex.
Bug: 63756964
Test: test/testrunner/testrunner.py --host -j40
Change-Id: Icfffb2e17372439f0833ecce1c0ddb05e7e7e69c
diff --git a/runtime/interpreter/shadow_frame.h b/runtime/interpreter/shadow_frame.h
index 80fdadb..88275cc 100644
--- a/runtime/interpreter/shadow_frame.h
+++ b/runtime/interpreter/shadow_frame.h
@@ -92,7 +92,7 @@
}
uint32_t GetDexPC() const {
- return (dex_pc_ptr_ == nullptr) ? dex_pc_ : dex_pc_ptr_ - code_item_->insns_;
+ return (dex_pc_ptr_ == nullptr) ? dex_pc_ : dex_pc_ptr_ - dex_instructions_;
}
int16_t GetCachedHotnessCountdown() const {
@@ -146,12 +146,8 @@
return &vregs_[i + NumberOfVRegs()];
}
- void SetCodeItem(const DexFile::CodeItem* code_item) {
- code_item_ = code_item;
- }
-
- const DexFile::CodeItem* GetCodeItem() const {
- return code_item_;
+ const uint16_t* GetDexInstructions() const {
+ return dex_instructions_;
}
float GetVRegFloat(size_t i) const {
@@ -324,8 +320,8 @@
return OFFSETOF_MEMBER(ShadowFrame, dex_pc_ptr_);
}
- static size_t CodeItemOffset() {
- return OFFSETOF_MEMBER(ShadowFrame, code_item_);
+ static size_t DexInstructionsOffset() {
+ return OFFSETOF_MEMBER(ShadowFrame, dex_instructions_);
}
static size_t CachedHotnessCountdownOffset() {
@@ -372,7 +368,7 @@
method_(method),
result_register_(nullptr),
dex_pc_ptr_(nullptr),
- code_item_(nullptr),
+ dex_instructions_(nullptr),
number_of_vregs_(num_vregs),
dex_pc_(dex_pc),
cached_hotness_countdown_(0),
@@ -403,7 +399,8 @@
ArtMethod* method_;
JValue* result_register_;
const uint16_t* dex_pc_ptr_;
- const DexFile::CodeItem* code_item_;
+ // Dex instruction base of the code item.
+ const uint16_t* dex_instructions_;
LockCountData lock_count_data_; // This may contain GC roots when lock counting is active.
const uint32_t number_of_vregs_;
uint32_t dex_pc_;