[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_b
Re: [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch
Thu, 19 Jan 2017 17:53:50 +0000
I see. For now, I've made the type check only work when BYTE_CODE_SAFE is defined at compile time. I'll make it a part of the regular code once the byte-switch is implemented and there are no performance issues with doing so.
> On another thought, `byte-switch` is used while compiling certain
> `cond` forms. It
> replaces the traditional goto-if-nil bytecode by using a hash table mapping
> values to addresses/tags to be jumped to. Since `byte-switch` is essentially a
> "dynamic" goto (in the sense that the address/tag cannot be known at
> compile time),
> wouldn't doing a runtime type check in the bytecode VM for what is a
> hash table lookup + goto have a significant performance penalty?
I don't know. Only measurement can tell. My guess is that hash_lookup
already takes a significant amount of time, so a HASH_TABLE_P test would be
negligible in comparison.
> On Wed, Jan 18, 2017 at 11:18 PM, Stefan Monnier
> <address@hidden> wrote:
>>> * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch
>>> Fgethash type checks the provided table object, which is unnecessary
>>> for compiled bytecode.
>> While it's true that we can cause a core dump of Emacs if we feed it an
>> invalid .elc file, that's a "feature" I'd rather shrink rather
>> than generalize.
> Vibhav Pant