[LispM-Hackers] Funcall notes

Paul Fuqua pf@ti.com
Fri, 19 Oct 2001 19:16:12 -0500


    Date: 19 Oct 2001 15:33:01 -0800
    From: james@unlambda.com (James A. Crippen)
    
    The SSDN isn't exactly the most lucid of texts...  Seems like it was
    written in a hurry.

It was never intended as a single manual.  What's there is a collection
of various independent and semi-interrelated internal documents, all of
which have something do with the low-level structure.  I wrote the
function-calling chapter, for example, as a standalone document to
accompany the call/return/throw microcode.
    
    What exactly is the address being pushed, though?

Micro-pc, on the micro-PDL;  not visible to the macroinstruction level.

    These instructions all seem to be interlaced with each other,
    algorithm-wise.  The microcode must have been implemented as one large
    routine with lots of jumps and conditionals, that all together
    implemented the whole set (or few sets) of CALL instructions.

The generic CALL came first, with the more specific ones written later
as short stubs that jump into the generic path after setting some
variables.  Really, a CALL is a CALL;  the specific variations are just
speedups for common cases.
    
    The LC offset is always calculated for the *previous* function and put
    in the *previous* function's state on the stack, right?

In today's typical processor, a CALL instruction saves the current PC.
On the Explorer, the "current PC" is saved as the current function plus
the offset within it, which facilitates moving functions around during
GC.  The hardware LC register itself was a full address, the
function/offset form was just for storage.
    
    Hmm.  We won't have a micro pc, AFAICT.  How would we simulate this?

Magic?  Seriously, one might arbitrarily set a magic "micro-pc" value
(looked up in a table) depending on the kind of error detected, which
might also be used when restarting the macroinstruction (though maybe we
could just retry).  Haven't thought about it much.

                              pf