[Top][All Lists]

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

Re: lexical-binding questions

From: egnarts-ms
Subject: Re: lexical-binding questions
Date: Mon, 14 May 2012 23:40:19 -0700 (PDT)

Stefan Monnier wrote:
> A much more productive patch would be to speed up function calls from
> byte-code functions to byte-code functions by performing them without
> leaving the byte-code interpreter (currently the code does a ridiculous
> dance where the byte-code interpreter takes the args from the byte-code
> stack, passes them to Ffuncall which calls funcall_lambda which then
> calls exec_byte_code which sets up a new byte-code stack and copies the
> args to this new stack, to finally run the destination byte-code).

You know, it is not quite clear (at least to me) how it is possible to speed
up this mechanism. exec_byte_code currently allocates stack frames on a
per-call basis, according to what a byte-code object says about its max
stack depth. So,

1) doing direct call from exec_byte_code to exec_byte_code would most
evidently imply the same procedure: creating a new stack frame and copying
all the arguments (as Lisp_Objects) to it;

2) besides the above, going through Ffuncall does some additional things,
like checking lisp_eval_depth and performing GC if necessary, plus updating
the backtrace_list global variable. By all evidence, all these things must
also be performed when a byte-compiled function calls directly another
byte-compiled function, as you suggest, 'cause otherwise Emacs's behavior
would be significantly changed. This creates additional difficulties, as
Ffuncall is located in "eval.c" (and exec_byte_code -- in "bytecode.c").

Maybe there's some info I'm not aware of, or just misunderstanding something
? I'm really interested in this question.
View this message in context: 
Sent from the Emacs - Dev mailing list archive at Nabble.com.

reply via email to

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