Lines Matching refs:ctx

35 static bool isMarked(const Object *obj, const GcMarkContext *ctx)
37 return dvmHeapBitmapIsObjectBitSet(ctx->bitmap, obj);
91 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
93 if (!createMarkStack(&ctx->stack)) {
96 ctx->finger = NULL;
97 ctx->immuneLimit = (char*)dvmHeapSourceGetImmuneLimit(isPartial);
101 static long setAndReturnMarkBit(GcMarkContext *ctx, const void *obj)
103 return dvmHeapBitmapSetAndReturnObjectBit(ctx->bitmap, obj);
106 static void markObjectNonNull(const Object *obj, GcMarkContext *ctx,
109 assert(ctx != NULL);
112 if (obj < (Object *)ctx->immuneLimit) {
113 assert(isMarked(obj, ctx));
116 if (!setAndReturnMarkBit(ctx, obj)) {
119 if (checkFinger && (void *)obj < ctx->finger) {
122 markStackPush(&ctx->stack, obj);
133 static void markObject(const Object *obj, GcMarkContext *ctx)
136 markObjectNonNull(obj, ctx, true);
151 GcMarkContext *ctx = (GcMarkContext *)arg;
153 markObjectNonNull(obj, ctx, false);
198 GcMarkContext *ctx = (GcMarkContext *)arg;
200 markObjectNonNull(obj, ctx, true);
209 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
210 assert(ctx->finger == (void *)ULONG_MAX);
211 dvmVisitRoots(rootReMarkObjectVisitor, ctx);
217 static void scanFields(const Object *obj, GcMarkContext *ctx)
221 assert(ctx != NULL);
228 markObject(ref, ctx);
239 markObject(ref, ctx);
248 static void scanStaticFields(const ClassObject *clazz, GcMarkContext *ctx)
251 assert(ctx != NULL);
256 markObject(obj, ctx);
264 static void scanInterfaces(const ClassObject *clazz, GcMarkContext *ctx)
267 assert(ctx != NULL);
269 markObject((const Object *)clazz->interfaces[i], ctx);
277 static void scanClassObject(const Object *obj, GcMarkContext *ctx)
281 assert(ctx != NULL);
282 markObject((const Object *)obj->clazz, ctx);
285 markObject((const Object *)asClass->elementClass, ctx);
289 markObject((const Object *)asClass->super, ctx);
291 markObject((const Object *)asClass->classLoader, ctx);
292 scanFields(obj, ctx);
293 scanStaticFields(asClass, ctx);
295 scanInterfaces(asClass, ctx);
303 static void scanArrayObject(const Object *obj, GcMarkContext *ctx)
307 assert(ctx != NULL);
308 markObject((const Object *)obj->clazz, ctx);
313 markObject(contents[i], ctx);
408 static void delayReferenceReferent(Object *obj, GcMarkContext *ctx)
413 assert(ctx != NULL);
419 if (pending == NULL && referent != NULL && !isMarked(referent, ctx)) {
438 static void scanDataObject(const Object *obj, GcMarkContext *ctx)
442 assert(ctx != NULL);
443 markObject((const Object *)obj->clazz, ctx);
444 scanFields(obj, ctx);
446 delayReferenceReferent((Object *)obj, ctx);
454 static void scanObject(const Object *obj, GcMarkContext *ctx)
459 scanClassObject(obj, ctx);
461 scanArrayObject(obj, ctx);
463 scanDataObject(obj, ctx);
471 static void processMarkStack(GcMarkContext *ctx)
473 assert(ctx != NULL);
474 assert(ctx->finger == (void *)ULONG_MAX);
475 assert(ctx->stack.top >= ctx->stack.base);
476 GcMarkStack *stack = &ctx->stack;
479 scanObject(obj, ctx);
521 GcMarkContext *ctx)
523 const HeapBitmap *markBits = ctx->bitmap;
536 scanObject(obj, ctx);
555 static void scanGrayObjects(GcMarkContext *ctx)
572 ptr = scanDirtyCards(dirty, limit, ctx);
587 GcMarkContext *ctx = (GcMarkContext *)arg;
588 ctx->finger = (void *)finger;
589 scanObject(obj, ctx);
598 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
600 assert(ctx->finger == NULL);
605 dvmHeapBitmapScanWalk(ctx->bitmap, scanBitmapCallback, ctx);
607 ctx->finger = (void *)ULONG_MAX;
612 processMarkStack(ctx);
617 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
623 assert(ctx->finger == (void *)ULONG_MAX);
624 scanGrayObjects(ctx);
625 processMarkStack(ctx);
671 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
682 bool marked = isMarked(referent, ctx);
685 markObject(referent, ctx);
698 processMarkStack(ctx);
709 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
714 if (referent != NULL && !isMarked(referent, ctx)) {
733 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
740 if (referent != NULL && !isMarked(referent, ctx)) {
741 markObject(referent, ctx);
751 processMarkStack(ctx);
844 GcMarkContext *ctx = &gDvm.gcHeap->markContext;
852 destroyMarkStack(&ctx->stack);
854 ctx->finger = NULL;
866 SweepContext *ctx = (SweepContext *)arg;
867 if (ctx->isConcurrent) {
870 ctx->numBytes += dvmHeapSourceFreeList(numPtrs, ptrs);
871 ctx->numObjects += numPtrs;
872 if (ctx->isConcurrent) {
889 GcMarkContext* ctx = &gDvm.gcHeap->markContext;
893 if (!isMarked(*entry, ctx)) {
919 SweepContext ctx;
931 ctx.numObjects = ctx.numBytes = 0;
932 ctx.isConcurrent = isConcurrent;
937 sweepBitmapCallback, &ctx);
939 *numObjects = ctx.numObjects;
940 *numBytes = ctx.numBytes;
942 gDvm.allocProf.freeCount += ctx.numObjects;
943 gDvm.allocProf.freeSize += ctx.numBytes;