[M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Thu Aug 16 15:45:05 CEST 2012


diff attached and inline

Index: src/Target.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.m3,v
retrieving revision 1.123
diff -u -r1.123 Target.m3
--- src/Target.m3    7 Nov 2011 19:10:17 -0000    1.123
+++ src/Target.m3    16 Aug 2012 13:40:10 -0000
@@ -400,12 +400,12 @@
     ELSE RETURN FALSE;
     END;
 
-    InitCallingConventions (backend_mode,
-                            System IN SET OF Systems{Systems.I386_INTERIX,
-                                                     Systems.NT386,
-                                                     Systems.I386_NT,
-                                                     Systems.I386_CYGWIN,
-                                                     Systems.I386_MINGW});
+    MaybeInitCallingConventions (backend_mode,
+                                 System IN SET OF Systems{Systems.I386_INTERIX,
+                                                          Systems.NT386,
+                                                          Systems.I386_NT,
+                                                          Systems.I386_CYGWIN,
+                                                          Systems.I386_MINGW});
 
     (* fill in the "bytes" and "pack" fields *)
     FixI (Address, max_align);
@@ -439,6 +439,17 @@
     RETURN TRUE;
   END Init;
 
+CONST DefaultBackendMode = M3BackendMode_t.ExternalAssembly;
+CONST DefaultHasCallingConventions = FALSE;
+
+PROCEDURE MaybeInitCallingConventions(backend_mode: M3BackendMode_t;
+                                      calling_conventions: BOOLEAN) =
+BEGIN
+  IF backend_mode # DefaultBackendMode OR calling_conventions # DefaultHasCallingConventions THEN
+    InitCallingConventions(backend_mode, calling_conventions);
+  END;
+END MaybeInitCallingConventions;
+
 PROCEDURE InitCallingConventions(backend_mode: M3BackendMode_t;
                                  calling_conventions: BOOLEAN) =
   PROCEDURE New(name: TEXT; id: [0..1]): CallingConvention =
@@ -520,4 +531,5 @@
   END ConventionFromID;
 
 BEGIN
+  InitCallingConventions (DefaultBackendMode, DefaultHasCallingConventions);
 END Target.





> Date: Thu, 16 Aug 2012 15:43:08 +0000
> To: m3commit at elegosoft.com
> From: jkrell at elego.de
> Subject: [M3commit] CVS Update: cm3
> 
> CVSROOT:	/usr/cvs
> Changes by:	jkrell at birch.	12/08/16 15:43:08
> 
> Modified files:
> 	cm3/m3-sys/m3middle/src/: Target.m3 
> 
> Log message:
> 	The only reason, seemingly, that m3cgcat needs to know TARGET,
> 	is so it can initialize m3middle.Target, so that calling conventions
> 	are known. The vast majority of targets just have one calling convention,
> 	with id 0. Go ahead and default initialize calling conventions.
> 	Know what the default is, so that we only initialize again later
> 	for the rare case.
> 	
> 	Note that we could optimize this calling convention stuff a fair amount.
> 	The vast majority of targets have one calling convention and so the whole
> 	thing is moot usually. Only NT/x86 will ever have multiple calling conventions.
> 	(i.e. we might as well provide cc with id 1, equal to id 0, so m3cgcat
> 	would work for NT/x86..but not so simple, another factor is if we
> 	are using the integrated backend, and the division of labor of reversing
> 	parameter order and struct return wrt frontend vs. backend -- really,
> 	imho, the division of labor maybe shouldn't be variable like that,
> 	the backends should be consistent..but leave it alone at least for now..)
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20120816/efd08774/attachment-0002.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 1.txt
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20120816/efd08774/attachment-0002.txt>


More information about the M3commit mailing list