[M3devel] uplevel locals declared after function starts..
Jay K
jay.krell at cornell.edu
Fri Sep 21 01:18:59 CEST 2012
We get uplevel locals declared while within a function.So I think I'll bite the bullet and make multiple passes now.Otherwise I build up the frame struct "too early".I need to see all the locals -- all the uplevels, early in a function.
There is also a chance they don't all have unique names.
I do NOT expect I should have separate frames/static_links per-scope,just per-function.
I could put structs inside the frame, named after the line they starton or such.. that might be prettier and more readable, or not.
The structs could then be unioned at some point -- parallel scopescan/should share storage.
M3C.m3:PROCEDURE declare_local(...)BEGIN...IF u.in_proc THEN ExtraScope_Open(u); print(u, var.Declare() & " M3_INIT;"); <* ASSERT up_level = FALSE *> this fails ELSE IF up_level THEN u.current_proc.uplevels := TRUE; END; u.current_proc.locals.addhi(var); END; RETURN var;END declare_local;
== package /Users/jay/dev2/cm3/m3-libs/m3tk-misc ==
...new source -> compiling Args.m3
****** runtime error:*** <*ASSERT*> failed.*** file "../src/M3C.m3", line 1778***
m3_backend => 1536m3cc (aka cm3cg) failed compiling: Args.mc
I'm guessing the code is here:
PROCEDURE Errors(h: Handle; indent: CARDINAL := 0): Text.T RAISES {}= BEGIN IF h.errors = 0 THEN <*FATAL Fatal*> BEGIN RAISE Fatal; END; ELSE
VAR texts := NEW(REF ARRAY OF TEXT, h.errors * 2); (* allocates space for all the error messages + padding *) pos: CARDINAL := 0; padding := Fmt.Pad("", indent); fmt: Text.T;
<*INLINE*> PROCEDURE Add(t: Text.T) RAISES {}= BEGIN texts[pos] := t; INC(pos) END Add; <*INLINE*> PROCEDURE PaddedAdd(t: Text.T) RAISES {}= BEGIN Add(padding); Add(t) END PaddedAdd;
see how "texts" is both uplevel and "not at the start" of the function.
This is going to take a few days to deal with.
Compiler can compile itself, and a large swath of the system now.I didn't use the self-built compiler, but I will do that next. It probably works.Very good.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120920/a2cadc30/attachment-0001.html>
More information about the M3devel
mailing list