[LMH]Re: LispM-Hackers digest, Vol 1 #190 - 1 msg
Sat Jul 12 21:39:00 2003
>Does anyone have any ideas for what to do about emulating DTP-U-Entry
>"functions"? I'm going to take a stab at getting the U-Entry for LIST
OK. I'm looking at the old microcode for this one. I don't think this
changed in any way in VM2.
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!) If the object is a DTP-U-Entry object, the following is the
algorithm to resolve it to a microcode routine:
1. Treat the pointer field of the DTP-U-Entry as an integer. Check that
it is in range for uentries (compare to A-AMCENT). Trap if out of range
2. Use the entry number to index into the microcode entry area
3. If the word is not a fixnum. Then this isn't really a microcoded
function so try the call again with this object as the called function.
4. If the selected word in the microcode entry area is a fixnum, then it
is a microcode entry. Save the fixnum for later use.
5. The args info word is in another table, the microcode entry args info
6. Set M-AP (args pointer) to the new frame.
7. Use the args descriptor to check for too many or too few args.
8. Check for and handle PDL buffer overflow.
9. Copy the args to the top of stack.
10. Build the entry state word. (This might be a bit different in VM2).
This is the same as for a macro-to-macro call.
11. Now that the stack is set up, handle any traps:
a. if trap-on-calls
b. signal any errors previously detected (wrong number of args,
12. Use the number from step 4 to index into yet another table, the
micocode symbol area (A-V-MICRO-CODE-SYMBOL-AREA). The result is
probably a fixnum. Its low 16-bits are a microcode address.
13. Push the finish-up routine on the micro-stack.
14. Jump to the microcode address from step 12.
15. Run the microcoded routine. It may trap, call out to macrocode (via
the support vector) or by interrupted.
16. When it is done, it must return a value. That value becomes the
value of the function.
17. On return the usual checks (trap on exit, PDL underflow, throw, etc.
checks are performed) then the stack frame is exited and the result
The comments on the LIST entry are:
This is not callable with MISC instructions, only as a function.
It is documented as taking an &REST argument but actually takes
63 optional args. When entered, the arguments are on the stack and M-R
contains the number of them.
Other forms of LIST are LIST* and LIST-IN-AREA (first argument is AREA
to cons in). They are probably in adjacent entries in the microcode
entry area and probably have microinstruction entry address that differ
by 5 to 25 with LIST being the lowest microaddress, LIST* next and
I hope this helps.