[DGD] some questions about interpret.cpp
Carter Cheng
cartercheng at gmail.com
Mon Dec 28 19:09:50 CET 2015
Also concerning kfuns why would they want to modify the program counter?
Shouldn't the kfun return to the subsequent instruction after the kfun call
in most cases?
On Tue, Dec 29, 2015 at 2:08 AM, Carter Cheng <cartercheng at gmail.com> wrote:
> Thanks Felix. Yes it has been a while. I haven't been much involved in
> mudding for the past 5 years or so.
> I was looking over some old projects and just decided to take a look at
> the dgd internals and go over them a bit more carefully to see what I
> understood and did not understand. I found the setjmp code in error.cpp but
> I might be misunderstanding something still.
>
> On Tue, Dec 29, 2015 at 12:13 AM, Felix A. Croes <felix at dworkin.nl> wrote:
>
>> 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
>> ____________________________________________
>> https://mail.dworkin.nl/mailman/listinfo/dgd
>
>
>
More information about the DGD
mailing list