2 * C-level stuff to implement Lisp-level PURIFY
6 * This software is part of the SBCL system. See the README file for
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
17 #include <sys/types.h>
27 #include "interrupt.h"
31 #include "gc-internal.h"
33 #include "genesis/primitive-objects.h"
34 #include "genesis/static-symbols.h"
38 #if defined(LISP_FEATURE_GENCGC)
39 /* this is another artifact of the poor integration between gencgc and
40 * the rest of the runtime: on cheney gc there is a global
41 * dynamic_space_free_pointer which is valid whenever foreign function
42 * call is active, but in gencgc there's no such variable and we have
45 static lispobj *dynamic_space_free_pointer;
47 extern unsigned long bytes_consed_between_gcs;
50 lose("GC invariant lost, file \"%s\", line %d", __FILE__, __LINE__)
53 #define gc_assert(ex) do { \
54 if (!(ex)) gc_abort(); \
61 /* These hold the original end of the read_only and static spaces so
62 * we can tell what are forwarding pointers. */
64 static lispobj *read_only_end, *static_end;
66 static lispobj *read_only_free, *static_free;
68 static lispobj *pscav(lispobj *addr, int nwords, boolean constant);
70 #define LATERBLOCKSIZE 1020
71 #define LATERMAXCOUNT 10
80 } *later_blocks = NULL;
81 static int later_count = 0;
83 /* FIXME: Shouldn't this be defined in sbcl.h? See also notes in
87 #define FUN_RAW_ADDR_OFFSET 0
89 #define FUN_RAW_ADDR_OFFSET (6*sizeof(lispobj) - FUN_POINTER_LOWTAG)
93 forwarding_pointer_p(lispobj obj)
95 lispobj *ptr = native_pointer(obj);
97 return ((static_end <= ptr && ptr <= static_free) ||
98 (read_only_end <= ptr && ptr <= read_only_free));
102 dynamic_pointer_p(lispobj ptr)
104 #ifndef LISP_FEATURE_GENCGC
105 return (ptr >= (lispobj)current_dynamic_space
107 ptr < (lispobj)dynamic_space_free_pointer);
109 /* Be more conservative, and remember, this is a maybe. */
110 return (ptr >= (lispobj)DYNAMIC_SPACE_START
112 ptr < (lispobj)dynamic_space_free_pointer);
116 static inline lispobj *
117 newspace_alloc(int nwords, int constantp)
120 nwords=CEILING(nwords,2);
123 read_only_free+=nwords;
133 #ifdef LISP_FEATURE_X86
135 #ifdef LISP_FEATURE_GENCGC
137 * enhanced x86/GENCGC stack scavenging by Douglas Crosher
139 * Scavenging the stack on the i386 is problematic due to conservative
140 * roots and raw return addresses. Here it is handled in two passes:
141 * the first pass runs before any objects are moved and tries to
142 * identify valid pointers and return address on the stack, the second
143 * pass scavenges these.
146 static unsigned pointer_filter_verbose = 0;
148 /* FIXME: This is substantially the same code as
149 * possibly_valid_dynamic_space_pointer in gencgc.c. The only
150 * relevant difference seems to be that the gencgc code also checks
151 * for raw pointers into Code objects, whereas in purify these are
152 * checked separately in setup_i386_stack_scav - they go onto
153 * valid_stack_ra_locations instead of just valid_stack_locations */
156 valid_dynamic_space_pointer(lispobj *pointer, lispobj *start_addr)
158 /* If it's not a return address then it needs to be a valid Lisp
160 if (!is_lisp_pointer((lispobj)pointer))
163 /* Check that the object pointed to is consistent with the pointer
165 switch (lowtag_of((lispobj)pointer)) {
166 case FUN_POINTER_LOWTAG:
167 /* Start_addr should be the enclosing code object, or a closure
169 switch (widetag_of(*start_addr)) {
170 case CODE_HEADER_WIDETAG:
171 /* This case is probably caught above. */
173 case CLOSURE_HEADER_WIDETAG:
174 case FUNCALLABLE_INSTANCE_HEADER_WIDETAG:
175 if ((int)pointer != ((int)start_addr+FUN_POINTER_LOWTAG)) {
176 if (pointer_filter_verbose) {
177 fprintf(stderr,"*Wf2: %x %x %x\n", (unsigned int) pointer,
178 (unsigned int) start_addr, *start_addr);
184 if (pointer_filter_verbose) {
185 fprintf(stderr,"*Wf3: %x %x %x\n", (unsigned int) pointer,
186 (unsigned int) start_addr, *start_addr);
191 case LIST_POINTER_LOWTAG:
192 if ((int)pointer != ((int)start_addr+LIST_POINTER_LOWTAG)) {
193 if (pointer_filter_verbose)
194 fprintf(stderr,"*Wl1: %x %x %x\n", (unsigned int) pointer,
195 (unsigned int) start_addr, *start_addr);
198 /* Is it plausible cons? */
199 if ((is_lisp_pointer(start_addr[0])
200 || ((start_addr[0] & 3) == 0) /* fixnum */
201 || (widetag_of(start_addr[0]) == BASE_CHAR_WIDETAG)
202 || (widetag_of(start_addr[0]) == UNBOUND_MARKER_WIDETAG))
203 && (is_lisp_pointer(start_addr[1])
204 || ((start_addr[1] & 3) == 0) /* fixnum */
205 || (widetag_of(start_addr[1]) == BASE_CHAR_WIDETAG)
206 || (widetag_of(start_addr[1]) == UNBOUND_MARKER_WIDETAG))) {
209 if (pointer_filter_verbose) {
210 fprintf(stderr,"*Wl2: %x %x %x\n", (unsigned int) pointer,
211 (unsigned int) start_addr, *start_addr);
215 case INSTANCE_POINTER_LOWTAG:
216 if ((int)pointer != ((int)start_addr+INSTANCE_POINTER_LOWTAG)) {
217 if (pointer_filter_verbose) {
218 fprintf(stderr,"*Wi1: %x %x %x\n", (unsigned int) pointer,
219 (unsigned int) start_addr, *start_addr);
223 if (widetag_of(start_addr[0]) != INSTANCE_HEADER_WIDETAG) {
224 if (pointer_filter_verbose) {
225 fprintf(stderr,"*Wi2: %x %x %x\n", (unsigned int) pointer,
226 (unsigned int) start_addr, *start_addr);
231 case OTHER_POINTER_LOWTAG:
232 if ((int)pointer != ((int)start_addr+OTHER_POINTER_LOWTAG)) {
233 if (pointer_filter_verbose) {
234 fprintf(stderr,"*Wo1: %x %x %x\n", (unsigned int) pointer,
235 (unsigned int) start_addr, *start_addr);
239 /* Is it plausible? Not a cons. XXX should check the headers. */
240 if (is_lisp_pointer(start_addr[0]) || ((start_addr[0] & 3) == 0)) {
241 if (pointer_filter_verbose) {
242 fprintf(stderr,"*Wo2: %x %x %x\n", (unsigned int) pointer,
243 (unsigned int) start_addr, *start_addr);
247 switch (widetag_of(start_addr[0])) {
248 case UNBOUND_MARKER_WIDETAG:
249 case BASE_CHAR_WIDETAG:
250 if (pointer_filter_verbose) {
251 fprintf(stderr,"*Wo3: %x %x %x\n", (unsigned int) pointer,
252 (unsigned int) start_addr, *start_addr);
256 /* only pointed to by function pointers? */
257 case CLOSURE_HEADER_WIDETAG:
258 case FUNCALLABLE_INSTANCE_HEADER_WIDETAG:
259 if (pointer_filter_verbose) {
260 fprintf(stderr,"*Wo4: %x %x %x\n", (unsigned int) pointer,
261 (unsigned int) start_addr, *start_addr);
265 case INSTANCE_HEADER_WIDETAG:
266 if (pointer_filter_verbose) {
267 fprintf(stderr,"*Wo5: %x %x %x\n", (unsigned int) pointer,
268 (unsigned int) start_addr, *start_addr);
272 /* the valid other immediate pointer objects */
273 case SIMPLE_VECTOR_WIDETAG:
275 case COMPLEX_WIDETAG:
276 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
277 case COMPLEX_SINGLE_FLOAT_WIDETAG:
279 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
280 case COMPLEX_DOUBLE_FLOAT_WIDETAG:
282 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
283 case COMPLEX_LONG_FLOAT_WIDETAG:
285 case SIMPLE_ARRAY_WIDETAG:
286 case COMPLEX_BASE_STRING_WIDETAG:
287 case COMPLEX_VECTOR_NIL_WIDETAG:
288 case COMPLEX_BIT_VECTOR_WIDETAG:
289 case COMPLEX_VECTOR_WIDETAG:
290 case COMPLEX_ARRAY_WIDETAG:
291 case VALUE_CELL_HEADER_WIDETAG:
292 case SYMBOL_HEADER_WIDETAG:
294 case CODE_HEADER_WIDETAG:
296 case SINGLE_FLOAT_WIDETAG:
297 case DOUBLE_FLOAT_WIDETAG:
298 #ifdef LONG_FLOAT_WIDETAG
299 case LONG_FLOAT_WIDETAG:
301 case SIMPLE_ARRAY_NIL_WIDETAG:
302 case SIMPLE_BASE_STRING_WIDETAG:
303 case SIMPLE_BIT_VECTOR_WIDETAG:
304 case SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG:
305 case SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG:
306 case SIMPLE_ARRAY_UNSIGNED_BYTE_7_WIDETAG:
307 case SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG:
308 case SIMPLE_ARRAY_UNSIGNED_BYTE_15_WIDETAG:
309 case SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG:
310 case SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG:
311 case SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG:
312 case SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG:
313 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
314 case SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG:
316 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
317 case SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG:
319 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
320 case SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG:
322 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
323 case SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG:
325 case SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG:
326 case SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG:
327 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
328 case SIMPLE_ARRAY_LONG_FLOAT_WIDETAG:
330 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
331 case SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG:
333 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
334 case SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG:
336 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
337 case SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG:
340 case WEAK_POINTER_WIDETAG:
344 if (pointer_filter_verbose) {
345 fprintf(stderr,"*Wo6: %x %x %x\n", (unsigned int) pointer,
346 (unsigned int) start_addr, *start_addr);
352 if (pointer_filter_verbose) {
353 fprintf(stderr,"*W?: %x %x %x\n", (unsigned int) pointer,
354 (unsigned int) start_addr, *start_addr);
363 #define MAX_STACK_POINTERS 256
364 lispobj *valid_stack_locations[MAX_STACK_POINTERS];
365 unsigned int num_valid_stack_locations;
367 #define MAX_STACK_RETURN_ADDRESSES 128
368 lispobj *valid_stack_ra_locations[MAX_STACK_RETURN_ADDRESSES];
369 lispobj *valid_stack_ra_code_objects[MAX_STACK_RETURN_ADDRESSES];
370 unsigned int num_valid_stack_ra_locations;
372 /* Identify valid stack slots. */
374 setup_i386_stack_scav(lispobj *lowaddr, lispobj *base)
376 lispobj *sp = lowaddr;
377 num_valid_stack_locations = 0;
378 num_valid_stack_ra_locations = 0;
379 for (sp = lowaddr; sp < base; sp++) {
381 /* Find the object start address */
382 lispobj *start_addr = search_dynamic_space((void *)thing);
384 /* We need to allow raw pointers into Code objects for
385 * return addresses. This will also pick up pointers to
386 * functions in code objects. */
387 if (widetag_of(*start_addr) == CODE_HEADER_WIDETAG) {
388 /* FIXME asserting here is a really dumb thing to do.
389 * If we've overflowed some arbitrary static limit, we
390 * should just refuse to purify, instead of killing
391 * the whole lisp session
393 gc_assert(num_valid_stack_ra_locations <
394 MAX_STACK_RETURN_ADDRESSES);
395 valid_stack_ra_locations[num_valid_stack_ra_locations] = sp;
396 valid_stack_ra_code_objects[num_valid_stack_ra_locations++] =
397 (lispobj *)((int)start_addr + OTHER_POINTER_LOWTAG);
399 if (valid_dynamic_space_pointer((void *)thing, start_addr)) {
400 gc_assert(num_valid_stack_locations < MAX_STACK_POINTERS);
401 valid_stack_locations[num_valid_stack_locations++] = sp;
406 if (pointer_filter_verbose) {
407 fprintf(stderr, "number of valid stack pointers = %d\n",
408 num_valid_stack_locations);
409 fprintf(stderr, "number of stack return addresses = %d\n",
410 num_valid_stack_ra_locations);
415 pscav_i386_stack(void)
419 for (i = 0; i < num_valid_stack_locations; i++)
420 pscav(valid_stack_locations[i], 1, 0);
422 for (i = 0; i < num_valid_stack_ra_locations; i++) {
423 lispobj code_obj = (lispobj)valid_stack_ra_code_objects[i];
424 pscav(&code_obj, 1, 0);
425 if (pointer_filter_verbose) {
426 fprintf(stderr,"*C moved RA %x to %x; for code object %x to %x\n",
427 *valid_stack_ra_locations[i],
428 (int)(*valid_stack_ra_locations[i])
429 - ((int)valid_stack_ra_code_objects[i] - (int)code_obj),
430 (unsigned int) valid_stack_ra_code_objects[i], code_obj);
432 *valid_stack_ra_locations[i] =
433 ((int)(*valid_stack_ra_locations[i])
434 - ((int)valid_stack_ra_code_objects[i] - (int)code_obj));
442 pscav_later(lispobj *where, int count)
446 if (count > LATERMAXCOUNT) {
447 while (count > LATERMAXCOUNT) {
448 pscav_later(where, LATERMAXCOUNT);
449 count -= LATERMAXCOUNT;
450 where += LATERMAXCOUNT;
454 if (later_blocks == NULL || later_count == LATERBLOCKSIZE ||
455 (later_count == LATERBLOCKSIZE-1 && count > 1)) {
456 new = (struct later *)malloc(sizeof(struct later));
457 new->next = later_blocks;
458 if (later_blocks && later_count < LATERBLOCKSIZE)
459 later_blocks->u[later_count].ptr = NULL;
465 later_blocks->u[later_count++].count = count;
466 later_blocks->u[later_count++].ptr = where;
471 ptrans_boxed(lispobj thing, lispobj header, boolean constant)
474 lispobj result, *new, *old;
476 nwords = 1 + HeaderValue(header);
479 old = (lispobj *)native_pointer(thing);
480 new = newspace_alloc(nwords,constant);
483 bcopy(old, new, nwords * sizeof(lispobj));
485 /* Deposit forwarding pointer. */
486 result = make_lispobj(new, lowtag_of(thing));
490 pscav(new, nwords, constant);
495 /* We need to look at the layout to see whether it is a pure structure
496 * class, and only then can we transport as constant. If it is pure,
497 * we can ALWAYS transport as a constant. */
499 ptrans_instance(lispobj thing, lispobj header, boolean /* ignored */ constant)
501 lispobj layout = ((struct instance *)native_pointer(thing))->slots[0];
502 lispobj pure = ((struct instance *)native_pointer(layout))->slots[15];
506 return (ptrans_boxed(thing, header, 1));
508 return (ptrans_boxed(thing, header, 0));
511 /* Substructure: special case for the COMPACT-INFO-ENVs,
512 * where the instance may have a point to the dynamic
513 * space placed into it (e.g. the cache-name slot), but
514 * the lists and arrays at the time of a purify can be
515 * moved to the RO space. */
517 lispobj result, *new, *old;
519 nwords = 1 + HeaderValue(header);
522 old = (lispobj *)native_pointer(thing);
523 new = newspace_alloc(nwords, 0); /* inconstant */
526 bcopy(old, new, nwords * sizeof(lispobj));
528 /* Deposit forwarding pointer. */
529 result = make_lispobj(new, lowtag_of(thing));
533 pscav(new, nwords, 1);
539 return NIL; /* dummy value: return something ... */
544 ptrans_fdefn(lispobj thing, lispobj header)
547 lispobj result, *new, *old, oldfn;
550 nwords = 1 + HeaderValue(header);
553 old = (lispobj *)native_pointer(thing);
554 new = newspace_alloc(nwords, 0); /* inconstant */
557 bcopy(old, new, nwords * sizeof(lispobj));
559 /* Deposit forwarding pointer. */
560 result = make_lispobj(new, lowtag_of(thing));
563 /* Scavenge the function. */
564 fdefn = (struct fdefn *)new;
566 pscav(&fdefn->fun, 1, 0);
567 if ((char *)oldfn + FUN_RAW_ADDR_OFFSET == fdefn->raw_addr)
568 fdefn->raw_addr = (char *)fdefn->fun + FUN_RAW_ADDR_OFFSET;
574 ptrans_unboxed(lispobj thing, lispobj header)
577 lispobj result, *new, *old;
579 nwords = 1 + HeaderValue(header);
582 old = (lispobj *)native_pointer(thing);
583 new = newspace_alloc(nwords,1); /* always constant */
586 bcopy(old, new, nwords * sizeof(lispobj));
588 /* Deposit forwarding pointer. */
589 result = make_lispobj(new , lowtag_of(thing));
596 ptrans_vector(lispobj thing, int bits, int extra,
597 boolean boxed, boolean constant)
599 struct vector *vector;
601 lispobj result, *new;
603 vector = (struct vector *)native_pointer(thing);
604 nwords = 2 + (CEILING((fixnum_value(vector->length)+extra)*bits,32)>>5);
606 new=newspace_alloc(nwords, (constant || !boxed));
607 bcopy(vector, new, nwords * sizeof(lispobj));
609 result = make_lispobj(new, lowtag_of(thing));
610 vector->header = result;
613 pscav(new, nwords, constant);
618 #ifdef LISP_FEATURE_X86
620 apply_code_fixups_during_purify(struct code *old_code, struct code *new_code)
622 int nheader_words, ncode_words, nwords;
623 void *constants_start_addr, *constants_end_addr;
624 void *code_start_addr, *code_end_addr;
625 lispobj fixups = NIL;
626 unsigned displacement = (unsigned)new_code - (unsigned)old_code;
627 struct vector *fixups_vector;
629 ncode_words = fixnum_value(new_code->code_size);
630 nheader_words = HeaderValue(*(lispobj *)new_code);
631 nwords = ncode_words + nheader_words;
633 constants_start_addr = (void *)new_code + 5*4;
634 constants_end_addr = (void *)new_code + nheader_words*4;
635 code_start_addr = (void *)new_code + nheader_words*4;
636 code_end_addr = (void *)new_code + nwords*4;
638 /* The first constant should be a pointer to the fixups for this
639 * code objects. Check. */
640 fixups = new_code->constants[0];
642 /* It will be 0 or the unbound-marker if there are no fixups, and
643 * will be an other-pointer to a vector if it is valid. */
645 (fixups==UNBOUND_MARKER_WIDETAG) ||
646 !is_lisp_pointer(fixups)) {
647 #ifdef LISP_FEATURE_GENCGC
648 /* Check for a possible errors. */
649 sniff_code_object(new_code,displacement);
654 fixups_vector = (struct vector *)native_pointer(fixups);
656 /* Could be pointing to a forwarding pointer. */
657 if (is_lisp_pointer(fixups) && (dynamic_pointer_p(fixups))
658 && forwarding_pointer_p(*(lispobj *)fixups_vector)) {
659 /* If so then follow it. */
661 (struct vector *)native_pointer(*(lispobj *)fixups_vector);
664 if (widetag_of(fixups_vector->header) ==
665 SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG) {
666 /* We got the fixups for the code block. Now work through the
667 * vector, and apply a fixup at each address. */
668 int length = fixnum_value(fixups_vector->length);
670 for (i=0; i<length; i++) {
671 unsigned offset = fixups_vector->data[i];
672 /* Now check the current value of offset. */
674 *(unsigned *)((unsigned)code_start_addr + offset);
676 /* If it's within the old_code object then it must be an
677 * absolute fixup (relative ones are not saved) */
678 if ((old_value>=(unsigned)old_code)
679 && (old_value<((unsigned)old_code + nwords*4)))
680 /* So add the dispacement. */
681 *(unsigned *)((unsigned)code_start_addr + offset) = old_value
684 /* It is outside the old code object so it must be a relative
685 * fixup (absolute fixups are not saved). So subtract the
687 *(unsigned *)((unsigned)code_start_addr + offset) = old_value
692 /* No longer need the fixups. */
693 new_code->constants[0] = 0;
695 #ifdef LISP_FEATURE_GENCGC
696 /* Check for possible errors. */
697 sniff_code_object(new_code,displacement);
703 ptrans_code(lispobj thing)
705 struct code *code, *new;
707 lispobj func, result;
709 code = (struct code *)native_pointer(thing);
710 nwords = HeaderValue(code->header) + fixnum_value(code->code_size);
712 new = (struct code *)newspace_alloc(nwords,1); /* constant */
714 bcopy(code, new, nwords * sizeof(lispobj));
716 #ifdef LISP_FEATURE_X86
717 apply_code_fixups_during_purify(code,new);
720 result = make_lispobj(new, OTHER_POINTER_LOWTAG);
722 /* Stick in a forwarding pointer for the code object. */
723 *(lispobj *)code = result;
725 /* Put in forwarding pointers for all the functions. */
726 for (func = code->entry_points;
728 func = ((struct simple_fun *)native_pointer(func))->next) {
730 gc_assert(lowtag_of(func) == FUN_POINTER_LOWTAG);
732 *(lispobj *)native_pointer(func) = result + (func - thing);
735 /* Arrange to scavenge the debug info later. */
736 pscav_later(&new->debug_info, 1);
738 /* FIXME: why would this be a fixnum? */
739 /* "why" is a hard word, but apparently for compiled functions the
740 trace_table_offset contains the length of the instructions, as
741 a fixnum. See CODE-INST-AREA-LENGTH in
742 src/compiler/target-disassem.lisp. -- CSR, 2004-01-08 */
743 if (!(fixnump(new->trace_table_offset)))
745 pscav(&new->trace_table_offset, 1, 0);
747 new->trace_table_offset = NIL; /* limit lifetime */
750 /* Scavenge the constants. */
751 pscav(new->constants, HeaderValue(new->header)-5, 1);
753 /* Scavenge all the functions. */
754 pscav(&new->entry_points, 1, 1);
755 for (func = new->entry_points;
757 func = ((struct simple_fun *)native_pointer(func))->next) {
758 gc_assert(lowtag_of(func) == FUN_POINTER_LOWTAG);
759 gc_assert(!dynamic_pointer_p(func));
761 #ifdef LISP_FEATURE_X86
762 /* Temporarily convert the self pointer to a real function pointer. */
763 ((struct simple_fun *)native_pointer(func))->self
764 -= FUN_RAW_ADDR_OFFSET;
766 pscav(&((struct simple_fun *)native_pointer(func))->self, 2, 1);
767 #ifdef LISP_FEATURE_X86
768 ((struct simple_fun *)native_pointer(func))->self
769 += FUN_RAW_ADDR_OFFSET;
771 pscav_later(&((struct simple_fun *)native_pointer(func))->name, 3);
778 ptrans_func(lispobj thing, lispobj header)
781 lispobj code, *new, *old, result;
782 struct simple_fun *function;
784 /* Thing can either be a function header, a closure function
785 * header, a closure, or a funcallable-instance. If it's a closure
786 * or a funcallable-instance, we do the same as ptrans_boxed.
787 * Otherwise we have to do something strange, 'cause it is buried
788 * inside a code object. */
790 if (widetag_of(header) == SIMPLE_FUN_HEADER_WIDETAG) {
792 /* We can only end up here if the code object has not been
793 * scavenged, because if it had been scavenged, forwarding pointers
794 * would have been left behind for all the entry points. */
796 function = (struct simple_fun *)native_pointer(thing);
799 ((native_pointer(thing) -
800 (HeaderValue(function->header))), OTHER_POINTER_LOWTAG);
802 /* This will cause the function's header to be replaced with a
803 * forwarding pointer. */
807 /* So we can just return that. */
808 return function->header;
811 /* It's some kind of closure-like thing. */
812 nwords = 1 + HeaderValue(header);
813 old = (lispobj *)native_pointer(thing);
815 /* Allocate the new one. FINs *must* not go in read_only
816 * space. Closures can; they never change */
819 (nwords,(widetag_of(header)!=FUNCALLABLE_INSTANCE_HEADER_WIDETAG));
822 bcopy(old, new, nwords * sizeof(lispobj));
824 /* Deposit forwarding pointer. */
825 result = make_lispobj(new, lowtag_of(thing));
829 pscav(new, nwords, 0);
836 ptrans_returnpc(lispobj thing, lispobj header)
840 /* Find the corresponding code object. */
841 code = thing - HeaderValue(header)*sizeof(lispobj);
843 /* Make sure it's been transported. */
844 new = *(lispobj *)native_pointer(code);
845 if (!forwarding_pointer_p(new))
846 new = ptrans_code(code);
848 /* Maintain the offset: */
849 return new + (thing - code);
852 #define WORDS_PER_CONS CEILING(sizeof(struct cons) / sizeof(lispobj), 2)
855 ptrans_list(lispobj thing, boolean constant)
857 struct cons *old, *new, *orig;
860 orig = (struct cons *) newspace_alloc(0,constant);
864 /* Allocate a new cons cell. */
865 old = (struct cons *)native_pointer(thing);
866 new = (struct cons *) newspace_alloc(WORDS_PER_CONS,constant);
868 /* Copy the cons cell and keep a pointer to the cdr. */
870 thing = new->cdr = old->cdr;
872 /* Set up the forwarding pointer. */
873 *(lispobj *)old = make_lispobj(new, LIST_POINTER_LOWTAG);
875 /* And count this cell. */
877 } while (lowtag_of(thing) == LIST_POINTER_LOWTAG &&
878 dynamic_pointer_p(thing) &&
879 !(forwarding_pointer_p(*(lispobj *)native_pointer(thing))));
881 /* Scavenge the list we just copied. */
882 pscav((lispobj *)orig, length * WORDS_PER_CONS, constant);
884 return make_lispobj(orig, LIST_POINTER_LOWTAG);
888 ptrans_otherptr(lispobj thing, lispobj header, boolean constant)
890 switch (widetag_of(header)) {
891 /* FIXME: this needs a reindent */
893 case SINGLE_FLOAT_WIDETAG:
894 case DOUBLE_FLOAT_WIDETAG:
895 #ifdef LONG_FLOAT_WIDETAG
896 case LONG_FLOAT_WIDETAG:
898 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
899 case COMPLEX_SINGLE_FLOAT_WIDETAG:
901 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
902 case COMPLEX_DOUBLE_FLOAT_WIDETAG:
904 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
905 case COMPLEX_LONG_FLOAT_WIDETAG:
908 return ptrans_unboxed(thing, header);
911 case COMPLEX_WIDETAG:
912 case SIMPLE_ARRAY_WIDETAG:
913 case COMPLEX_BASE_STRING_WIDETAG:
914 case COMPLEX_BIT_VECTOR_WIDETAG:
915 case COMPLEX_VECTOR_NIL_WIDETAG:
916 case COMPLEX_VECTOR_WIDETAG:
917 case COMPLEX_ARRAY_WIDETAG:
918 return ptrans_boxed(thing, header, constant);
920 case VALUE_CELL_HEADER_WIDETAG:
921 case WEAK_POINTER_WIDETAG:
922 return ptrans_boxed(thing, header, 0);
924 case SYMBOL_HEADER_WIDETAG:
925 return ptrans_boxed(thing, header, 0);
927 case SIMPLE_ARRAY_NIL_WIDETAG:
928 return ptrans_vector(thing, 0, 0, 0, constant);
930 case SIMPLE_BASE_STRING_WIDETAG:
931 return ptrans_vector(thing, 8, 1, 0, constant);
933 case SIMPLE_BIT_VECTOR_WIDETAG:
934 return ptrans_vector(thing, 1, 0, 0, constant);
936 case SIMPLE_VECTOR_WIDETAG:
937 return ptrans_vector(thing, 32, 0, 1, constant);
939 case SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG:
940 return ptrans_vector(thing, 2, 0, 0, constant);
942 case SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG:
943 return ptrans_vector(thing, 4, 0, 0, constant);
945 case SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG:
946 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
947 case SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG:
948 case SIMPLE_ARRAY_UNSIGNED_BYTE_7_WIDETAG:
950 return ptrans_vector(thing, 8, 0, 0, constant);
952 case SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG:
953 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
954 case SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG:
955 case SIMPLE_ARRAY_UNSIGNED_BYTE_15_WIDETAG:
957 return ptrans_vector(thing, 16, 0, 0, constant);
959 case SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG:
960 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
961 case SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG:
962 case SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG:
964 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
965 case SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG:
966 case SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG:
968 return ptrans_vector(thing, 32, 0, 0, constant);
970 case SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG:
971 return ptrans_vector(thing, 32, 0, 0, constant);
973 case SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG:
974 return ptrans_vector(thing, 64, 0, 0, constant);
976 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
977 case SIMPLE_ARRAY_LONG_FLOAT_WIDETAG:
978 #ifdef LISP_FEATURE_X86
979 return ptrans_vector(thing, 96, 0, 0, constant);
982 return ptrans_vector(thing, 128, 0, 0, constant);
986 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
987 case SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG:
988 return ptrans_vector(thing, 64, 0, 0, constant);
991 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
992 case SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG:
993 return ptrans_vector(thing, 128, 0, 0, constant);
996 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
997 case SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG:
998 #ifdef LISP_FEATURE_X86
999 return ptrans_vector(thing, 192, 0, 0, constant);
1002 return ptrans_vector(thing, 256, 0, 0, constant);
1006 case CODE_HEADER_WIDETAG:
1007 return ptrans_code(thing);
1009 case RETURN_PC_HEADER_WIDETAG:
1010 return ptrans_returnpc(thing, header);
1013 return ptrans_fdefn(thing, header);
1016 /* Should only come across other pointers to the above stuff. */
1023 pscav_fdefn(struct fdefn *fdefn)
1027 fix_func = ((char *)(fdefn->fun+FUN_RAW_ADDR_OFFSET) == fdefn->raw_addr);
1028 pscav(&fdefn->name, 1, 1);
1029 pscav(&fdefn->fun, 1, 0);
1031 fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
1032 return sizeof(struct fdefn) / sizeof(lispobj);
1035 #ifdef LISP_FEATURE_X86
1036 /* now putting code objects in static space */
1038 pscav_code(struct code*code)
1042 nwords = HeaderValue(code->header) + fixnum_value(code->code_size);
1044 /* Arrange to scavenge the debug info later. */
1045 pscav_later(&code->debug_info, 1);
1047 /* Scavenge the constants. */
1048 pscav(code->constants, HeaderValue(code->header)-5, 1);
1050 /* Scavenge all the functions. */
1051 pscav(&code->entry_points, 1, 1);
1052 for (func = code->entry_points;
1054 func = ((struct simple_fun *)native_pointer(func))->next) {
1055 gc_assert(lowtag_of(func) == FUN_POINTER_LOWTAG);
1056 gc_assert(!dynamic_pointer_p(func));
1058 #ifdef LISP_FEATURE_X86
1059 /* Temporarily convert the self pointer to a real function
1061 ((struct simple_fun *)native_pointer(func))->self
1062 -= FUN_RAW_ADDR_OFFSET;
1064 pscav(&((struct simple_fun *)native_pointer(func))->self, 2, 1);
1065 #ifdef LISP_FEATURE_X86
1066 ((struct simple_fun *)native_pointer(func))->self
1067 += FUN_RAW_ADDR_OFFSET;
1069 pscav_later(&((struct simple_fun *)native_pointer(func))->name, 3);
1072 return CEILING(nwords,2);
1077 pscav(lispobj *addr, int nwords, boolean constant)
1079 lispobj thing, *thingp, header;
1080 int count = 0; /* (0 = dummy init value to stop GCC warning) */
1081 struct vector *vector;
1083 while (nwords > 0) {
1085 if (is_lisp_pointer(thing)) {
1086 /* It's a pointer. Is it something we might have to move? */
1087 if (dynamic_pointer_p(thing)) {
1088 /* Maybe. Have we already moved it? */
1089 thingp = (lispobj *)native_pointer(thing);
1091 if (is_lisp_pointer(header) && forwarding_pointer_p(header))
1092 /* Yep, so just copy the forwarding pointer. */
1095 /* Nope, copy the object. */
1096 switch (lowtag_of(thing)) {
1097 case FUN_POINTER_LOWTAG:
1098 thing = ptrans_func(thing, header);
1101 case LIST_POINTER_LOWTAG:
1102 thing = ptrans_list(thing, constant);
1105 case INSTANCE_POINTER_LOWTAG:
1106 thing = ptrans_instance(thing, header, constant);
1109 case OTHER_POINTER_LOWTAG:
1110 thing = ptrans_otherptr(thing, header, constant);
1114 /* It was a pointer, but not one of them? */
1122 else if (thing & 3) { /* FIXME: 3? not 2? */
1123 /* It's an other immediate. Maybe the header for an unboxed */
1125 switch (widetag_of(thing)) {
1126 case BIGNUM_WIDETAG:
1127 case SINGLE_FLOAT_WIDETAG:
1128 case DOUBLE_FLOAT_WIDETAG:
1129 #ifdef LONG_FLOAT_WIDETAG
1130 case LONG_FLOAT_WIDETAG:
1133 /* It's an unboxed simple object. */
1134 count = HeaderValue(thing)+1;
1137 case SIMPLE_VECTOR_WIDETAG:
1138 if (HeaderValue(thing) == subtype_VectorValidHashing) {
1139 *addr = (subtype_VectorMustRehash << N_WIDETAG_BITS) |
1140 SIMPLE_VECTOR_WIDETAG;
1145 case SIMPLE_ARRAY_NIL_WIDETAG:
1149 case SIMPLE_BASE_STRING_WIDETAG:
1150 vector = (struct vector *)addr;
1151 count = CEILING(NWORDS(fixnum_value(vector->length)+1,8)+2,2);
1154 case SIMPLE_BIT_VECTOR_WIDETAG:
1155 vector = (struct vector *)addr;
1156 count = CEILING(NWORDS(fixnum_value(vector->length),1)+2,2);
1159 case SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG:
1160 vector = (struct vector *)addr;
1161 count = CEILING(NWORDS(fixnum_value(vector->length),2)+2,2);
1164 case SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG:
1165 vector = (struct vector *)addr;
1166 count = CEILING(NWORDS(fixnum_value(vector->length),4)+2,2);
1169 case SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG:
1170 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1171 case SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG:
1172 case SIMPLE_ARRAY_UNSIGNED_BYTE_7_WIDETAG:
1174 vector = (struct vector *)addr;
1175 count = CEILING(NWORDS(fixnum_value(vector->length),8)+2,2);
1178 case SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG:
1179 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1180 case SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG:
1181 case SIMPLE_ARRAY_UNSIGNED_BYTE_15_WIDETAG:
1183 vector = (struct vector *)addr;
1184 count = CEILING(NWORDS(fixnum_value(vector->length),16)+2,2);
1187 case SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG:
1188 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1189 case SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG:
1190 case SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG:
1192 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1193 case SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG:
1194 case SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG:
1196 vector = (struct vector *)addr;
1197 count = CEILING(NWORDS(fixnum_value(vector->length),32)+2,2);
1200 #if N_WORD_BITS == 64
1201 case SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG:
1202 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG
1203 case SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG:
1204 case SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG:
1206 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG
1207 case SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG:
1208 case SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG:
1210 vector = (struct vector *)addr;
1211 count = CEILING(NWORDS(fixnum_value(vector->length),64)+2,2);
1215 case SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG:
1216 vector = (struct vector *)addr;
1217 count = CEILING(fixnum_value(vector->length)+2,2);
1220 case SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG:
1221 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1222 case SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG:
1224 vector = (struct vector *)addr;
1225 count = fixnum_value(vector->length)*2+2;
1228 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1229 case SIMPLE_ARRAY_LONG_FLOAT_WIDETAG:
1230 vector = (struct vector *)addr;
1231 #ifdef LISP_FEATURE_X86
1232 count = fixnum_value(vector->length)*3+2;
1235 count = fixnum_value(vector->length)*4+2;
1240 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1241 case SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG:
1242 vector = (struct vector *)addr;
1243 count = fixnum_value(vector->length)*4+2;
1247 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1248 case SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG:
1249 vector = (struct vector *)addr;
1250 #ifdef LISP_FEATURE_X86
1251 count = fixnum_value(vector->length)*6+2;
1254 count = fixnum_value(vector->length)*8+2;
1259 case CODE_HEADER_WIDETAG:
1260 #ifndef LISP_FEATURE_X86
1261 gc_abort(); /* no code headers in static space */
1263 count = pscav_code((struct code*)addr);
1267 case SIMPLE_FUN_HEADER_WIDETAG:
1268 case RETURN_PC_HEADER_WIDETAG:
1269 /* We should never hit any of these, 'cause they occur
1270 * buried in the middle of code objects. */
1274 #ifdef LISP_FEATURE_X86
1275 case CLOSURE_HEADER_WIDETAG:
1276 case FUNCALLABLE_INSTANCE_HEADER_WIDETAG:
1277 /* The function self pointer needs special care on the
1278 * x86 because it is the real entry point. */
1280 lispobj fun = ((struct closure *)addr)->fun
1281 - FUN_RAW_ADDR_OFFSET;
1282 pscav(&fun, 1, constant);
1283 ((struct closure *)addr)->fun = fun + FUN_RAW_ADDR_OFFSET;
1289 case WEAK_POINTER_WIDETAG:
1290 /* Weak pointers get preserved during purify, 'cause I
1291 * don't feel like figuring out how to break them. */
1292 pscav(addr+1, 2, constant);
1297 /* We have to handle fdefn objects specially, so we
1298 * can fix up the raw function address. */
1299 count = pscav_fdefn((struct fdefn *)addr);
1308 /* It's a fixnum. */
1320 purify(lispobj static_roots, lispobj read_only_roots)
1324 struct later *laters, *next;
1325 struct thread *thread;
1327 if(all_threads->next) {
1328 /* FIXME: there should be _some_ sensible error reporting
1329 * convention. See following comment too */
1330 fprintf(stderr,"Can't purify when more than one thread exists\n");
1336 printf("[doing purification:");
1339 #ifdef LISP_FEATURE_GENCGC
1340 gc_alloc_update_all_page_tables();
1342 for_each_thread(thread)
1343 if (fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)) != 0) {
1344 /* FIXME: 1. What does this mean? 2. It shouldn't be reporting
1345 * its error simply by a. printing a string b. to stdout instead
1347 printf(" Ack! Can't purify interrupt contexts. ");
1352 #if defined(LISP_FEATURE_X86)
1353 dynamic_space_free_pointer =
1354 (lispobj*)SymbolValue(ALLOCATION_POINTER,0);
1357 read_only_end = read_only_free =
1358 (lispobj *)SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0);
1359 static_end = static_free =
1360 (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER,0);
1367 #if (defined(LISP_FEATURE_GENCGC) && defined(LISP_FEATURE_X86))
1368 /* note this expects only one thread to be active. We'd have to
1369 * stop all the others in the same way as GC does if we wanted
1370 * PURIFY to work when >1 thread exists */
1371 setup_i386_stack_scav(((&static_roots)-2),
1372 ((void *)all_threads->control_stack_end));
1375 pscav(&static_roots, 1, 0);
1376 pscav(&read_only_roots, 1, 1);
1379 printf(" handlers");
1382 pscav((lispobj *) all_threads->interrupt_data->interrupt_handlers,
1383 sizeof(all_threads->interrupt_data->interrupt_handlers)
1391 #ifndef LISP_FEATURE_X86
1392 pscav((lispobj *)all_threads->control_stack_start,
1393 current_control_stack_pointer -
1394 all_threads->control_stack_start,
1397 #ifdef LISP_FEATURE_GENCGC
1403 printf(" bindings");
1406 #if !defined(LISP_FEATURE_X86)
1407 pscav( (lispobj *)all_threads->binding_stack_start,
1408 (lispobj *)current_binding_stack_pointer -
1409 all_threads->binding_stack_start,
1412 for_each_thread(thread) {
1413 pscav( (lispobj *)thread->binding_stack_start,
1414 (lispobj *)SymbolValue(BINDING_STACK_POINTER,thread) -
1415 (lispobj *)thread->binding_stack_start,
1417 pscav( (lispobj *) (thread+1),
1418 fixnum_value(SymbolValue(FREE_TLS_INDEX,0)) -
1419 (sizeof (struct thread))/(sizeof (lispobj)),
1426 /* The original CMU CL code had scavenge-read-only-space code
1427 * controlled by the Lisp-level variable
1428 * *SCAVENGE-READ-ONLY-SPACE*. It was disabled by default, and it
1429 * wasn't documented under what circumstances it was useful or
1430 * safe to turn it on, so it's been turned off in SBCL. If you
1431 * want/need this functionality, and can test and document it,
1432 * please submit a patch. */
1434 if (SymbolValue(SCAVENGE_READ_ONLY_SPACE) != UNBOUND_MARKER_WIDETAG
1435 && SymbolValue(SCAVENGE_READ_ONLY_SPACE) != NIL) {
1436 unsigned read_only_space_size =
1437 (lispobj *)SymbolValue(READ_ONLY_SPACE_FREE_POINTER) -
1438 (lispobj *)READ_ONLY_SPACE_START;
1440 "scavenging read only space: %d bytes\n",
1441 read_only_space_size * sizeof(lispobj));
1442 pscav( (lispobj *)READ_ONLY_SPACE_START, read_only_space_size, 0);
1450 clean = (lispobj *)STATIC_SPACE_START;
1452 while (clean != static_free)
1453 clean = pscav(clean, static_free - clean, 0);
1454 laters = later_blocks;
1455 count = later_count;
1456 later_blocks = NULL;
1458 while (laters != NULL) {
1459 for (i = 0; i < count; i++) {
1460 if (laters->u[i].count == 0) {
1462 } else if (laters->u[i].count <= LATERMAXCOUNT) {
1463 pscav(laters->u[i+1].ptr, laters->u[i].count, 1);
1466 pscav(laters->u[i].ptr, 1, 1);
1469 next = laters->next;
1472 count = LATERBLOCKSIZE;
1474 } while (clean != static_free || later_blocks != NULL);
1481 os_zero((os_vm_address_t) current_dynamic_space,
1482 (os_vm_size_t) DYNAMIC_SPACE_SIZE);
1484 /* Zero the stack. Note that the stack is also zeroed by SUB-GC
1485 * calling SCRUB-CONTROL-STACK - this zeros the stack on the x86. */
1486 #ifndef LISP_FEATURE_X86
1487 os_zero((os_vm_address_t) current_control_stack_pointer,
1489 ((all_threads->control_stack_end -
1490 current_control_stack_pointer) * sizeof(lispobj)));
1493 /* It helps to update the heap free pointers so that free_heap can
1494 * verify after it's done. */
1495 SetSymbolValue(READ_ONLY_SPACE_FREE_POINTER, (lispobj)read_only_free,0);
1496 SetSymbolValue(STATIC_SPACE_FREE_POINTER, (lispobj)static_free,0);
1498 #if !defined(ALLOCATION_POINTER)
1499 dynamic_space_free_pointer = current_dynamic_space;
1500 set_auto_gc_trigger(bytes_consed_between_gcs);
1502 #if defined LISP_FEATURE_GENCGC
1505 #error unsupported case /* in CMU CL, was "ibmrt using GC" */