diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/alloc.c b/src/alloc.c index 4f3928a4824..38daee065ae 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -502,30 +502,20 @@ pointer_align (void *ptr, int alignment) | |||
| 502 | return (void *) ROUNDUP ((uintptr_t) ptr, alignment); | 502 | return (void *) ROUNDUP ((uintptr_t) ptr, alignment); |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | /* Extract the pointer hidden within A, if A is not a symbol. | 505 | /* Extract the pointer hidden within O. Define this as a function, as |
| 506 | If A is a symbol, extract the hidden pointer's offset from lispsym, | 506 | functions are cleaner and can be used in debuggers. Also, define |
| 507 | converted to void *. */ | 507 | it as a macro if being compiled with GCC without optimization, for |
| 508 | performance in that case. macro_XPNTR is private to this section | ||
| 509 | of code. */ | ||
| 510 | |||
| 511 | #define macro_XPNTR(o) \ | ||
| 512 | ((void *) \ | ||
| 513 | (SYMBOLP (o) \ | ||
| 514 | ? ((char *) lispsym \ | ||
| 515 | - ((EMACS_UINT) Lisp_Symbol << (USE_LSB_TAG ? 0 : VALBITS)) \ | ||
| 516 | + XLI (o)) \ | ||
| 517 | : (char *) XLP (o) - (XLI (o) & ~VALMASK))) | ||
| 508 | 518 | ||
| 509 | #define macro_XPNTR_OR_SYMBOL_OFFSET(a) \ | ||
| 510 | ((void *) (intptr_t) (USE_LSB_TAG ? XLI (a) - XTYPE (a) : XLI (a) & VALMASK)) | ||
| 511 | |||
| 512 | /* Extract the pointer hidden within A. */ | ||
| 513 | |||
| 514 | #define macro_XPNTR(a) \ | ||
| 515 | ((void *) ((intptr_t) XPNTR_OR_SYMBOL_OFFSET (a) \ | ||
| 516 | + (SYMBOLP (a) ? (char *) lispsym : NULL))) | ||
| 517 | |||
| 518 | /* For pointer access, define XPNTR and XPNTR_OR_SYMBOL_OFFSET as | ||
| 519 | functions, as functions are cleaner and can be used in debuggers. | ||
| 520 | Also, define them as macros if being compiled with GCC without | ||
| 521 | optimization, for performance in that case. The macro_* names are | ||
| 522 | private to this section of code. */ | ||
| 523 | |||
| 524 | static ATTRIBUTE_UNUSED void * | ||
| 525 | XPNTR_OR_SYMBOL_OFFSET (Lisp_Object a) | ||
| 526 | { | ||
| 527 | return macro_XPNTR_OR_SYMBOL_OFFSET (a); | ||
| 528 | } | ||
| 529 | static ATTRIBUTE_UNUSED void * | 519 | static ATTRIBUTE_UNUSED void * |
| 530 | XPNTR (Lisp_Object a) | 520 | XPNTR (Lisp_Object a) |
| 531 | { | 521 | { |
| @@ -533,7 +523,6 @@ XPNTR (Lisp_Object a) | |||
| 533 | } | 523 | } |
| 534 | 524 | ||
| 535 | #if DEFINE_KEY_OPS_AS_MACROS | 525 | #if DEFINE_KEY_OPS_AS_MACROS |
| 536 | # define XPNTR_OR_SYMBOL_OFFSET(a) macro_XPNTR_OR_SYMBOL_OFFSET (a) | ||
| 537 | # define XPNTR(a) macro_XPNTR (a) | 526 | # define XPNTR(a) macro_XPNTR (a) |
| 538 | #endif | 527 | #endif |
| 539 | 528 | ||
| @@ -5605,7 +5594,7 @@ static Lisp_Object | |||
| 5605 | purecopy (Lisp_Object obj) | 5594 | purecopy (Lisp_Object obj) |
| 5606 | { | 5595 | { |
| 5607 | if (INTEGERP (obj) | 5596 | if (INTEGERP (obj) |
| 5608 | || (! SYMBOLP (obj) && PURE_P (XPNTR_OR_SYMBOL_OFFSET (obj))) | 5597 | || (! SYMBOLP (obj) && PURE_P (XPNTR (obj))) |
| 5609 | || SUBRP (obj)) | 5598 | || SUBRP (obj)) |
| 5610 | return obj; /* Already pure. */ | 5599 | return obj; /* Already pure. */ |
| 5611 | 5600 | ||