[LMH]Re: LispM-Hackers digest, Vol 1 #190 - 1 msg
Steve Krueger
stevelisp@grape-krueger.com
Sun Jul 13 12:10:01 2003
Steve Krueger wrote:
> Remember that the functional calling microcode dispatches on the
> datatype of the object being called and almost any datatype is
> actually a valid function. (Aside: This dispatch table is called
> D-QMRCL. We always thought the MIT folks called it that because its a
> miracle when it works!)
OK, I know I'm following up my own post here. I decided to look up
D-QMRCL and give its contents since it is a good summary of what to do
when calling various things.
The order of datatypes is a bit different than SSDN2 since I'm looking
at SSDN1 microcode, but the actions for the various datatypes are the same.
1. Invalid and not-in-the-machine datatypes are illegal to call. Some
of these forwards that would have been snapped out by the transporter
when they were read (e.g. EVCP) so they aren't exactly illegal to call,
but should have been resolved before entering the magic call routine:
DTP-TRAP, DTP-FREE, DTP-NULL, DTP-SYMBOL-HEADER, DTP-HEADER,
DTP-GC-FORWARD, DTP-EVCP, DTP-ONE-Q-FORWARD, DTP-HEADER-FORWARD,
DTP-BODY-FORWARD, DTP-ARRAY-HEADER, DTP-INSTANCE-HEADER,
DTP-SELF-REF-POINTER, DTP-FEF-HEADER, DTP-UNUSED-*.
2. Objects that can be called by invoking the interpretter. The
interpretter is the function APPLY-LAMBDA and is found in the support
vector. These objects are interpretted:
DTP-LOCATIVE, DTP-LIST,.
3. Symbols: Read the symbol's function cell and call that object instead.
4. Numbers. It is a trap (NUMBER-CALLED-AS-FUNCTION) to call a number:
DTP-FIXNUM, DTP-EXTENDED-NUMBER, DTP-CHARACTER, DTP-SMALL-FLONUM.
5. DTP-UCODE-ENTRY. Described in previous message.
6. DTP-FEF-POINTER. Usual macrocode function call.
7. DTP-ARRAY-POINTER. This performs an aref. Number of args must agree
with dimensionality of array.
8. DTP-STACK-GROUP performs a stack group call. This is pretty
complicated. Critical for the error handler to work!
9. DTP-CLOSURE and DTP-STACK-CLOSURE perform a closure call.
10. DTP-SELECT-METHOD does a method lookup and call.
11. DTP-INSTANCE does an instance call.
12. DTP-ENTITY does an entity call. (Did we removed these from VM2?)
So you can see that there are a lot of cases for function calling. The
LISP system uses every one of them!
One note is that the stack frame must be properly set up before you can
trap. For example, if you call a number, the stack frame is finished
before trapping.
I can look up details on any of the mysterious types of calls.
Eventually, we've got to describe the SG call.
-Steve