From: Christophe Rhodes Date: Sat, 30 Apr 2005 18:20:57 +0000 (+0000) Subject: 0.9.0.9: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=e01e7a01b67b98a47730a08dfa5d0d58518486ea;p=sbcl.git 0.9.0.9: More ThiemoSeuferPatches ... move search_space out of a .h file and into the common .c file Message-ID: <20050422220942.GH10767@hattusa.textio> (this version passes a respectable number of PFD ansi-tests on the x86. It doesn't run them to completion, mind you, but that I think is because of the test framework: MISC.587 at present signals a control-stack-exhausted error on the x86, which of course is not an ERROR but is a SERIOUS-CONDITION) --- diff --git a/src/runtime/cheneygc.c b/src/runtime/cheneygc.c index 2e54daf..4948da8 100644 --- a/src/runtime/cheneygc.c +++ b/src/runtime/cheneygc.c @@ -530,9 +530,9 @@ search_read_only_space(void *pointer) lispobj* end = (lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } lispobj * @@ -542,9 +542,9 @@ search_static_space(void *pointer) lispobj* end = (lispobj*)SymbolValue(STATIC_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } lispobj * @@ -554,9 +554,9 @@ search_dynamic_space(void *pointer) lispobj *end = (lispobj *) dynamic_space_free_pointer; if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } /* initialization. if gc_init can be moved to after core load, we could diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index 9b46c42..c083096 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -2007,3 +2007,40 @@ component_ptr_from_pc(lispobj *pc) return (NULL); } + +/* Scan an area looking for an object which encloses the given pointer. + * Return the object start on success or NULL on failure. */ +lispobj * +gc_search_space(lispobj *start, size_t words, lispobj *pointer) +{ + while (words > 0) { + size_t count = 1; + 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)) + count = 2; + else + count = (sizetab[widetag_of(thing)])(start); + + /* Check whether the pointer is within this object. */ + if ((pointer >= start) && (pointer < (start+count))) { + /* found it! */ + /*FSHOW((stderr,"/found %x in %x %x\n", pointer, start, thing));*/ + return(start); + } + + /* Round up the count. */ + count = CEILING(count,2); + + start += count; + words -= count; + } + return (NULL); +} diff --git a/src/runtime/gc-internal.h b/src/runtime/gc-internal.h index c49397a..b2ad82a 100644 --- a/src/runtime/gc-internal.h +++ b/src/runtime/gc-internal.h @@ -91,44 +91,9 @@ lispobj *search_read_only_space(void *pointer); lispobj *search_static_space(void *pointer); lispobj *search_dynamic_space(void *pointer); -#include "fixnump.h" +lispobj *gc_search_space(lispobj *start, size_t words, lispobj *pointer); -/* Scan an area looking for an object which encloses the given pointer. - * Return the object start on success or NULL on failure. */ -static lispobj * -search_space(lispobj *start, size_t words, lispobj *pointer) -{ - while (words > 0) { - size_t count = 1; - 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)) - count = 2; - else - count = (sizetab[widetag_of(thing)])(start); - - /* Check whether the pointer is within this object. */ - if ((pointer >= start) && (pointer < (start+count))) { - /* found it! */ - /*FSHOW((stderr,"/found %x in %x %x\n", pointer, start, thing));*/ - return(start); - } - - /* Round up the count. */ - count = CEILING(count,2); - - start += count; - words -= count; - } - return (NULL); -} +#include "fixnump.h" #ifdef LISP_FEATURE_GENCGC #include "gencgc-internal.h" diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 8f9028b..4cac73a 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -1970,9 +1970,9 @@ search_read_only_space(void *pointer) lispobj *end = (lispobj *) SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *) pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *) pointer)); } lispobj * @@ -1982,9 +1982,9 @@ search_static_space(void *pointer) lispobj *end = (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *) pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *) pointer)); } /* a faster version for searching the dynamic space. This will work even @@ -2001,9 +2001,9 @@ search_dynamic_space(void *pointer) return NULL; start = (lispobj *)((void *)page_address(page_index) + page_table[page_index].first_object_offset); - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } /* Is there any possibility that pointer is a valid Lisp object @@ -4060,7 +4060,7 @@ gencgc_pickup_dynamic(void) page_table[page].bytes_used = PAGE_BYTES; page_table[page].large_object = 0; - first=search_space(prev,(ptr+2)-prev,ptr); + first=gc_search_space(prev,(ptr+2)-prev,ptr); if(ptr == first) prev=ptr; page_table[page].first_object_offset = (void *)prev - page_address(page); diff --git a/version.lisp-expr b/version.lisp-expr index d5dadaf..5649506 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".) -"0.9.0.8" +"0.9.0.9"