Have JavaFrameRootInfo give more info about provenance of root.
It can be useful to differentiate between java frame roots being the
methods declaring class, from a proxy method, being unknown due to
an imprecise walk or being indeterminable. This passes that
information with the Vreg.
Test: ./test.py --host
Bug: 134162467
Change-Id: I74842d3eeedee5c836511e046652502a53de0f7e
diff --git a/runtime/java_frame_root_info.h b/runtime/java_frame_root_info.h
index 8141ea2..c21eee1 100644
--- a/runtime/java_frame_root_info.h
+++ b/runtime/java_frame_root_info.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_JAVA_FRAME_ROOT_INFO_H_
#include <iosfwd>
+#include <limits>
#include "base/locks.h"
#include "base/macros.h"
@@ -29,6 +30,20 @@
class JavaFrameRootInfo final : public RootInfo {
public:
+ static_assert(std::numeric_limits<size_t>::max() > std::numeric_limits<uint16_t>::max(),
+ "No extra space in vreg to store meta-data");
+ // Unable to determine what register number the root is from.
+ static constexpr size_t kUnknownVreg = -1;
+ // The register number for the root might be determinable but we did not attempt to find that
+ // information.
+ static constexpr size_t kImpreciseVreg = -2;
+ // The root is from the declaring class of the current method.
+ static constexpr size_t kMethodDeclaringClass = -3;
+ // The root is from the argument to a Proxy invoke.
+ static constexpr size_t kProxyReferenceArgument = -4;
+ // The maximum precise vreg number
+ static constexpr size_t kMaxVReg = std::numeric_limits<uint16_t>::max();
+
JavaFrameRootInfo(uint32_t thread_id, const StackVisitor* stack_visitor, size_t vreg)
: RootInfo(kRootJavaFrame, thread_id), stack_visitor_(stack_visitor), vreg_(vreg) {
}