0.6.12.48:
authorWilliam Harold Newman <william.newman@airmail.net>
Sat, 14 Jul 2001 04:25:14 +0000 (04:25 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Sat, 14 Jul 2001 04:25:14 +0000 (04:25 +0000)
made ldb conditional on :SB-LDB in *FEATURES*. (Dan Barlow
likes having the system stop on an ldb> prompt even
when running as a batch program, but for me it's a
nuisance. I want sh make.sh to terminate when it hits
an error, period, since typically I make it beep when
it's done. And since ldb isn't really appropriate for
the problems that ordinary users have to deal with,
it should be reasonable to suppress it by default,
which is an overkill way to keep my system from
stopping on an ldb> prompt.)
more gencgc tidying..
..hardwired enable_pointer_filter conditionalization to
always be enabled
..renamed the PTR() and Pointerp() macros to
native_pointer() and is_lisp_pointer() inline
functions

19 files changed:
base-target-features.lisp-expr
src/runtime/alloc.c
src/runtime/alpha-arch.c
src/runtime/backtrace.c
src/runtime/breakpoint.c
src/runtime/gc.c
src/runtime/gencgc.c
src/runtime/interr.c
src/runtime/linux-os.c
src/runtime/monitor.c
src/runtime/monitor.h
src/runtime/parse.c
src/runtime/print.c
src/runtime/purify.c
src/runtime/runtime.c
src/runtime/runtime.h
src/runtime/search.c
src/runtime/x86-arch.c
version.lisp-expr

index 5aa58f7..5f22ccb 100644 (file)
  :sb-propagate-float-type
  :sb-propagate-fun-type
 
- ;; Setting this makes more debugging information available.
- ;; If you aren't hacking or troubleshooting SBCL itself, you
- ;; probably don't want this set.
+ ;; Make more debugging information available (for debugging SBCL
+ ;; itself). If you aren't hacking or troubleshooting SBCL itself,
+ ;; you probably don't want this set.
  ;;
  ;; At least two varieties of debugging information are enabled by this
  ;; option:
  ;; readtable configured so that the system sources can be read.
  ; :sb-show
 
+ ;; Build SBCL with the old CMU CL low level debugger, "ldb". If 
+ ;; are aren't messing with CMU CL at a very low level (e.g. 
+ ;; trying to diagnose GC problems) you shouldn't need this.
+ ; :sb-ldb
+
  ;; This isn't really a target Lisp feature at all, but controls
  ;; whether the build process produces an after-xc.core file. This
  ;; can be useful for shortening the edit/compile/debug cycle if
index c78d167..d40c272 100644 (file)
@@ -108,7 +108,7 @@ alloc_string(char *str)
 {
     int len = strlen(str);
     lispobj result = alloc_vector(type_SimpleString, len+1, 8);
-    struct vector *vec = (struct vector *)PTR(result);
+    struct vector *vec = (struct vector *)native_pointer(result);
 
     vec->length = make_fixnum(len);
     strcpy((char *)vec->data, str);
index 99087e6..001bc18 100644 (file)
@@ -259,7 +259,7 @@ void arch_do_displaced_inst(os_context_t *context,unsigned int orig_inst)
   after_breakpoint=1;
   os_flush_icache((os_vm_address_t)next_pc, sizeof(unsigned long));
 
-  ldb_monitor();
+  monitor_or_something();
   sigreturn(context);
 }
 
@@ -268,7 +268,7 @@ void arch_do_displaced_inst(os_context_t *context,unsigned int orig_inst)
 static void
 sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context) {
     fake_foreign_function_call(context);
-    ldb_monitor();
+    monitor_or_something();
 }
 
 static void
index dd214e4..7895597 100644 (file)
@@ -64,7 +64,7 @@ code_pointer(lispobj object)
     lispobj *headerp, header;
     int type, len;
 
-    headerp = (lispobj *) PTR(object);
+    headerp = (lispobj *) native_pointer(object);
     header = *headerp;
     type = TypeOf(header);
 
@@ -122,7 +122,7 @@ call_info_from_context(struct call_info *info, os_context_t *context)
                                                            reg_OCFP));
         info->lra = (lispobj)(*os_context_register_addr(context, reg_LRA));
         info->code = code_pointer(info->lra);
