comparison src/extents.c @ 3092:141c2920ea48

[xemacs-hg @ 2005-11-25 01:41:31 by crestani] Incremental Garbage Collector
author crestani
date Fri, 25 Nov 2005 01:42:08 +0000
parents facf3239ba30
children 2b8bb4938bb4
comparison
equal deleted inserted replaced
3091:c22d8984148c 3092:141c2920ea48
240 /* Holds a marker that moves as elements in the array are inserted and 240 /* Holds a marker that moves as elements in the array are inserted and
241 deleted, similar to standard markers. */ 241 deleted, similar to standard markers. */
242 242
243 typedef struct gap_array_marker 243 typedef struct gap_array_marker
244 { 244 {
245 #ifdef NEW_GC
246 struct lrecord_header header;
247 #endif /* NEW_GC */
245 int pos; 248 int pos;
246 struct gap_array_marker *next; 249 struct gap_array_marker *next;
247 } Gap_Array_Marker; 250 } Gap_Array_Marker;
248 251
249 252
267 */ 270 */
268 271
269 272
270 typedef struct gap_array 273 typedef struct gap_array
271 { 274 {
275 #ifdef NEW_GC
276 struct lrecord_header header;
277 #endif /* NEW_GC */
272 Elemcount gap; 278 Elemcount gap;
273 Elemcount gapsize; 279 Elemcount gapsize;
274 Elemcount numels; 280 Elemcount numels;
275 Bytecount elsize; 281 Bytecount elsize;
276 /* Redundant numbers computed from the others, for marking purposes */ 282 /* Redundant numbers computed from the others, for marking purposes */
279 Gap_Array_Marker *markers; 285 Gap_Array_Marker *markers;
280 /* this is a stretchy array */ 286 /* this is a stretchy array */
281 char array[1]; 287 char array[1];
282 } Gap_Array; 288 } Gap_Array;
283 289
290 #ifndef NEW_GC
284 static Gap_Array_Marker *gap_array_marker_freelist; 291 static Gap_Array_Marker *gap_array_marker_freelist;
292 #endif /* not NEW_GC */
285 293
286 /* Convert a "memory position" (i.e. taking the gap into account) into 294 /* Convert a "memory position" (i.e. taking the gap into account) into
287 the address of the element at (i.e. after) that position. "Memory 295 the address of the element at (i.e. after) that position. "Memory
288 positions" are only used internally and are of type Memxpos. 296 positions" are only used internally and are of type Memxpos.
289 "Array positions" are used externally and are of type int. */ 297 "Array positions" are used externally and are of type int. */
308 /* extent list */ 316 /* extent list */
309 /* ------------------------------- */ 317 /* ------------------------------- */
310 318
311 typedef struct extent_list_marker 319 typedef struct extent_list_marker
312 { 320 {
321 #ifdef NEW_GC
322 struct lrecord_header header;
323 #endif /* NEW_GC */
313 Gap_Array_Marker *m; 324 Gap_Array_Marker *m;
314 int endp; 325 int endp;
315 struct extent_list_marker *next; 326 struct extent_list_marker *next;
316 } Extent_List_Marker; 327 } Extent_List_Marker;
317 328
318 typedef struct extent_list 329 typedef struct extent_list
319 { 330 {
331 #ifdef NEW_GC
332 struct lrecord_header header;
333 #endif /* NEW_GC */
320 Gap_Array *start; 334 Gap_Array *start;
321 Gap_Array *end; 335 Gap_Array *end;
322 Extent_List_Marker *markers; 336 Extent_List_Marker *markers;
323 } Extent_List; 337 } Extent_List;
324 338
339 #ifndef NEW_GC
325 static Extent_List_Marker *extent_list_marker_freelist; 340 static Extent_List_Marker *extent_list_marker_freelist;
341 #endif /* not NEW_GC */
326 342
327 #define EXTENT_LESS_VALS(e,st,nd) ((extent_start (e) < (st)) || \ 343 #define EXTENT_LESS_VALS(e,st,nd) ((extent_start (e) < (st)) || \
328 ((extent_start (e) == (st)) && \ 344 ((extent_start (e) == (st)) && \
329 (extent_end (e) > (nd)))) 345 (extent_end (e) > (nd))))
330 346
375 /* buffer-extent primitives */ 391 /* buffer-extent primitives */
376 /* ------------------------------- */ 392 /* ------------------------------- */
377 393
378 typedef struct stack_of_extents 394 typedef struct stack_of_extents
379 { 395 {
396 #ifdef NEW_GC
397 struct lrecord_header header;
398 #endif /* NEW_GC */
380 Extent_List *extents; 399 Extent_List *extents;
381 Memxpos pos; /* Position of stack of extents. EXTENTS is the list of 400 Memxpos pos; /* Position of stack of extents. EXTENTS is the list of
382 all extents that overlap this position. This position 401 all extents that overlap this position. This position
383 can be -1 if the stack of extents is invalid (this 402 can be -1 if the stack of extents is invalid (this
384 happens when a buffer is first created or a string's 403 happens when a buffer is first created or a string's
567 586
568 /* If we have to get more space, get enough to last a while. We use 587 /* If we have to get more space, get enough to last a while. We use
569 a geometric progression that saves on realloc space. */ 588 a geometric progression that saves on realloc space. */
570 increment += 100 + ga->numels / 8; 589 increment += 100 + ga->numels / 8;
571 590
591 #ifdef NEW_GC
592 ga = (Gap_Array *) mc_realloc (ga,
593 offsetof (Gap_Array, array) +
594 (ga->numels + ga->gapsize + increment) *
595 ga->elsize);
596 #else /* not NEW_GC */
572 ga = (Gap_Array *) xrealloc (ga, 597 ga = (Gap_Array *) xrealloc (ga,
573 offsetof (Gap_Array, array) + 598 offsetof (Gap_Array, array) +
574 (ga->numels + ga->gapsize + increment) * 599 (ga->numels + ga->gapsize + increment) *
575 ga->elsize); 600 ga->elsize);
601 #endif /* not NEW_GC */
576 if (ga == 0) 602 if (ga == 0)
577 memory_full (); 603 memory_full ();
578 604
579 real_gap_loc = ga->gap; 605 real_gap_loc = ga->gap;
580 old_gap_size = ga->gapsize; 606 old_gap_size = ga->gapsize;
662 gap_array_make_marker (Gap_Array *ga, Elemcount pos) 688 gap_array_make_marker (Gap_Array *ga, Elemcount pos)
663 { 689 {
664 Gap_Array_Marker *m; 690 Gap_Array_Marker *m;
665 691
666 assert (pos >= 0 && pos <= ga->numels); 692 assert (pos >= 0 && pos <= ga->numels);
693 #ifdef NEW_GC
694 m = alloc_lrecord_type (Gap_Array_Marker, &lrecord_gap_array_marker);
695 #else /* not NEW_GC */
667 if (gap_array_marker_freelist) 696 if (gap_array_marker_freelist)
668 { 697 {
669 m = gap_array_marker_freelist; 698 m = gap_array_marker_freelist;
670 gap_array_marker_freelist = gap_array_marker_freelist->next; 699 gap_array_marker_freelist = gap_array_marker_freelist->next;
671 } 700 }
672 else 701 else
673 m = xnew (Gap_Array_Marker); 702 m = xnew (Gap_Array_Marker);
703 #endif /* not NEW_GC */
674 704
675 m->pos = GAP_ARRAY_ARRAY_TO_MEMORY_POS (ga, pos); 705 m->pos = GAP_ARRAY_ARRAY_TO_MEMORY_POS (ga, pos);
676 m->next = ga->markers; 706 m->next = ga->markers;
677 ga->markers = m; 707 ga->markers = m;
678 return m; 708 return m;
688 assert (p); 718 assert (p);
689 if (prev) 719 if (prev)
690 prev->next = p->next; 720 prev->next = p->next;
691 else 721 else
692 ga->markers = p->next; 722 ga->markers = p->next;
723 #ifdef NEW_GC
724 mc_free (m);
725 #else /* not NEW_GC */
693 m->next = gap_array_marker_freelist; 726 m->next = gap_array_marker_freelist;
694 m->pos = 0xDEADBEEF; /* -559038737 base 10 */ 727 m->pos = 0xDEADBEEF; /* -559038737 base 10 */
695 gap_array_marker_freelist = m; 728 gap_array_marker_freelist = m;
696 } 729 #endif /* not NEW_GC */
697 730 }
731
732 #ifndef NEW_GC
698 static void 733 static void
699 gap_array_delete_all_markers (Gap_Array *ga) 734 gap_array_delete_all_markers (Gap_Array *ga)
700 { 735 {
701 Gap_Array_Marker *p, *next; 736 Gap_Array_Marker *p, *next;
702 737
706 p->next = gap_array_marker_freelist; 741 p->next = gap_array_marker_freelist;
707 p->pos = 0xDEADBEEF; /* -559038737 as an int */ 742 p->pos = 0xDEADBEEF; /* -559038737 as an int */
708 gap_array_marker_freelist = p; 743 gap_array_marker_freelist = p;
709 } 744 }
710 } 745 }
746 #endif /* not NEW_GC */
711 747
712 static void 748 static void
713 gap_array_move_marker (Gap_Array *ga, Gap_Array_Marker *m, Elemcount pos) 749 gap_array_move_marker (Gap_Array *ga, Gap_Array_Marker *m, Elemcount pos)
714 { 750 {
715 assert (pos >= 0 && pos <= ga->numels); 751 assert (pos >= 0 && pos <= ga->numels);
720 GAP_ARRAY_MEMORY_TO_ARRAY_POS (ga, (m)->pos) 756 GAP_ARRAY_MEMORY_TO_ARRAY_POS (ga, (m)->pos)
721 757
722 static Gap_Array * 758 static Gap_Array *
723 make_gap_array (Elemcount elsize) 759 make_gap_array (Elemcount elsize)
724 { 760 {
761 #ifdef NEW_GC
762 Gap_Array *ga = alloc_lrecord_type (Gap_Array, &lrecord_gap_array);
763 #else /* not NEW_GC */
725 Gap_Array *ga = xnew_and_zero (Gap_Array); 764 Gap_Array *ga = xnew_and_zero (Gap_Array);
765 #endif /* not NEW_GC */
726 ga->elsize = elsize; 766 ga->elsize = elsize;
727 return ga; 767 return ga;
728 } 768 }
729 769
770 #ifndef NEW_GC
730 static void 771 static void
731 free_gap_array (Gap_Array *ga) 772 free_gap_array (Gap_Array *ga)
732 { 773 {
733 gap_array_delete_all_markers (ga); 774 gap_array_delete_all_markers (ga);
734 xfree (ga, Gap_Array *); 775 xfree (ga, Gap_Array *);
735 } 776 }
777 #endif /* not NEW_GC */
736 778
737 779
738 /************************************************************************/ 780 /************************************************************************/
739 /* Extent list primitives */ 781 /* Extent list primitives */
740 /************************************************************************/ 782 /************************************************************************/
885 static Extent_List_Marker * 927 static Extent_List_Marker *
886 extent_list_make_marker (Extent_List *el, int pos, int endp) 928 extent_list_make_marker (Extent_List *el, int pos, int endp)
887 { 929 {
888 Extent_List_Marker *m; 930 Extent_List_Marker *m;
889 931
932 #ifdef NEW_GC
933 m = alloc_lrecord_type (Extent_List_Marker, &lrecord_extent_list_marker);
934 #else /* not NEW_GC */
890 if (extent_list_marker_freelist) 935 if (extent_list_marker_freelist)
891 { 936 {
892 m = extent_list_marker_freelist; 937 m = extent_list_marker_freelist;
893 extent_list_marker_freelist = extent_list_marker_freelist->next; 938 extent_list_marker_freelist = extent_list_marker_freelist->next;
894 } 939 }
895 else 940 else
896 m = xnew (Extent_List_Marker); 941 m = xnew (Extent_List_Marker);
942 #endif /* not NEW_GC */
897 943
898 m->m = gap_array_make_marker (endp ? el->end : el->start, pos); 944 m->m = gap_array_make_marker (endp ? el->end : el->start, pos);
899 m->endp = endp; 945 m->endp = endp;
900 m->next = el->markers; 946 m->next = el->markers;
901 el->markers = m; 947 el->markers = m;
915 assert (p); 961 assert (p);
916 if (prev) 962 if (prev)
917 prev->next = p->next; 963 prev->next = p->next;
918 else 964 else
919 el->markers = p->next; 965 el->markers = p->next;
966 #ifdef NEW_GC
967 gap_array_delete_marker (m->endp ? el->end : el->start, m->m);
968 #else /* not NEW_GC */
920 m->next = extent_list_marker_freelist; 969 m->next = extent_list_marker_freelist;
921 extent_list_marker_freelist = m; 970 extent_list_marker_freelist = m;
922 gap_array_delete_marker (m->endp ? el->end : el->start, m->m); 971 gap_array_delete_marker (m->endp ? el->end : el->start, m->m);
972 #endif /* not NEW_GC */
923 } 973 }
924 974
925 #define extent_list_marker_pos(el, mkr) \ 975 #define extent_list_marker_pos(el, mkr) \
926 gap_array_marker_pos ((mkr)->endp ? (el)->end : (el)->start, (mkr)->m) 976 gap_array_marker_pos ((mkr)->endp ? (el)->end : (el)->start, (mkr)->m)
927 977
928 static Extent_List * 978 static Extent_List *
929 allocate_extent_list (void) 979 allocate_extent_list (void)
930 { 980 {
981 #ifdef NEW_GC
982 Extent_List *el = alloc_lrecord_type (Extent_List, &lrecord_extent_list);
983 #else /* not NEW_GC */
931 Extent_List *el = xnew (Extent_List); 984 Extent_List *el = xnew (Extent_List);
985 #endif /* not NEW_GC */
932 el->start = make_gap_array (sizeof (EXTENT)); 986 el->start = make_gap_array (sizeof (EXTENT));
933 el->end = make_gap_array (sizeof (EXTENT)); 987 el->end = make_gap_array (sizeof (EXTENT));
934 el->markers = 0; 988 el->markers = 0;
935 return el; 989 return el;
936 } 990 }
937 991
992 #ifndef NEW_GC
938 static void 993 static void
939 free_extent_list (Extent_List *el) 994 free_extent_list (Extent_List *el)
940 { 995 {
941 free_gap_array (el->start); 996 free_gap_array (el->start);
942 free_gap_array (el->end); 997 free_gap_array (el->end);
943 xfree (el, Extent_List *); 998 xfree (el, Extent_List *);
944 } 999 }
1000 #endif /* not NEW_GC */
945 1001
946 1002
947 /************************************************************************/ 1003 /************************************************************************/
948 /* Auxiliary extent structure */ 1004 /* Auxiliary extent structure */
949 /************************************************************************/ 1005 /************************************************************************/
1019 (Generally it won't if there haven't been any extents added to the 1075 (Generally it won't if there haven't been any extents added to the
1020 string.) So use the _force version if you need the extent_info 1076 string.) So use the _force version if you need the extent_info
1021 structure to be there. */ 1077 structure to be there. */
1022 1078
1023 static struct stack_of_extents *allocate_soe (void); 1079 static struct stack_of_extents *allocate_soe (void);
1080 #ifndef NEW_GC
1024 static void free_soe (struct stack_of_extents *soe); 1081 static void free_soe (struct stack_of_extents *soe);
1082 #endif /* not NEW_GC */
1025 static void soe_invalidate (Lisp_Object obj); 1083 static void soe_invalidate (Lisp_Object obj);
1026 1084
1027 extern const struct sized_memory_description gap_array_marker_description; 1085 extern const struct sized_memory_description gap_array_marker_description;
1028 1086
1029 static const struct memory_description gap_array_marker_description_1[] = { 1087 static const struct memory_description gap_array_marker_description_1[] = {
1088 #ifdef NEW_GC
1089 { XD_LISP_OBJECT, offsetof (Gap_Array_Marker, next) },
1090 #else /* not NEW_GC */
1030 { XD_BLOCK_PTR, offsetof (Gap_Array_Marker, next), 1, 1091 { XD_BLOCK_PTR, offsetof (Gap_Array_Marker, next), 1,
1031 { &gap_array_marker_description } }, 1092 { &gap_array_marker_description } },
1093 #endif /* not NEW_GC */
1032 { XD_END } 1094 { XD_END }
1033 }; 1095 };
1034 1096
1097 #ifdef NEW_GC
1098 DEFINE_LRECORD_IMPLEMENTATION ("gap-array-marker", gap_array_marker,
1099 0, /*dumpable-flag*/
1100 0, 0, 0, 0, 0,
1101 gap_array_marker_description_1,
1102 struct gap_array_marker);
1103 #else /* not NEW_GC */
1035 const struct sized_memory_description gap_array_marker_description = { 1104 const struct sized_memory_description gap_array_marker_description = {
1036 sizeof (Gap_Array_Marker), 1105 sizeof (Gap_Array_Marker),
1037 gap_array_marker_description_1 1106 gap_array_marker_description_1
1038 }; 1107 };
1108 #endif /* not NEW_GC */
1039 1109
1040 static const struct memory_description lispobj_gap_array_description_1[] = { 1110 static const struct memory_description lispobj_gap_array_description_1[] = {
1041 { XD_ELEMCOUNT, offsetof (Gap_Array, gap) }, 1111 { XD_ELEMCOUNT, offsetof (Gap_Array, gap) },
1042 { XD_BYTECOUNT, offsetof (Gap_Array, offset_past_gap) }, 1112 { XD_BYTECOUNT, offsetof (Gap_Array, offset_past_gap) },
1043 { XD_ELEMCOUNT, offsetof (Gap_Array, els_past_gap) }, 1113 { XD_ELEMCOUNT, offsetof (Gap_Array, els_past_gap) },
1114 #ifdef NEW_GC
1115 { XD_LISP_OBJECT, offsetof (Gap_Array, markers) },
1116 #else /* not NEW_GC */
1044 { XD_BLOCK_PTR, offsetof (Gap_Array, markers), 1, 1117 { XD_BLOCK_PTR, offsetof (Gap_Array, markers), 1,
1045 { &gap_array_marker_description }, XD_FLAG_NO_KKCC }, 1118 { &gap_array_marker_description }, XD_FLAG_NO_KKCC },
1119 #endif /* not NEW_GC */
1046 { XD_BLOCK_ARRAY, offsetof (Gap_Array, array), XD_INDIRECT (0, 0), 1120 { XD_BLOCK_ARRAY, offsetof (Gap_Array, array), XD_INDIRECT (0, 0),
1047 { &lisp_object_description } }, 1121 { &lisp_object_description } },
1048 { XD_BLOCK_ARRAY, XD_INDIRECT (1, offsetof (Gap_Array, array)), 1122 { XD_BLOCK_ARRAY, XD_INDIRECT (1, offsetof (Gap_Array, array)),
1049 XD_INDIRECT (2, 0), { &lisp_object_description } }, 1123 XD_INDIRECT (2, 0), { &lisp_object_description } },
1050 { XD_END } 1124 { XD_END }
1051 }; 1125 };
1052 1126
1127 #ifdef NEW_GC
1128
1129 static Bytecount
1130 size_gap_array (const void *lheader)
1131 {
1132 Gap_Array *ga = (Gap_Array *) lheader;
1133 return offsetof (Gap_Array, array) + (ga->numels + ga->gapsize) * ga->elsize;
1134 }
1135
1136 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("gap-array", gap_array,
1137 0, /*dumpable-flag*/
1138 0, 0, 0, 0, 0,
1139 lispobj_gap_array_description_1,
1140 size_gap_array,
1141 struct gap_array);
1142 #else /* not NEW_GC */
1053 static const struct sized_memory_description lispobj_gap_array_description = { 1143 static const struct sized_memory_description lispobj_gap_array_description = {
1054 sizeof (Gap_Array), 1144 sizeof (Gap_Array),
1055 lispobj_gap_array_description_1 1145 lispobj_gap_array_description_1
1056 }; 1146 };
1057 1147
1058 extern const struct sized_memory_description extent_list_marker_description; 1148 extern const struct sized_memory_description extent_list_marker_description;
1149 #endif /* not NEW_GC */
1059 1150
1060 static const struct memory_description extent_list_marker_description_1[] = { 1151 static const struct memory_description extent_list_marker_description_1[] = {
1152 #ifdef NEW_GC
1153 { XD_LISP_OBJECT, offsetof (Extent_List_Marker, m) },
1154 { XD_LISP_OBJECT, offsetof (Extent_List_Marker, next) },
1155 #else /* not NEW_GC */
1061 { XD_BLOCK_PTR, offsetof (Extent_List_Marker, m), 1, 1156 { XD_BLOCK_PTR, offsetof (Extent_List_Marker, m), 1,
1062 { &gap_array_marker_description } }, 1157 { &gap_array_marker_description } },
1063 { XD_BLOCK_PTR, offsetof (Extent_List_Marker, next), 1, 1158 { XD_BLOCK_PTR, offsetof (Extent_List_Marker, next), 1,
1064 { &extent_list_marker_description } }, 1159 { &extent_list_marker_description } },
1160 #endif /* not NEW_GC */
1065 { XD_END } 1161 { XD_END }
1066 }; 1162 };
1067 1163
1164 #ifdef NEW_GC
1165 DEFINE_LRECORD_IMPLEMENTATION ("extent-list-marker", extent_list_marker,
1166 0, /*dumpable-flag*/
1167 0, 0, 0, 0, 0,
1168 extent_list_marker_description_1,
1169 struct extent_list_marker);
1170 #else /* not NEW_GC */
1068 const struct sized_memory_description extent_list_marker_description = { 1171 const struct sized_memory_description extent_list_marker_description = {
1069 sizeof (Extent_List_Marker), 1172 sizeof (Extent_List_Marker),
1070 extent_list_marker_description_1 1173 extent_list_marker_description_1
1071 }; 1174 };
1175 #endif /* not NEW_GC */
1072 1176
1073 static const struct memory_description extent_list_description_1[] = { 1177 static const struct memory_description extent_list_description_1[] = {
1178 #ifdef NEW_GC
1179 { XD_LISP_OBJECT, offsetof (Extent_List, start) },
1180 { XD_LISP_OBJECT, offsetof (Extent_List, end) },
1181 { XD_LISP_OBJECT, offsetof (Extent_List, markers) },
1182 #else /* not NEW_GC */
1074 { XD_BLOCK_PTR, offsetof (Extent_List, start), 1, 1183 { XD_BLOCK_PTR, offsetof (Extent_List, start), 1,
1075 { &lispobj_gap_array_description } }, 1184 { &lispobj_gap_array_description } },
1076 { XD_BLOCK_PTR, offsetof (Extent_List, end), 1, 1185 { XD_BLOCK_PTR, offsetof (Extent_List, end), 1,
1077 { &lispobj_gap_array_description }, XD_FLAG_NO_KKCC }, 1186 { &lispobj_gap_array_description }, XD_FLAG_NO_KKCC },
1078 { XD_BLOCK_PTR, offsetof (Extent_List, markers), 1, 1187 { XD_BLOCK_PTR, offsetof (Extent_List, markers), 1,
1079 { &extent_list_marker_description }, XD_FLAG_NO_KKCC }, 1188 { &extent_list_marker_description }, XD_FLAG_NO_KKCC },
1189 #endif /* not NEW_GC */
1080 { XD_END } 1190 { XD_END }
1081 }; 1191 };
1082 1192
1193 #ifdef NEW_GC
1194 DEFINE_LRECORD_IMPLEMENTATION ("extent-list", extent_list,
1195 0, /*dumpable-flag*/
1196 0, 0, 0, 0, 0,
1197 extent_list_description_1,
1198 struct extent_list);
1199 #else /* not NEW_GC */
1083 static const struct sized_memory_description extent_list_description = { 1200 static const struct sized_memory_description extent_list_description = {
1084 sizeof (Extent_List), 1201 sizeof (Extent_List),
1085 extent_list_description_1 1202 extent_list_description_1
1086 }; 1203 };
1204 #endif /* not NEW_GC */
1087 1205
1088 static const struct memory_description stack_of_extents_description_1[] = { 1206 static const struct memory_description stack_of_extents_description_1[] = {
1207 #ifdef NEW_GC
1208 { XD_LISP_OBJECT, offsetof (Stack_Of_Extents, extents) },
1209 #else /* not NEW_GC */
1089 { XD_BLOCK_PTR, offsetof (Stack_Of_Extents, extents), 1, 1210 { XD_BLOCK_PTR, offsetof (Stack_Of_Extents, extents), 1,
1090 { &extent_list_description } }, 1211 { &extent_list_description } },
1212 #endif /* not NEW_GC */
1091 { XD_END } 1213 { XD_END }
1092 }; 1214 };
1093 1215
1216 #ifdef NEW_GC
1217 DEFINE_LRECORD_IMPLEMENTATION ("stack-of-extents", stack_of_extents,
1218 0, /*dumpable-flag*/
1219 0, 0, 0, 0, 0,
1220 stack_of_extents_description_1,
1221 struct stack_of_extents);
1222 #else /* not NEW_GC */
1094 static const struct sized_memory_description stack_of_extents_description = { 1223 static const struct sized_memory_description stack_of_extents_description = {
1095 sizeof (Stack_Of_Extents), 1224 sizeof (Stack_Of_Extents),
1096 stack_of_extents_description_1 1225 stack_of_extents_description_1
1097 }; 1226 };
1227 #endif /* not NEW_GC */
1098 1228
1099 static const struct memory_description extent_info_description [] = { 1229 static const struct memory_description extent_info_description [] = {
1230 #ifdef NEW_GC
1231 { XD_LISP_OBJECT, offsetof (struct extent_info, extents) },
1232 { XD_LISP_OBJECT, offsetof (struct extent_info, soe) },
1233 #else /* not NEW_GC */
1100 { XD_BLOCK_PTR, offsetof (struct extent_info, extents), 1, 1234 { XD_BLOCK_PTR, offsetof (struct extent_info, extents), 1,
1101 { &extent_list_description } }, 1235 { &extent_list_description } },
1102 { XD_BLOCK_PTR, offsetof (struct extent_info, soe), 1, 1236 { XD_BLOCK_PTR, offsetof (struct extent_info, soe), 1,
1103 { &stack_of_extents_description }, XD_FLAG_NO_KKCC }, 1237 { &stack_of_extents_description }, XD_FLAG_NO_KKCC },
1238 #endif /* not NEW_GC */
1104 { XD_END } 1239 { XD_END }
1105 }; 1240 };
1106 1241
1107 static Lisp_Object 1242 static Lisp_Object
1108 mark_extent_info (Lisp_Object obj) 1243 mark_extent_info (Lisp_Object obj)
1140 struct extent_info *data = (struct extent_info *) header; 1275 struct extent_info *data = (struct extent_info *) header;
1141 1276
1142 if (for_disksave) 1277 if (for_disksave)
1143 return; 1278 return;
1144 1279
1280 #ifdef NEW_GC
1281 data->soe = 0;
1282 data->extents = 0;
1283 #else /* not NEW_GC */
1145 if (data->soe) 1284 if (data->soe)
1146 { 1285 {
1147 free_soe (data->soe); 1286 free_soe (data->soe);
1148 data->soe = 0; 1287 data->soe = 0;
1149 } 1288 }
1150 if (data->extents) 1289 if (data->extents)
1151 { 1290 {
1152 free_extent_list (data->extents); 1291 free_extent_list (data->extents);
1153 data->extents = 0; 1292 data->extents = 0;
1154 } 1293 }
1294 #endif /* not NEW_GC */
1155 } 1295 }
1156 1296
1157 DEFINE_LRECORD_IMPLEMENTATION ("extent-info", extent_info, 1297 DEFINE_LRECORD_IMPLEMENTATION ("extent-info", extent_info,
1158 0, /*dumpable-flag*/ 1298 0, /*dumpable-flag*/
1159 mark_extent_info, internal_object_printer, 1299 mark_extent_info, internal_object_printer,
1179 { 1319 {
1180 struct extent_info *data = XEXTENT_INFO (extent_info); 1320 struct extent_info *data = XEXTENT_INFO (extent_info);
1181 1321
1182 if (data->soe) 1322 if (data->soe)
1183 { 1323 {
1324 #ifndef NEW_GC
1184 free_soe (data->soe); 1325 free_soe (data->soe);
1326 #endif /* not NEW_GC */
1185 data->soe = 0; 1327 data->soe = 0;
1186 } 1328 }
1187 } 1329 }
1188 1330
1189 1331
1324 } 1466 }
1325 1467
1326 void 1468 void
1327 uninit_buffer_extents (struct buffer *b) 1469 uninit_buffer_extents (struct buffer *b)
1328 { 1470 {
1471 #ifndef NEW_GC
1329 struct extent_info *data = XEXTENT_INFO (b->extent_info); 1472 struct extent_info *data = XEXTENT_INFO (b->extent_info);
1473 #endif /* not NEW_GC */
1330 1474
1331 /* Don't destroy the extents here -- there may still be children 1475 /* Don't destroy the extents here -- there may still be children
1332 extents pointing to the extents. */ 1476 extents pointing to the extents. */
1333 detach_all_extents (wrap_buffer (b)); 1477 detach_all_extents (wrap_buffer (b));
1478 #ifndef NEW_GC
1334 finalize_extent_info (data, 0); 1479 finalize_extent_info (data, 0);
1480 #endif /* not NEW_GC */
1335 } 1481 }
1336 1482
1337 /* Retrieve the extent list that an extent is a member of; the 1483 /* Retrieve the extent list that an extent is a member of; the
1338 return value will never be 0 except in destroyed buffers (in which 1484 return value will never be 0 except in destroyed buffers (in which
1339 case the only extents that can refer to this buffer are detached 1485 case the only extents that can refer to this buffer are detached
1647 } 1793 }
1648 1794
1649 static struct stack_of_extents * 1795 static struct stack_of_extents *
1650 allocate_soe (void) 1796 allocate_soe (void)
1651 { 1797 {
1798 #ifdef NEW_GC
1799 struct stack_of_extents *soe =
1800 alloc_lrecord_type (struct stack_of_extents, &lrecord_stack_of_extents);
1801 #else /* not NEW_GC */
1652 struct stack_of_extents *soe = xnew_and_zero (struct stack_of_extents); 1802 struct stack_of_extents *soe = xnew_and_zero (struct stack_of_extents);
1803 #endif /* not NEW_GC */
1653 soe->extents = allocate_extent_list (); 1804 soe->extents = allocate_extent_list ();
1654 soe->pos = -1; 1805 soe->pos = -1;
1655 return soe; 1806 return soe;
1656 } 1807 }
1657 1808
1809 #ifndef NEW_GC
1658 static void 1810 static void
1659 free_soe (struct stack_of_extents *soe) 1811 free_soe (struct stack_of_extents *soe)
1660 { 1812 {
1661 free_extent_list (soe->extents); 1813 free_extent_list (soe->extents);
1662 xfree (soe, struct stack_of_extents *); 1814 xfree (soe, struct stack_of_extents *);
1663 } 1815 }
1816 #endif /* not NEW_GC */
1664 1817
1665 /* ------------------------------- */ 1818 /* ------------------------------- */
1666 /* other primitives */ 1819 /* other primitives */
1667 /* ------------------------------- */ 1820 /* ------------------------------- */
1668 1821
7297 syms_of_extents (void) 7450 syms_of_extents (void)
7298 { 7451 {
7299 INIT_LRECORD_IMPLEMENTATION (extent); 7452 INIT_LRECORD_IMPLEMENTATION (extent);
7300 INIT_LRECORD_IMPLEMENTATION (extent_info); 7453 INIT_LRECORD_IMPLEMENTATION (extent_info);
7301 INIT_LRECORD_IMPLEMENTATION (extent_auxiliary); 7454 INIT_LRECORD_IMPLEMENTATION (extent_auxiliary);
7455 #ifdef NEW_GC
7456 INIT_LRECORD_IMPLEMENTATION (gap_array_marker);
7457 INIT_LRECORD_IMPLEMENTATION (gap_array);
7458 INIT_LRECORD_IMPLEMENTATION (extent_list_marker);
7459 INIT_LRECORD_IMPLEMENTATION (extent_list);
7460 INIT_LRECORD_IMPLEMENTATION (stack_of_extents);
7461 #endif /* not NEW_GC */
7302 7462
7303 DEFSYMBOL (Qextentp); 7463 DEFSYMBOL (Qextentp);
7304 DEFSYMBOL (Qextent_live_p); 7464 DEFSYMBOL (Qextent_live_p);
7305 7465
7306 DEFSYMBOL (Qall_extents_closed); 7466 DEFSYMBOL (Qall_extents_closed);