emacs-devel
[Top][All Lists]
Advanced

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

Re: scratch/bytecode-speedup 870806d4c4 04/11: Pin bytecode strings to a


From: Stefan Monnier
Subject: Re: scratch/bytecode-speedup 870806d4c4 04/11: Pin bytecode strings to avoid copy at call time
Date: Tue, 11 Jan 2022 12:09:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> branch: scratch/bytecode-speedup
> commit 870806d4c453addca794aa0940298425241e13d9
> Author: Mattias EngdegÄrd <mattiase@acm.org>
> Commit: Mattias EngdegÄrd <mattiase@acm.org>
>
>     Pin bytecode strings to avoid copy at call time
> +  /* ... we plonk BYTESTR and VECTOR there to ensure that they survive
> +     GC (bug#33014), since these variables aren't used directly beyond
> +     the interpreter prologue and wouldn't be found in the stack frame
> +     otherwise.  */
> +  stack_base[0] = bytestr;
> +  stack_base[1] = vector;
> +  Lisp_Object *top = stack_base + 1;
> +  Lisp_Object *stack_lim = top + stack_items;
> +  unsigned char const *bytestr_data = SDATA (bytestr);

Why not keep a ref to the function object itself?
That would also allow providing a new bytecode to extract a `self`
reference to the function that's being executed.

Oh, I think I can see one reason: there's no such object when we're
called from `Fbyte_code`.  Maybe `Fbyte_code` should be reimplemented as
`(funcall (make-byte-code 0 bytecode csts depth))`?
(and change `bytecomp.el` not to use `byte-code` any more)
(and mark `byte-code` as obsolete)


        Stefan




reply via email to

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