🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98797

byte-compiling funcall

#98797
From: Roger Crew
Date: Thu, 28 Feb 1991 22:02
38 lines
2087 bytes
Not an actual bug, but...

Consider

     (funcall (calculate foo) arg1 arg2)

This is produced by the           
current byte-compiler:            As far as I can tell, 
                                  this is entirely equivalent: 
0   constant funcall              
1   constant calculate            0   constant calculate  
2   varref   foo                  1   varref   foo        
3   call     1                    2   call     1          
4   varref   arg1                 3   varref   arg1       
5   varref   arg2                 4   varref   arg2       
6   call     3                    5   call     2          
7   return                        6   return              

If there's no reason the byte-compiler should not be 
producing the code on the right (which should be 
faster depending on the expense of function calls),
the following could be added to bytecomp.el:

(put 'funcall 'byte-compile 'byte-compile-funcall)

(defun byte-compile-funcall (form)
  (let ((args (cdr form)))
    (while args (byte-compile-form (car args)) (setq args (cdr args))))
  (byte-compile-out 'byte-call (length (nthcdr 2 form)))
  (setq byte-compile-depth (- byte-compile-depth (length (nthcdr 2 form)))))


Emacs-version: 18.55

--
Roger Crew                                        ``I kill Optimax...''
Usenet:    {arpa gateways, decwrl, uunet, rutgers}!cs.stanford.edu!crew
Internet:  crew@CS.Stanford.EDU
Technical Details
Message-ID: <9102282203.AA24755@Neon.Stanford.EDU>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!lll-winken!sun-barr!apple!agate!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,c9f3b7e277d70093,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-03-01 05:13:28 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!lll-winken!sun-barr!apple!agate!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage
From: crew@NEON.STANFORD.EDU (Roger Crew)
Newsgroups: gnu.emacs.bug
Subject: byte-compiling funcall
Message-ID: <9102282203.AA24755@Neon.Stanford.EDU>
Date: 28 Feb 91 22:02:58 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 38
Approved: bug-gnu-emacs@prep.ai.mit.edu