-        pc = (unsigned long)PTR(info->lra);
+        pc = (unsigned long)native_pointer(info->lra);
     }
     else {
         info->frame =
@@ -179,7 +179,7 @@ previous_info(struct call_info *info)
     else {
         info->code = code_pointer(info->lra);
         if (info->code != NULL)
-            info->pc = (unsigned long)PTR(info->lra) -
+            info->pc = (unsigned long)native_pointer(info->lra) -
                 (unsigned long)info->code -
 #ifndef alpha
                 (HEADER_LENGTH(info->code->header) * sizeof(lispobj));
@@ -218,19 +218,19 @@ backtrace(int nframes)
                 struct function *header;
                 lispobj name;
 
-                header = (struct function *) PTR(function);
+                header = (struct function *) native_pointer(function);
                 name = header->name;
 
                 if (LowtagOf(name) == type_OtherPointer) {
                     lispobj *object;
 
-                    object = (lispobj *) PTR(name);
+                    object = (lispobj *) native_pointer(name);
 
                     if (TypeOf(*object) == type_SymbolHeader) {
                         struct symbol *symbol;
 
                         symbol = (struct symbol *) object;
-                        object = (lispobj *) PTR(symbol->name);
+                        object = (lispobj *) native_pointer(symbol->name);
                     }
                     if (TypeOf(*object) == type_SimpleString) {
                         struct vector *string;
index 44f78d7..9e95a8a 100644 (file)
@@ -35,7 +35,7 @@ static void *compute_pc(lispobj code_obj, int pc_offset)
 {
     struct code *code;
 
-    code = (struct code *)PTR(code_obj);
+    code = (struct code *)native_pointer(code_obj);
     return (void *)((char *)code + HeaderValue(code->header)*sizeof(lispobj)
                    + pc_offset);
 }
@@ -102,7 +102,7 @@ static int compute_offset(os_context_t *context, lispobj code)
        return 0;
     else {
        unsigned long code_start;
-       struct code *codeptr = (struct code *)PTR(code);
+       struct code *codeptr = (struct code *)native_pointer(code);
 #ifdef parisc
        unsigned long pc = *os_context_pc_addr(context) & ~3;
 #else
@@ -171,7 +171,7 @@ void *handle_function_end_breakpoint(int signal, siginfo_t *info,
     fake_foreign_function_call(context);
 
     code = find_code(context);
-    codeptr = (struct code *)PTR(code);
+    codeptr = (struct code *)native_pointer(code);
 
     funcall3(SymbolFunction(HANDLE_BREAKPOINT),
             compute_offset(context, code),
@@ -197,7 +197,7 @@ void *handle_function_end_breakpoint(int signal, siginfo_t *info,
     fake_foreign_function_call(context);
 
     code = find_code(context);
-    codeptr = (struct code *)PTR(code);
+    codeptr = (struct code *)native_pointer(code);
 
     /* Don't disallow recursive breakpoint traps. Otherwise, we can't
      * use debugger breakpoints anywhere in here. */
index fda4e74..b7fee14 100644 (file)
@@ -79,9 +79,9 @@ from_space_p(lispobj object)
 
        /* this can be called for untagged pointers as well as for 
           descriptors, so this assertion's not applicable
-          gc_assert(Pointerp(object));
+          gc_assert(is_lisp_pointer(object));
        */
-       ptr = (lispobj *) PTR(object);
+       ptr = (lispobj *) native_pointer(object);
 
        return ((from_space <= ptr) &&
                (ptr < from_space_free_pointer));
@@ -92,9 +92,9 @@ new_space_p(lispobj object)
 {
        lispobj *ptr;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       ptr = (lispobj *) PTR(object);
+       ptr = (lispobj *) native_pointer(object);
                
        return ((new_space <= ptr) &&
                (ptr < new_space_free_pointer));
@@ -122,7 +122,7 @@ copy_object(lispobj object, int nwords)
        lispobj *new;
        lispobj *source, *dest;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
        gc_assert(from_space_p(object));
        gc_assert((nwords & 0x01) == 0);
 
@@ -134,7 +134,7 @@ copy_object(lispobj object, int nwords)
        new_space_free_pointer += nwords;
 
        dest = new;
-       source = (lispobj *) PTR(object);
+       source = (lispobj *) native_pointer(object);
 
 #ifdef DEBUG_COPY_VERBOSE
        fprintf(stderr,"Copying %d words from %p to %p\n", nwords,source,new);
@@ -388,15 +388,16 @@ scavenge(lispobj *start, u32 nwords)
                       (unsigned long) start, (unsigned long) object, type);
 #endif
 
-                if (Pointerp(object)) {
+                if (is_lisp_pointer(object)) {
                    /* It be a pointer. */
                    if (from_space_p(object)) {
                         /* It currently points to old space.  Check for a */
                         /* forwarding pointer. */
                         lispobj first_word;
 
-                        first_word = *((lispobj *)PTR(object));
-                        if (Pointerp(first_word) && new_space_p(first_word)) {
+                        first_word = *((lispobj *)native_pointer(object));
+                        if (is_lisp_pointer(first_word) &&
+                           new_space_p(first_word)) {
                             /* Yep, there be a forwarding pointer. */
                             *start = first_word;
                             words_scavenged = 1;
@@ -577,7 +578,7 @@ print_garbage(lispobj *from_space, lispobj *from_space_free_pointer)
                lispobj header;
 
                object = *start;
-               forwardp = Pointerp(object) && new_space_p(object);
+               forwardp = is_lisp_pointer(object) && new_space_p(object);
 
                if (forwardp) {
                        int tag;
@@ -597,7 +598,7 @@ print_garbage(lispobj *from_space, lispobj *from_space_free_pointer)
                                nwords = 1;
                                break;
                        case type_OtherPointer:
-                               pointer = (lispobj *) PTR(object);
+                               pointer = (lispobj *) native_pointer(object);
                                header = *pointer;
                                type = TypeOf(header);
                                nwords = (sizetab[type])(pointer);
@@ -632,10 +633,10 @@ scav_function_pointer(lispobj *where, lispobj object)
   lispobj first;
   int type;
 
-  gc_assert(Pointerp(object));
+  gc_assert(is_lisp_pointer(object));
       
   /* object is a pointer into from space. Not a FP */
-  first_pointer = (lispobj *) PTR(object);
+  first_pointer = (lispobj *) native_pointer(object);
   first = *first_pointer;
                
   /* must transport object -- object may point */
@@ -655,7 +656,7 @@ scav_function_pointer(lispobj *where, lispobj object)
   
   first = *first_pointer = copy;
 
-  gc_assert(Pointerp(first));
+  gc_assert(is_lisp_pointer(first));
   gc_assert(!from_space_p(first));
 
   *where = first;
@@ -678,11 +679,11 @@ trans_code(struct code *code)
 
        /* if object has already been transported, just return pointer */
        first = code->header;
-       if (Pointerp(first) && new_space_p(first)) {
+       if (is_lisp_pointer(first) && new_space_p(first)) {
 #ifdef DEBUG_CODE_GC
            printf("Was already transported\n");
 #endif
-           return (struct code *) PTR(first);
+           return (struct code *) native_pointer(first);
        }
        
        gc_assert(TypeOf(first) == type_CodeHeader);
@@ -696,7 +697,7 @@ trans_code(struct code *code)
        nwords = CEILING(nwords, 2);
 
        l_new_code = copy_object(l_code, nwords);
-       new_code = (struct code *) PTR(l_new_code);
+       new_code = (struct code *) native_pointer(l_new_code);
 
        displacement = l_new_code - l_code;
 
@@ -719,13 +720,13 @@ trans_code(struct code *code)
                struct function *fheaderp, *nfheaderp;
                lispobj nfheaderl;
                
-               fheaderp = (struct function *) PTR(fheaderl);
+               fheaderp = (struct function *) native_pointer(fheaderl);
                gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
 
                /* calcuate the new function pointer and the new */
                /* function header */
                nfheaderl = fheaderl + displacement;
-               nfheaderp = (struct function *) PTR(nfheaderl);
+               nfheaderp = (struct function *) native_pointer(nfheaderl);
 
                /* set forwarding pointer */
 #ifdef DEBUG_CODE_GC
@@ -779,12 +780,12 @@ scav_code_header(lispobj *where, lispobj object)
        /* code data block */
        fheaderl = code->entry_points;
        while (fheaderl != NIL) {
-               fheaderp = (struct function *) PTR(fheaderl);
+               fheaderp = (struct function *) native_pointer(fheaderl);
                gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
                
 #if defined(DEBUG_CODE_GC)
                printf("Scavenging boxed section of entry point located at 0x%08x.\n",
-                      (unsigned long) PTR(fheaderl));
+                      (unsigned long) native_pointer(fheaderl));
 #endif
                scavenge(&fheaderp->name, 1);
                scavenge(&fheaderp->arglist, 1);
@@ -801,7 +802,7 @@ trans_code_header(lispobj object)
 {
        struct code *ncode;
 
-       ncode = trans_code((struct code *) PTR(object));
+       ncode = trans_code((struct code *) native_pointer(object));
        return (lispobj) LOW_WORD(ncode) | type_OtherPointer;
 }
 
@@ -839,7 +840,7 @@ trans_return_pc_header(lispobj object)
        unsigned long offset;
        struct code *code, *ncode;
        lispobj ret;
-       return_pc = (struct function *) PTR(object);
+       return_pc = (struct function *) native_pointer(object);
        offset = HeaderValue(return_pc->header)  * 4 ;
 
        /* Transport the whole code object */
@@ -849,7 +850,7 @@ trans_return_pc_header(lispobj object)
 #endif
        ncode = trans_code(code);
        if(object==0x304748d7) {
-           /* ldb_monitor(); */
+           /* monitor_or_something(); */
        }
        ret= ((lispobj) LOW_WORD(ncode) + offset) | type_OtherPointer;
 #ifdef DEBUG_CODE_GC
@@ -897,7 +898,7 @@ trans_function_header(lispobj object)
        unsigned long offset;
        struct code *code, *ncode;
        
-       fheader = (struct function *) PTR(object);
+       fheader = (struct function *) native_pointer(object);
        offset = HeaderValue(fheader->header) * 4;
 
        /* Transport the whole code object */
@@ -917,7 +918,7 @@ scav_instance_pointer(lispobj *where, lispobj object)
   lispobj  *first_pointer;
   
   /* object is a pointer into from space.  Not a FP */
-  first_pointer = (lispobj *) PTR(object);
+  first_pointer = (lispobj *) native_pointer(object);
   
   *where = *first_pointer = trans_boxed(object);
   return 1;
@@ -933,14 +934,14 @@ scav_list_pointer(lispobj *where, lispobj object)
 {
   lispobj first, *first_pointer;
 
-  gc_assert(Pointerp(object));
+  gc_assert(is_lisp_pointer(object));
 
   /* object is a pointer into from space.  Not a FP. */
-  first_pointer = (lispobj *) PTR(object);
+  first_pointer = (lispobj *) native_pointer(object);
   
   first = *first_pointer = trans_list(object);
   
-  gc_assert(Pointerp(first));
+  gc_assert(is_lisp_pointer(first));
   gc_assert(!from_space_p(first));
   
   *where = first;
@@ -953,11 +954,11 @@ trans_list(lispobj object)
        lispobj new_list_pointer;
        struct cons *cons, *new_cons;
        
-       cons = (struct cons *) PTR(object);
+       cons = (struct cons *) native_pointer(object);
 
        /* ### Don't use copy_object here. */
        new_list_pointer = copy_object(object, 2);
-       new_cons = (struct cons *) PTR(new_list_pointer);
+       new_cons = (struct cons *) native_pointer(new_list_pointer);
 
        /* Set forwarding pointer. */
        cons->car = new_list_pointer;
@@ -973,15 +974,15 @@ trans_list(lispobj object)
 
                 if (LowtagOf(cdr) != type_ListPointer ||
                     !from_space_p(cdr) ||
-                    (Pointerp(first = *(lispobj *)PTR(cdr)) &&
-                     new_space_p(first)))
+                    (is_lisp_pointer(first = *(lispobj *)native_pointer(cdr))
+                    && new_space_p(first)))
                        break;
 
-               cdr_cons = (struct cons *) PTR(cdr);
+               cdr_cons = (struct cons *) native_pointer(cdr);
 
                /* ### Don't use copy_object here */
                new_cdr = copy_object(cdr, 2);
-               new_cdr_cons = (struct cons *) PTR(new_cdr);
+               new_cdr_cons = (struct cons *) native_pointer(new_cdr);
 
                /* Set forwarding pointer */
                cdr_cons->car = new_cdr;
@@ -1006,13 +1007,13 @@ scav_other_pointer(lispobj *where, lispobj object)
 {
   lispobj first, *first_pointer;
 
-  gc_assert(Pointerp(object));
+  gc_assert(is_lisp_pointer(object));
 
   /* Object is a pointer into from space - not a FP */
-  first_pointer = (lispobj *) PTR(object);
+  first_pointer = (lispobj *) native_pointer(object);
   first = *first_pointer = (transother[TypeOf(*first_pointer)])(object);
 
-  gc_assert(Pointerp(first));
+  gc_assert(is_lisp_pointer(first));
   gc_assert(!from_space_p(first));
 
   *where = first;
@@ -1061,9 +1062,9 @@ trans_boxed(lispobj object)
        lispobj header;
        unsigned long length;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       header = *((lispobj *) PTR(object));
+       header = *((lispobj *) native_pointer(object));
        length = HeaderValue(header) + 1;
        length = CEILING(length, 2);
 
@@ -1122,9 +1123,9 @@ trans_unboxed(lispobj object)
        unsigned long length;
 
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       header = *((lispobj *) PTR(object));
+       header = *((lispobj *) native_pointer(object));
        length = HeaderValue(header) + 1;
        length = CEILING(length, 2);
 
@@ -1171,12 +1172,12 @@ trans_string(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
        /* NOTE: Strings contain one more byte of data than the length */
        /* slot indicates. */
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length) + 1;
        nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
@@ -1215,9 +1216,9 @@ trans_vector(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
 
        length = fixnum_value(vector->length);
        nwords = CEILING(length + 2, 2);
@@ -1258,9 +1259,9 @@ trans_vector_bit(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
@@ -1300,9 +1301,9 @@ trans_vector_unsigned_byte_2(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(NWORDS(length, 16) + 2, 2);
 
@@ -1342,9 +1343,9 @@ trans_vector_unsigned_byte_4(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
@@ -1384,9 +1385,9 @@ trans_vector_unsigned_byte_8(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
@@ -1426,9 +1427,9 @@ trans_vector_unsigned_byte_16(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(NWORDS(length, 2) + 2, 2);
 
@@ -1468,9 +1469,9 @@ trans_vector_unsigned_byte_32(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(length + 2, 2);
 
@@ -1510,9 +1511,9 @@ trans_vector_single_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(length + 2, 2);
 
@@ -1552,9 +1553,9 @@ trans_vector_double_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(length * 2 + 2, 2);
 
@@ -1597,9 +1598,9 @@ trans_vector_long_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
 #ifdef sparc
        nwords = CEILING(length * 4 + 2, 2);
@@ -1645,9 +1646,9 @@ trans_vector_complex_single_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(length * 2 + 2, 2);
 
@@ -1688,9 +1689,9 @@ trans_vector_complex_double_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
        nwords = CEILING(length * 4 + 2, 2);
 
@@ -1733,9 +1734,9 @@ trans_vector_complex_long_float(lispobj object)
        struct vector *vector;
        int length, nwords;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
-       vector = (struct vector *) PTR(object);
+       vector = (struct vector *) native_pointer(object);
        length = fixnum_value(vector->length);
 #ifdef sparc
        nwords = CEILING(length * 8 + 2, 2);
@@ -1782,7 +1783,7 @@ trans_weak_pointer(lispobj object)
        lispobj copy;
        struct weak_pointer *wp;
 
-       gc_assert(Pointerp(object));
+       gc_assert(is_lisp_pointer(object));
 
 #if defined(DEBUG_WEAK)
        printf("Transporting weak pointer from 0x%08x\n", object);
@@ -1792,7 +1793,7 @@ trans_weak_pointer(lispobj object)
        /* been transported so they can be fixed up in a post-GC pass. */
 
        copy = copy_object(object, WEAK_POINTER_NWORDS);
-       wp = (struct weak_pointer *) PTR(copy);
+       wp = (struct weak_pointer *) native_pointer(copy);
        
 
        /* Push the weak pointer onto the list of weak pointers. */
@@ -1824,7 +1825,7 @@ void scan_weak_pointers(void)
                printf("Value: 0x%08x\n", (unsigned int) value);
 #endif         
 
-               if (!(Pointerp(value) && from_space_p(value)))
+               if (!(is_lisp_pointer(value) && from_space_p(value)))
                        continue;
 
                /* Now, we need to check if the object has been */
@@ -1832,14 +1833,14 @@ void scan_weak_pointers(void)
                /* still good and needs to be updated.  Otherwise, the */
                /* weak pointer needs to be nil'ed out. */
 
-               first_pointer = (lispobj *) PTR(value);
+               first_pointer = (lispobj *) native_pointer(value);
                first = *first_pointer;
                
 #if defined(DEBUG_WEAK)
                printf("First: 0x%08x\n", (unsigned long) first);
 #endif         
 
-               if (Pointerp(first) && new_space_p(first))
+               if (is_lisp_pointer(first) && new_space_p(first))
                        wp->value = first;
                else {
                        wp->value = NIL;
index e06237e..04c5d0a 100644 (file)
@@ -71,26 +71,6 @@ boolean gencgc_unmap_zero = 1;
 
 /* the minimum size (in bytes) for a large object*/
 unsigned large_object_size = 4 * 4096;
-
-/* Should we filter stack/register pointers? This substantially reduces the
- * number of invalid pointers accepted.
- *
- * FIXME: This is basically constant=1. It will probably degrade
- * interrupt safety during object initialization. But I don't think we
- * should do without it -- the possibility of the GC being too
- * conservative and hence running out of memory is also. Perhaps the
- * interrupt safety issue could be fixed by making the initialization
- * code do WITHOUT-GCING or WITHOUT-INTERRUPTS until the appropriate
- * type bits have been set. (That might be necessary anyway, in order
- * to keep interrupt code's allocation operations from stepping on the
- * interrupted code's allocations.) Or perhaps it could be fixed by
- * making sure that uninitialized memory is zero, reserving the
- * all-zero case for uninitialized memory, and making the
- * is-it-possibly-a-valid-pointer code check for all-zero and return
- * true in that case. Then after either fix, we could get rid of this
- * variable and simply hardwire the system always to do pointer
- * filtering. */
-boolean enable_pointer_filter = 1;
 \f
 /*
  * debugging
@@ -1429,7 +1409,7 @@ copy_object(lispobj object, int nwords)
     lispobj *new;
     lispobj *source, *dest;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
     gc_assert(from_space_p(object));
     gc_assert((nwords & 0x01) == 0);
 
@@ -1440,7 +1420,7 @@ copy_object(lispobj object, int nwords)
     new = gc_quick_alloc(nwords*4);
 
     dest = new;
-    source = (lispobj *) PTR(object);
+    source = (lispobj *) native_pointer(object);
 
     /* Copy the object. */
     while (nwords > 0) {
@@ -1469,7 +1449,7 @@ copy_large_object(lispobj object, int nwords)
     lispobj *source, *dest;
     int first_page;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
     gc_assert(from_space_p(object));
     gc_assert((nwords & 0x01) == 0);
 
@@ -1575,7 +1555,7 @@ copy_large_object(lispobj object, int nwords)
        new = gc_quick_alloc_large(nwords*4);
 
        dest = new;
-       source = (lispobj *) PTR(object);
+       source = (lispobj *) native_pointer(object);
 
        /* Copy the object. */
        while (nwords > 0) {
@@ -1599,7 +1579,7 @@ copy_unboxed_object(lispobj object, int nwords)
     lispobj *new;
     lispobj *source, *dest;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
     gc_assert(from_space_p(object));
     gc_assert((nwords & 0x01) == 0);
 
@@ -1610,7 +1590,7 @@ copy_unboxed_object(lispobj object, int nwords)
     new = gc_quick_alloc_unboxed(nwords*4);
 
     dest = new;
-    source = (lispobj *) PTR(object);
+    source = (lispobj *) native_pointer(object);
 
     /* Copy the object. */
     while (nwords > 0) {
@@ -1644,7 +1624,7 @@ copy_large_unboxed_object(lispobj object, int nwords)
     lispobj *source, *dest;
     int first_page;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
     gc_assert(from_space_p(object));
     gc_assert((nwords & 0x01) == 0);
 
@@ -1739,7 +1719,7 @@ copy_large_unboxed_object(lispobj object, int nwords)
        new = gc_quick_alloc_large_unboxed(nwords*4);
 
        dest = new;
-       source = (lispobj *) PTR(object);
+       source = (lispobj *) native_pointer(object);
 
        /* Copy the object. */
        while (nwords > 0) {
@@ -1777,11 +1757,11 @@ scavenge(lispobj *start, long n_words)
        
        gc_assert(object != 0x01); /* not a forwarding pointer */
 
-       if (Pointerp(object)) {
+       if (is_lisp_pointer(object)) {
            if (from_space_p(object)) {
                /* It currently points to old space. Check for a
                 * forwarding pointer. */
-               lispobj *ptr = (lispobj *)PTR(object);
+               lispobj *ptr = (lispobj *)native_pointer(object);
                lispobj first_word = *ptr;
                if (first_word == 0x01) {
                    /* Yes, there's a forwarding pointer. */
@@ -1824,10 +1804,10 @@ scav_function_pointer(lispobj *where, lispobj object)
     lispobj *first_pointer;
     lispobj copy;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
     /* Object is a pointer into from space - no a FP. */
-    first_pointer = (lispobj *) PTR(object);
+    first_pointer = (lispobj *) native_pointer(object);
 
     /* must transport object -- object may point to either a function
      * header, a closure function header, or to a closure header. */
@@ -1848,7 +1828,7 @@ scav_function_pointer(lispobj *where, lispobj object)
        first_pointer[1] = copy;
     }
 
-    gc_assert(Pointerp(copy));
+    gc_assert(is_lisp_pointer(copy));
     gc_assert(!from_space_p(copy));
 
     *where = copy;
@@ -1902,8 +1882,10 @@ sniff_code_object(struct code *code, unsigned displacement)
        unsigned d2 = *((unsigned char *)p - 2);
        unsigned d3 = *((unsigned char *)p - 3);
        unsigned d4 = *((unsigned char *)p - 4);
+#if QSHOW
        unsigned d5 = *((unsigned char *)p - 5);
        unsigned d6 = *((unsigned char *)p - 6);
+#endif
 
        /* Check for code references. */
        /* Check for a 32 bit word that looks like an absolute
@@ -2085,7 +2067,8 @@ apply_code_fixups(struct code *old_code, struct code *new_code)
 
     /* It will be 0 or the unbound-marker if there are no fixups, and
      * will be an other pointer if it is valid. */
-    if ((fixups == 0) || (fixups == type_UnboundMarker) || !Pointerp(fixups)) {
+    if ((fixups == 0) || (fixups == type_UnboundMarker) ||
+       !is_lisp_pointer(fixups)) {
        /* Check for possible errors. */
        if (check_code_fixups)
            sniff_code_object(new_code, displacement);
@@ -2099,14 +2082,15 @@ apply_code_fixups(struct code *old_code, struct code *new_code)
        return;
     }
 
-    fixups_vector = (struct vector *)PTR(fixups);
+    fixups_vector = (struct vector *)native_pointer(fixups);
 
     /* Could be pointing to a forwarding pointer. */
-    if (Pointerp(fixups) && (find_page_index((void*)fixups_vector) != -1)
-       && (fixups_vector->header == 0x01)) {
+    if (is_lisp_pointer(fixups) &&
+       (find_page_index((void*)fixups_vector) != -1) &&
+       (fixups_vector->header == 0x01)) {
        /* If so, then follow it. */
        /*SHOW("following pointer to a forwarding pointer");*/
-       fixups_vector = (struct vector *)PTR((lispobj)fixups_vector->length);
+       fixups_vector = (struct vector *)native_pointer((lispobj)fixups_vector->length);
     }
 
     /*SHOW("got fixups");*/
@@ -2172,7 +2156,7 @@ trans_code(struct code *code)
     nwords = CEILING(nwords, 2);
 
     l_new_code = copy_large_object(l_code, nwords);
-    new_code = (struct code *) PTR(l_new_code);
+    new_code = (struct code *) native_pointer(l_new_code);
 
     /* may not have been moved.. */
     if (new_code == code)
@@ -2202,13 +2186,13 @@ trans_code(struct code *code)
        struct function *fheaderp, *nfheaderp;
        lispobj nfheaderl;
 
-       fheaderp = (struct function *) PTR(fheaderl);
+       fheaderp = (struct function *) native_pointer(fheaderl);
        gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
 
        /* Calculate the new function pointer and the new */
        /* function header. */
        nfheaderl = fheaderl + displacement;
-       nfheaderp = (struct function *) PTR(nfheaderl);
+       nfheaderp = (struct function *) native_pointer(nfheaderl);
 
        /* Set forwarding pointer. */
        ((lispobj *)fheaderp)[0] = 0x01;
@@ -2252,9 +2236,9 @@ scav_code_header(lispobj *where, lispobj object)
         entry_point != NIL;
         entry_point = function_ptr->next) {
 
-       gc_assert(Pointerp(entry_point));
+       gc_assert(is_lisp_pointer(entry_point));
 
-       function_ptr = (struct function *) PTR(entry_point);
+       function_ptr = (struct function *) native_pointer(entry_point);
        gc_assert(TypeOf(function_ptr->header) == type_FunctionHeader);
 
        scavenge(&function_ptr->name, 1);
@@ -2270,7 +2254,7 @@ trans_code_header(lispobj object)
 {
     struct code *ncode;
 
-    ncode = trans_code((struct code *) PTR(object));
+    ncode = trans_code((struct code *) native_pointer(object));
     return (lispobj) ncode | type_OtherPointer;
 }
 
@@ -2308,7 +2292,7 @@ trans_return_pc_header(lispobj object)
 
     SHOW("/trans_return_pc_header: Will this work?");
 
-    return_pc = (struct function *) PTR(object);
+    return_pc = (struct function *) native_pointer(object);
     offset = HeaderValue(return_pc->header) * 4;
 
     /* Transport the whole code object. */
@@ -2355,7 +2339,7 @@ trans_function_header(lispobj object)
     unsigned long offset;
     struct code *code, *ncode;
 
-    fheader = (struct function *) PTR(object);
+    fheader = (struct function *) native_pointer(object);
     offset = HeaderValue(fheader->header) * 4;
 
     /* Transport the whole code object. */
@@ -2379,7 +2363,7 @@ scav_instance_pointer(lispobj *where, lispobj object)
 
     gc_assert(copy != object);
 
-    first_pointer = (lispobj *) PTR(object);
+    first_pointer = (lispobj *) native_pointer(object);
 
     /* Set forwarding pointer. */
     first_pointer[0] = 0x01;
@@ -2400,20 +2384,20 @@ scav_list_pointer(lispobj *where, lispobj object)
 {
     lispobj first, *first_pointer;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
     /* Object is a pointer into from space - not FP. */
 
     first = trans_list(object);
     gc_assert(first != object);
 
-    first_pointer = (lispobj *) PTR(object);
+    first_pointer = (lispobj *) native_pointer(object);
 
     /* Set forwarding pointer */
     first_pointer[0] = 0x01;
     first_pointer[1] = first;
 
-    gc_assert(Pointerp(first));
+    gc_assert(is_lisp_pointer(first));
     gc_assert(!from_space_p(first));
     *where = first;
     return 1;
@@ -2428,7 +2412,7 @@ trans_list(lispobj object)
 
     gc_assert(from_space_p(object));
 
-    cons = (struct cons *) PTR(object);
+    cons = (struct cons *) native_pointer(object);
 
     /* Copy 'object'. */
     new_cons = (struct cons *) gc_quick_alloc(sizeof(struct cons));
@@ -2450,10 +2434,10 @@ trans_list(lispobj object)
        struct cons *cdr_cons, *new_cdr_cons;
 
        if (LowtagOf(cdr) != type_ListPointer || !from_space_p(cdr)
-           || (*((lispobj *)PTR(cdr)) == 0x01))
+           || (*((lispobj *)native_pointer(cdr)) == 0x01))
            break;
 
-       cdr_cons = (struct cons *) PTR(cdr);
+       cdr_cons = (struct cons *) native_pointer(cdr);
 
        /* Copy 'cdr'. */
        new_cdr_cons = (struct cons*) gc_quick_alloc(sizeof(struct cons));
@@ -2488,10 +2472,10 @@ scav_other_pointer(lispobj *where, lispobj object)
 {
     lispobj first, *first_pointer;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
     /* Object is a pointer into from space - not FP. */
-    first_pointer = (lispobj *) PTR(object);
+    first_pointer = (lispobj *) native_pointer(object);
 
     first = (transother[TypeOf(*first_pointer)])(object);
 
@@ -2502,7 +2486,7 @@ scav_other_pointer(lispobj *where, lispobj object)
        *where = first;
     }
 
-    gc_assert(Pointerp(first));
+    gc_assert(is_lisp_pointer(first));
     gc_assert(!from_space_p(first));
 
     return 1;
@@ -2550,9 +2534,9 @@ trans_boxed(lispobj object)
     lispobj header;
     unsigned long length;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    header = *((lispobj *) PTR(object));
+    header = *((lispobj *) native_pointer(object));
     length = HeaderValue(header) + 1;
     length = CEILING(length, 2);
 
@@ -2565,9 +2549,9 @@ trans_boxed_large(lispobj object)
     lispobj header;
     unsigned long length;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    header = *((lispobj *) PTR(object));
+    header = *((lispobj *) native_pointer(object));
     length = HeaderValue(header) + 1;
     length = CEILING(length, 2);
 
@@ -2628,9 +2612,9 @@ trans_unboxed(lispobj object)
     unsigned long length;
 
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    header = *((lispobj *) PTR(object));
+    header = *((lispobj *) native_pointer(object));
     length = HeaderValue(header) + 1;
     length = CEILING(length, 2);
 
@@ -2644,9 +2628,9 @@ trans_unboxed_large(lispobj object)
     unsigned long length;
 
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    header = *((lispobj *) PTR(object));
+    header = *((lispobj *) native_pointer(object));
     length = HeaderValue(header) + 1;
     length = CEILING(length, 2);
 
@@ -2694,13 +2678,13 @@ trans_string(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
     /* NOTE: A string contains one more byte of data (a terminating
      * '\0' to help when interfacing with C functions) than indicated
      * by the length slot. */
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length) + 1;
     nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
@@ -2760,10 +2744,10 @@ scav_vector(lispobj *where, lispobj object)
 
     /* Scavenge element 0, which may be a hash-table structure. */
     scavenge(where+2, 1);
-    if (!Pointerp(where[2])) {
+    if (!is_lisp_pointer(where[2])) {
        lose("no pointer at %x in hash table", where[2]);
     }
-    hash_table = (lispobj *)PTR(where[2]);
+    hash_table = (lispobj *)native_pointer(where[2]);
     /*FSHOW((stderr,"/hash_table = %x\n", hash_table));*/
     if (TypeOf(hash_table[0]) != type_InstanceHeader) {
        lose("hash table not instance (%x at %x)", hash_table[0], hash_table);
@@ -2772,14 +2756,14 @@ scav_vector(lispobj *where, lispobj object)
     /* Scavenge element 1, which should be some internal symbol that
      * the hash table code reserves for marking empty slots. */
     scavenge(where+3, 1);
-    if (!Pointerp(where[3])) {
+    if (!is_lisp_pointer(where[3])) {
        lose("not empty-hash-table-slot symbol pointer: %x", where[3]);
     }
     empty_symbol = where[3];
     /* fprintf(stderr,"* empty_symbol = %x\n", empty_symbol);*/
-    if (TypeOf(*(lispobj *)PTR(empty_symbol)) != type_SymbolHeader) {
+    if (TypeOf(*(lispobj *)native_pointer(empty_symbol)) != type_SymbolHeader) {
        lose("not a symbol where empty-hash-table-slot symbol expected: %x",
-            *(lispobj *)PTR(empty_symbol));
+            *(lispobj *)native_pointer(empty_symbol));
     }
 
     /* Scavenge hash table, which will fix the positions of the other
@@ -2787,7 +2771,7 @@ scav_vector(lispobj *where, lispobj object)
     scavenge(hash_table, 16);
 
     /* Cross-check the kv_vector. */
-    if (where != (lispobj *)PTR(hash_table[9])) {
+    if (where != (lispobj *)native_pointer(hash_table[9])) {
        lose("hash_table table!=this table %x", hash_table[9]);
     }
 
@@ -2798,11 +2782,11 @@ scav_vector(lispobj *where, lispobj object)
     {
        lispobj index_vector_obj = hash_table[13];
 
-       if (Pointerp(index_vector_obj) &&
-           (TypeOf(*(lispobj *)PTR(index_vector_obj)) == type_SimpleArrayUnsignedByte32)) {
-           index_vector = ((unsigned int *)PTR(index_vector_obj)) + 2;
+       if (is_lisp_pointer(index_vector_obj) &&
+           (TypeOf(*(lispobj *)native_pointer(index_vector_obj)) == type_SimpleArrayUnsignedByte32)) {
+           index_vector = ((unsigned int *)native_pointer(index_vector_obj)) + 2;
            /*FSHOW((stderr, "/index_vector = %x\n",index_vector));*/
-           length = fixnum_value(((unsigned int *)PTR(index_vector_obj))[1]);
+           length = fixnum_value(((unsigned int *)native_pointer(index_vector_obj))[1]);
            /*FSHOW((stderr, "/length = %d\n", length));*/
        } else {
            lose("invalid index_vector %x", index_vector_obj);
@@ -2813,11 +2797,11 @@ scav_vector(lispobj *where, lispobj object)
     {
        lispobj next_vector_obj = hash_table[14];
 
-       if (Pointerp(next_vector_obj) &&
-           (TypeOf(*(lispobj *)PTR(next_vector_obj)) == type_SimpleArrayUnsignedByte32)) {
-           next_vector = ((unsigned int *)PTR(next_vector_obj)) + 2;
+       if (is_lisp_pointer(next_vector_obj) &&
+           (TypeOf(*(lispobj *)native_pointer(next_vector_obj)) == type_SimpleArrayUnsignedByte32)) {
+           next_vector = ((unsigned int *)native_pointer(next_vector_obj)) + 2;
            /*FSHOW((stderr, "/next_vector = %x\n", next_vector));*/
-           next_vector_length = fixnum_value(((unsigned int *)PTR(next_vector_obj))[1]);
+           next_vector_length = fixnum_value(((unsigned int *)native_pointer(next_vector_obj))[1]);
            /*FSHOW((stderr, "/next_vector_length = %d\n", next_vector_length));*/
        } else {
            lose("invalid next_vector %x", next_vector_obj);
@@ -2832,12 +2816,12 @@ scav_vector(lispobj *where, lispobj object)
         * probably other stuff too. Ugh.. */
        lispobj hash_vector_obj = hash_table[15];
 
-       if (Pointerp(hash_vector_obj) &&
-           (TypeOf(*(lispobj *)PTR(hash_vector_obj))
+       if (is_lisp_pointer(hash_vector_obj) &&
+           (TypeOf(*(lispobj *)native_pointer(hash_vector_obj))
             == type_SimpleArrayUnsignedByte32)) {
-           hash_vector = ((unsigned int *)PTR(hash_vector_obj)) + 2;
+           hash_vector = ((unsigned int *)native_pointer(hash_vector_obj)) + 2;
            /*FSHOW((stderr, "/hash_vector = %x\n", hash_vector));*/
-           gc_assert(fixnum_value(((unsigned int *)PTR(hash_vector_obj))[1])
+           gc_assert(fixnum_value(((unsigned int *)native_pointer(hash_vector_obj))[1])
                      == next_vector_length);
        } else {
            hash_vector = NULL;
@@ -2924,9 +2908,9 @@ trans_vector(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
 
     length = fixnum_value(vector->length);
     nwords = CEILING(length + 2, 2);
@@ -2967,9 +2951,9 @@ trans_vector_bit(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
@@ -3009,9 +2993,9 @@ trans_vector_unsigned_byte_2(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(NWORDS(length, 16) + 2, 2);
 
@@ -3051,9 +3035,9 @@ trans_vector_unsigned_byte_4(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
@@ -3092,9 +3076,9 @@ trans_vector_unsigned_byte_8(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
@@ -3134,9 +3118,9 @@ trans_vector_unsigned_byte_16(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(NWORDS(length, 2) + 2, 2);
 
@@ -3175,9 +3159,9 @@ trans_vector_unsigned_byte_32(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length + 2, 2);
 
@@ -3216,9 +3200,9 @@ trans_vector_single_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length + 2, 2);
 
@@ -3257,9 +3241,9 @@ trans_vector_double_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length * 2 + 2, 2);
 
@@ -3299,9 +3283,9 @@ trans_vector_long_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length * 3 + 2, 2);
 
@@ -3343,9 +3327,9 @@ trans_vector_complex_single_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length * 2 + 2, 2);
 
@@ -3386,9 +3370,9 @@ trans_vector_complex_double_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length * 4 + 2, 2);
 
@@ -3430,9 +3414,9 @@ trans_vector_complex_long_float(lispobj object)
     struct vector *vector;
     int length, nwords;
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
-    vector = (struct vector *) PTR(object);
+    vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
     nwords = CEILING(length * 6 + 2, 2);
 
@@ -3506,7 +3490,7 @@ trans_weak_pointer(lispobj object)
     lispobj copy;
     /* struct weak_pointer *wp; */
 
-    gc_assert(Pointerp(object));
+    gc_assert(is_lisp_pointer(object));
 
 #if defined(DEBUG_WEAK)
     FSHOW((stderr, "Transporting weak pointer from 0x%08x\n", object));
@@ -3516,7 +3500,7 @@ trans_weak_pointer(lispobj object)
     /* been transported so they can be fixed up in a post-GC pass. */
 
     copy = copy_object(object, WEAK_POINTER_NWORDS);
-    /*  wp = (struct weak_pointer *) PTR(copy);*/
+    /*  wp = (struct weak_pointer *) native_pointer(copy);*/
        
 
     /* Push the weak pointer onto the list of weak pointers. */
@@ -3539,14 +3523,14 @@ void scan_weak_pointers(void)
        lispobj value = wp->value;
        lispobj *first_pointer;
 
-       first_pointer = (lispobj *)PTR(value);
+       first_pointer = (lispobj *)native_pointer(value);
 
        /*
        FSHOW((stderr, "/weak pointer at 0x%08x\n", (unsigned long) wp));
        FSHOW((stderr, "/value: 0x%08x\n", (unsigned long) value));
        */
 
-       if (Pointerp(value) && from_space_p(value)) {
+       if (is_lisp_pointer(value) && from_space_p(value)) {
            /* Now, we need to check whether the object has been forwarded. If
             * it has been, the weak pointer is still good and needs to be
             * updated. Otherwise, the weak pointer needs to be nil'ed
@@ -3868,7 +3852,7 @@ search_space(lispobj *start, size_t words, lispobj *pointer)
        lispobj thing = *start;
 
        /* If thing is an immediate then this is a cons. */
-       if (Pointerp(thing)
+       if (is_lisp_pointer(thing)
            || ((thing & 3) == 0) /* fixnum */
            || (TypeOf(thing) == type_BaseChar)
            || (TypeOf(thing) == type_UnboundMarker))
@@ -3951,12 +3935,27 @@ possibly_valid_dynamic_space_pointer(lispobj *pointer)
 
     /* If it's not a return address then it needs to be a valid Lisp
      * pointer. */
-    if (!Pointerp((lispobj)pointer)) {
+    if (!is_lisp_pointer((lispobj)pointer)) {
        return 0;
     }
 
     /* Check that the object pointed to is consistent with the pointer
-     * low tag. */
+     * low tag.
+     *
+     * FIXME: It's not safe to rely on the result from this check
+     * before an object is initialized. Thus, if we were interrupted
+     * just as an object had been allocated but not initialized, the
+     * GC relying on this result could bogusly reclaim the memory.
+     * However, we can't really afford to do without this check. So
+     * we should make it safe somehow. 
+     *   (1) Perhaps just review the code to make sure
+     *       that WITHOUT-GCING or WITHOUT-INTERRUPTS or some such
+     *       thing is wrapped around critical sections where allocated
+     *       memory type bits haven't been set.
+     *   (2) Perhaps find some other hack to protect against this, e.g.
+     *       recording the result of the last call to allocate-lisp-memory,
+     *       and returning true from this function when *pointer is
+     *       a reference to that result. */
     switch (LowtagOf((lispobj)pointer)) {
     case type_FunctionPointer:
        /* Start_addr should be the enclosing code object, or a closure
@@ -3996,11 +3995,11 @@ possibly_valid_dynamic_space_pointer(lispobj *pointer)
            return 0;
        }
        /* Is it plausible cons? */
-       if ((Pointerp(start_addr[0])
+       if ((is_lisp_pointer(start_addr[0])
            || ((start_addr[0] & 3) == 0) /* fixnum */
            || (TypeOf(start_addr[0]) == type_BaseChar)
            || (TypeOf(start_addr[0]) == type_UnboundMarker))
-          && (Pointerp(start_addr[1])
+          && (is_lisp_pointer(start_addr[1])
               || ((start_addr[1] & 3) == 0) /* fixnum */
               || (TypeOf(start_addr[1]) == type_BaseChar)
               || (TypeOf(start_addr[1]) == type_UnboundMarker)))
@@ -4039,7 +4038,7 @@ possibly_valid_dynamic_space_pointer(lispobj *pointer)
            return 0;
        }
        /* Is it plausible?  Not a cons. XXX should check the headers. */
-       if (Pointerp(start_addr[0]) || ((start_addr[0] & 3) == 0)) {
+       if (is_lisp_pointer(start_addr[0]) || ((start_addr[0] & 3) == 0)) {
            if (gencgc_verbose)
                FSHOW((stderr,
                       "/Wo2: %x %x %x\n",
@@ -4357,7 +4356,7 @@ preserve_pointer(void *addr)
      * expensive but important, since it vastly reduces the
      * probability that random garbage will be bogusly interpreter as
      * a pointer which prevents a page from moving. */
-    if (enable_pointer_filter && !possibly_valid_dynamic_space_pointer(addr))
+    if (!possibly_valid_dynamic_space_pointer(addr))
        return;
 
     /* Work backwards to find a page with a first_object_offset of 0.
@@ -5030,7 +5029,7 @@ verify_space(lispobj *start, size_t words)
        size_t count = 1;
        lispobj thing = *(lispobj*)start;
 
-       if (Pointerp(thing)) {
+       if (is_lisp_pointer(thing)) {
            int page_index = find_page_index((void*)thing);
            int to_readonly_space =
                (READ_ONLY_SPACE_START <= thing &&
@@ -5047,7 +5046,7 @@ verify_space(lispobj *start, size_t words)
                    && (page_table[page_index].bytes_used == 0))
                    lose ("Ptr %x @ %x sees free page.", thing, start);
                /* Check that it doesn't point to a forwarding pointer! */
-               if (*((lispobj *)PTR(thing)) == 0x01) {
+               if (*((lispobj *)native_pointer(thing)) == 0x01) {
                    lose("Ptr %x @ %x sees forwarding ptr.", thing, start);
                }
                /* Check that its not in the RO space as it would then be a
@@ -5133,7 +5132,7 @@ verify_space(lispobj *start, size_t words)
                         * the code data block. */
                        fheaderl = code->entry_points;
                        while (fheaderl != NIL) {
-                           fheaderp = (struct function *) PTR(fheaderl);
+                           fheaderp = (struct function *) native_pointer(fheaderl);
                            gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
                            verify_space(&fheaderp->name, 1);
                            verify_space(&fheaderp->arglist, 1);
@@ -5423,15 +5422,17 @@ garbage_collect_generation(int generation, int raise)
        }
     }
 
+#if QSHOW
     if (gencgc_verbose > 1) {
        int num_dont_move_pages = count_dont_move_pages();
-       FSHOW((stderr,
-              "/non-movable pages due to conservative pointers = %d (%d bytes)\n",
-              num_dont_move_pages,
-              /* FIXME: 4096 should be symbolic constant here and
-               * prob'ly elsewhere too. */
-              num_dont_move_pages * 4096));
+       fprintf(stderr,
+               "/non-movable pages due to conservative pointers = %d (%d bytes)\n",
+               num_dont_move_pages,
+               /* FIXME: 4096 should be symbolic constant here and
+                * prob'ly elsewhere too. */
+               num_dont_move_pages * 4096);
     }
+#endif
 
     /* Scavenge all the rest of the roots. */
 
index 7f60dde..b8a863f 100644 (file)
@@ -162,6 +162,6 @@ lispobj debug_print(lispobj string)
        the stack before doing anything else here */
     char untouched[32];
     fprintf(stderr, "%s\n", 
-           (char *)(((struct vector *)PTR(string))->data),untouched);
+           (char *)(((struct vector *)native_pointer(string))->data),untouched);
     return NIL;
 }
index e5e17c0..c5d5485 100644 (file)
@@ -281,7 +281,7 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
        while ( ! (CONTROL_STACK_START <= *current_control_frame_pointer &&
                   *current_control_frame_pointer <= control_stack_top))
            ((char*)current_control_frame_pointer) -= sizeof(lispobj);
-       ldb_monitor();
+       monitor_or_something();
     } else if (!interrupt_maybe_gc(signal, info, context)) {
        interrupt_handle_now(signal, info, context);
     }
index cbd9287..72d3104 100644 (file)
 
 #include "runtime.h"
 #include "sbcl.h"
-#include "globals.h"
-#include "vars.h"
-#include "parse.h"
-#include "os.h"
-#include "interrupt.h"
-#include "lispregs.h"
-#include "monitor.h"
+
+/* Almost all of this file can be skipped if we're not supporting LDB. */
+#if defined(LISP_FEATURE_SB_LDB)
+
 #include "print.h"
 #include "arch.h"
 #include "interr.h"
@@ -216,7 +213,7 @@ search_cmd(char **ptr)
             return;
         }
         if (more_p(ptr)) {
-            addr = (lispobj *)PTR((long)parse_addr(ptr));
+            addr = (lispobj *)native_pointer((long)parse_addr(ptr));
             if (more_p(ptr)) {
                 count = parse_number(ptr);
             }
@@ -557,3 +554,17 @@ throw_to_monitor()
 {
     longjmp(curbuf, 1);
 }
+
+#endif /* defined(LISP_FEATURE_SB_LDB) */
+
+/* what we do when things go badly wrong at a low level */
+void
+monitor_or_something()
+{
+#if defined(LISP_FEATURE_SB_LDB)
+    ldb_monitor();
+#else
+    fprintf(stderr, "There's no LDB in this build; exiting.\n");
+    exit(1);
+#endif
+}
index 3eec762..f899466 100644 (file)
@@ -9,5 +9,5 @@
  * files for more information.
  */
 
-extern void ldb_monitor(void);
 extern void throw_to_monitor(void);
+extern void monitor_or_something(void);
index 7e1c8c1..4038f51 100644 (file)
@@ -1,3 +1,5 @@
+/* parsing for LDB monitor */
+
 /*
  * This software is part of the SBCL system. See the README file for
  * more information.
@@ -15,6 +17,9 @@
 
 #include "runtime.h"
 #include "sbcl.h"
+
+#if defined(LISP_FEATURE_SB_LDB)
+
 #include "globals.h"
 #include "vars.h"
 #include "parse.h"
@@ -356,3 +361,5 @@ char **ptr;
 
     return result;
 }
+
+#endif /* defined(LISP_FEATURE_SB_LDB) */
index 8ff85e8..485948f 100644 (file)
@@ -1,4 +1,4 @@
-/* code for low-level debugging output */
+/* code for low-level debugging/diagnostic output */
 
 /*
  * This software is part of the SBCL system. See the README file for
 
 /*
  * FIXME:
- *   1. Ordinary users won't get much out of this code, so it shouldn't
- *      be compiled into the ordinary build of the system. Probably it
- *      should be made conditional on the SB-SHOW target feature.
- *   2. Some of the code in here (subtype_Names[] and the various
- *      foo_slots[], at least) is deeply broken, depending on fixed
- *      (and already out-of-date) values in sbcl.h.
+ *   Some of the code in here (subtype_Names[] and the various
+ *   foo_slots[], at least) is deeply broken, depending on fixed
+ *   (and already out-of-date) values in sbcl.h.
  */
 
 #include <stdio.h>
 
 #include "print.h"
 #include "runtime.h"
+
+/* This file can be skipped if we're not supporting LDB. */
+#if defined(LISP_FEATURE_SB_LDB)
+
 #include "sbcl.h"
 #include "monitor.h"
 #include "vars.h"
@@ -294,7 +295,7 @@ static void brief_list(lispobj obj)
     else {
         putchar('(');
         while (LowtagOf(obj) == type_ListPointer) {
-            struct cons *cons = (struct cons *)PTR(obj);
+            struct cons *cons = (struct cons *)native_pointer(obj);
 
             if (space)
                 putchar(' ');
@@ -324,7 +325,7 @@ static void print_list(lispobj obj)
     } else if (obj == NIL) {
         printf(" (NIL)");
     } else {
-        struct cons *cons = (struct cons *)PTR(obj);
+        struct cons *cons = (struct cons *)native_pointer(obj);
 
         print_obj("car: ", cons->car);
         print_obj("cdr: ", cons->cdr);
@@ -334,15 +335,15 @@ static void print_list(lispobj obj)
 static void brief_struct(lispobj obj)
 {
     printf("#<ptr to 0x%08lx instance>",
-           (unsigned long) ((struct instance *)PTR(obj))->slots[0]);
+           (unsigned long) ((struct instance *)native_pointer(obj))->slots[0]);
 }
 
 static void print_struct(lispobj obj)
 {
-    struct instance *instance = (struct instance *)PTR(obj);
+    struct instance *instance = (struct instance *)native_pointer(obj);
     int i;
     char buffer[16];
-    print_obj("type: ", ((struct instance *)PTR(obj))->slots[0]);
+    print_obj("type: ", ((struct instance *)native_pointer(obj))->slots[0]);
     for (i = 1; i < HeaderValue(instance->header); i++) {
        sprintf(buffer, "slot %d: ", i);
        print_obj(buffer, instance->slots[i]);
@@ -357,7 +358,7 @@ static void brief_otherptr(lispobj obj)
     struct vector *vector;
     char *charptr;
 
-    ptr = (lispobj *) PTR(obj);
+    ptr = (lispobj *) native_pointer(obj);
 
     if (!is_valid_lisp_addr((os_vm_address_t)obj)) {
            printf("(invalid address)");
@@ -369,7 +370,7 @@ static void brief_otherptr(lispobj obj)
     switch (type) {
         case type_SymbolHeader:
             symbol = (struct symbol *)ptr;
-            vector = (struct vector *)PTR(symbol->name);
+            vector = (struct vector *)native_pointer(symbol->name);
             for (charptr = (char *)vector->data; *charptr != '\0'; charptr++) {
                 if (*charptr == '"')
                     putchar('\\');
@@ -437,7 +438,7 @@ static void print_otherptr(lispobj obj)
         int count, type, index;
         char *cptr, buffer[16];
 
-       ptr = (lispobj*) PTR(obj);
+       ptr = (lispobj*) native_pointer(obj);
        if (ptr == NULL) {
                printf(" (NULL Pointer)");
                return;
@@ -478,45 +479,45 @@ static void print_otherptr(lispobj obj)
 
             case type_SingleFloat:
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct single_float *)PTR(obj))->value);
+                printf("%g", ((struct single_float *)native_pointer(obj))->value);
                 break;
 
             case type_DoubleFloat:
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct double_float *)PTR(obj))->value);
+                printf("%g", ((struct double_float *)native_pointer(obj))->value);
                 break;
 
 #ifdef type_LongFloat
             case type_LongFloat:
                 NEWLINE_OR_RETURN;
-                printf("%Lg", ((struct long_float *)PTR(obj))->value);
+                printf("%Lg", ((struct long_float *)native_pointer(obj))->value);
                 break;
 #endif
 
 #ifdef type_ComplexSingleFloat
             case type_ComplexSingleFloat:
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct complex_single_float *)PTR(obj))->real);
+                printf("%g", ((struct complex_single_float *)native_pointer(obj))->real);
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct complex_single_float *)PTR(obj))->imag);
+                printf("%g", ((struct complex_single_float *)native_pointer(obj))->imag);
                 break;
 #endif
 
 #ifdef type_ComplexDoubleFloat
             case type_ComplexDoubleFloat:
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct complex_double_float *)PTR(obj))->real);
+                printf("%g", ((struct complex_double_float *)native_pointer(obj))->real);
                 NEWLINE_OR_RETURN;
-                printf("%g", ((struct complex_double_float *)PTR(obj))->imag);
+                printf("%g", ((struct complex_double_float *)native_pointer(obj))->imag);
                 break;
 #endif
 
 #ifdef type_ComplexLongFloat
             case type_ComplexLongFloat:
                 NEWLINE_OR_RETURN;
-                printf("%Lg", ((struct complex_long_float *)PTR(obj))->real);
+                printf("%Lg", ((struct complex_long_float *)native_pointer(obj))->real);
                 NEWLINE_OR_RETURN;
-                printf("%Lg", ((struct complex_long_float *)PTR(obj))->imag);
+                printf("%Lg", ((struct complex_long_float *)native_pointer(obj))->imag);
                 break;
 #endif
 
@@ -658,7 +659,6 @@ static void print_obj(char *prefix, lispobj obj)
     char buffer[256];
     boolean verbose = cur_depth < brief_depth;
 
-
     if (!continue_p(verbose))
         return;
 
@@ -729,3 +729,13 @@ void brief_print(lispobj obj)
     print_obj("", obj);
     putchar('\n');
 }
+
+#else
+
+void
+brief_print(lispobj obj)
+{
+    printf("lispobj 0x%lx\n", (unsigned long)obj);
+}
+     
+#endif /* defined(LISP_FEATURE_SB_LDB) */
index 136b8da..c706085 100644 (file)
@@ -125,12 +125,23 @@ dynamic_pointer_p(lispobj ptr)
 
 static unsigned pointer_filter_verbose = 0;
 
+/* FIXME: This is substantially the same code as in gencgc.c. (There
+ * are some differences, at least (1) the gencgc.c code needs to worry
+ * about return addresses on the stack pinning code objects, (2) the
+ * gencgc.c code needs to worry about the GC maybe happening in an
+ * interrupt service routine when the main thread of control was
+ * interrupted just as it had allocated memory and before it
+ * initialized it, while PURIFY needn't worry about that, and (3) the
+ * gencgc.c code has mutated more under maintenance since the fork
+ * from CMU CL than the code here has.) The two versions should be
+ * made to explicitly share common code, instead of just two different
+ * cut-and-pasted versions. */
 static int
 valid_dynamic_space_pointer(lispobj *pointer, lispobj *start_addr)
 {
     /* If it's not a return address then it needs to be a valid Lisp
      * pointer. */
-    if (!Pointerp((lispobj)pointer))
+    if (!is_lisp_pointer((lispobj)pointer))
        return 0;
 
     /* Check that the object pointed to is consistent with the pointer
@@ -171,11 +182,11 @@ valid_dynamic_space_pointer(lispobj *pointer, lispobj *start_addr)
            return 0;
        }
        /* Is it plausible cons? */
-       if((Pointerp(start_addr[0])
+       if((is_lisp_pointer(start_addr[0])
            || ((start_addr[0] & 3) == 0) /* fixnum */
            || (TypeOf(start_addr[0]) == type_BaseChar)
            || (TypeOf(start_addr[0]) == type_UnboundMarker))
-          && (Pointerp(start_addr[1])
+          && (is_lisp_pointer(start_addr[1])
               || ((start_addr[1] & 3) == 0) /* fixnum */
               || (TypeOf(start_addr[1]) == type_BaseChar)
               || (TypeOf(start_addr[1]) == type_UnboundMarker))) {
@@ -212,7 +223,7 @@ valid_dynamic_space_pointer(lispobj *pointer, lispobj *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(is_lisp_pointer(start_addr[0]) || ((start_addr[0] & 3) == 0)) {
            if (pointer_filter_verbose) {
                fprintf(stderr,"*Wo2: %x %x %x\n", (unsigned int) pointer, 
                        (unsigned int) start_addr, *start_addr);
@@ -442,7 +453,7 @@ ptrans_boxed(lispobj thing, lispobj header, boolean constant)
     nwords = 1 + HeaderValue(header);
 
     /* Allocate it */
-    old = (lispobj *)PTR(thing);
+    old = (lispobj *)native_pointer(thing);
     if (constant) {
         new = read_only_free;
         read_only_free += CEILING(nwords, 2);
@@ -471,8 +482,8 @@ ptrans_boxed(lispobj thing, lispobj header, boolean constant)
 static lispobj
 ptrans_instance(lispobj thing, lispobj header, boolean constant)
 {
-    lispobj layout = ((struct instance *)PTR(thing))->slots[0];
-    lispobj pure = ((struct instance *)PTR(layout))->slots[15];
+    lispobj layout = ((struct instance *)native_pointer(thing))->slots[0];
+    lispobj pure = ((struct instance *)native_pointer(layout))->slots[15];
 
     switch (pure) {
     case T:
@@ -492,7 +503,7 @@ ptrans_instance(lispobj thing, lispobj header, boolean constant)
            nwords = 1 + HeaderValue(header);
 
            /* Allocate it */
-           old = (lispobj *)PTR(thing);
+           old = (lispobj *)native_pointer(thing);
            new = static_free;
            static_free += CEILING(nwords, 2);
 
@@ -524,7 +535,7 @@ ptrans_fdefn(lispobj thing, lispobj header)
     nwords = 1 + HeaderValue(header);
 
     /* Allocate it */
-    old = (lispobj *)PTR(thing);
+    old = (lispobj *)native_pointer(thing);
     new = static_free;
     static_free += CEILING(nwords, 2);
 
@@ -554,7 +565,7 @@ ptrans_unboxed(lispobj thing, lispobj header)
     nwords = 1 + HeaderValue(header);
 
     /* Allocate it */
-    old = (lispobj *)PTR(thing);
+    old = (lispobj *)native_pointer(thing);
     new = read_only_free;
     read_only_free += CEILING(nwords, 2);
 
@@ -576,7 +587,7 @@ ptrans_vector(lispobj thing, int bits, int extra,
     int nwords;
     lispobj result, *new;
 
-    vector = (struct vector *)PTR(thing);
+    vector = (struct vector *)native_pointer(thing);
     nwords = 2 + (CEILING((fixnum_value(vector->length)+extra)*bits,32)>>5);
 
     if (boxed && !constant) {
@@ -631,7 +642,9 @@ apply_code_fixups_during_purify(struct code *old_code, struct code *new_code)
 
   /* It will be 0 or the unbound-marker if there are no fixups, and
    * will be an other-pointer to a vector if it is valid. */
-  if ((fixups==0) || (fixups==type_UnboundMarker) || !Pointerp(fixups)) {
+  if ((fixups==0) ||
+      (fixups==type_UnboundMarker) ||
+      !is_lisp_pointer(fixups)) {
 #ifdef GENCGC
     /* Check for a possible errors. */
     sniff_code_object(new_code,displacement);
@@ -639,13 +652,13 @@ apply_code_fixups_during_purify(struct code *old_code, struct code *new_code)
     return;
   }
 
-  fixups_vector = (struct vector *)PTR(fixups);
+  fixups_vector = (struct vector *)native_pointer(fixups);
 
   /* Could be pointing to a forwarding pointer. */
-  if (Pointerp(fixups) && (dynamic_pointer_p(fixups))
+  if (is_lisp_pointer(fixups) && (dynamic_pointer_p(fixups))
       && forwarding_pointer_p(*(lispobj *)fixups_vector)) {
     /* If so then follow it. */
-    fixups_vector = (struct vector *)PTR(*(lispobj *)fixups_vector);
+    fixups_vector = (struct vector *)native_pointer(*(lispobj *)fixups_vector);
   }
 
   if (TypeOf(fixups_vector->header) == type_SimpleArrayUnsignedByte32) {
@@ -691,7 +704,7 @@ ptrans_code(lispobj thing)
     int nwords;
     lispobj func, result;
 
-    code = (struct code *)PTR(thing);
+    code = (struct code *)native_pointer(thing);
     nwords = HeaderValue(code->header) + fixnum_value(code->code_size);
 
     new = (struct code *)read_only_free;
@@ -711,11 +724,11 @@ ptrans_code(lispobj thing)
     /* Put in forwarding pointers for all the functions. */
     for (func = code->entry_points;
          func != NIL;
-         func = ((struct function *)PTR(func))->next) {
+         func = ((struct function *)native_pointer(func))->next) {
 
         gc_assert(LowtagOf(func) == type_FunctionPointer);
 
-        *(lispobj *)PTR(func) = result + (func - thing);
+        *(lispobj *)native_pointer(func) = result + (func - thing);
     }
 
     /* Arrange to scavenge the debug info later. */
@@ -735,20 +748,20 @@ ptrans_code(lispobj thing)
     pscav(&new->entry_points, 1, 1);
     for (func = new->entry_points;
          func != NIL;
-         func = ((struct function *)PTR(func))->next) {
+         func = ((struct function *)native_pointer(func))->next) {
         gc_assert(LowtagOf(func) == type_FunctionPointer);
         gc_assert(!dynamic_pointer_p(func));
 
 #ifdef __i386__
        /* Temporarly convert the self pointer to a real function
            pointer. */
-       ((struct function *)PTR(func))->self -= RAW_ADDR_OFFSET;
+       ((struct function *)native_pointer(func))->self -= RAW_ADDR_OFFSET;
 #endif
-        pscav(&((struct function *)PTR(func))->self, 2, 1);
+        pscav(&((struct function *)native_pointer(func))->self, 2, 1);
 #ifdef __i386__
-       ((struct function *)PTR(func))->self += RAW_ADDR_OFFSET;
+       ((struct function *)native_pointer(func))->self += RAW_ADDR_OFFSET;
 #endif
-        pscav_later(&((struct function *)PTR(func))->name, 3);
+        pscav_later(&((struct function *)native_pointer(func))->name, 3);
     }
 
     return result;
@@ -774,8 +787,10 @@ ptrans_func(lispobj thing, lispobj header)
          * scavenged, because if it had been scavenged, forwarding pointers
          * would have been left behind for all the entry points. */
 
-        function = (struct function *)PTR(thing);
-        code = (PTR(thing)-(HeaderValue(function->header)*sizeof(lispobj))) |
+        function = (struct function *)native_pointer(thing);
+        code =
+           (native_pointer(thing) -
+            (HeaderValue(function->header)*sizeof(lispobj))) |
             type_OtherPointer;
 
         /* This will cause the function's header to be replaced with a 
@@ -788,7 +803,7 @@ ptrans_func(lispobj thing, lispobj header)
     else {
        /* It's some kind of closure-like thing. */
         nwords = 1 + HeaderValue(header);
-        old = (lispobj *)PTR(thing);
+        old = (lispobj *)native_pointer(thing);
 
        /* Allocate the new one. */
        if (TypeOf(header) == type_FuncallableInstanceHeader) {
@@ -826,7 +841,7 @@ ptrans_returnpc(lispobj thing, lispobj header)
     code = thing - HeaderValue(header)*sizeof(lispobj);
 
     /* Make sure it's been transported. */
-    new = *(lispobj *)PTR(code);
+    new = *(lispobj *)native_pointer(code);
     if (!forwarding_pointer_p(new))
         new = ptrans_code(code);
 
@@ -850,7 +865,7 @@ ptrans_list(lispobj thing, boolean constant)
 
     do {
         /* Allocate a new cons cell. */
-        old = (struct cons *)PTR(thing);
+        old = (struct cons *)native_pointer(thing);
         if (constant) {
             new = (struct cons *)read_only_free;
             read_only_free += WORDS_PER_CONS;
@@ -871,7 +886,7 @@ ptrans_list(lispobj thing, boolean constant)
         length++;
     } while (LowtagOf(thing) == type_ListPointer &&
              dynamic_pointer_p(thing) &&
-             !(forwarding_pointer_p(*(lispobj *)PTR(thing))));
+             !(forwarding_pointer_p(*(lispobj *)native_pointer(thing))));
 
     /* Scavenge the list we just copied. */
     pscav((lispobj *)orig, length * WORDS_PER_CONS, constant);
@@ -1049,20 +1064,20 @@ pscav_code(struct code*code)
     pscav(&code->entry_points, 1, 1);
     for (func = code->entry_points;
          func != NIL;
-         func = ((struct function *)PTR(func))->next) {
+         func = ((struct function *)native_pointer(func))->next) {
         gc_assert(LowtagOf(func) == type_FunctionPointer);
         gc_assert(!dynamic_pointer_p(func));
 
 #ifdef __i386__
        /* Temporarly convert the self pointer to a real function
         * pointer. */
-       ((struct function *)PTR(func))->self -= RAW_ADDR_OFFSET;
+       ((struct function *)native_pointer(func))->self -= RAW_ADDR_OFFSET;
 #endif
-        pscav(&((struct function *)PTR(func))->self, 2, 1);
+        pscav(&((struct function *)native_pointer(func))->self, 2, 1);
 #ifdef __i386__
-       ((struct function *)PTR(func))->self += RAW_ADDR_OFFSET;
+       ((struct function *)native_pointer(func))->self += RAW_ADDR_OFFSET;
 #endif
-        pscav_later(&((struct function *)PTR(func))->name, 3);
+        pscav_later(&((struct function *)native_pointer(func))->name, 3);
     }
 
     return CEILING(nwords,2);
@@ -1078,13 +1093,13 @@ pscav(lispobj *addr, int nwords, boolean constant)
 
     while (nwords > 0) {
         thing = *addr;
-        if (Pointerp(thing)) {
+        if (is_lisp_pointer(thing)) {
             /* It's a pointer. Is it something we might have to move? */
             if (dynamic_pointer_p(thing)) {
                 /* Maybe. Have we already moved it? */
-               thingp = (lispobj *)PTR(thing);
+               thingp = (lispobj *)native_pointer(thing);
                 header = *thingp;
-                if (Pointerp(header) && forwarding_pointer_p(header))
+                if (is_lisp_pointer(header) && forwarding_pointer_p(header))
                     /* Yep, so just copy the forwarding pointer. */
                     thing = header;
                 else {
index d39b892..efefc8e 100644 (file)
 #endif
 \f
 /* SIGINT handler that invokes the monitor (for when Lisp isn't up to it) */
-
 static void
 sigint_handler(int signal, siginfo_t *info, void *void_context)
 {
-    printf("\nSIGINT hit at 0x%08lX\n", 
-          (unsigned long) *os_context_pc_addr(void_context));
-    ldb_monitor();
+    lose("\nSIGINT hit at 0x%08lX\n", 
+        (unsigned long) *os_context_pc_addr(void_context));
 }
 
 /* (This is not static, because we want to be able to call it from
@@ -245,7 +243,7 @@ More information on SBCL is available at <http://sbcl.sourceforge.net/>.
     define_var("nil", NIL, 1);
     define_var("t", T, 1);
 
-    set_lossage_handler(ldb_monitor);
+    set_lossage_handler(monitor_or_something);
 
 #if 0
     os_init();
index 9062ed5..8315ea1 100644 (file)
 #define type_Bits 8
 #define type_Mask ((1<<type_Bits)-1)
 
-/* FIXME: There seems to be no reason that TypeOf, HeaderValue,
- * Pointerp, PTR, CONS, SYMBOL, and FDEFN can't be defined
- * as (possibly inline) functions instead of macros. */
+/* FIXME: There seems to be no reason that TypeOf, HeaderValue, CONS,
+ * SYMBOL, and FDEFN can't be defined as (possibly inline) functions
+ * instead of macros. */
 
 #define TypeOf(obj) ((obj)&type_Mask)
 #define HeaderValue(obj) ((unsigned long) ((obj)>>type_Bits))
 
-#define Pointerp(obj) ((obj) & 0x01)
-#define PTR(obj) ((unsigned long)((obj)&~lowtag_Mask))
-
 #define CONS(obj) ((struct cons *)((obj)-type_ListPointer))
 #define SYMBOL(obj) ((struct symbol *)((obj)-type_OtherPointer))
 #define FDEFN(obj) ((struct fdefn *)((obj)-type_OtherPointer))
@@ -76,6 +73,22 @@ typedef signed int s32;
 
 typedef u32 lispobj;
 
+/* Is the Lisp object obj something with pointer nature (as opposed to
+ * e.g. a fixnum or character or unbound marker)? */
+static inline int
+is_lisp_pointer(lispobj obj)
+{
+    return obj & 1;
+}
+
+/* Convert from a lispobj with type bits to a native (ordinary
+ * C/assembly) pointer to the beginning of the object. */
+static inline lispobj
+native_pointer(lispobj obj)
+{
+    return obj & ~lowtag_Mask;
+}
+
 /* FIXME: There seems to be no reason that make_fixnum and fixnum_value
  * can't be implemented as (possibly inline) functions. */
 #define make_fixnum(n) ((lispobj)((n)<<2))
@@ -103,7 +116,7 @@ typedef int boolean;
  * in GCC later than version 2.7 or so. If you are using some 
  * compiler that doesn't understand this, you could could just
  * change it to "typedef void never_returns" and nothing would
- * break, you might just get a few more bytes of compiled code or
+ * break, though you might get a few more bytes of compiled code or
  * a few more compiler warnings. -- WHN 2000-10-21 */
 typedef volatile void never_returns;
 
index 01de0d1..7639ed1 100644 (file)
@@ -39,9 +39,9 @@ boolean search_for_symbol(char *name, lispobj **start, int *count)
     struct vector *symbol_name;
 
     while (search_for_type(type_SymbolHeader, start, count)) {
-        symbol = (struct symbol *)PTR((lispobj)*start);
+        symbol = (struct symbol *)native_pointer((lispobj)*start);
        if (LowtagOf(symbol->name) == type_OtherPointer) {
-            symbol_name = (struct vector *)PTR(symbol->name);
+            symbol_name = (struct vector *)native_pointer(symbol->name);
             if (is_valid_lisp_addr((os_vm_address_t)symbol_name) &&
                TypeOf(symbol_name->header) == type_SimpleString &&
                strcmp((char *)symbol_name->data, name) == 0)
index 1bb6ba1..7ec436b 100644 (file)
@@ -266,7 +266,7 @@ static void
 sigill_handler(int signal, siginfo_t *siginfo, void *void_context) {
     os_context_t *context = (os_context_t*)void_context;
     fake_foreign_function_call(context);
-    ldb_monitor();
+    monitor_or_something();
 }
 
 void
index 511c621..abdb236 100644 (file)
@@ -16,4 +16,4 @@
 ;;; four numeric fields, is used for versions which aren't released
 ;;; but correspond only to CVS tags or snapshots.
 
-"0.6.12.47"
+"0.6.12.48"