Simplify DexRegisterMap API.
Store some of the needed decoding state explicitly to avoid passing it
around all the time. The DexRegisterMap class is rewritten in next CL.
Test: test-art-host-gtest-stack_map_test
Change-Id: Ie268dff2a1c1da2e08f0e6799ae51c30e11f350b
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 2648920..63a09f2 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -246,8 +246,7 @@
// Copy values between them.
for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) {
- DexRegisterLocation::Kind catch_location =
- catch_vreg_map.GetLocationKind(vreg, number_of_vregs, code_info);
+ DexRegisterLocation::Kind catch_location = catch_vreg_map.GetLocationKind(vreg);
if (catch_location == DexRegisterLocation::Kind::kNone) {
continue;
}
@@ -255,9 +254,7 @@
// Get vreg value from its current location.
uint32_t vreg_value;
- VRegKind vreg_kind = ToVRegKind(throw_vreg_map.GetLocationKind(vreg,
- number_of_vregs,
- code_info));
+ VRegKind vreg_kind = ToVRegKind(throw_vreg_map.GetLocationKind(vreg));
bool get_vreg_success = stack_visitor->GetVReg(stack_visitor->GetMethod(),
vreg,
vreg_kind,
@@ -268,9 +265,7 @@
<< "native_pc_offset=" << stack_visitor->GetNativePcOffset() << ")";
// Copy value to the catch phi's stack slot.
- int32_t slot_offset = catch_vreg_map.GetStackOffsetInBytes(vreg,
- number_of_vregs,
- code_info);
+ int32_t slot_offset = catch_vreg_map.GetStackOffsetInBytes(vreg);
ArtMethod** frame_top = stack_visitor->GetCurrentQuickFrame();
uint8_t* slot_address = reinterpret_cast<uint8_t*>(frame_top) + slot_offset;
uint32_t* slot_ptr = reinterpret_cast<uint32_t*>(slot_address);
@@ -425,17 +420,14 @@
continue;
}
- DexRegisterLocation::Kind location =
- vreg_map.GetLocationKind(vreg, number_of_vregs, code_info);
+ DexRegisterLocation::Kind location = vreg_map.GetLocationKind(vreg);
static constexpr uint32_t kDeadValue = 0xEBADDE09;
uint32_t value = kDeadValue;
bool is_reference = false;
switch (location) {
case DexRegisterLocation::Kind::kInStack: {
- const int32_t offset = vreg_map.GetStackOffsetInBytes(vreg,
- number_of_vregs,
- code_info);
+ const int32_t offset = vreg_map.GetStackOffsetInBytes(vreg);
const uint8_t* addr = reinterpret_cast<const uint8_t*>(GetCurrentQuickFrame()) + offset;
value = *reinterpret_cast<const uint32_t*>(addr);
uint32_t bit = (offset >> 2);
@@ -448,7 +440,7 @@
case DexRegisterLocation::Kind::kInRegisterHigh:
case DexRegisterLocation::Kind::kInFpuRegister:
case DexRegisterLocation::Kind::kInFpuRegisterHigh: {
- uint32_t reg = vreg_map.GetMachineRegister(vreg, number_of_vregs, code_info);
+ uint32_t reg = vreg_map.GetMachineRegister(vreg);
bool result = GetRegisterIfAccessible(reg, ToVRegKind(location), &value);
CHECK(result);
if (location == DexRegisterLocation::Kind::kInRegister) {
@@ -459,7 +451,7 @@
break;
}
case DexRegisterLocation::Kind::kConstant: {
- value = vreg_map.GetConstant(vreg, number_of_vregs, code_info);
+ value = vreg_map.GetConstant(vreg);
if (value == 0) {
// Make it a reference for extra safety.
is_reference = true;
@@ -472,9 +464,7 @@
default: {
LOG(FATAL)
<< "Unexpected location kind "
- << vreg_map.GetLocationInternalKind(vreg,
- number_of_vregs,
- code_info);
+ << vreg_map.GetLocationInternalKind(vreg);
UNREACHABLE();
}
}