From: Alastair Bridgewater Date: Tue, 31 Dec 2013 14:48:10 +0000 (-0500) Subject: gencgc: Simpler conservative root validation on non-x86oids. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b27852e74e11ccc9808305a73d815a4a67d77963;hp=8f79e6459a0e8fdd33c81a66f7e4adfa13f25005;p=sbcl.git gencgc: Simpler conservative root validation on non-x86oids. * On "precise" gencgc targets (currently, non-x86oids), we only ever treat valid object pointers as conservative (pinned) roots, so most of the validity checking is unnecessary. * Add a shortcut path through valid_conservative_root_p() for this precise case. --- diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 1d48cc3..f23d83e 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -2077,6 +2077,16 @@ possibly_valid_dynamic_space_pointer(lispobj *pointer) static int valid_conservative_root_p(void *addr, page_index_t addr_page_index) { +#ifdef GENCGC_IS_PRECISE + /* If we're in precise gencgc (non-x86oid as of this writing) then + * we are only called on valid object pointers in the first place, + * so we just have to do a bounds-check against the heap, a + * generation check, and the already-pinned check. */ + if ((addr_page_index == -1) + || (page_table[addr_page_index].gen != from_space) + || (page_table[addr_page_index].dont_move != 0)) + return 0; +#else /* quick check 1: Address is quite likely to have been invalid. */ if ((addr_page_index == -1) || page_free_p(addr_page_index) @@ -2099,12 +2109,7 @@ valid_conservative_root_p(void *addr, page_index_t addr_page_index) * address referring to something in a CodeObject). This is * expensive but important, since it vastly reduces the * probability that random garbage will be bogusly interpreted as - * a pointer which prevents a page from moving. - * - * This only needs to happen on x86oids, where this is used for - * conservative roots. Non-x86oid systems only ever call this - * function on known-valid lisp objects. */ -#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) + * a pointer which prevents a page from moving. */ if (!(code_page_p(addr_page_index) || (is_lisp_pointer((lispobj)addr) && possibly_valid_dynamic_space_pointer(addr))))