new function: is_lisp_immediate()
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 15 Aug 2008 10:58:15 +0000 (10:58 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 15 Aug 2008 10:58:15 +0000 (10:58 +0000)
 * Use where appropriate in the runtime.

 * Since runtime.h now includes fixnum.h, remove a few includes as well.

src/runtime/gc-common.c
src/runtime/gencgc.c
src/runtime/purify.c
src/runtime/runtime.h
version.lisp-expr

index 3f251bf..deae3bf 100644 (file)
@@ -37,7 +37,6 @@
 #include "validate.h"
 #include "lispregs.h"
 #include "arch.h"
-#include "fixnump.h"
 #include "gc.h"
 #include "genesis/primitive-objects.h"
 #include "genesis/static-symbols.h"
@@ -2371,13 +2370,7 @@ gc_search_space(lispobj *start, size_t words, lispobj *pointer)
         lispobj thing = *start;
 
         /* If thing is an immediate then this is a cons. */
-        if (is_lisp_pointer(thing)
-            || (fixnump(thing))
-            || (widetag_of(thing) == CHARACTER_WIDETAG)
-#if N_WORD_BITS == 64
-            || (widetag_of(thing) == SINGLE_FLOAT_WIDETAG)
-#endif
-            || (widetag_of(thing) == UNBOUND_MARKER_WIDETAG))
+        if (is_lisp_pointer(thing) || is_lisp_immediate(thing))
             count = 2;
         else
             count = (sizetab[widetag_of(thing)])(start);
index 08facdd..699cc62 100644 (file)
@@ -38,7 +38,6 @@
 #include "validate.h"
 #include "lispregs.h"
 #include "arch.h"
-#include "fixnump.h"
 #include "gc.h"
 #include "gc-internal.h"
 #include "thread.h"
@@ -2184,20 +2183,8 @@ looks_like_valid_lisp_pointer_p(lispobj *pointer, lispobj *start_addr)
             return 0;
         }
         /* Is it plausible cons? */
-        if ((is_lisp_pointer(start_addr[0])
-            || (fixnump(start_addr[0]))
-            || (widetag_of(start_addr[0]) == CHARACTER_WIDETAG)
-#if N_WORD_BITS == 64
-            || (widetag_of(start_addr[0]) == SINGLE_FLOAT_WIDETAG)
-#endif
-            || (widetag_of(start_addr[0]) == UNBOUND_MARKER_WIDETAG))
-           && (is_lisp_pointer(start_addr[1])
-               || (fixnump(start_addr[1]))
-               || (widetag_of(start_addr[1]) == CHARACTER_WIDETAG)
-#if N_WORD_BITS == 64
-               || (widetag_of(start_addr[1]) == SINGLE_FLOAT_WIDETAG)
-#endif
-               || (widetag_of(start_addr[1]) == UNBOUND_MARKER_WIDETAG)))
+        if ((is_lisp_pointer(start_addr[0]) || is_lisp_immediate(start_addr[0])) &&
+            (is_lisp_pointer(start_addr[1]) || is_lisp_immediate(start_addr[1])))
             break;
         else {
             if (gencgc_verbose)
index e033c7d..3440b2f 100644 (file)
@@ -27,7 +27,6 @@
 #include "interrupt.h"
 #include "purify.h"
 #include "interr.h"
-#include "fixnump.h"
 #include "gc.h"
 #include "gc-internal.h"
 #include "thread.h"
index 8304b77..9905632 100644 (file)
@@ -123,6 +123,21 @@ is_lisp_pointer(lispobj obj)
     return obj & 1;
 }
 
+#include "fixnump.h"
+
+/* Is the Lisp object obj something with immediate nature (e.g. a
+ * fixnum or character or unbound marker)? */
+static inline int
+is_lisp_immediate(lispobj obj)
+{
+    return (fixnump(obj)
+            || (widetag_of(obj) == CHARACTER_WIDETAG)
+#if N_WORD_BITS == 64
+            || (widetag_of(obj) == SINGLE_FLOAT_WIDETAG)
+#endif
+            || (widetag_of(obj) == UNBOUND_MARKER_WIDETAG));
+}
+
 /* Convert from a lispobj with type bits to a native (ordinary
  * C/assembly) pointer to the beginning of the object. */
 static inline lispobj *
index 157799d..54397f3 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.19.27"
+"1.0.19.28"