From f87f749ba5ffeb2e51b28c83d01ac7e33a5ca76d Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 15 Aug 2008 10:58:15 +0000 Subject: [PATCH] new function: is_lisp_immediate() * Use where appropriate in the runtime. * Since runtime.h now includes fixnum.h, remove a few includes as well. --- src/runtime/gc-common.c | 9 +-------- src/runtime/gencgc.c | 17 ++--------------- src/runtime/purify.c | 1 - src/runtime/runtime.h | 15 +++++++++++++++ version.lisp-expr | 2 +- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index 3f251bf..deae3bf 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -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); diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 08facdd..699cc62 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -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) diff --git a/src/runtime/purify.c b/src/runtime/purify.c index e033c7d..3440b2f 100644 --- a/src/runtime/purify.c +++ b/src/runtime/purify.c @@ -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" diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 8304b77..9905632 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -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 * diff --git a/version.lisp-expr b/version.lisp-expr index 157799d..54397f3 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4