[M3commit] CVS Update: cm3

Jay Krell jkrell at elego.de
Thu Feb 18 14:05:00 CET 2010


CVSROOT:	/usr/cvs
Changes by:	jkrell at birch.	10/02/18 14:05:00

Modified files:
	cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 
	                        M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 
	                        M3x86.m3 M3x86Rep.i3 Stackx86.i3 
	                        Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile 

Log message:
	restore it to building
	restore it to working at least well enough for cm3 to work
	probably also all the new 64bit and atomic stuff
	but only minimally tested (ran some new tests, but not
	with the very latest versions)
	some obscuring diff-minimization done here, such as
	renaming interfaes and forwarding constants/types/procedures
	from one interface to another
	still to do maybe try to remove our fork of the older tint/tword
	
	darn, there is a bug still, building showheap fails an assertion
	
	Index: Codex86.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.i3,v
	retrieving revision 1.24
	diff -u -r1.24 Codex86.i3
	--- Codex86.i3	15 Feb 2010 09:25:07 -0000	1.24
	+++ Codex86.i3	18 Feb 2010 13:02:03 -0000
	@@ -11,7 +11,7 @@
	IMPORT M3CG, M3ObjFile, TFloat;
	FROM M3CG IMPORT MType, Label, ByteOffset;
	FROM M3CG_Ops IMPORT ErrorHandler;
	-IMPORT M3x86Rep, Wrx86, Target;
	+IMPORT M3x86Rep, Wrx86, M3BackInt AS Target;
	FROM M3x86Rep IMPORT Operand, NRegs, MVar, x86Var, x86Proc, Regno;
	
	TYPE T <: Public;
	Index: Codex86.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v
	retrieving revision 1.82
	diff -u -r1.82 Codex86.m3
	--- Codex86.m3	18 Feb 2010 11:38:22 -0000	1.82
	+++ Codex86.m3	18 Feb 2010 13:02:03 -0000
	@@ -8,8 +8,8 @@
	
	MODULE Codex86;
	
	-IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target;
	-IMPORT TInt, TWord;
	+IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86;
	+IMPORT M3BackInt AS Target, M3BackInt AS TInt, M3BackWord AS TWord;
	
	FROM TargetMap IMPORT CG_Bytes;
	
	@@ -2316,7 +2316,7 @@
	PROCEDURE init_intvar (t: T; size: ByteSize; f_lit: FLiteral; abscall: AbsCall):
	x86Var =
	VAR intvar: x86Var;
	-      tint: Target.Int;
	+      tint: TInt.TargetInt;
	BEGIN
	intvar := t.parent.declare_global(M3ID.NoID, size, 4,
	Type.Struct, 0, FALSE, TRUE);
	@@ -2324,7 +2324,7 @@
	
	WHILE f_lit # NIL DO
	FOR i := 0 TO f_lit.flit_size - 1 DO
	-        EVAL TInt.FromInt(f_lit.arr[i], Target.Integer.bytes, tint);
	+        EVAL TInt.IntToTargetInt(f_lit.arr[i], tint);
	t.parent.init_int(f_lit.loc + i, tint, Type.Word8);
	END;
	
	@@ -2332,7 +2332,7 @@
	END;
	
	WHILE abscall # NIL DO
	-      t.parent.init_int(abscall.loc, TZero, Type.Int32);
	+      t.parent.init_int(abscall.loc, TInt.TargetIntZero, Type.Int32);
	t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym);
	abscall := abscall.link;
	END;
	Index: M3BackInt.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3BackInt.i3,v
	retrieving revision 1.2
	diff -u -r1.2 M3BackInt.i3
	--- M3BackInt.i3	18 Feb 2010 11:41:37 -0000	1.2
	+++ M3BackInt.i3	18 Feb 2010 13:02:03 -0000
	@@ -6,7 +6,7 @@
	(* Last Modified On Thu Mar 10 13:42:53 PST 1994 By kalsow     *)
	(*      Modified On Thu May 20 08:20:38 PDT 1993 By muller     *)
	
	-INTERFACE M3BackInt;
	+INTERFACE M3BackInt; (* also known as TInt *)
	
	(*  Modula-3 target description
	
	@@ -18,7 +18,16 @@
	otherwise they return FALSE.
	*)
	
	-FROM Target IMPORT Int, IBytes;
	+IMPORT TInt, Target;
	+
	+TYPE
	+  Int = (* OPAQUE *) RECORD
	+    n: CARDINAL;          (* only bytes [0..n-1] contain valid bits *)
	+    x := IBytes{0,..};    (* default is Zero *)
	+  END;
	+  TargetInt = Target.Int;
	+  IBytes = ARRAY [0..7] OF IByte;
	+  IByte = BITS 8 FOR [0..16_ff];
	
	CONST
	Zero      = Int{NUMBER (IBytes), IBytes{ 0,0,..}};
	@@ -108,4 +117,38 @@
	which when sign-extended equal 'i'.  Returns the number of
	significant bytes in the result.  Returns -1 if 'buf' is too short. *)
	
	+PROCEDURE FromTargetInt (READONLY i: Target.Int): Int;
	+
	+TYPE
	+  Int_type = RECORD (* Like Target.Int_type *)
	+    size    : CARDINAL;  (* bit size *)
	+    bytes   : CARDINAL;  (* byte size *)
	+    min     : Int;       (* minimum value of this type *)
	+    max     : Int;       (* maximum value of this type *)
	+  END;
	+
	+VAR (* CONST *)
	+  Integer: Int_type;
	+  Int8: Int_type;
	+  Int16: Int_type;
	+  Int32: Int_type;
	+  Int64: Int_type;
	+  Word8: Int_type;
	+  Word16: Int_type;
	+  Word32: Int_type;
	+  Word64: Int_type;
	+
	+PROCEDURE Init();
	+
	+(* renaming for diff minimization *)
	+CONST TypeNames = Target.TypeNames;
	+CONST FindConvention = Target.FindConvention;
	+CONST IntToTargetInt = TInt.FromInt;
	+CONST TargetIntZero = TInt.Zero;
	+TYPE Float = Target.Float;
	+TYPE Precision = Target.Precision;
	+VAR Extended: Target.Float_type;
	+CONST FloatType = Target.FloatType;
	+PROCEDURE TargetIntToDiagnosticText(a: Int): TEXT;
	+
	END M3BackInt.
	Index: M3BackInt.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3BackInt.m3,v
	retrieving revision 1.2
	diff -u -r1.2 M3BackInt.m3
	--- M3BackInt.m3	18 Feb 2010 11:41:37 -0000	1.2
	+++ M3BackInt.m3	18 Feb 2010 13:02:03 -0000
	@@ -6,10 +6,10 @@
	(* Last Modified On Tue Jul 12 08:31:56 PDT 1994 By kalsow     *)
	(*      Modified On Thu May 20 08:46:32 PDT 1993 By muller     *)
	
	-MODULE M3BackInt;
	+MODULE M3BackInt; (* also known as TInt *)
	
	-IMPORT Word, TWord, Text;
	-FROM Target IMPORT Int, IByte, IBytes;
	+IMPORT Target, Word, Text, Fmt;
	+IMPORT M3BackWord AS TWord;
	
	CONST (* IMPORTS *)
	RShift = Word.RightShift;
	@@ -443,5 +443,52 @@
	RETURN k;
	END ToBytes;
	
	+PROCEDURE FromTargetInt (READONLY i: Target.Int): Int =
	+  BEGIN
	+    FOR j := 4 TO 7 DO
	+      IF i[j] # 0 AND i[j] # 16_FF THEN
	+        RETURN Int{n := 8, x := i};
	+      END;
	+    END;
	+    RETURN Int{n := 4, x := i};
	+  END FromTargetInt;
	+
	+PROCEDURE InitInt(VAR a: Int_type; READONLY b: Target.Int_type) =
	+  BEGIN
	+    a.size := b.size;
	+    a.bytes := b.bytes;
	+    a.min := FromTargetInt(b.min);
	+    a.max := FromTargetInt(b.max);
	+  END InitInt;
	+
	+PROCEDURE Init() =
	+  BEGIN
	+    InitInt(Int8, Target.Int8);
	+    InitInt(Int16, Target.Int16);
	+    InitInt(Int32, Target.Int32);
	+    InitInt(Int64, Target.Int64);
	+    InitInt(Word8, Target.Word8);
	+    InitInt(Word16, Target.Word16);
	+    InitInt(Word32, Target.Word32);
	+    InitInt(Word64, Target.Word64);
	+    InitInt(Integer, Target.Integer);
	+    Extended := Target.Extended;
	+  END Init;
	+
	+PROCEDURE TargetIntToDiagnosticText(a: Int): TEXT =
	+  VAR t: TEXT;
	+  BEGIN
	+    t := "n:";
	+    t := t & Fmt.Unsigned(a.n);
	+    t := t & ",x:";
	+    FOR i := 0 TO 7 DO
	+      t := t & Fmt.Unsigned(a.x[i]);
	+      IF i # 7 THEN
	+        t := t & ",";
	+      END;
	+    END;
	+    RETURN t;
	+  END TargetIntToDiagnosticText;
	+
	BEGIN
	END M3BackInt.
	Index: M3BackWord.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3BackWord.i3,v
	retrieving revision 1.2
	diff -u -r1.2 M3BackWord.i3
	--- M3BackWord.i3	18 Feb 2010 11:41:37 -0000	1.2
	+++ M3BackWord.i3	18 Feb 2010 13:02:03 -0000
	@@ -6,7 +6,7 @@
	(* Last Modified On Fri Nov 19 09:32:50 PST 1993 By kalsow     *)
	(*      Modified On Thu May 20 08:20:38 PDT 1993 By muller     *)
	
	-INTERFACE M3BackWord;
	+INTERFACE M3BackWord; (* also known as TWord *)
	
	(*  Modula-3 target description
	
	@@ -18,7 +18,7 @@
	otherwise they return FALSE.
	*)
	
	-FROM Target IMPORT Int;
	+FROM M3BackInt IMPORT Int;
	
	PROCEDURE New (READONLY chars: ARRAY OF CHAR;  base: [2..16];  n: CARDINAL;
	VAR i: Int): BOOLEAN;
	Index: M3BackWord.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3BackWord.m3,v
	retrieving revision 1.2
	diff -u -r1.2 M3BackWord.m3
	--- M3BackWord.m3	18 Feb 2010 11:41:37 -0000	1.2
	+++ M3BackWord.m3	18 Feb 2010 13:02:03 -0000
	@@ -6,10 +6,10 @@
	(* Last Modified On Fri Nov 19 09:32:56 PST 1993 By kalsow     *)
	(*      Modified On Thu May 20 08:46:32 PDT 1993 By muller     *)
	
	-MODULE M3BackWord;
	+MODULE M3BackWord; (* also known as TWord *)
	
	-IMPORT Word, TInt;
	-FROM Target IMPORT Int, IByte, IBytes;
	+IMPORT Word, M3BackInt, M3BackInt AS TInt;
	+FROM M3BackInt IMPORT Int, IByte, IBytes;
	
	CONST (* IMPORTS *)
	RShift = Word.RightShift;
	Index: M3x86.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v
	retrieving revision 1.130
	diff -u -r1.130 M3x86.m3
	--- M3x86.m3	18 Feb 2010 11:38:22 -0000	1.130
	+++ M3x86.m3	18 Feb 2010 13:02:04 -0000
	@@ -8,7 +8,8 @@
	MODULE M3x86 EXPORTS M3x86, M3x86Rep;
	
	IMPORT Wr, Text, Fmt, IntRefTbl, Word;
	-IMPORT M3CG, M3ID, M3CG_Ops, Target, TInt, TFloat, TWord;
	+IMPORT M3CG, M3ID, M3CG_Ops, M3BackInt AS Target, TFloat;
	+IMPORT M3BackInt AS TInt, M3BackWord AS TWord;
	IMPORT M3ObjFile, TargetMap;
	
	FROM TargetMap IMPORT CG_Bytes;
	@@ -25,6 +26,7 @@
	
	IMPORT Wrx86, Stackx86, Codex86;
	
	+FROM M3BackInt IMPORT TargetInt;
	FROM Stackx86 IMPORT MaxMin;
	FROM Codex86 IMPORT Cond, Op, FOp, FIm, unscond, revcond, FloatBytes;
	
	@@ -252,6 +254,7 @@
	IntType[Type. Int64] := Target.Int64;
	IntType[Type.Word32] := Target.Word32;
	IntType[Type.Word64] := Target.Word64;
	+    TInt.Init();
	
	IF logfile # NIL THEN
	u.debug := TRUE;
	@@ -492,8 +495,10 @@
	END declare_set;
	
	PROCEDURE declare_subrange (u: U; t, domain: TypeUID;
	-                            READONLY min, max: Target.Int;
	+                            READONLY xmin, xmax: TargetInt;
	s: BitSize) =
	+  VAR min := TInt.FromTargetInt(xmin);
	+      max := TInt.FromTargetInt(xmax);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd  ("declare_subrange");
	@@ -1090,9 +1095,10 @@
	u.init_varstore := NIL;
	END end_init;
	
	-PROCEDURE init_int (u: U; o: ByteOffset; READONLY value: Target.Int; t: Type) =
	+PROCEDURE init_int (u: U; o: ByteOffset; READONLY xvalue: TargetInt; t: Type) =
	VAR bytes := ARRAY [0..7] OF [0..255]{0, ..};
	len: CARDINAL := 0;
	+      value := TargetIntToBackInt(xvalue);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd   ("init_int");
	@@ -1805,8 +1811,9 @@
	u.vstack.pushimmT(TZero, Type.Addr);
	END load_nil;
	
	-PROCEDURE load_integer  (u: U;  t: IType;  READONLY i: Target.Int) =
	+PROCEDURE load_integer  (u: U;  t: IType;  READONLY j: TargetInt) =
	(* push ; s0.t := i *)
	+  VAR i := TInt.FromTargetInt(j);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd   ("load_integer");
	@@ -3174,9 +3181,10 @@
	END;
	END check_nil;
	
	-PROCEDURE check_lo (u: U;  t: IType;  READONLY i: Target.Int;  code: RuntimeError) =
	+PROCEDURE check_lo (u: U;  t: IType;  READONLY j: TargetInt;  code: RuntimeError) =
	(* IF (s0.t < i) THEN abort(code) *)
	VAR safelab: Label;
	+      i := TInt.FromTargetInt(j);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd   ("check_lo");
	@@ -3210,9 +3218,10 @@
	END
	END check_lo;
	
	-PROCEDURE check_hi (u: U;  t: IType;  READONLY i: Target.Int;  code: RuntimeError) =
	+PROCEDURE check_hi (u: U;  t: IType;  READONLY j: TargetInt;  code: RuntimeError) =
	(* IF (i < s0.t) THEN abort(code) *)
	VAR safelab: Label;
	+      i := TInt.FromTargetInt(j);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd   ("check_hi");
	@@ -3246,10 +3255,12 @@
	END
	END check_hi;
	
	-PROCEDURE check_range (u: U;  t: IType;  READONLY a, b: Target.Int;  code: RuntimeError) =
	+PROCEDURE check_range (u: U;  t: IType;  READONLY xa, xb: TargetInt;  code: RuntimeError) =
	(* IF (s0.t < a) OR (b < s0.t) THEN abort(code) *)
	VAR lo, hi: Target.Int;
	safelab, outrange: Label;
	+      a := TInt.FromTargetInt(xa);
	+      b := TInt.FromTargetInt(xb);
	BEGIN
	IF u.debug THEN
	u.wr.Cmd   ("check_range");
	@@ -3278,9 +3289,9 @@
	ELSIF TInt.LT(hi, a) OR TInt.LT(b, lo) THEN
	reportfault(u, code);
	ELSIF TInt.LE(hi, b) THEN
	-          check_lo(u, t, a, code);
	+          check_lo(u, t, xa, code);
	ELSIF TInt.GE(lo, a) THEN
	-          check_hi(u, t, b, code);
	+          check_hi(u, t, xb, code);
	ELSIF TInt.EQ(a, TZero) THEN
	(* 0 <= x <= b  ==>   UNSIGNED(x) <= b *)
	safelab := u.cg.reserve_labels(1, TRUE);
	Index: M3x86Rep.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86Rep.i3,v
	retrieving revision 1.31
	diff -u -r1.31 M3x86Rep.i3
	--- M3x86Rep.i3	18 Feb 2010 11:38:22 -0000	1.31
	+++ M3x86Rep.i3	18 Feb 2010 13:02:04 -0000
	@@ -8,7 +8,7 @@
	
	INTERFACE M3x86Rep;
	
	-IMPORT M3CG, M3ID, Target, TInt;
	+IMPORT M3CG, M3ID, M3BackInt AS TInt, M3BackInt AS Target;
	
	FROM M3CG IMPORT ByteOffset, ByteSize, Alignment;
	FROM M3CG IMPORT Var, Proc, Name;
	@@ -161,4 +161,6 @@
	
	VAR(*CONST*) IntType: ARRAY IType OF Target.Int_type;
	
	+CONST TargetIntToBackInt = TInt.FromTargetInt;
	+
	END M3x86Rep.
	Index: Stackx86.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Stackx86.i3,v
	retrieving revision 1.16
	diff -u -r1.16 Stackx86.i3
	--- Stackx86.i3	12 Feb 2010 13:43:17 -0000	1.16
	+++ Stackx86.i3	18 Feb 2010 13:02:04 -0000
	@@ -11,7 +11,7 @@
	FROM M3CG IMPORT Type, MType, ZType, IType, Sign, ByteOffset;
	FROM M3CG_Ops IMPORT ErrorHandler;
	
	-IMPORT M3x86Rep, Codex86, Wrx86, Target;
	+IMPORT M3x86Rep, Codex86, Wrx86, M3BackInt AS Target;
	FROM M3x86Rep IMPORT Operand, OLoc, MVar, Regno, Force, RegSet, FlToInt;
	FROM M3x86Rep IMPORT x86Proc, x86Var, OperandPart;
	
	Index: Stackx86.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Stackx86.m3,v
	retrieving revision 1.96
	diff -u -r1.96 Stackx86.m3
	--- Stackx86.m3	18 Feb 2010 11:38:22 -0000	1.96
	+++ Stackx86.m3	18 Feb 2010 13:02:04 -0000
	@@ -9,7 +9,8 @@
	
	IMPORT M3ID, M3CG, TargetMap, M3CG_Ops, M3x86Rep, Codex86, Wrx86;
	
	-IMPORT Target, TInt, TWord, Fmt;
	+IMPORT M3BackInt AS TInt, M3BackWord AS TWord;
	+IMPORT M3BackInt AS Target, Fmt;
	FROM Target IMPORT FloatType;
	FROM TargetMap IMPORT CG_Bytes, CG_Align_bytes;
	
	Index: Wrx86.i3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Wrx86.i3,v
	retrieving revision 1.2
	diff -u -r1.2 Wrx86.i3
	--- Wrx86.i3	6 Feb 2010 14:24:55 -0000	1.2
	+++ Wrx86.i3	18 Feb 2010 13:02:04 -0000
	@@ -8,7 +8,7 @@
	
	INTERFACE Wrx86;
	
	-IMPORT Wr, Target;
	+IMPORT Wr, M3BackInt AS Target;
	
	FROM M3CG IMPORT Name, TypeUID;
	FROM M3CG IMPORT Var, Proc, Label;
	Index: Wrx86.m3
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Wrx86.m3,v
	retrieving revision 1.8
	diff -u -r1.8 Wrx86.m3
	--- Wrx86.m3	18 Feb 2010 11:38:22 -0000	1.8
	+++ Wrx86.m3	18 Feb 2010 13:02:04 -0000
	@@ -9,7 +9,7 @@
	MODULE Wrx86;
	
	IMPORT Wr, Thread, Text;
	-IMPORT M3Buf, M3ID, M3CG, Target, TInt AS TargetInt, TFloat;
	+IMPORT M3Buf, M3ID, M3CG, M3BackInt, M3BackInt AS Target, TFloat;
	
	FROM M3CG IMPORT Name, TypeUID;
	FROM M3CG IMPORT Var, Proc, Label, No_label;
	@@ -153,8 +153,8 @@
	PROCEDURE TInt (t: T;  READONLY i: Target.Int) =
	VAR
	buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR;
	-    len := TargetInt.ToChars (i, buf);
	-  BEGIN
	+    len := M3BackInt.ToChars (i, buf);
	+ BEGIN
	OutC (t, ' ');
	OutS (t, SUBARRAY (buf, 0, len));
	OutC (t, ' ');
	Index: m3makefile
	===================================================================
	RCS file: /usr/cvs/cm3/m3-sys/m3back/src/m3makefile,v
	retrieving revision 1.3
	diff -u -r1.3 m3makefile
	--- m3makefile	25 Jul 2009 17:44:33 -0000	1.3
	+++ m3makefile	18 Feb 2010 13:02:04 -0000
	@@ -11,6 +11,8 @@
	import ("m3middle")
	import ("m3objfile")
	
	+module ("M3BackInt")
	+module ("M3BackWord")
	Module    ("M3x86")
	interface ("M3x86Rep")
	module    ("Wrx86")




More information about the M3commit mailing list