[Top][All Lists]

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

Re: lexical-binding questions

From: Stefan Monnier
Subject: Re: lexical-binding questions
Date: Tue, 15 May 2012 09:55:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

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

It doesn't have to stay that way.

> 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;

You would call exec_byte_code but either call some new function or make
no function call at all (thought that would probably require manually
handling a separate "return address stack").

> 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,

Yes, we'd have to duplicate some code and we can't eliminate all
the overhead.  Like all optimizations, it's difficult to know beforehand
whether it will be worthwhile, but I think there are some significant
savings to be had.

In the same area, providing some way to do tail-call-optimization would
be very welcome (tho only for lexical-binding code).


reply via email to

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