[DGD] hook functions for compile/recompile/destruct for programs (and related data)

Felix A. Croes felix at dworkin.nl
Sun Aug 22 13:32:10 CEST 2010


Carter Cheng <cartercheng at gmail.com> wrote:

> Thanks for the help. I do have one follow up question that so far I
> have not been able to figure out. For a given control block how are
> the functions organized and indexed and identified by something like
> call other when a call is made? If you could answer this it would help
> me greatly.

The first step is from (object, function name) to (program object,
function index), where "program object" is the object that defines the
function, and "function index" an offset in the function table.  This
is done in i_call() using the symbol table in the control block.

The second step is from function index to byte code offset.  The
information is found directly in the function definition table of
the control block of the program object.  This is done in i_funcall().

The byte code offset is an offset in the "program" byte array of the
aforementioned control block.  At that location is function prototype
info, followed by maximum stack depth, followed by number of local
variables, followed by the offset of line number info (all handled by
i_funcall()), followed by the actual byte code of the function (handled
by i_interpret()).

Regards,
Felix Croes



More information about the DGD mailing list