[M3commit] [modula3/cm3] 496e9b: Fix compiler-generated FINALLY procedure using par...
rodney.m.bates at acm.org
Sun Aug 2 02:36:54 CEST 2015
Author: Rodney Bates <rodney.m.bates at acm.org>
Date: 2015-08-01 (Sat, 01 Aug 2015)
Fix compiler-generated FINALLY procedure using parent procedure's temporary.
Changes to be committed:
CG was not stacking global variables used for keeping track of temporaries
when entering nested procedures. In the case of a compiler-generated
nested procedure for the finally part of a TRY--FINALLY block, this
meant the finally code could use a temporary allocated by the parent,
though not in use at the time. This violated the comment in M3CG_Ops.i3:
declare_temp (s: ByteSize; a: Alignment; t: Type;
in_memory: BOOLEAN): Var;
(* declares an anonymous local variable. Temps are declared
and freed between their containing procedure's begin_procedure and
end_procedure calls. Temps are never referenced by nested procedures. *)
In cases of nested procedures explicitly declared in source code, this
didn't matter because they are located ahead of any of the parent
procedure's executable code, when it has no allocated temps, and they
free their own temps at their end, restoring the previous state.
More information about the M3commit