diff options
author | Sebastien Hertz <shertz@google.com> | 2014-07-16 11:56:07 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2014-07-17 20:43:37 +0200 |
commit | c901dd7bdc80b953d04100ef2f54b8d1ca5f466b (patch) | |
tree | de52f83ac4dab4ca5b48cbc5a4701abdc762f2d1 /runtime/stack.h | |
parent | 81457a3cd8fca14396b5785a4e4c8070c259b07a (diff) | |
download | art-c901dd7bdc80b953d04100ef2f54b8d1ca5f466b.tar.gz art-c901dd7bdc80b953d04100ef2f54b8d1ca5f466b.tar.bz2 art-c901dd7bdc80b953d04100ef2f54b8d1ca5f466b.zip |
Fix access to long/double stack values from debugger
Long and double values live in a pair of DEX registers. When we compile DEX
code with the Quick compiler, a DEX register either lives in the stack or is
promoted to a physical register. In the case of a pair of DEX registers, the
Quick compiler assumes both registers live in the same "area": both live in
the stack or both are promoted to physical registers.
From the debugger, we used to access these values by reading/writing each DEX
register separately. However, this does not work when only one DEX register of
a pair is promoted and the other lives in the stack. In this case, the compiled
code reads from/writes to the stack only.
To fix that, the debugger must follow the same rule than the Quick compiler: if
both DEX registers are promoted, read/write them from/to physical registers,
otherwise read/write them from/to the stack. We add StackVisitor:GetVRegPair and
StackVisitor:SetVRegPair for this purpose.
We also follow the same rule when deoptimizing. However we need to do that only
when we know two consecutive DEX registers are part of a pair (long or double).
We know that thanks to the verifier.
Bug: 15527793
Change-Id: I04812285ff26ef0129f39792a1cf776f3591ca2d
Diffstat (limited to 'runtime/stack.h')
-rw-r--r-- | runtime/stack.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/stack.h b/runtime/stack.h index ef498ef06f..578f569c43 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -568,9 +568,26 @@ class StackVisitor { return val; } + bool GetVRegPair(mirror::ArtMethod* m, uint16_t vreg, VRegKind kind_lo, VRegKind kind_hi, + uint64_t* val) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + uint64_t GetVRegPair(mirror::ArtMethod* m, uint16_t vreg, VRegKind kind_lo, + VRegKind kind_hi) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + uint64_t val; + bool success = GetVRegPair(m, vreg, kind_lo, kind_hi, &val); + CHECK(success) << "Failed to read vreg pair " << vreg + << " of kind [" << kind_lo << "," << kind_hi << "]"; + return val; + } + bool SetVReg(mirror::ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + bool SetVRegPair(mirror::ArtMethod* m, uint16_t vreg, uint64_t new_value, + VRegKind kind_lo, VRegKind kind_hi) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + uintptr_t* GetGPRAddress(uint32_t reg) const; // This is a fast-path for getting/setting values in a quick frame. |