From 11e45077acba2e757799a00b3be9d63fec36a7cc Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 16 Aug 2011 17:40:46 -0700 Subject: Add a reference table implementation. This is suitable for pinned array references and the like. I've also brought in some of the human-readable type printing stuff for the benefit of the reference table dumping code. This patch includes tests, but doesn't yet wire anything up. Change-Id: Iaf6066201bbd254e033dee4fd0b8dfd0bc17afa9 --- src/utils.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h index 842db63a26..ea51d1e2ec 100644 --- a/src/utils.h +++ b/src/utils.h @@ -5,10 +5,13 @@ #include "globals.h" #include "logging.h" +#include "stringpiece.h" #include "stringprintf.h" namespace art { +class Object; + template static inline bool IsPowerOfTwo(T x) { return (x & (x - 1)) == 0; @@ -132,6 +135,17 @@ static inline std::string PrintableString(const StringT& s) { return result; } +// Return a newly-allocated string containing a human-readable equivalent +// of 'descriptor'. So "I" would be "int", "[[I" would be "int[][]", +// "[Ljava/lang/String;" would be "java.lang.String[]", and so forth. +std::string PrettyDescriptor(const StringPiece& descriptor); + +// Returns a human-readable string form of the name of the class of +// the given object. So given a java.lang.String, the output would +// be "java.lang.String". Given an array of int, the output would be "int[]". +// Given String.class, the output would be "java.lang.Class". +std::string PrettyType(const Object* obj); + } // namespace art #endif // ART_SRC_UTILS_H_ -- cgit v1.2.3-59-g8ed1b