emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conservative GC isn't safe


From: Daniel Colascione
Subject: Re: Conservative GC isn't safe
Date: Sat, 26 Nov 2016 00:33:13 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/26/2016 12:30 AM, Paul Eggert wrote:
On 11/26/2016 12:11 AM, Daniel Colascione wrote:

  1) mark_maybe_pointer looks only for exact matches on object start.
It's perfectly legal for the compiler to keep an interior object
pointer and discard the pointer to the object start.

Yes, just as it's perfectly legal for the compiler to subtract 42 from
every pointer before putting it in a register or storing it into memory.
In practice, though, compilers don't do this around calls to the garbage
collector. (True, this assumption should be documented better.)

I can imagine a compiler having a legitimate reason to use an interior pointer, but I can't see why it'd subtract 42, XOR it with 0xDEADBEEF, or make other opaque transformations. We already search the memory tree, and each tree node has both start and end information for each allocation. We should be able to cope with interior pointers.

  2) INTERVAL is GCed, but it's not represented in the memory tree:
struct interval isn't a real lisp object and it's allocated as
MEM_TYPE_NON_LISP. Even a direct pointer to the start of an interval
won't protect it from GC. Shouldn't we treat intervals like conses?

Does the code ever create an interval that is accessible only via locals
when a GC occurs? If not, Emacs should be OK. (This should also be
documented better.)

Anywhere in the code? Forever? I wouldn't be confident saying so.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]