summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-09-12 17:33:56 -0700
committerMathieu Chartier <mathieuc@google.com>2013-09-13 10:30:24 -0700
commit423d2a3dcbb260b020efb5da59f784c9f02accbf (patch)
tree79ed739e6072f8308c1cd880f9420a1c63539c95 /runtime/stack.h
parentb048dd2b662c19644361f4396a1e8d6213445ee8 (diff)
downloadart-423d2a3dcbb260b020efb5da59f784c9f02accbf.zip
art-423d2a3dcbb260b020efb5da59f784c9f02accbf.tar.gz
art-423d2a3dcbb260b020efb5da59f784c9f02accbf.tar.bz2
Add support for changing roots through the root visitor callback.
Needed for copying collectors. Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index 8ecf8f0..bd29ceb 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -150,7 +150,12 @@ class ShadowFrame {
mirror::Object* GetVRegReference(size_t i) const {
DCHECK_LT(i, NumberOfVRegs());
if (HasReferenceArray()) {
- return References()[i];
+ mirror::Object* ref = References()[i];
+ // If the vreg reference is not equal to the vreg then the vreg reference is stale.
+ if (reinterpret_cast<uint32_t>(ref) != vregs_[i]) {
+ return nullptr;
+ }
+ return ref;
} else {
const uint32_t* vreg = &vregs_[i];
return *reinterpret_cast<mirror::Object* const*>(vreg);
@@ -459,13 +464,14 @@ class StackVisitor {
uintptr_t GetGPR(uint32_t reg) const;
void SetGPR(uint32_t reg, uintptr_t value);
- uint32_t GetVReg(mirror::ArtMethod** cur_quick_frame, const DexFile::CodeItem* code_item,
+ // This is a fast-path for getting/setting values in a quick frame.
+ uint32_t* GetVRegAddr(mirror::ArtMethod** cur_quick_frame, const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills, size_t frame_size,
uint16_t vreg) const {
int offset = GetVRegOffset(code_item, core_spills, fp_spills, frame_size, vreg);
DCHECK_EQ(cur_quick_frame, GetCurrentQuickFrame());
byte* vreg_addr = reinterpret_cast<byte*>(cur_quick_frame) + offset;
- return *reinterpret_cast<uint32_t*>(vreg_addr);
+ return reinterpret_cast<uint32_t*>(vreg_addr);
}
uintptr_t GetReturnPc() const;