diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2020-06-01 22:26:32 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-06-01 22:26:32 -0700 |
| commit | e10bd9e249bf70d0165a0cc050656ad94f34197d (patch) | |
| tree | 7eb22d41a6e7aeb8757e883479bdc0f2b8ec1d45 /src/alloc.c | |
| parent | 2c1e5b9e77d5da26cfb01917c25546e776c67789 (diff) | |
| parent | 44c0e074f7cb84481785cb49515a4bd7235a074b (diff) | |
| download | emacs-e10bd9e249bf70d0165a0cc050656ad94f34197d.tar.gz | |
Merge from origin/emacs-27
44c0e074f7 * doc/emacs/buffers.texi (Icomplete): Mention icomplete-mi...
68b6dad1d8 Be more aggressive in marking objects during GC
36f508f589 ; * src/xdisp.c (find_last_unchanged_at_beg_row): Fix a typo.
cc340da1fe Fix bug #41618 "(byte-compile 'foo) errors when foo is a m...
41232e6797 Avoid crashes due to bidi cache being reset during redisplay
f72bb4ce36 * lisp/tab-bar.el (switch-to-buffer-other-tab): Normalize ...
d3e0023aaa ; * etc/TODO: Fix formatting. (Bug#41497)
a8ad94cd2f Fix mingw.org's MinGW GCC 9 warning about 'execve'
# Conflicts:
# lisp/tab-bar.el
# nt/inc/ms-w32.h
# src/alloc.c
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/src/alloc.c b/src/alloc.c index e241b9933a4..124b50d0d3f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4687,35 +4687,6 @@ mark_maybe_objects (Lisp_Object const *array, ptrdiff_t nelts) mark_maybe_object (*array); } -/* A lower bound on the alignment of Lisp objects that need marking. - Although 1 is safe, higher values speed up mark_maybe_pointer. - If USE_LSB_TAG, this value is typically GCALIGNMENT; otherwise, - it's determined by the natural alignment of Lisp structs. - All vectorlike objects have alignment at least that of union - vectorlike_header and it's unlikely they all have alignment greater, - so use the union as a safe and likely-accurate standin for - vectorlike objects. */ - -enum { GC_OBJECT_ALIGNMENT_MINIMUM - = max (GCALIGNMENT, - min (alignof (union vectorlike_header), - min (min (alignof (struct Lisp_Cons), - alignof (struct Lisp_Float)), - min (alignof (struct Lisp_String), - alignof (struct Lisp_Symbol))))) }; - -/* Return true if P might point to Lisp data that can be garbage - collected, and false otherwise (i.e., false if it is easy to see - that P cannot point to Lisp data that can be garbage collected). - Symbols are implemented via offsets not pointers, but the offsets - are also multiples of GC_OBJECT_ALIGNMENT_MINIMUM. */ - -static bool -maybe_lisp_pointer (void *p) -{ - return (uintptr_t) p % GC_OBJECT_ALIGNMENT_MINIMUM == 0; -} - /* If P points to Lisp data, mark that as live if it isn't already marked. */ @@ -4728,9 +4699,6 @@ mark_maybe_pointer (void *p) VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); #endif - if (!maybe_lisp_pointer (p)) - return; - if (pdumper_object_p (p)) { int type = pdumper_find_object_type (p); @@ -4830,7 +4798,16 @@ mark_memory (void const *start, void const *end) for (pp = start; (void const *) pp < end; pp += GC_POINTER_ALIGNMENT) { - mark_maybe_pointer (*(void *const *) pp); + char *p = *(char *const *) pp; + mark_maybe_pointer (p); + + /* Unmask any struct Lisp_Symbol pointer that make_lisp_symbol + previously disguised by adding the address of 'lispsym'. + On a host with 32-bit pointers and 64-bit Lisp_Objects, + a Lisp_Object might be split into registers saved into + non-adjacent words and P might be the low-order word's value. */ + p += (intptr_t) lispsym; + mark_maybe_pointer (p); verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT |
