[DGD] Question concerning stack use between basic blocks

Felix A. Croes felix at dworkin.nl
Mon Dec 21 07:52:07 CET 2015


Carter Cheng <cartercheng at gmail.com> wrote:

> Hello everyone,
>
> I was wondering if anyone knew what the behavior of the stack is between
> basic blocks especially after branch merges. Is it in general safe to
> assume that data on the stack after a branch instruction is subsequently
> untouched? It would seem rather tricky to keep records of exactly what
> values mean on the stack especially if the stack is manipulated in a
> different fashion in two basic blocks the in the shared successor block the
> data is still accessed in some fashion. I probably should check the source
> but I was hoping to save a bit of time digging through the lpc compiler
> code finding this.

In DGD's VM, every instruction that accesses a value on the stack also
pops it.  Different branches can (of course) put different values on the
stack, but the number of values on the stack is the same for both branches
of a merge point.

Regards,
Felix Croes



More information about the DGD mailing list