emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Make purecopy create hash tables properly


From: Stefan Monnier
Subject: Re: [PATCH] Make purecopy create hash tables properly
Date: Sat, 28 Jan 2017 09:58:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> Not sure if I'm correct here, but shouldn't we be *not* purecopying weak hash
> tables?

Good point.  So we should check NILP (old->weak) and signal an
error if set.  And thus old->next_weak should always be NULL and is
trivial to copy.

> I'd recommend skipping purecopy for hash tables altogether, and add an

That would imply we can't purecopy any object which ends up referencing
a hash-table.  Unless we arrange to keep track of those hash-tables
which are referenced from purespace.  We already do that for symbols, so
maybe we can extend/generalize that mechanism (probably a good idea).

> internal :read-only flag to (make-hash-table) for hash tables we know
> aren't going to be be written to, and are thus safe to be purecopied
> (this would obviously only be useful for hash tables that are defined
> using printed syntax).

For cons cells we do:

  CHECK_IMPURE (cell, XCONS (cell));

in `setcar', so we can do the same for hash-tables.  Since purespace is
contiguous, CHECK_IMPURE is pretty efficient, and since it only relies
on the pointer value, the CPU can compute it in parallel with the access to
the object (and the test itself is trivial to predict), so it should
have a negligible impact on performance.


        Stefan



reply via email to

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