diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-12-06 17:15:56 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-12-06 17:15:56 -0800 |
commit | c6cba2af37638cc47ff69aed866669567ef365d9 (patch) | |
tree | b51309c1357607de7f1f8e81197fd8c63ee9efe0 | |
parent | dc4246db788fc54a633189047bb696c5a33b884c (diff) |
Clarified comment.
-rw-r--r-- | src/upb_def.c | 13 |
1 files 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. |