OSDN Git Service

Minor code clean-up. Fix a placeholder comment that I left in the
authorCarl Shapiro <cshapiro@google.com>
Tue, 6 Apr 2010 02:36:37 +0000 (19:36 -0700)
committerCarl Shapiro <cshapiro@google.com>
Tue, 6 Apr 2010 02:36:37 +0000 (19:36 -0700)
code.  Change a comment that was added at my request to be less
verbose.  At the same time, repurpose an unused variable to hold the
field offset so the field access code flows without wrapping.

Change-Id: I27d10c26b76620eb7d5ace55b4e6f76e5e4c44d6

vm/alloc/Verify.c

index 20e7b8a..db552e8 100644 (file)
@@ -19,7 +19,9 @@
 #include "alloc/Verify.h"
 #include "alloc/HeapBitmap.h"
 
-/* comment everything, of course! */
+/*
+ * Assertion that the given reference points to a valid object.
+ */
 #define VERIFY_REFERENCE(x) do {                                \
         if (!verifyReference((x), &(x))) {                      \
             LOGE("Verify of %p at %p failed", (x), &(x));       \
@@ -123,12 +125,9 @@ static void verifyDataObject(const DataObject *obj)
         }
     }
     if (IS_CLASS_FLAG_SET(obj->obj.clazz, CLASS_ISREFERENCE)) {
-        /*
-         * Reference.referent is not included in the above loop. See
-         * precacheReferenceOffsets in Class.c for details.
-         */
-        addr = BYTE_OFFSET((Object *)obj,
-                           gDvm.offJavaLangRefReference_referent);
+        /* Verify the hidden Reference.referent field. */
+        offset = gDvm.offJavaLangRefReference_referent;
+        addr = BYTE_OFFSET((Object *)obj, offset);
         VERIFY_REFERENCE(((JValue *)addr)->l);
     }
     LOGV("Exiting verifyDataObject(obj=%p) %zx", obj, length);