summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Carl Shapiro <cshapiro@google.com> 2011-08-16 18:35:19 -0700
committer Carl Shapiro <cshapiro@google.com> 2011-08-16 18:35:19 -0700
commit5b1982d2b41ab7a664fb04117539f29eadafa773 (patch)
treec4c347fce75552a63269c6dbd979432b34a4e7be
parentb3c5ea6d937900651d6d0f8106fbd166256a59cb (diff)
Get rid of some C artifacts as noted in the initial review.
Change-Id: If476df8bbd0505157fce938777d3ee17d6da5c98
-rw-r--r--src/reference_table.cc28
-rw-r--r--src/reference_table.h14
2 files changed, 17 insertions, 25 deletions
diff --git a/src/reference_table.cc b/src/reference_table.cc
index 3f0c5d5056..df908afdc9 100644
--- a/src/reference_table.cc
+++ b/src/reference_table.cc
@@ -46,10 +46,8 @@ void ReferenceTable::Remove(Object* obj) {
}
}
-/*
- * If "obj" is an array, return the number of elements in the array.
- * Otherwise, return zero.
- */
+// If "obj" is an array, return the number of elements in the array.
+// Otherwise, return zero.
size_t GetElementCount(const Object* obj) {
if (obj == NULL || obj == kClearedJniWeakGlobal || !obj->IsArray()) {
return 0;
@@ -90,13 +88,11 @@ struct ObjectComparator {
}
};
-/*
- * Log an object with some additional info.
- *
- * Pass in the number of elements in the array (or 0 if this is not an
- * array object), and the number of additional objects that are identical
- * or equivalent to the original.
- */
+// Log an object with some additional info.
+//
+// Pass in the number of elements in the array (or 0 if this is not an
+// array object), and the number of additional objects that are identical
+// or equivalent to the original.
void LogSummaryLine(const Object* obj, size_t elems, int identical, int equiv) {
if (obj == NULL) {
LOG(WARNING) << " NULL reference (count=" << equiv << ")";
@@ -129,12 +125,10 @@ size_t ReferenceTable::Size() const {
return entries_.size();
}
-/*
- * Dump a summary of an array of references to the log file.
- *
- * This is used to dump the contents of ReferenceTable and IndirectRefTable
- * structs.
- */
+// Dump a summary of an array of references to the log file.
+//
+// This is used to dump the contents of ReferenceTable and IndirectRefTable
+// structs.
void ReferenceTable::Dump() const {
LOG(WARNING) << name_ << " reference table dump:";
diff --git a/src/reference_table.h b/src/reference_table.h
index 140cc37ea1..1181304ab4 100644
--- a/src/reference_table.h
+++ b/src/reference_table.h
@@ -26,15 +26,13 @@ namespace art {
class Object;
-#define kInvalidIndirectRefObject reinterpret_cast<Object*>(0xdead4321)
-#define kClearedJniWeakGlobal reinterpret_cast<Object*>(0xdead1234)
+static const Object* const kInvalidIndirectRefObject = reinterpret_cast<Object*>(0xdead4321);
+static const Object* const kClearedJniWeakGlobal = reinterpret_cast<Object*>(0xdead1234);
-/*
- * Maintain a table of references. Used for internal local references,
- * JNI monitor references, and JNI pinned array references.
- *
- * None of the functions are synchronized.
- */
+// Maintain a table of references. Used for internal local references,
+// JNI monitor references, and JNI pinned array references.
+//
+// None of the functions are synchronized.
class ReferenceTable {
public:
ReferenceTable(const char* name, size_t initial_size, size_t max_size);