unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] Make purecopy create hash tables properly
Date: Sun, 29 Jan 2017 12:58:23 -0500	[thread overview]
Message-ID: <jwv7f5dhi3p.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: CA+T2Sh0BFif8q3C+UOP2KesKagBeV7iYUsCwmQQRTr4+FpQECg@mail.gmail.com

> 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	other threads:[~2017-01-29 17:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 18:37 [PATCH] Make purecopy create hash tables properly Vibhav Pant
2017-01-27 22:06 ` Paul Eggert
2017-01-27 23:10 ` Stefan Monnier
2017-01-28 10:25   ` Vibhav Pant
2017-01-28 10:26     ` Vibhav Pant
2017-01-28 14:58     ` Stefan Monnier
2017-01-28 20:06       ` Vibhav Pant
2017-01-29  2:18         ` Stefan Monnier
2017-01-29 17:23       ` Vibhav Pant
2017-01-29 17:58         ` Stefan Monnier [this message]
2017-01-29 19:14           ` Vibhav Pant
2017-01-29 19:41             ` Stefan Monnier
2017-01-30 12:43               ` Vibhav Pant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7f5dhi3p.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).