Re: float to pointer coercion (cost 13)
- From: Duane Rettig <duane@xxxxxxxxx>
- Date: 12 Apr 2005 20:10:24 -0700
Kent M Pitman <pitman@xxxxxxxxxxx> writes:
> Duane Rettig <duane@xxxxxxxxx> writes:
>
> > > May I ask how this works? Do you compile two versions of the
> > > function, one with immediate-args and one without, and decide which
> > > one to use at compile-time, depending on whether or not the calling
> > > function knows the return type?
> >
> > Nope. The function is compiled once, but it is given two entry
> > points. The "normal" entry point is actually at the beginning of
> > the code vector, and it jumps to a hook function, whose job it is
> > to unbox the arguments according to the spec and then "call" the
> > original function again, but to the immediate-args entry point.
> > Once the function is done, it returns to the hook function, which
> > boxes up the result. When a function is compiled that knows about
> > the immediate-function, it places its arguments according to the calling
> > standard, and calls the function at its secondary (immediate-args)
> > entry point. It is also responsible for handling any unboxed value
> > coming back, since the function will return directly to the caller.
>
> I assume this technique was borrowed from MACLISP, which did a similar
> thing.
No, I didn't realize that Maclisp used that technique.
> Or maybe it came from some contemporary hack in the "Franz Lisp",
> which I have always assumed is some conceptual if not actual relative
> of Allegro, though oddly I never did the work to cement their connection
> in my brain.
It's good that you didn't, because the only thing they have had in
common is the developers who have worked on them. Franz Lisp largely
mirrored Maclisp, and its original purpose was to provide an underpinning
for the copy of Macsyma that Dr. Fateman brought with him to Berkeley.
Allegro CL was started from scratch (though its sequence functions came
essentially from Spice Lisp code) and had very little moved over from
Franz Lisp, except that the Flavors module was ported to Allegro CL
and then stayed there (where it remains today).
> Every time I think of this magic calling sequence, it reminds me of a
> funny story that... ah, well, why should I repeat myself? Google knows...
>
> http://groups-beta.google.com/group/comp.lang.lisp/msg/08d9bcb39f41765a
I didn't realize that MacLisp had that kind of implementation. It looks
like it has the same redefinition issues that our immed-args system has.
Also, your farther-out idea seems like if it were carried to extreme,
it would carry with it a combinatorial explosion. But the idea looks
strikingly similar to a more user-driven style that we are all used
to - defstruct boa-constructors. With such multiple (but limited)
"entry points" (i.e. functions) describable by the user, a compiler
could indeed do such an optimization.
--
Duane Rettig duane@xxxxxxxxx Franz Inc. http://www.franz.com/
555 12th St., Suite 1450 http://www.555citycenter.com/
Oakland, Ca. 94607 Phone: (510) 452-2000; Fax: (510) 452-0182
.
- References:
- float to pointer coercion (cost 13)
- From: Jacek Generowicz
- Re: float to pointer coercion (cost 13)
- From: Christophe Rhodes
- Re: float to pointer coercion (cost 13)
- From: Jacek Generowicz
- Re: float to pointer coercion (cost 13)
- From: Duane Rettig
- Re: float to pointer coercion (cost 13)
- From: rif
- Re: float to pointer coercion (cost 13)
- From: Duane Rettig
- Re: float to pointer coercion (cost 13)
- From: Kent M Pitman
- float to pointer coercion (cost 13)
- Prev by Date: Re: How does Lisp's functional model gel with event-driven GUI apps?
- Next by Date: Comparing Lisp conditions to Java Exceptions
- Previous by thread: Re: float to pointer coercion (cost 13)
- Next by thread: Re: float to pointer coercion (cost 13)
- Index(es):