[M3devel] frontend misses a few types

Jay K jay.krell at cornell.edu
Wed Apr 17 04:37:15 CEST 2013


Here is what it looks like:


INTERFACE VBT;

TYPE VBT_T = OBJECT METHODS
init(op: PaintOp_T := PaintOp_TransparentSwap;
     txt: Pixmap_T := Pixmap_Gray;
     READONLY delta := Point_T{0});
END;

TYPE Pixmap_T = RECORD Pixmap_T_field: INTEGER END;
CONST Pixmap_Gray = Pixmap_T{1};

TYPE PaintOp_T = RECORD PaintOp_T_field:INTEGER END;
CONST PaintOp_Swap = PaintOp_T{2};
CONST PaintOp_TransparentSwap = PaintOp_T{3};

TYPE Point_T = RECORD Point_T_field: INTEGER END;

END VBT.



INTERFACE HighlightVBT;

IMPORT VBT;
TYPE HighlightVBT_T <: VBT.VBT_T;

END HighlightVBT.



MODULE Main;
IMPORT HighlightVBT;

PROCEDURE Main() =
BEGIN
    NEW(HighlightVBT.HighlightVBT_T).init();
    NEW(HighlightVBT.HighlightVBT_T).init();
END Main;


BEGIN
    Main();
END Main.



unit Main does not receive declare_record for 
  PaintOp_T
  Pixmap_T
  and maybe Point_T

It is somewhat obvious why.
VBT is not directly imported by Main.


Point_T is passed by reference, so the backend can inject
a simple forward declaration:
struct T123; typedef struct T123 T123;


But PaintOp_T and Pixmap_T are passed by value
and it is desirable to have them fully defined, so I can use C's pass by struct by value feature.



Furthermore, multiple calls to init() generate multiple
instances of Point_T{0}.


Anyone interested in fixing it? I'll debug it probably..


 - Jay




From: jay.krell at cornell.edu
To: m3devel at elegosoft.com
Date: Tue, 16 Apr 2013 01:28:16 +0000
Subject: [M3devel] frontend misses a few types




It'd be great to fix this in the frontend.


jbook2:p255 jay$ rm -rf AMD64_DARWIN && /dev2/cm3/m3-sys/cm3/AMD64_DARWIN/cm3 -keep
--- building in AMD64_DARWIN ---

ReadWish /cm3/pkg/libm3/AMD64_DARWIN/libm3.a ffffffffe90634a6
new source -> compiling VBT.i3
new source -> compiling HighlightVBT.i3
new source -> compiling HighlightVBT.m3
new source -> compiling Main.m3
warning: pop_struct: unknown typeid:T79A5AEBB
warning: pop_struct: unknown typeid:T23E73F69
 -> linking pgm
./pgm >stdout.pgm.raw 2>stderr.pgm.raw
jbook2:p255 jay$ pwd
/dev2/cm3/m3-sys/m3tests/src/p2/p255


Also, in this example, each call creates another copy of the default parameter in the module globals.
That should be optimized in the frontend.
The test case here is really small.


 - Jay


> Date: Tue, 16 Apr 2013 03:21:25 +0000
> To: m3commit at elegosoft.com
> From: jkrell at elego.de
> Subject: [M3commit] CVS Update: cm3
> 
> CVSROOT:	/usr/cvs
> Changes by:	jkrell at birch.	13/04/16 03:21:25
> 
> Added files:
> 	cm3/m3-sys/m3tests/src/p2/p255/: HighlightVBT.i3 HighlightVBT.m3 
> 	                                 Main.m3 VBT.i3 m3makefile 
> 
> Log message:
> 	This test case demonstrates a problem
> 	where the frontend doesn't describe all the types
> 	to the backend. And also where it doesn't single-instance
> 	constants that it could/should.
> 	
> 	It is adapted from Trestle and a little of libm3.
> 	It is reduced very much.
> 
 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20130417/1c9ead92/attachment-0002.html>


More information about the M3devel mailing list