ART: Add precise root visiting
Add VisitRootFlags::kVisitRootFlagPrecise to signal a
request for precise RootInfo objects.
Move VisitRootFlags to gc_root.h. Refactor VisitRoot
functions to pass flags. Add code in Thread visiting
to decode vregs in compiled code.
Bug: 31385354
Test: m test-art-host
Change-Id: I8e7280f0ab682871f729f2a1c6b18670cf2dbf82
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index b795409..79e80f1 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -86,6 +86,22 @@
return os;
}
+// Not all combinations of flags are valid. You may not visit all roots as well as the new roots
+// (no logical reason to do this). You also may not start logging new roots and stop logging new
+// roots (also no logical reason to do this).
+//
+// The precise flag ensures that more metadata is supplied. An example is vreg data for compiled
+// method frames.
+enum VisitRootFlags : uint8_t {
+ kVisitRootFlagAllRoots = 0x1,
+ kVisitRootFlagNewRoots = 0x2,
+ kVisitRootFlagStartLoggingNewRoots = 0x4,
+ kVisitRootFlagStopLoggingNewRoots = 0x8,
+ kVisitRootFlagClearRootLog = 0x10,
+ kVisitRootFlagClassLoader = 0x20,
+ kVisitRootFlagPrecise = 0x80,
+};
+
class RootVisitor {
public:
virtual ~RootVisitor() { }