- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wl2: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- case type_InstancePointer:
- if ((int)pointer != ((int)start_addr+type_InstancePointer)) {
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wi1: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- if (TypeOf(start_addr[0]) != type_InstanceHeader) {
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wi2: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- break;
- case type_OtherPointer:
- if ((int)pointer != ((int)start_addr+type_OtherPointer)) {
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo1: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- /* Is it plausible? Not a cons. X should check the headers. */
- if(Pointerp(start_addr[0]) || ((start_addr[0] & 3) == 0)) {
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo2: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- switch (TypeOf(start_addr[0])) {
- case type_UnboundMarker:
- case type_BaseChar:
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo3: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
-
- /* only pointed to by function pointers? */
- case type_ClosureHeader:
- case type_FuncallableInstanceHeader:
- case type_ByteCodeFunction:
- case type_ByteCodeClosure:
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo4: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
-
- case type_InstanceHeader:
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo5: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
-
- /* the valid other immediate pointer objects */
- case type_SimpleVector:
- case type_Ratio:
- case type_Complex:
-#ifdef type_ComplexSingleFloat
- case type_ComplexSingleFloat:
-#endif
-#ifdef type_ComplexDoubleFloat
- case type_ComplexDoubleFloat:
-#endif
-#ifdef type_ComplexLongFloat
- case type_ComplexLongFloat:
-#endif
- case type_SimpleArray:
- case type_ComplexString:
- case type_ComplexBitVector:
- case type_ComplexVector:
- case type_ComplexArray:
- case type_ValueCellHeader:
- case type_SymbolHeader:
- case type_Fdefn:
- case type_CodeHeader:
- case type_Bignum:
- case type_SingleFloat:
- case type_DoubleFloat:
-#ifdef type_LongFloat
- case type_LongFloat:
-#endif
- case type_SimpleString:
- case type_SimpleBitVector:
- case type_SimpleArrayUnsignedByte2:
- case type_SimpleArrayUnsignedByte4:
- case type_SimpleArrayUnsignedByte8:
- case type_SimpleArrayUnsignedByte16:
- case type_SimpleArrayUnsignedByte32:
-#ifdef type_SimpleArraySignedByte8
- case type_SimpleArraySignedByte8:
-#endif
-#ifdef type_SimpleArraySignedByte16
- case type_SimpleArraySignedByte16:
-#endif
-#ifdef type_SimpleArraySignedByte30
- case type_SimpleArraySignedByte30:
-#endif
-#ifdef type_SimpleArraySignedByte32
- case type_SimpleArraySignedByte32:
-#endif
- case type_SimpleArraySingleFloat:
- case type_SimpleArrayDoubleFloat:
-#ifdef type_SimpleArrayLongFloat
- case type_SimpleArrayLongFloat:
-#endif
-#ifdef type_SimpleArrayComplexSingleFloat
- case type_SimpleArrayComplexSingleFloat:
-#endif
-#ifdef type_SimpleArrayComplexDoubleFloat
- case type_SimpleArrayComplexDoubleFloat:
-#endif
-#ifdef type_SimpleArrayComplexLongFloat
- case type_SimpleArrayComplexLongFloat:
-#endif
- case type_Sap:
- case type_WeakPointer:
- break;
-
- default:
- if (pointer_filter_verbose) {
- fprintf(stderr,"*Wo6: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
- break;
- default:
- if (pointer_filter_verbose) {
- fprintf(stderr,"*W?: %x %x %x\n", pointer, start_addr, *start_addr);
- }
- return 0;
- }
-
- /* looks good */
- return 1;
-}
-
-#define MAX_STACK_POINTERS 256
-lispobj *valid_stack_locations[MAX_STACK_POINTERS];
-unsigned int num_valid_stack_locations;
-
-#define MAX_STACK_RETURN_ADDRESSES 128
-lispobj *valid_stack_ra_locations[MAX_STACK_RETURN_ADDRESSES];
-lispobj *valid_stack_ra_code_objects[MAX_STACK_RETURN_ADDRESSES];
-unsigned int num_valid_stack_ra_locations;
-
-/* Identify valid stack slots. */
-static void
-setup_i386_stack_scav(lispobj *lowaddr, lispobj *base)
-{
- lispobj *sp = lowaddr;
- num_valid_stack_locations = 0;
- num_valid_stack_ra_locations = 0;
- for (sp = lowaddr; sp < base; sp++) {
- lispobj thing = *sp;
- /* Find the object start address */
- lispobj *start_addr = search_dynamic_space((void *)thing);
- if (start_addr) {
- /* We need to allow raw pointers into Code objects for return
- * addresses. This will also pick up pointers to functions in code
- * objects. */
- if (TypeOf(*start_addr) == type_CodeHeader) {
- gc_assert(num_valid_stack_ra_locations < MAX_STACK_RETURN_ADDRESSES);
- valid_stack_ra_locations[num_valid_stack_ra_locations] = sp;
- valid_stack_ra_code_objects[num_valid_stack_ra_locations++] =
- (lispobj *)((int)start_addr + type_OtherPointer);
- } else {
- if (valid_dynamic_space_pointer((void *)thing, start_addr)) {
- gc_assert(num_valid_stack_locations < MAX_STACK_POINTERS);
- valid_stack_locations[num_valid_stack_locations++] = sp;
- }
- }
- }
- }
- if (pointer_filter_verbose) {
- fprintf(stderr, "number of valid stack pointers = %d\n",
- num_valid_stack_locations);
- fprintf(stderr, "number of stack return addresses = %d\n",
- num_valid_stack_ra_locations);
- }
-}
-
-static void
-pscav_i386_stack(void)
-{
- int i;
-
- for (i = 0; i < num_valid_stack_locations; i++)
- pscav(valid_stack_locations[i], 1, 0);
-
- for (i = 0; i < num_valid_stack_ra_locations; i++) {
- lispobj code_obj = (lispobj)valid_stack_ra_code_objects[i];
- pscav(&code_obj, 1, 0);
- if (pointer_filter_verbose) {
- fprintf(stderr,"*C moved RA %x to %x; for code object %x to %x\n",
- *valid_stack_ra_locations[i],
- (int)(*valid_stack_ra_locations[i])
- - ((int)valid_stack_ra_code_objects[i] - (int)code_obj),
- valid_stack_ra_code_objects[i], code_obj);