From c6cba2af37638cc47ff69aed866669567ef365d9 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 6 Dec 2009 17:15:56 -0800 Subject: Clarified comment. --- src/upb_def.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/upb_def.c b/src/upb_def.c index 1983be4..6bb1d0c 100644 --- a/src/upb_def.c +++ b/src/upb_def.c @@ -44,12 +44,13 @@ static int div_round_up(int numerator, int denominator) { // // The cycles in this graph are AB and ABC. When A's external refcount // transitions from 0->1, we say that A takes "cycle references" on both -// cycles. Since A and B are common to both cycles, A and B's cycle refcounts -// will be incremented by two, and C's will be incremented by one. Likewise, -// when A's external refcount transitions from 1->0, we decrement A and B's -// cycle refcounts by two and C's by one. We collect a cyclic type when its -// cycle refcount drops to zero. A precondition for this is that the external -// refcount has dropped to zero also. +// cycles. Taking a cycle reference means incrementing the cycle refcount of +// all defs in the cycle. Since A and B are common to both cycles, A and B's +// cycle refcounts will be incremented by two, and C's will be incremented by +// one. Likewise, when A's external refcount transitions from 1->0, we +// decrement A and B's cycle refcounts by two and C's by one. We collect a +// cyclic type when its cycle refcount drops to zero. A precondition for this +// is that the external refcount has dropped to zero also. // // This algorithm is relatively cheap, since it only requires extra work when // the external refcount on a cyclic type transitions from 0->1 or 1->0. -- cgit v1.2.3