[M3devel] better typing on SUBARRAY temporaries?
Jay K
jay.krell at cornell.edu
Wed Jul 22 07:42:29 CEST 2015
In the C backend I have a notion of "weak struct types" and "strong struct types".
"Strong" types have fields with types and names corresponding to the original Modula-3. i.e. they debug well.
"Weak" types have just arrays of characters (in a struct), sized/aligned to what the front end asked for. i.e. they debug poorly.
Originally I had only weak types.Ideally I have no weak types.I'm down to very few weak types now.I'd like to finish eliminating weak types.
A quick investigation shows weak types come from open arrays and jmpbufs.Open array temporaries from SUBARRAY specifically.
Can we fix this?
We have:m3front/src/types/OpenArrayType.m3:
PROCEDURE DeclareTemp (t: Type.T): CG.Var = VAR p := Reduce (t); size := Target.Address.pack + OpenDepth (p) * Target.Integer.pack; BEGIN RETURN CG.Declare_temp (size, Target.Address.align, CG.Type.Struct, in_memory := TRUE); END DeclareTemp;
PROCEDURE Compiler (p: P) = VAR size := Target.Address.pack + OpenDepth (p) * Target.Integer.pack; BEGIN Type.Compile (p.element); CG.Declare_open_array (Type.GlobalUID(p), Type.GlobalUID(p.element), size); END Compiler;
DeclareTemp is used in SUBARRAY expressions -- truly temporaries,not variables authored by anyone in Modula-3.
Can this be easily fixed?
Thanks, - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150722/b0e622c2/attachment-0001.html>
More information about the M3devel
mailing list