diff options
| author | Paul Eggert | 2021-07-11 00:27:43 -0700 |
|---|---|---|
| committer | Paul Eggert | 2021-07-11 01:30:11 -0700 |
| commit | 2f7afef5ffe023a7a12520201ab70643f826abfd (patch) | |
| tree | e205d56652cde83343a39dc4e742f8f1ffa2c203 /src/alloc.c | |
| parent | d93ff9459feb77ed5df0d3af563d1280ff42062f (diff) | |
| download | emacs-2f7afef5ffe023a7a12520201ab70643f826abfd.tar.gz emacs-2f7afef5ffe023a7a12520201ab70643f826abfd.zip | |
Fix pdumper-related GC bug
* src/alloc.c (mark_maybe_pointer): Also mark pointers
to pdumper objects, even when the pointers are tagged.
Add a FIXME saying why this isn’t enough.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 76d8c7ddd11..752eaec1352 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4755,6 +4755,17 @@ mark_maybe_pointer (void *p) | |||
| 4755 | definitely _don't_ have an object. */ | 4755 | definitely _don't_ have an object. */ |
| 4756 | if (pdumper_object_p (p)) | 4756 | if (pdumper_object_p (p)) |
| 4757 | { | 4757 | { |
| 4758 | /* FIXME: This code assumes that every reachable pdumper object | ||
| 4759 | is addressed either by a pointer to the object start, or by | ||
| 4760 | the same pointer with an LSB-style tag. This assumption | ||
| 4761 | fails if a pdumper object is reachable only via machine | ||
| 4762 | addresses of non-initial object components. Although such | ||
| 4763 | addressing is rare in machine code generated by C compilers | ||
| 4764 | from Emacs source code, it can occur in some cases. To fix | ||
| 4765 | this problem, the pdumper code should grok non-initial | ||
| 4766 | addresses, as the non-pdumper code does. */ | ||
| 4767 | uintptr_t mask = VALMASK; | ||
| 4768 | p = (void *) ((uintptr_t) p & mask); | ||
| 4758 | /* Don't use pdumper_object_p_precise here! It doesn't check the | 4769 | /* Don't use pdumper_object_p_precise here! It doesn't check the |
| 4759 | tag bits. OBJ here might be complete garbage, so we need to | 4770 | tag bits. OBJ here might be complete garbage, so we need to |
| 4760 | verify both the pointer and the tag. */ | 4771 | verify both the pointer and the tag. */ |