From 6a0bf43d7c5961297aa5024aec534e5bab73c8af Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Nov 2011 00:14:27 -0800 Subject: Standardize on VIRT_ADDR_VARIES behavior; otherwise, valgrind does not work on some platforms. Problem reported by Andreas Schwab in . * puresize.h (pure, PURE_P): Always behave as if VIRT_ADDR_VARIES is set, removing the need for VIRT_ADDRESS_VARIES. (PURE_P): Use a more-efficient implementation that needs just one comparison, not two: on x86-64 with GCC 4.6.2, this cut down the number of instructions from 6 (xorl, cmpq, jge, xorl, cmpq, setge) to 4 (xorl, subq, cmpq, setbe). * alloc.c (pure): Always extern now, since that's the VIRT_ADDR_VARIES behavior. (PURE_POINTER_P): Use a single comparison, not two, for consistency with the new puresize.h. * lisp.h (PNTR_COMPARISON_TYPE): Remove; no longer needed. * m/ibms390.h, m/intel386.h, m/template.h, s/cygwin.h, s/hpux10-20.h: Remove VIRT_ADDR_VARIES no longer needed. --- src/puresize.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/puresize.h') diff --git a/src/puresize.h b/src/puresize.h index c26c496a757..4290c30c68d 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -75,21 +75,7 @@ extern void pure_write_error (void) NO_RETURN; /* Define PURE_P. */ -#ifdef VIRT_ADDR_VARIES -/* For machines where text and data can go anywhere - in virtual memory. */ - extern EMACS_INT pure[]; #define PURE_P(obj) \ - ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) \ - && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) - -#else /* not VIRT_ADDR_VARIES */ - -extern char my_edata[]; - -#define PURE_P(obj) \ - ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata) - -#endif /* VIRT_ADDRESS_VARIES */ + ((uintptr_t) XPNTR (obj) - (uintptr_t) pure <= PURESIZE) -- cgit v1.2.3-70-g09d2