[DGD] some questions about interpret.cpp

Felix A. Croes felix at dworkin.nl
Mon Dec 28 17:13:42 CET 2015


Carter Cheng <cartercheng at gmail.com> wrote:

>[...]
> 1) in all the kfun style function calls the program counter in the frame
> f->pc = pc;  and following the call pc = f->pc. What is the purpose of
> this? I did a casual grep of the kfun directory and no kfuns seem to update
> this variable in the kfun code.

Kfuns can call i_lvalues(), which does modify the program counter.


> 2) both rlimits() and catch() recursively call interpretv1. This would
> suggest in someways that for certain opcodes the code behaves like a
> call_other function call. I.e. are returns illegal in catch and rlimit
> blocks? Since the return in the catch/rlimit block would "return" to the
> instruction following the rlimit/catch as opposed to the caller of the
> function.

The RETURN instruction has multiple meanings, either return from
function or exit from (one level of) rlimits or catch.  How it should
be interpreted depends on the context, which is never ambiguous.

We previously discussed this on 26 June 2010.  Time flies.


> 3) catch also uses the C++ try catch but the error code seems to still use
> setjmp longjmp which only minimally rewinds the stack and thus would break
> C++ classes with custom destructors. Is the intent to use exceptions here
> to get better behavior?

This surprises me.  Where do you see setjmp/longjmp being used?

Regards,
Felix Croes



More information about the DGD mailing list