Add GcRoot to clean up and enforce read barriers.
Introduce a value-type wrapper around Object* for GC roots so that 1)
we won't have to directly add the read barrier code in many places and
2) we can avoid accidentally bypassing/missing read barriers on GC
roots (the GcRoot interface ensures that the read barrier is executed
on a read).
The jdwp test passed.
Bug: 12687968
Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
diff --git a/runtime/reference_table.h b/runtime/reference_table.h
index 1cd0999..8765442 100644
--- a/runtime/reference_table.h
+++ b/runtime/reference_table.h
@@ -23,6 +23,7 @@
#include <vector>
#include "base/mutex.h"
+#include "gc_root.h"
#include "object_callbacks.h"
namespace art {
@@ -50,7 +51,7 @@
void VisitRoots(RootCallback* visitor, void* arg, uint32_t tid, RootType root_type);
private:
- typedef std::vector<mirror::Object*> Table;
+ typedef std::vector<GcRoot<mirror::Object>> Table;
static void Dump(std::ostream& os, Table& entries)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
friend class IndirectReferenceTable; // For Dump.