Mercurial > emacs
comparison src/alloc.c @ 28406:451721e784a8
Stop assuming interval pointers and lisp objects can be distinguished by
inspection. Beginnings of support for expensive internal consistency checks.
* config.in (ENABLE_CHECKING): Undef.
* lisp.h (struct interval): Replace "parent" field with a union of interval
pointer and Lisp_Object; add new bitfield to use as discriminant. Change other
flag fields to bitfields.
(CHECK): New macro for consistency checking. If ENABLE_CHECKING is defined and
the supplied test fails, print a message and abort.
(eassert): New macro. Use CHECK to provide an assert-like facility.
* intervals.h (NULL_INTERVAL_P): Now applies only to real interval pointers;
abort if the value looks like a lisp object.
(NULL_INTERVAL_P, NULL_PARENT, HAS_PARENT, HAS_OBJECT, SET_PARENT, SET_OBJECT,
INTERVAL_PARENT, GET_INTERVAL_OBJECT, COPY_PARENT): Modify for new interval
parent definition.
* alloc.c (mark_interval_tree, MARK_INTERVAL_TREE, UNMARK_BALANCE_INTERVALS):
Update references that need an addressable lisp object in the interval
structure.
(die): New function.
(suppress_checking): New variable.
* intervals.c (interval_start_pos): Just return 0 if there's no parent object.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Wed, 29 Mar 2000 22:14:34 +0000 |
parents | 7a3e8a76057b |
children | ecba29fa0198 |
comparison
equal
deleted
inserted
replaced
28405:870e99935503 | 28406:451721e784a8 |
---|---|
764 function is always called through the MARK_INTERVAL_TREE macro, | 764 function is always called through the MARK_INTERVAL_TREE macro, |
765 which takes care of that. */ | 765 which takes care of that. */ |
766 | 766 |
767 /* XMARK expands to an assignment; the LHS of an assignment can't be | 767 /* XMARK expands to an assignment; the LHS of an assignment can't be |
768 a cast. */ | 768 a cast. */ |
769 XMARK (* (Lisp_Object *) &tree->parent); | 769 XMARK (tree->up.obj); |
770 | 770 |
771 traverse_intervals (tree, 1, 0, mark_interval, Qnil); | 771 traverse_intervals (tree, 1, 0, mark_interval, Qnil); |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 /* Mark the interval tree rooted in I. */ | 775 /* Mark the interval tree rooted in I. */ |
776 | 776 |
777 #define MARK_INTERVAL_TREE(i) \ | 777 #define MARK_INTERVAL_TREE(i) \ |
778 do { \ | 778 do { \ |
779 if (!NULL_INTERVAL_P (i) \ | 779 if (!NULL_INTERVAL_P (i) \ |
780 && ! XMARKBIT (*(Lisp_Object *) &i->parent)) \ | 780 && ! XMARKBIT (i->up.obj)) \ |
781 mark_interval_tree (i); \ | 781 mark_interval_tree (i); \ |
782 } while (0) | 782 } while (0) |
783 | 783 |
784 | 784 |
785 /* The oddity in the call to XUNMARK is necessary because XUNMARK | 785 /* The oddity in the call to XUNMARK is necessary because XUNMARK |
788 | 788 |
789 #define UNMARK_BALANCE_INTERVALS(i) \ | 789 #define UNMARK_BALANCE_INTERVALS(i) \ |
790 do { \ | 790 do { \ |
791 if (! NULL_INTERVAL_P (i)) \ | 791 if (! NULL_INTERVAL_P (i)) \ |
792 { \ | 792 { \ |
793 XUNMARK (* (Lisp_Object *) (&(i)->parent)); \ | 793 XUNMARK ((i)->up.obj); \ |
794 (i) = balance_intervals (i); \ | 794 (i) = balance_intervals (i); \ |
795 } \ | 795 } \ |
796 } while (0) | 796 } while (0) |
797 | 797 |
798 | 798 |
4647 XSETINT (consed[7], | 4647 XSETINT (consed[7], |
4648 strings_consed & ~(((EMACS_INT) 1) << (VALBITS - 1))); | 4648 strings_consed & ~(((EMACS_INT) 1) << (VALBITS - 1))); |
4649 | 4649 |
4650 return Flist (8, consed); | 4650 return Flist (8, consed); |
4651 } | 4651 } |
4652 | |
4653 int suppress_checking; | |
4654 void | |
4655 die (msg, file, line) | |
4656 const char *msg; | |
4657 const char *file; | |
4658 int line; | |
4659 { | |
4660 fprintf (stderr, "\r\nEmacs fatal error: %s:%d: %s\r\n", | |
4661 file, line, msg); | |
4662 abort (); | |
4663 } | |
4652 | 4664 |
4653 /* Initialization */ | 4665 /* Initialization */ |
4654 | 4666 |
4655 void | 4667 void |
4656 init_alloc_once () | 4668 init_alloc_once () |