X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=vm%2FReferenceTable.cpp;h=24180d4bf394e8e1eb668be8b4bb774fa5126b79;hb=c5d0614f778e0f26db913fdc7320f08e9417e984;hp=4ec80ae23cd8af99c1c20eb7c596ee30da373ca1;hpb=259a8a5154c63a793ea0ee438d146acda7d990b6;p=android-x86%2Fdalvik.git diff --git a/vm/ReferenceTable.cpp b/vm/ReferenceTable.cpp index 4ec80ae23..24180d4bf 100644 --- a/vm/ReferenceTable.cpp +++ b/vm/ReferenceTable.cpp @@ -56,15 +56,15 @@ void dvmClearReferenceTable(ReferenceTable* pRef) */ bool dvmAddToReferenceTable(ReferenceTable* pRef, Object* obj) { - assert(dvmIsValidObject(obj)); assert(obj != NULL); + assert(dvmIsHeapAddress(obj)); assert(pRef->table != NULL); assert(pRef->allocEntries <= pRef->maxEntries); if (pRef->nextEntry == pRef->table + pRef->allocEntries) { /* reached end of allocated space; did we hit buffer max? */ if (pRef->nextEntry == pRef->table + pRef->maxEntries) { - LOGW("ReferenceTable overflow (max=%d)", pRef->maxEntries); + ALOGW("ReferenceTable overflow (max=%d)", pRef->maxEntries); return false; } @@ -78,7 +78,7 @@ bool dvmAddToReferenceTable(ReferenceTable* pRef, Object* obj) newTable = (Object**) realloc(pRef->table, newSize * sizeof(Object*)); if (newTable == NULL) { - LOGE("Unable to expand ref table (from %d to %d %d-byte entries)", + ALOGE("Unable to expand ref table (from %d to %d %d-byte entries)", pRef->allocEntries, newSize, sizeof(Object*)); return false; } @@ -141,10 +141,10 @@ bool dvmRemoveFromReferenceTable(ReferenceTable* pRef, Object** bottom, if (moveCount != 0) { /* remove from middle, slide the rest down */ memmove(ptr, ptr+1, moveCount * sizeof(Object*)); - //LOGV("LREF delete %p, shift %d down", obj, moveCount); + //ALOGV("LREF delete %p, shift %d down", obj, moveCount); } else { /* last entry, falls off the end */ - //LOGV("LREF delete %p from end", obj); + //ALOGV("LREF delete %p from end", obj); } return true; @@ -216,11 +216,11 @@ static int compareObject(const void* vobj1, const void* vobj2) static void logSummaryLine(const Object* obj, size_t elems, int identical, int equiv) { if (obj == NULL) { - LOGW(" NULL reference (count=%d)", equiv); + ALOGW(" NULL reference (count=%d)", equiv); return; } if (obj == kClearedJniWeakGlobal) { - LOGW(" cleared jweak (count=%d)", equiv); + ALOGW(" cleared jweak (count=%d)", equiv); return; } @@ -239,7 +239,7 @@ static void logSummaryLine(const Object* obj, size_t elems, int identical, int e if (identical + equiv != 0) { StringAppendF(&msg, " (%d unique instances)", equiv + 1); } - LOGW(" %s", msg.c_str()); + ALOGW(" %s", msg.c_str()); } /* @@ -251,10 +251,10 @@ static void logSummaryLine(const Object* obj, size_t elems, int identical, int e void dvmDumpReferenceTableContents(Object* const* refs, size_t count, const char* descr) { - LOGW("%s reference table (%p) dump:", descr, refs); + ALOGW("%s reference table (%p) dump:", descr, refs); if (count == 0) { - LOGW(" (empty)"); + ALOGW(" (empty)"); return; } @@ -264,20 +264,20 @@ void dvmDumpReferenceTableContents(Object* const* refs, size_t count, if (first < 0) { first = 0; } - LOGW(" Last %d entries (of %d):", (count - first), count); + ALOGW(" Last %d entries (of %d):", (count - first), count); for (int idx = count - 1; idx >= first; --idx) { const Object* ref = refs[idx]; if (ref == NULL) { continue; } if (ref == kClearedJniWeakGlobal) { - LOGW(" %5d: cleared jweak", idx); + ALOGW(" %5d: cleared jweak", idx); continue; } if (ref->clazz == NULL) { // should only be possible right after a plain dvmMalloc(). size_t size = dvmObjectSizeInHeap(ref); - LOGW(" %5d: %p (raw) (%zd bytes)", idx, ref, size); + ALOGW(" %5d: %p (raw) (%zd bytes)", idx, ref, size); continue; } @@ -304,13 +304,13 @@ void dvmDumpReferenceTableContents(Object* const* refs, size_t count, } free(s); } - LOGW(" %5d: %p %s%s", idx, ref, className.c_str(), extras.c_str()); + ALOGW(" %5d: %p %s%s", idx, ref, className.c_str(), extras.c_str()); } // Make a copy of the table, and sort it. Object** tableCopy = (Object**)malloc(sizeof(Object*) * count); if (tableCopy == NULL) { - LOGE("Unable to copy table with %d elements", count); + ALOGE("Unable to copy table with %d elements", count); return; } memcpy(tableCopy, refs, sizeof(Object*) * count); @@ -329,7 +329,7 @@ void dvmDumpReferenceTableContents(Object* const* refs, size_t count, } // Dump a summary of the whole table. - LOGW(" Summary:"); + ALOGW(" Summary:"); size_t equiv, identical; equiv = identical = 0; size_t idx;