[M3devel] try/finally and ter optimization?

Jay K jay.krell at cornell.edu
Thu Jul 8 12:22:32 CEST 2010


To be clear, in several emails and commit comments, I mixed up "pre" and "ter".
 "ter" allowed now.
 "pre" is the problem.

 - Jay


----------------------------------------
> From: jay.krell at cornell.edu
> To: m3devel at elegosoft.com
> Subject: try/finally and ter optimization?
> Date: Wed, 7 Jul 2010 21:01:33 +0000
>
>
> This is an example that crashes the backend if ter is enabled.
> TryFinStmt has three modes: Compile1, Compile2, Compile3.
>  - stack walker
>  - two other modes depending on the form of the function (I didn't read closely).
>   One of them calls setjmp, one does not.
>   In this case, no call to setjmp.
>   Needs further investigation.
>  Even if I put code in the finally block, same thing.
>  TryStmt.m3 only has two modes, stack walker and not.
>  So I think the problem is somewhere in TryFinStmt -- it doesn't generate a call to setjmp (Marker.CaptureState)
>
>
>
> (* Compiling this program has crashed some backends.
>  * (gcc backend with -O3, no volatile, 'ter')
>  * This is reduced from libm3/Formatter.m3
>  * The point therefore is merely to compile it without crashing.
>  *)
>
> MODULE Main;
>
> VAR NoAlignOp: CARDINAL;
>
> PROCEDURE PeekOp(<*NOWARN*> i: CARDINAL): CARDINAL =
>   BEGIN RETURN NoAlignOp; END PeekOp;
>
> VAR pos1: CARDINAL := 0;
>
> <*NOWARN*> PROCEDURE PrintAlign(VAR pos: CARDINAL) =
>   VAR op, endRun: CARDINAL := 0;
>   BEGIN
>     TRY
>       LOOP
>         op := PeekOp(pos);
>         LOOP
>           IF op = NoAlignOp THEN
>             IF endRun = pos THEN
>               INC(endRun);
>             END;
>             EXIT;
>           END;
>           op := PeekOp(pos1);
>         END;
>       END;
>     FINALLY
>     END;
>   END PrintAlign;
>
> BEGIN
> END Main.
>
>
 		 	   		  


More information about the M3devel mailing list