[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Make purecopy create hash tables properly
From: |
Vibhav Pant |
Subject: |
Re: [PATCH] Make purecopy create hash tables properly |
Date: |
Sat, 28 Jan 2017 15:55:08 +0530 |
On Sat, Jan 28, 2017 at 4:40 AM, Stefan Monnier
<address@hidden> wrote:
> Whichever option you take, please pay attention to `next_weak` because
> in your patch, you'll end up purecopying some of the other weak
> hash-tables but you won't register this one as a weak hash table, so it
> will lead to serious problems.
Not sure if I'm correct here, but shouldn't we be *not* purecopying weak hash
tables? Otherwise, GC will result in potentially writing over/freeing pure
memory, something that we don't want to happen. Plus, I think that this opens
another can of worms for code like this:
(let ((h #s(hash-table data ())))
(puthash 'foo 'bar h))
or
(defun a ()
#s(hash-table data ())) ;; the returned table might be purecopied
;; and the callee might write to it
Which also writes to pure storage if the code is purecopied during
dumping emacs.
I'd recommend skipping purecopy for hash tables altogether, and add an
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).
--
Vibhav Pant
address@hidden
- [PATCH] Make purecopy create hash tables properly, Vibhav Pant, 2017/01/27
- Re: [PATCH] Make purecopy create hash tables properly, Paul Eggert, 2017/01/27
- Re: [PATCH] Make purecopy create hash tables properly, Stefan Monnier, 2017/01/27
- Re: [PATCH] Make purecopy create hash tables properly,
Vibhav Pant <=
- Re: [PATCH] Make purecopy create hash tables properly, Vibhav Pant, 2017/01/29
- Re: [PATCH] Make purecopy create hash tables properly, Stefan Monnier, 2017/01/29
- Re: [PATCH] Make purecopy create hash tables properly, Vibhav Pant, 2017/01/29
- Re: [PATCH] Make purecopy create hash tables properly, Stefan Monnier, 2017/01/29
- Re: [PATCH] Make purecopy create hash tables properly, Vibhav Pant, 2017/01/30