From 9a4556face22e74ca549e95155e428869505b2c7 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Sun, 12 Dec 2010 16:00:59 -0800 Subject: [PATCH] Fix a comment that misrepresents the root marking algorithm. During the initial root marking nothing is pushed on the mark stack. Marked roots are pushed during the scanning phase following root marking. Unfortunately, the comment above the root marking callback incorrectly claimed that it pushed objects on the mark stack. In addition, this change renames the marking callback for the re-mark phase to more accurately reflect its limited usage. Change-Id: I38161fa723e00e14bd8d047a2e25cdbfd215a2c6 --- vm/alloc/MarkSweep.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c index c38a278d5..13ca89ec6 100644 --- a/vm/alloc/MarkSweep.c +++ b/vm/alloc/MarkSweep.c @@ -154,10 +154,11 @@ static void markObject(const Object *obj, GcMarkContext *ctx) /* * Callback applied to root references during the initial root - * marking. Visited roots are always marked but are only pushed on - * the mark stack if their address is below the finger. + * marking. Marks white objects but does not push them on the mark + * stack. */ -static void rootMarkObjectVisitor(void *addr, RootType type, u4 thread, void *arg) +static void rootMarkObjectVisitor(void *addr, RootType type, u4 thread, + void *arg) { Object *obj; GcMarkContext *ctx; @@ -205,11 +206,11 @@ void dvmHeapMarkRootSet() } /* - * Callback applied to root references during root remarking. If the - * root location contains a white reference it is pushed on the mark - * stack and grayed. + * Callback applied to root references during root remarking. Marks + * white objects and pushes them on the mark stack. */ -static void markObjectVisitor(void *addr, RootType type, u4 thread, void *arg) +static void rootReMarkObjectVisitor(void *addr, RootType type, u4 thread, + void *arg) { Object *obj; GcMarkContext *ctx; @@ -230,7 +231,7 @@ void dvmHeapReMarkRootSet(void) { GcMarkContext *ctx = &gDvm.gcHeap->markContext; assert(ctx->finger == (void *)ULONG_MAX); - dvmVisitRoots(markObjectVisitor, ctx); + dvmVisitRoots(rootReMarkObjectVisitor, ctx); } /* -- 2.11.0