[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: User-reserved element in byte code vectors
From: |
Lars Brinkhoff |
Subject: |
Re: User-reserved element in byte code vectors |
Date: |
02 May 2004 09:59:24 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Stefan Monnier <address@hidden> writes:
> I'd argue that the closure's enviornment should be put as the first
> element in the constants-vector rather than in a separate slot in
> the byte code object: it makes closure construction slower and more
> clostly, but it makes the function call faster.
The downside to that is that you would have to create both a new byte
code object, and a new constants vector every time a closure is
creates, e.g.:
(defun make-closure (template env)
(let ((args (aref template 0))
(code (aref template 1))
(constants (aref template 2))
(stack-size (aref template 3))
(doc (aref template 4))
(interactive (aref template 5)))
(setq constants (copy-sequence constants))
(setq (aref constants 0) env)
(make-byte-code args code constants stack-size doc interactive)))
Whereas if the environment is located directly in the function, you
only have to create a new byte code object:
(defun make-closure (template env)
(let ((args (aref template 0))
(code (aref template 1))
(constants (aref template 2))
(stack-size (aref template 3))
(doc (aref template 4))
(interactive (aref template 5)))
(make-byte-code args code constants stack-size doc interactive env)))
--
Lars Brinkhoff, Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting http://www.brinkhoff.se/
- Re: User-reserved element in byte code vectors,
Lars Brinkhoff <=
- Re: User-reserved element in byte code vectors, Miles Bader, 2004/05/02
- Re: User-reserved element in byte code vectors, Lars Brinkhoff, 2004/05/02
- Re: User-reserved element in byte code vectors, Richard Stallman, 2004/05/03
- Re: User-reserved element in byte code vectors, Miles Bader, 2004/05/03
- Re: User-reserved element in byte code vectors, Lars Brinkhoff, 2004/05/05
- Re: User-reserved element in byte code vectors, Richard Stallman, 2004/05/05
- Re: User-reserved element in byte code vectors, Miles Bader, 2004/05/06
- Re: User-reserved element in byte code vectors, Miles Bader, 2004/05/06
- Re: User-reserved element in byte code vectors, Richard Stallman, 2004/05/06
- Re: User-reserved element in byte code vectors, Miles Bader, 2004/05/14