summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2011-08-16 17:40:46 -0700
committer Elliott Hughes <enh@google.com> 2011-08-16 18:00:12 -0700
commit11e45077acba2e757799a00b3be9d63fec36a7cc (patch)
tree3538d83b1bdb862d657a93aa894ad74fc6ec9c68 /src/utils.h
parente2ff782c0cf770c3f72916ba9072bc24bf732ce0 (diff)
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
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h14
1 files changed, 14 insertions, 0 deletions
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<typename T>
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<java.lang.String>".
+std::string PrettyType(const Object* obj);
+
} // namespace art
#endif // ART_SRC_UTILS_H_