From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: egnarts-ms Newsgroups: gmane.emacs.devel Subject: Re: lexical-binding questions Date: Mon, 14 May 2012 23:40:19 -0700 (PDT) Message-ID: <33844651.post@talk.nabble.com> References: <871umzrvfw.fsf@gmail.com> <87y5p64o3v.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1337064030 3844 80.91.229.3 (15 May 2012 06:40:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 May 2012 06:40:30 +0000 (UTC) To: Emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 15 08:40:30 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SUBQq-0007SF-8K for ged-emacs-devel@m.gmane.org; Tue, 15 May 2012 08:40:28 +0200 Original-Received: from localhost ([::1]:42553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUBQp-0007Cd-GW for ged-emacs-devel@m.gmane.org; Tue, 15 May 2012 02:40:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUBQl-0007CL-PX for Emacs-devel@gnu.org; Tue, 15 May 2012 02:40:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUBQj-0005xO-IN for Emacs-devel@gnu.org; Tue, 15 May 2012 02:40:23 -0400 Original-Received: from sam.nabble.com ([216.139.236.26]:33790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUBQj-0005x9-Dm for Emacs-devel@gnu.org; Tue, 15 May 2012 02:40:21 -0400 Original-Received: from telerig.nabble.com ([192.168.236.162]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1SUBQh-0008JJ-Fq for Emacs-devel@gnu.org; Mon, 14 May 2012 23:40:19 -0700 In-Reply-To: X-Nabble-From: egnartsms@gmail.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 216.139.236.26 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150488 Archived-At: 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: http://old.nabble.com/lexical-binding-questions-tp33799305p33844651.html Sent from the Emacs - Dev mailing list archive at Nabble.com.