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: Sun, 29 Jan 2017 12:58:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

> Based on these suggestions, I have made a few more modifications to the code:
> * `gethash' now takes an additional :purecopy argument. If non-nil, the table
> will/can be copied to pure storage when the Emacs binary is being dumped.
> Since objects in pure storage are read only, gethash enforces that :weak and
> :purecopy aren't non-nil at the same time, erroring out when the latter is 
> true.

Hmm... why do that in gethash?  Why not just check NILP (obj->weak)
when purecopying?

> * All functions that modify hash tables (`puthash', `clrhash' and `remhash')
> make sure that the table is not in pure storage (with CHECK_IMPURE).

Good.

> * `make_pure_hash_table' now also purecopies the hash table test, and enforces
> the checks above with `eassert'.

Sounds good.

> * A new struct, `pinned_object' is used as a linked list to store objects that
> should be marked before every GC cycle.  For now, this is only used when
> a hash table with the :purecopy property set to nil is passed to purecopy (but
> should be usable for other objects in the future).

An array would be significantly more efficient, but that sounds good.

> Should this work, or is there anything else I need to do?

I think this should work.

> +make_pure_hash_table (struct Lisp_Hash_Table *table) {

Nitpick: I'd call it `purecopy_hash_table`.


        Stefan




reply via email to

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