[Top][All Lists]

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

Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optio

From: Stefan Monnier
Subject: Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables.
Date: Sat, 11 Feb 2017 10:51:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> +            /* 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.


reply via email to

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