[eclipse-clp-users] Question about recursion frames in ECLiPSe-CLP

From: Schüpbach Adrian Laurent <scadrian_at_...159...>
Date: Tue, 13 Jan 2009 14:05:28 +0100
Dear ECLiPSe-team

I'm trying to port ECLiPSe-CLP to a new OS we are currently writing and I'd
have some questions.

I started with the minimal set of files needed to build Kernel/<arch>/sepia
and wanted to get that working first. That means I take the files
in Kernel/ and Shm/ and I build libeclipse, libshm and libdummies and
finally link it together with a simple example (eg_c_basic).

I'm using version 6.0.42.

I can compile and link the example file which does
ec_init(), ec_post_string(), ec_resume(), ec_queue_read() and
ec_cleanup().

When I try to run it, ec_init() almost terminates, but not completely.
It reads in lib/kernel.eco and parses it, that seems ok.

At some point, just before ec_init() terminates, ec_emulate() returns with
PTHROW due to a recursion frame. PTHROW is returned by
emu.c at around line 6600 where it checks for the recursion frame.


I have some questions about that:

1. What is a recursion frame and why does it usually get pushed?
2. Why would the recursion frame not be expected at this point?
3. Which emulator is exited here? Are there several emulators?
4. Is there anything I can look for to identify the problem?
5. Is there any detailed code documentation?


This is the piece of code in emu.c at about line 6600 which causes the emulator
to return PTHROW. IsRecursionFrame(BTop(pw1)) is true while
IsInterruptFrame(BTop(pw1)) is false.


        else if (IsInterruptFrame(BTop(pw1))||IsRecursionFrame(BTop(pw1)))
		{
		// exit an emulator: restore everything from the invoc frame.
        // Normally we will continue throwing in an earlier emulator
        // invocation, but that's not sure because the C code can
        // choose not to propagate the throw. Therefore we must
        // restore the engine to a reasonable state now rather
        // than wait for the catch!
        //
            err_code = PTHROW;
		    B.args = pw1;
		    goto _exit_emulator_;	/// (err_code,scratch_pw)
		}
        else	/* other frame, skip it */


Unfortunately I don't fully understand the code and the execution flow there.
I hope you can give me some hints what I should look for or how I could
try to debug.

Thank you in advance!

Cheers
Adrian
Received on Tue Jan 13 2009 - 13:17:40 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST