diff options
author | Jim Blandy <jimb@redhat.com> | 1993-07-18 06:26:10 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-07-18 06:26:10 +0000 |
commit | 024383ac89cc4c6390a58ddc40ab79767e4ab52a (patch) | |
tree | 025ee363b95555232a18978b5ca41dc965d8edcf /src/lisp.h | |
parent | a583b0b6b726ba91f583eefaad4637f2f4170b15 (diff) | |
download | emacs-024383ac89cc4c6390a58ddc40ab79767e4ab52a.tar.gz |
Consistently use the mark bit of the root interval's parent field
to say whether or not the interval tree has been visited (and skip
it when revisited), and the mark bit of the plist field to say
whether or not that interval has been visited (and abort if
revisited); don't try to use the plist mark bit for both
meanings.
* alloc.c (mark_interval_tree): Don't test if the interval tree
has already been visited here; let the MARK_INTERVAL_TREE macro do
that; avoid function call overhead. Mark the interval tree as
having been visited by setting TREE->parent's mark bit.
(MARK_INTERVAL_TREE): If the tree has been visited (according to
I->parent's mark bit), don't call mark_interval_tree.
(gc_sweep): Rebalance the interval trees of those large strings
which are still alive. This also clears the mark bits of those
trees' root intervals' parent fields.
(compact_strings): Rebalance the interval tree of each small
strings which is still alive. This also clears the mark bits of
that tree's root interval's parent field. Since the string has
moved, update the root interval's parent pointer to contain the
new address.
* lisp.h (struct interval): Doc fix; explain the roles of the mark
bits of the parent and plist members.
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h index c34dc54d7bc..8d6d00c9981 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -447,8 +447,18 @@ struct interval unsigned int position; /* Cache of interval's character position */ struct interval *left; /* Intervals which precede me. */ struct interval *right; /* Intervals which succeed me. */ - struct interval *parent; /* Parent in the tree, or the Lisp_Object - containing this interval tree. */ + + /* Parent in the tree, or the Lisp_Object containing this interval tree. + + The mark bit on the root interval of an interval tree says + whether we have started (and possibly finished) marking the + tree. If GC comes across an interval tree whose root's parent + field has its markbit set, it leaves the tree alone. + + You'd think we could store this information in the parent object + somewhere (after all, that should be visited once and then + ignored too, right?), but strings are GC'd strangely. */ + struct interval *parent; /* The remaining components are `properties' of the interval. The first four are duplicates for things which can be on the list, @@ -460,7 +470,11 @@ struct interval before this interval goes into it. */ unsigned char rear_sticky; /* Likewise for just after it. */ - Lisp_Object plist; /* Properties of this interval. */ + /* Properties of this interval. + The mark bit on this field says whether this particular interval + tree node has been visited. Since intervals should never be + shared, GC aborts if it seems to have visited an interval twice. */ + Lisp_Object plist; }; typedef struct interval *INTERVAL; |