Mercurial > hg > xemacs-beta
comparison src/extents.c @ 5168:cf900a2f1fa3
extract gap array from extents.c, use in range tables
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-03-22 Ben Wing <ben@xemacs.org>
* Makefile.in.in (objs):
* array.c:
* array.c (gap_array_adjust_markers):
* array.c (gap_array_move_gap):
* array.c (gap_array_make_gap):
* array.c (gap_array_insert_els):
* array.c (gap_array_delete_els):
* array.c (gap_array_make_marker):
* array.c (gap_array_delete_marker):
* array.c (gap_array_delete_all_markers):
* array.c (gap_array_clone):
* array.h:
* depend:
* emacs.c (main_1):
* extents.c:
* extents.c (EXTENT_GAP_ARRAY_AT):
* extents.c (extent_list_num_els):
* extents.c (extent_list_locate):
* extents.c (extent_list_at):
* extents.c (extent_list_delete_all):
* extents.c (allocate_extent_list):
* extents.c (syms_of_extents):
* extents.h:
* extents.h (XEXTENT_LIST_MARKER):
* lisp.h:
* rangetab.c:
* rangetab.c (mark_range_table):
* rangetab.c (print_range_table):
* rangetab.c (range_table_equal):
* rangetab.c (range_table_hash):
* rangetab.c (verify_range_table):
* rangetab.c (get_range_table_pos):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.c (Fget_range_table):
* rangetab.c (put_range_table):
* rangetab.c (Fclear_range_table):
* rangetab.c (Fmap_range_table):
* rangetab.c (unified_range_table_bytes_needed):
* rangetab.c (unified_range_table_copy_data):
* rangetab.c (unified_range_table_lookup):
* rangetab.h:
* rangetab.h (struct range_table_entry):
* rangetab.h (struct Lisp_Range_Table):
* rangetab.h (rangetab_gap_array_at):
* symsinit.h:
Rename dynarr.c to array.c. Move gap array from extents.c to array.c.
Extract dynarr, gap array and stack-like malloc into new file array.h.
Rename GAP_ARRAY_NUM_ELS -> gap_array_length(). Add gap_array_at(),
gap_array_atp().
Rewrite range table code to use gap arrays. Make put_range_table()
smarter so that its operation is O(log n) for adding a localized
range.
* gc.c (lispdesc_block_size_1):
Don't ABORT() when two elements are located at the same place.
This will happen with a size-0 gap array -- both parts of the array
(before and after gap) are in the same place.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 22 Mar 2010 19:12:15 -0500 |
parents | 1fae11d56ad2 |
children | 6c6d78781d59 |
comparison
equal
deleted
inserted
replaced
5167:e374ea766cc1 | 5168:cf900a2f1fa3 |
---|---|
229 #include "profile.h" | 229 #include "profile.h" |
230 #include "redisplay.h" | 230 #include "redisplay.h" |
231 #include "gutter.h" | 231 #include "gutter.h" |
232 | 232 |
233 /* ------------------------------- */ | 233 /* ------------------------------- */ |
234 /* gap array */ | |
235 /* ------------------------------- */ | |
236 | |
237 /* Note that this object is not extent-specific and should perhaps be | |
238 moved into another file. */ | |
239 | |
240 /* Holds a marker that moves as elements in the array are inserted and | |
241 deleted, similar to standard markers. */ | |
242 | |
243 typedef struct gap_array_marker | |
244 { | |
245 #ifdef NEW_GC | |
246 NORMAL_LISP_OBJECT_HEADER header; | |
247 #endif /* NEW_GC */ | |
248 int pos; | |
249 struct gap_array_marker *next; | |
250 } Gap_Array_Marker; | |
251 | |
252 | |
253 /* Holds a "gap array", which is an array of elements with a gap located | |
254 in it. Insertions and deletions with a high degree of locality | |
255 are very fast, essentially in constant time. Array positions as | |
256 used and returned in the gap array functions are independent of | |
257 the gap. */ | |
258 | |
259 /* Layout of gap array: | |
260 | |
261 <------ gap ------><---- gapsize ----><----- numels - gap ----> | |
262 <---------------------- numels + gapsize ---------------------> | |
263 | |
264 For marking purposes, we use two extra variables computed from | |
265 the others -- the offset to the data past the gap, plus the number | |
266 of elements in that data: | |
267 | |
268 offset_past_gap = elsize * (gap + gapsize) | |
269 els_past_gap = numels - gap | |
270 */ | |
271 | |
272 | |
273 typedef struct gap_array | |
274 { | |
275 #ifdef NEW_GC | |
276 NORMAL_LISP_OBJECT_HEADER header; | |
277 #endif /* NEW_GC */ | |
278 Elemcount gap; | |
279 Elemcount gapsize; | |
280 Elemcount numels; | |
281 Bytecount elsize; | |
282 /* Redundant numbers computed from the others, for marking purposes */ | |
283 Bytecount offset_past_gap; | |
284 Elemcount els_past_gap; | |
285 Gap_Array_Marker *markers; | |
286 /* this is a stretchy array */ | |
287 char array[1]; | |
288 } Gap_Array; | |
289 | |
290 #ifndef NEW_GC | |
291 static Gap_Array_Marker *gap_array_marker_freelist; | |
292 #endif /* not NEW_GC */ | |
293 | |
294 /* Convert a "memory position" (i.e. taking the gap into account) into | |
295 the address of the element at (i.e. after) that position. "Memory | |
296 positions" are only used internally and are of type Memxpos. | |
297 "Array positions" are used externally and are of type int. */ | |
298 #define GAP_ARRAY_MEMEL_ADDR(ga, memel) ((ga)->array + (ga)->elsize*(memel)) | |
299 | |
300 /* Number of elements currently in a gap array */ | |
301 #define GAP_ARRAY_NUM_ELS(ga) ((ga)->numels) | |
302 | |
303 #define GAP_ARRAY_ARRAY_TO_MEMORY_POS(ga, pos) \ | |
304 ((pos) <= (ga)->gap ? (pos) : (pos) + (ga)->gapsize) | |
305 | |
306 #define GAP_ARRAY_MEMORY_TO_ARRAY_POS(ga, pos) \ | |
307 ((pos) <= (ga)->gap ? (pos) : (pos) - (ga)->gapsize) | |
308 | |
309 /* Convert an array position into the address of the element at | |
310 (i.e. after) that position. */ | |
311 #define GAP_ARRAY_EL_ADDR(ga, pos) ((pos) < (ga)->gap ? \ | |
312 GAP_ARRAY_MEMEL_ADDR(ga, pos) : \ | |
313 GAP_ARRAY_MEMEL_ADDR(ga, (pos) + (ga)->gapsize)) | |
314 | |
315 /* ------------------------------- */ | |
316 /* extent list */ | 234 /* extent list */ |
317 /* ------------------------------- */ | 235 /* ------------------------------- */ |
318 | 236 |
319 typedef struct extent_list_marker | 237 typedef struct extent_list_marker |
320 { | 238 { |
377 | 295 |
378 /* Is extent E1 less than or equal to extent E2 in the e-order? */ | 296 /* Is extent E1 less than or equal to extent E2 in the e-order? */ |
379 #define EXTENT_E_LESS_EQUAL(e1,e2) \ | 297 #define EXTENT_E_LESS_EQUAL(e1,e2) \ |
380 EXTENT_E_LESS_EQUAL_VALS (e1, extent_start (e2), extent_end (e2)) | 298 EXTENT_E_LESS_EQUAL_VALS (e1, extent_start (e2), extent_end (e2)) |
381 | 299 |
382 #define EXTENT_GAP_ARRAY_AT(ga, pos) (* (EXTENT *) GAP_ARRAY_EL_ADDR(ga, pos)) | 300 #define EXTENT_GAP_ARRAY_AT(ga, pos) gap_array_at (ga, pos, EXTENT) |
383 | 301 |
384 /* ------------------------------- */ | 302 /* ------------------------------- */ |
385 /* buffer-extent primitives */ | 303 /* buffer-extent primitives */ |
386 /* ------------------------------- */ | 304 /* ------------------------------- */ |
387 | 305 |
508 | 426 |
509 int debug_soe; | 427 int debug_soe; |
510 | 428 |
511 | 429 |
512 /************************************************************************/ | 430 /************************************************************************/ |
513 /* Generalized gap array */ | |
514 /************************************************************************/ | |
515 | |
516 /* This generalizes the "array with a gap" model used to store buffer | |
517 characters. This is based on the stuff in insdel.c and should | |
518 probably be merged with it. This is not extent-specific and should | |
519 perhaps be moved into a separate file. */ | |
520 | |
521 /* ------------------------------- */ | |
522 /* internal functions */ | |
523 /* ------------------------------- */ | |
524 | |
525 /* Adjust the gap array markers in the range (FROM, TO]. Parallel to | |
526 adjust_markers() in insdel.c. */ | |
527 | |
528 static void | |
529 gap_array_adjust_markers (Gap_Array *ga, Memxpos from, | |
530 Memxpos to, Elemcount amount) | |
531 { | |
532 Gap_Array_Marker *m; | |
533 | |
534 for (m = ga->markers; m; m = m->next) | |
535 m->pos = do_marker_adjustment (m->pos, from, to, amount); | |
536 } | |
537 | |
538 static void | |
539 gap_array_recompute_derived_values (Gap_Array *ga) | |
540 { | |
541 ga->offset_past_gap = ga->elsize * (ga->gap + ga->gapsize); | |
542 ga->els_past_gap = ga->numels - ga->gap; | |
543 } | |
544 | |
545 /* Move the gap to array position POS. Parallel to move_gap() in | |
546 insdel.c but somewhat simplified. */ | |
547 | |
548 static void | |
549 gap_array_move_gap (Gap_Array *ga, Elemcount pos) | |
550 { | |
551 Elemcount gap = ga->gap; | |
552 Elemcount gapsize = ga->gapsize; | |
553 | |
554 if (pos < gap) | |
555 { | |
556 memmove (GAP_ARRAY_MEMEL_ADDR (ga, pos + gapsize), | |
557 GAP_ARRAY_MEMEL_ADDR (ga, pos), | |
558 (gap - pos)*ga->elsize); | |
559 gap_array_adjust_markers (ga, (Memxpos) pos, (Memxpos) gap, | |
560 gapsize); | |
561 } | |
562 else if (pos > gap) | |
563 { | |
564 memmove (GAP_ARRAY_MEMEL_ADDR (ga, gap), | |
565 GAP_ARRAY_MEMEL_ADDR (ga, gap + gapsize), | |
566 (pos - gap)*ga->elsize); | |
567 gap_array_adjust_markers (ga, (Memxpos) (gap + gapsize), | |
568 (Memxpos) (pos + gapsize), - gapsize); | |
569 } | |
570 ga->gap = pos; | |
571 | |
572 gap_array_recompute_derived_values (ga); | |
573 } | |
574 | |
575 /* Make the gap INCREMENT characters longer. Parallel to make_gap() in | |
576 insdel.c. The gap array may be moved, so assign the return value back | |
577 to the array pointer. */ | |
578 | |
579 static Gap_Array * | |
580 gap_array_make_gap (Gap_Array *ga, Elemcount increment) | |
581 { | |
582 Elemcount real_gap_loc; | |
583 Elemcount old_gap_size; | |
584 | |
585 /* If we have to get more space, get enough to last a while. We use | |
586 a geometric progression that saves on realloc space. */ | |
587 increment += 100 + ga->numels / 8; | |
588 | |
589 #ifdef NEW_GC | |
590 ga = (Gap_Array *) mc_realloc (ga, | |
591 offsetof (Gap_Array, array) + | |
592 (ga->numels + ga->gapsize + increment) * | |
593 ga->elsize); | |
594 #else /* not NEW_GC */ | |
595 ga = (Gap_Array *) xrealloc (ga, | |
596 offsetof (Gap_Array, array) + | |
597 (ga->numels + ga->gapsize + increment) * | |
598 ga->elsize); | |
599 #endif /* not NEW_GC */ | |
600 if (ga == 0) | |
601 memory_full (); | |
602 | |
603 real_gap_loc = ga->gap; | |
604 old_gap_size = ga->gapsize; | |
605 | |
606 /* Call the newly allocated space a gap at the end of the whole space. */ | |
607 ga->gap = ga->numels + ga->gapsize; | |
608 ga->gapsize = increment; | |
609 | |
610 /* Move the new gap down to be consecutive with the end of the old one. | |
611 This adjusts the markers properly too. */ | |
612 gap_array_move_gap (ga, real_gap_loc + old_gap_size); | |
613 | |
614 /* Now combine the two into one large gap. */ | |
615 ga->gapsize += old_gap_size; | |
616 ga->gap = real_gap_loc; | |
617 | |
618 gap_array_recompute_derived_values (ga); | |
619 | |
620 return ga; | |
621 } | |
622 | |
623 /* ------------------------------- */ | |
624 /* external functions */ | |
625 /* ------------------------------- */ | |
626 | |
627 /* Insert NUMELS elements (pointed to by ELPTR) into the specified | |
628 gap array at POS. The gap array may be moved, so assign the | |
629 return value back to the array pointer. */ | |
630 | |
631 static Gap_Array * | |
632 gap_array_insert_els (Gap_Array *ga, Elemcount pos, void *elptr, | |
633 Elemcount numels) | |
634 { | |
635 assert (pos >= 0 && pos <= ga->numels); | |
636 if (ga->gapsize < numels) | |
637 ga = gap_array_make_gap (ga, numels - ga->gapsize); | |
638 if (pos != ga->gap) | |
639 gap_array_move_gap (ga, pos); | |
640 | |
641 memcpy (GAP_ARRAY_MEMEL_ADDR (ga, ga->gap), (char *) elptr, | |
642 numels*ga->elsize); | |
643 ga->gapsize -= numels; | |
644 ga->gap += numels; | |
645 ga->numels += numels; | |
646 gap_array_recompute_derived_values (ga); | |
647 /* This is the equivalent of insert-before-markers. | |
648 | |
649 #### Should only happen if marker is "moves forward at insert" type. | |
650 */ | |
651 | |
652 gap_array_adjust_markers (ga, pos - 1, pos, numels); | |
653 return ga; | |
654 } | |
655 | |
656 /* Delete NUMELS elements from the specified gap array, starting at FROM. */ | |
657 | |
658 static void | |
659 gap_array_delete_els (Gap_Array *ga, Elemcount from, Elemcount numdel) | |
660 { | |
661 Elemcount to = from + numdel; | |
662 Elemcount gapsize = ga->gapsize; | |
663 | |
664 assert (from >= 0); | |
665 assert (numdel >= 0); | |
666 assert (to <= ga->numels); | |
667 | |
668 /* Make sure the gap is somewhere in or next to what we are deleting. */ | |
669 if (to < ga->gap) | |
670 gap_array_move_gap (ga, to); | |
671 if (from > ga->gap) | |
672 gap_array_move_gap (ga, from); | |
673 | |
674 /* Relocate all markers pointing into the new, larger gap | |
675 to point at the end of the text before the gap. */ | |
676 gap_array_adjust_markers (ga, to + gapsize, to + gapsize, | |
677 - numdel - gapsize); | |
678 | |
679 ga->gapsize += numdel; | |
680 ga->numels -= numdel; | |
681 ga->gap = from; | |
682 gap_array_recompute_derived_values (ga); | |
683 } | |
684 | |
685 static Gap_Array_Marker * | |
686 gap_array_make_marker (Gap_Array *ga, Elemcount pos) | |
687 { | |
688 Gap_Array_Marker *m; | |
689 | |
690 assert (pos >= 0 && pos <= ga->numels); | |
691 #ifdef NEW_GC | |
692 m = XGAP_ARRAY_MARKER (ALLOC_NORMAL_LISP_OBJECT (gap_array_marker)); | |
693 #else /* not NEW_GC */ | |
694 if (gap_array_marker_freelist) | |
695 { | |
696 m = gap_array_marker_freelist; | |
697 gap_array_marker_freelist = gap_array_marker_freelist->next; | |
698 } | |
699 else | |
700 m = xnew (Gap_Array_Marker); | |
701 #endif /* not NEW_GC */ | |
702 | |
703 m->pos = GAP_ARRAY_ARRAY_TO_MEMORY_POS (ga, pos); | |
704 m->next = ga->markers; | |
705 ga->markers = m; | |
706 return m; | |
707 } | |
708 | |
709 static void | |
710 gap_array_delete_marker (Gap_Array *ga, Gap_Array_Marker *m) | |
711 { | |
712 Gap_Array_Marker *p, *prev; | |
713 | |
714 for (prev = 0, p = ga->markers; p && p != m; prev = p, p = p->next) | |
715 ; | |
716 assert (p); | |
717 if (prev) | |
718 prev->next = p->next; | |
719 else | |
720 ga->markers = p->next; | |
721 #ifndef NEW_GC | |
722 m->next = gap_array_marker_freelist; | |
723 m->pos = 0xDEADBEEF; /* -559038737 base 10 */ | |
724 gap_array_marker_freelist = m; | |
725 #endif /* not NEW_GC */ | |
726 } | |
727 | |
728 #ifndef NEW_GC | |
729 static void | |
730 gap_array_delete_all_markers (Gap_Array *ga) | |
731 { | |
732 Gap_Array_Marker *p, *next; | |
733 | |
734 for (p = ga->markers; p; p = next) | |
735 { | |
736 next = p->next; | |
737 p->next = gap_array_marker_freelist; | |
738 p->pos = 0xDEADBEEF; /* -559038737 as an int */ | |
739 gap_array_marker_freelist = p; | |
740 } | |
741 } | |
742 #endif /* not NEW_GC */ | |
743 | |
744 static void | |
745 gap_array_move_marker (Gap_Array *ga, Gap_Array_Marker *m, Elemcount pos) | |
746 { | |
747 assert (pos >= 0 && pos <= ga->numels); | |
748 m->pos = GAP_ARRAY_ARRAY_TO_MEMORY_POS (ga, pos); | |
749 } | |
750 | |
751 #define gap_array_marker_pos(ga, m) \ | |
752 GAP_ARRAY_MEMORY_TO_ARRAY_POS (ga, (m)->pos) | |
753 | |
754 static Gap_Array * | |
755 make_gap_array (Elemcount elsize) | |
756 { | |
757 #ifdef NEW_GC | |
758 Gap_Array *ga = XGAP_ARRAY (ALLOC_SIZED_LISP_OBJECT (sizeof (Gap_Array), | |
759 gap_array)); | |
760 #else /* not NEW_GC */ | |
761 Gap_Array *ga = xnew_and_zero (Gap_Array); | |
762 #endif /* not NEW_GC */ | |
763 ga->elsize = elsize; | |
764 return ga; | |
765 } | |
766 | |
767 #ifndef NEW_GC | |
768 static void | |
769 free_gap_array (Gap_Array *ga) | |
770 { | |
771 gap_array_delete_all_markers (ga); | |
772 xfree (ga); | |
773 } | |
774 #endif /* not NEW_GC */ | |
775 | |
776 | |
777 /************************************************************************/ | |
778 /* Extent list primitives */ | 431 /* Extent list primitives */ |
779 /************************************************************************/ | 432 /************************************************************************/ |
780 | 433 |
781 /* A list of extents is maintained as a double gap array: one gap array | 434 /* A list of extents is maintained as a double gap array: one gap array |
782 is ordered by start index (the "display order") and the other is | 435 is ordered by start index (the "display order") and the other is |
789 integers (this should be generalized to handle integers and linked | 442 integers (this should be generalized to handle integers and linked |
790 list equally well). | 443 list equally well). |
791 */ | 444 */ |
792 | 445 |
793 /* Number of elements in an extent list */ | 446 /* Number of elements in an extent list */ |
794 #define extent_list_num_els(el) GAP_ARRAY_NUM_ELS (el->start) | 447 #define extent_list_num_els(el) gap_array_length (el->start) |
795 | 448 |
796 /* Return the position at which EXTENT is located in the specified extent | 449 /* Return the position at which EXTENT is located in the specified extent |
797 list (in the display order if ENDP is 0, in the e-order otherwise). | 450 list (in the display order if ENDP is 0, in the e-order otherwise). |
798 If the extent is not found, the position where the extent would | 451 If the extent is not found, the position where the extent would |
799 be inserted is returned. If ENDP is 0, the insertion would go after | 452 be inserted is returned. If ENDP is 0, the insertion would go after |
803 | 456 |
804 static int | 457 static int |
805 extent_list_locate (Extent_List *el, EXTENT extent, int endp, int *foundp) | 458 extent_list_locate (Extent_List *el, EXTENT extent, int endp, int *foundp) |
806 { | 459 { |
807 Gap_Array *ga = endp ? el->end : el->start; | 460 Gap_Array *ga = endp ? el->end : el->start; |
808 int left = 0, right = GAP_ARRAY_NUM_ELS (ga); | 461 int left = 0, right = gap_array_length (ga); |
809 int oldfoundpos, foundpos; | 462 int oldfoundpos, foundpos; |
810 int found; | 463 int found; |
811 | 464 |
812 while (left != right) | 465 while (left != right) |
813 { | 466 { |
823 } | 476 } |
824 | 477 |
825 /* Now we're at the beginning of all equal extents. */ | 478 /* Now we're at the beginning of all equal extents. */ |
826 found = 0; | 479 found = 0; |
827 oldfoundpos = foundpos = left; | 480 oldfoundpos = foundpos = left; |
828 while (foundpos < GAP_ARRAY_NUM_ELS (ga)) | 481 while (foundpos < gap_array_length (ga)) |
829 { | 482 { |
830 EXTENT e = EXTENT_GAP_ARRAY_AT (ga, foundpos); | 483 EXTENT e = EXTENT_GAP_ARRAY_AT (ga, foundpos); |
831 if (e == extent) | 484 if (e == extent) |
832 { | 485 { |
833 found = 1; | 486 found = 1; |
878 static EXTENT | 531 static EXTENT |
879 extent_list_at (Extent_List *el, Memxpos pos, int endp) | 532 extent_list_at (Extent_List *el, Memxpos pos, int endp) |
880 { | 533 { |
881 Gap_Array *ga = endp ? el->end : el->start; | 534 Gap_Array *ga = endp ? el->end : el->start; |
882 | 535 |
883 assert (pos >= 0 && pos < GAP_ARRAY_NUM_ELS (ga)); | 536 assert (pos >= 0 && pos < gap_array_length (ga)); |
884 return EXTENT_GAP_ARRAY_AT (ga, pos); | 537 return EXTENT_GAP_ARRAY_AT (ga, pos); |
885 } | 538 } |
886 | 539 |
887 /* Insert an extent into an extent list. */ | 540 /* Insert an extent into an extent list. */ |
888 | 541 |
915 } | 568 } |
916 | 569 |
917 static void | 570 static void |
918 extent_list_delete_all (Extent_List *el) | 571 extent_list_delete_all (Extent_List *el) |
919 { | 572 { |
920 gap_array_delete_els (el->start, 0, GAP_ARRAY_NUM_ELS (el->start)); | 573 gap_array_delete_els (el->start, 0, gap_array_length (el->start)); |
921 gap_array_delete_els (el->end, 0, GAP_ARRAY_NUM_ELS (el->end)); | 574 gap_array_delete_els (el->end, 0, gap_array_length (el->end)); |
922 } | 575 } |
923 | 576 |
924 static Extent_List_Marker * | 577 static Extent_List_Marker * |
925 extent_list_make_marker (Extent_List *el, int pos, int endp) | 578 extent_list_make_marker (Extent_List *el, int pos, int endp) |
926 { | 579 { |
978 #ifdef NEW_GC | 631 #ifdef NEW_GC |
979 Extent_List *el = XEXTENT_LIST (ALLOC_NORMAL_LISP_OBJECT (extent_list)); | 632 Extent_List *el = XEXTENT_LIST (ALLOC_NORMAL_LISP_OBJECT (extent_list)); |
980 #else /* not NEW_GC */ | 633 #else /* not NEW_GC */ |
981 Extent_List *el = xnew (Extent_List); | 634 Extent_List *el = xnew (Extent_List); |
982 #endif /* not NEW_GC */ | 635 #endif /* not NEW_GC */ |
983 el->start = make_gap_array (sizeof (EXTENT)); | 636 el->start = make_gap_array (sizeof (EXTENT), 1); |
984 el->end = make_gap_array (sizeof (EXTENT)); | 637 el->end = make_gap_array (sizeof (EXTENT), 1); |
985 el->markers = 0; | 638 el->markers = 0; |
986 return el; | 639 return el; |
987 } | 640 } |
988 | 641 |
989 #ifndef NEW_GC | 642 #ifndef NEW_GC |
1078 #ifndef NEW_GC | 731 #ifndef NEW_GC |
1079 static void free_soe (struct stack_of_extents *soe); | 732 static void free_soe (struct stack_of_extents *soe); |
1080 #endif /* not NEW_GC */ | 733 #endif /* not NEW_GC */ |
1081 static void soe_invalidate (Lisp_Object obj); | 734 static void soe_invalidate (Lisp_Object obj); |
1082 | 735 |
1083 extern const struct sized_memory_description gap_array_marker_description; | 736 #ifndef NEW_GC |
1084 | |
1085 static const struct memory_description gap_array_marker_description_1[] = { | |
1086 #ifdef NEW_GC | |
1087 { XD_LISP_OBJECT, offsetof (Gap_Array_Marker, next) }, | |
1088 #else /* not NEW_GC */ | |
1089 { XD_BLOCK_PTR, offsetof (Gap_Array_Marker, next), 1, | |
1090 { &gap_array_marker_description } }, | |
1091 #endif /* not NEW_GC */ | |
1092 { XD_END } | |
1093 }; | |
1094 | |
1095 #ifdef NEW_GC | |
1096 DEFINE_NODUMP_INTERNAL_LISP_OBJECT ("gap-array-marker", gap_array_marker, | |
1097 0, gap_array_marker_description_1, | |
1098 struct gap_array_marker); | |
1099 #else /* not NEW_GC */ | |
1100 const struct sized_memory_description gap_array_marker_description = { | |
1101 sizeof (Gap_Array_Marker), | |
1102 gap_array_marker_description_1 | |
1103 }; | |
1104 #endif /* not NEW_GC */ | |
1105 | |
1106 static const struct memory_description lispobj_gap_array_description_1[] = { | |
1107 { XD_ELEMCOUNT, offsetof (Gap_Array, gap) }, | |
1108 { XD_BYTECOUNT, offsetof (Gap_Array, offset_past_gap) }, | |
1109 { XD_ELEMCOUNT, offsetof (Gap_Array, els_past_gap) }, | |
1110 #ifdef NEW_GC | |
1111 { XD_LISP_OBJECT, offsetof (Gap_Array, markers) }, | |
1112 #else /* not NEW_GC */ | |
1113 { XD_BLOCK_PTR, offsetof (Gap_Array, markers), 1, | |
1114 { &gap_array_marker_description }, XD_FLAG_NO_KKCC }, | |
1115 #endif /* not NEW_GC */ | |
1116 { XD_BLOCK_ARRAY, offsetof (Gap_Array, array), XD_INDIRECT (0, 0), | |
1117 { &lisp_object_description } }, | |
1118 { XD_BLOCK_ARRAY, XD_INDIRECT (1, offsetof (Gap_Array, array)), | |
1119 XD_INDIRECT (2, 0), { &lisp_object_description } }, | |
1120 { XD_END } | |
1121 }; | |
1122 | |
1123 #ifdef NEW_GC | |
1124 | |
1125 static Bytecount | |
1126 size_gap_array (Lisp_Object obj) | |
1127 { | |
1128 Gap_Array *ga = XGAP_ARRAY (obj); | |
1129 return offsetof (Gap_Array, array) + (ga->numels + ga->gapsize) * ga->elsize; | |
1130 } | |
1131 | |
1132 DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT ("gap-array", gap_array, | |
1133 0, | |
1134 lispobj_gap_array_description_1, | |
1135 size_gap_array, | |
1136 struct gap_array); | |
1137 #else /* not NEW_GC */ | |
1138 static const struct sized_memory_description lispobj_gap_array_description = { | |
1139 sizeof (Gap_Array), | |
1140 lispobj_gap_array_description_1 | |
1141 }; | |
1142 | |
1143 extern const struct sized_memory_description extent_list_marker_description; | 737 extern const struct sized_memory_description extent_list_marker_description; |
1144 #endif /* not NEW_GC */ | 738 #endif /* not NEW_GC */ |
1145 | 739 |
1146 static const struct memory_description extent_list_marker_description_1[] = { | 740 static const struct memory_description extent_list_marker_description_1[] = { |
1147 #ifdef NEW_GC | 741 #ifdef NEW_GC |
7443 { | 7037 { |
7444 INIT_LISP_OBJECT (extent); | 7038 INIT_LISP_OBJECT (extent); |
7445 INIT_LISP_OBJECT (extent_info); | 7039 INIT_LISP_OBJECT (extent_info); |
7446 INIT_LISP_OBJECT (extent_auxiliary); | 7040 INIT_LISP_OBJECT (extent_auxiliary); |
7447 #ifdef NEW_GC | 7041 #ifdef NEW_GC |
7448 INIT_LISP_OBJECT (gap_array_marker); | |
7449 INIT_LISP_OBJECT (gap_array); | |
7450 INIT_LISP_OBJECT (extent_list_marker); | 7042 INIT_LISP_OBJECT (extent_list_marker); |
7451 INIT_LISP_OBJECT (extent_list); | 7043 INIT_LISP_OBJECT (extent_list); |
7452 INIT_LISP_OBJECT (stack_of_extents); | 7044 INIT_LISP_OBJECT (stack_of_extents); |
7453 #endif /* NEW_GC */ | 7045 #endif /* NEW_GC */ |
7454 | 7046 |