Lines Matching refs:obj
50 static inline long isMarked(const void *obj, const GcMarkContext *ctx) in isMarked() argument
52 return dvmHeapBitmapIsObjectBitSet(ctx->bitmap, obj); in isMarked()
88 #define MARK_STACK_PUSH(stack, obj) \ argument
90 *--(stack).top = (obj); \
105 static long setAndReturnMarkBit(GcMarkContext *ctx, const void *obj) in setAndReturnMarkBit() argument
107 return dvmHeapBitmapSetAndReturnObjectBit(ctx->bitmap, obj); in setAndReturnMarkBit()
110 static void markObjectNonNull(const Object *obj, GcMarkContext *ctx, in markObjectNonNull() argument
114 assert(obj != NULL); in markObjectNonNull()
115 assert(dvmIsValidObject(obj)); in markObjectNonNull()
117 if (obj < (Object *)ctx->immuneLimit) { in markObjectNonNull()
118 assert(isMarked(obj, ctx)); in markObjectNonNull()
121 if (!setAndReturnMarkBit(ctx, obj)) { in markObjectNonNull()
124 if (checkFinger && (void *)obj < ctx->finger) { in markObjectNonNull()
127 MARK_STACK_PUSH(ctx->stack, obj); in markObjectNonNull()
132 hprofMarkRootObject(gDvm.gcHeap->hprofContext, obj, 0); in markObjectNonNull()
144 static void markObject(const Object *obj, GcMarkContext *ctx) in markObject() argument
146 if (obj != NULL) { in markObject()
147 markObjectNonNull(obj, ctx, true); in markObject()
160 void dvmMarkObjectNonNull(const Object *obj) in dvmMarkObjectNonNull() argument
162 assert(obj != NULL); in dvmMarkObjectNonNull()
163 markObjectNonNull(obj, &gDvm.gcHeap->markContext, false); in dvmMarkObjectNonNull()
258 Object *obj; in markObjectVisitor() local
262 obj = *(Object **)addr; in markObjectVisitor()
263 if (obj != NULL) { in markObjectVisitor()
264 markObjectNonNull(obj, arg, true); in markObjectVisitor()
291 static void scanInstanceFields(const Object *obj, GcMarkContext *ctx) in scanInstanceFields() argument
293 assert(obj != NULL); in scanInstanceFields()
294 assert(obj->clazz != NULL); in scanInstanceFields()
297 if (obj->clazz->refOffsets != CLASS_WALK_SUPER) { in scanInstanceFields()
298 unsigned int refOffsets = obj->clazz->refOffsets; in scanInstanceFields()
302 markObject(dvmGetFieldObject((Object*)obj, in scanInstanceFields()
308 for (clazz = obj->clazz; clazz != NULL; clazz = clazz->super) { in scanInstanceFields()
311 void *addr = BYTE_OFFSET((Object *)obj, field->byteOffset); in scanInstanceFields()
322 static void scanClassObject(const ClassObject *obj, GcMarkContext *ctx) in scanClassObject() argument
326 assert(obj != NULL); in scanClassObject()
327 assert(obj->obj.clazz == gDvm.classJavaLangClass); in scanClassObject()
330 markObject((Object *)obj->obj.clazz, ctx); in scanClassObject()
331 if (IS_CLASS_FLAG_SET(obj, CLASS_ISARRAY)) { in scanClassObject()
332 markObject((Object *)obj->elementClass, ctx); in scanClassObject()
335 if (obj->status > CLASS_IDX) { in scanClassObject()
336 markObject((Object *)obj->super, ctx); in scanClassObject()
338 markObject(obj->classLoader, ctx); in scanClassObject()
340 for (i = 0; i < obj->sfieldCount; ++i) { in scanClassObject()
341 char ch = obj->sfields[i].field.signature[0]; in scanClassObject()
343 markObject(obj->sfields[i].value.l, ctx); in scanClassObject()
347 scanInstanceFields((const Object *)obj, ctx); in scanClassObject()
349 if (obj->status > CLASS_IDX) { in scanClassObject()
350 for (i = 0; i < obj->interfaceCount; ++i) { in scanClassObject()
351 markObject((Object *)obj->interfaces[i], ctx); in scanClassObject()
360 static void scanArrayObject(const ArrayObject *obj, GcMarkContext *ctx) in scanArrayObject() argument
364 assert(obj != NULL); in scanArrayObject()
365 assert(obj->obj.clazz != NULL); in scanArrayObject()
368 markObject((Object *)obj->obj.clazz, ctx); in scanArrayObject()
369 if (IS_CLASS_FLAG_SET(obj->obj.clazz, CLASS_ISOBJECTARRAY)) { in scanArrayObject()
371 Object **contents = (Object **)obj->contents; in scanArrayObject()
372 for (i = 0; i < obj->length; ++i) { in scanArrayObject()
381 static int referenceClassFlags(const Object *obj) in referenceClassFlags() argument
386 return GET_CLASS_FLAG_GROUP(obj->clazz, flags); in referenceClassFlags()
392 static bool isSoftReference(const Object *obj) in isSoftReference() argument
394 return referenceClassFlags(obj) == CLASS_ISREFERENCE; in isSoftReference()
400 static bool isWeakReference(const Object *obj) in isWeakReference() argument
402 return referenceClassFlags(obj) & CLASS_ISWEAKREFERENCE; in isWeakReference()
408 static bool isPhantomReference(const Object *obj) in isPhantomReference() argument
410 return referenceClassFlags(obj) & CLASS_ISPHANTOMREFERENCE; in isPhantomReference()
463 static void delayReferenceReferent(Object *obj, GcMarkContext *ctx) in delayReferenceReferent() argument
469 assert(obj != NULL); in delayReferenceReferent()
470 assert(obj->clazz != NULL); in delayReferenceReferent()
471 assert(IS_CLASS_FLAG_SET(obj->clazz, CLASS_ISREFERENCE)); in delayReferenceReferent()
475 pending = dvmGetFieldObject(obj, pendingNextOffset); in delayReferenceReferent()
476 referent = dvmGetFieldObject(obj, referentOffset); in delayReferenceReferent()
479 if (isSoftReference(obj)) { in delayReferenceReferent()
481 } else if (isWeakReference(obj)) { in delayReferenceReferent()
483 } else if (isPhantomReference(obj)) { in delayReferenceReferent()
487 enqueuePendingReference(obj, list); in delayReferenceReferent()
494 static void scanDataObject(DataObject *obj, GcMarkContext *ctx) in scanDataObject() argument
496 assert(obj != NULL); in scanDataObject()
497 assert(obj->obj.clazz != NULL); in scanDataObject()
500 markObject((Object *)obj->obj.clazz, ctx); in scanDataObject()
502 scanInstanceFields((const Object *)obj, ctx); in scanDataObject()
503 if (IS_CLASS_FLAG_SET(obj->obj.clazz, CLASS_ISREFERENCE)) { in scanDataObject()
504 delayReferenceReferent((Object *)obj, ctx); in scanDataObject()
512 static void scanObject(const Object *obj, GcMarkContext *ctx) in scanObject() argument
514 assert(obj != NULL); in scanObject()
516 assert(obj->clazz != NULL); in scanObject()
519 hprofDumpHeapObject(gDvm.gcHeap->hprofContext, obj); in scanObject()
523 if (obj->clazz == gDvm.classJavaLangClass) { in scanObject()
524 scanClassObject((ClassObject *)obj, ctx); in scanObject()
525 } else if (IS_CLASS_FLAG_SET(obj->clazz, CLASS_ISARRAY)) { in scanObject()
526 scanArrayObject((ArrayObject *)obj, ctx); in scanObject()
528 scanDataObject((DataObject *)obj, ctx); in scanObject()
547 static size_t objectSize(const Object *obj) in objectSize() argument
549 assert(dvmIsValidObject(obj)); in objectSize()
550 assert(dvmIsValidObject((Object *)obj->clazz)); in objectSize()
551 if (IS_CLASS_FLAG_SET(obj->clazz, CLASS_ISARRAY)) { in objectSize()
552 return dvmArrayObjectSize((ArrayObject *)obj); in objectSize()
553 } else if (obj->clazz == gDvm.classJavaLangClass) { in objectSize()
554 return dvmClassObjectSize((ClassObject *)obj); in objectSize()
556 return obj->clazz->objectSize; in objectSize()
608 Object *obj = nextGrayObject(next, limit, markBits); in scanGrayObjects() local
609 if (obj == NULL) in scanGrayObjects()
611 scanObject(obj, ctx); in scanGrayObjects()
612 next = (u1*)obj + ALIGN_UP(objectSize(obj), HB_OBJECT_ALIGNMENT); in scanGrayObjects()