summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/object_reference.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2017-08-09 20:13:18 -0700
committerMathieu Chartier <mathieuc@google.com>2017-08-09 20:13:38 -0700
commitad8ebb38059b9fe47fde8b1390113eabba2ac888 (patch)
tree092c7500442ed32121424bfaa980b3b700d90657 /runtime/mirror/object_reference.h
parentac50d97b1bf63ff2e0d813774f52499b2da78f6b (diff)
downloadart-ad8ebb38059b9fe47fde8b1390113eabba2ac888.tar.gz
art-ad8ebb38059b9fe47fde8b1390113eabba2ac888.tar.bz2
art-ad8ebb38059b9fe47fde8b1390113eabba2ac888.zip
Use HeapReference for SafeGetClass
Make sure to use heap refernece here so the value read isn't bogus for heap poisoning. Fixes heap poisoning tests that were broken for implicit null checks. Bug: 31023171 Test: test/testrunner/testrunner.py --interpreter --optimizing -j20 --host --verbose Change-Id: Ia67cdb304be205773d781251235f8b0b4bf7c0bd
Diffstat (limited to 'runtime/mirror/object_reference.h')
-rw-r--r--runtime/mirror/object_reference.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h
index 108e8ae730..c62ee6cb61 100644
--- a/runtime/mirror/object_reference.h
+++ b/runtime/mirror/object_reference.h
@@ -104,6 +104,8 @@ class MANAGED HeapReference {
using Compression = PtrCompression<kPoisonHeapReferences, MirrorType>;
public:
+ HeapReference() REQUIRES_SHARED(Locks::mutator_lock_) : HeapReference(nullptr) {}
+
template <bool kIsVolatile = false>
MirrorType* AsMirrorPtr() const REQUIRES_SHARED(Locks::mutator_lock_) {
return Compression::Decompress(
@@ -141,7 +143,7 @@ class MANAGED HeapReference {
private:
explicit HeapReference(MirrorType* mirror_ptr) REQUIRES_SHARED(Locks::mutator_lock_)
- : reference_(this->Compress(mirror_ptr)) {}
+ : reference_(Compression::Compress(mirror_ptr)) {}
// The encoded reference to a mirror::Object. Atomically updateable.
Atomic<uint32_t> reference_;