unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables.
       [not found] ` <20170211144459.A837B2319A@vcs0.savannah.gnu.org>
@ 2017-02-11 15:51   ` Stefan Monnier
  2017-02-11 17:48     ` Vibhav Pant
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2017-02-11 15:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Vibhav Pant

> +            /* Hash tables for switch are declared with :size set to the
> +               exact number of cases.  */
> +            if (BYTE_CODE_SAFE)
> +              eassert (HASH_TABLE_SIZE (h) == h->count);

Why should we force this constraint on the code that generates the
hash-tables.  I think this is wrong.  We just need a comment that
explains that we use h->count as a faster approximation of
HASH_TABLE_SIZE(h) (and BTW, the comment belongs next to the relevant
code which is not the `for` loop but the "if (h->count <= 5)" test) and
that we hence leave it to the bytecompiler to ensure that this
approximation is good enough.


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables.
  2017-02-11 15:51   ` [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables Stefan Monnier
@ 2017-02-11 17:48     ` Vibhav Pant
  2017-02-11 19:50       ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Vibhav Pant @ 2017-02-11 17:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

On Sat, Feb 11, 2017 at 9:21 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> +            /* Hash tables for switch are declared with :size set to the
>> +               exact number of cases.  */
>> +            if (BYTE_CODE_SAFE)
>> +              eassert (HASH_TABLE_SIZE (h) == h->count);
>
> Why should we force this constraint on the code that generates the
> hash-tables.  I think this is wrong.

Also, the rationale for putting a constraint on the :size of the hash
table was that it would save pure storage if the function (and thus
the jump table in the constant vector) was purecopied.

-- 
Vibhav Pant
vibhavp@gmail.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables.
  2017-02-11 17:48     ` Vibhav Pant
@ 2017-02-11 19:50       ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2017-02-11 19:50 UTC (permalink / raw)
  To: emacs-devel

> Also, the rationale for putting a constraint on the :size of the hash
> table was that it would save pure storage if the function (and thus
> the jump table in the constant vector) was purecopied.

But that's also a mere optimisation.  Not something whose absence
deserves an abort.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-11 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170211144458.18694.21302@vcs0.savannah.gnu.org>
     [not found] ` <20170211144459.A837B2319A@vcs0.savannah.gnu.org>
2017-02-11 15:51   ` [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables Stefan Monnier
2017-02-11 17:48     ` Vibhav Pant
2017-02-11 19:50       ` Stefan Monnier

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).