From hosking at elego.de Mon Feb 1 07:18:34 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 1 Feb 2010 7:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201061835.0A5662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/01 07:18:34 Modified files: cm3/doc/reference/: syntax.html Log message: Correction: include "~" in OtherChar. From jkrell at elego.de Mon Feb 1 12:45:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:45:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201114521.3DAD82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:45:20 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup to std, variable to add -debug to switches (I use this while working on longint/int64 for nt386) From jkrell at elego.de Mon Feb 1 12:58:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:58:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201115840.1CCB62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:58:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 13:00:07 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 13:00:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201120007.4C5F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 13:00:07 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 14:25:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:25:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132503.EC58D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:25:03 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: fix Abs for positive input From jkrell at elego.de Mon Feb 1 14:28:46 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:28:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132846.450302474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:28:46 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Log message: copy TInt, TWord from head; in particular because I was hitting an assertion failure in TInt line 42 building cvsup; taking everything is overkill and maybe won't even fix it, but should be ok From jkrell at elego.de Mon Feb 1 14:33:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:33:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133338.172582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:33:37 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 RsyncFile.m3 TokScan.m3 UnixMisc.m3 m3makefile cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: release_branch_cm3_5_8 DevT.m3 Log message: copy from head From jkrell at elego.de Mon Feb 1 14:37:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:37:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133737.F1E252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:37:37 Modified files: cm3/m3-tools/cvsup/suptcp/src/common/: Tag: release_branch_cm3_5_8 SupErrnoC.c Log message: copy from head: #define _REENTRANT on Interix, I think this code is dead anyway From jay.krell at cornell.edu Mon Feb 1 14:34:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 13:34:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201133338.172582474001@birch.elegosoft.com> References: <20100201133338.172582474001@birch.elegosoft.com> Message-ID: diff attached > Date: Mon, 1 Feb 2010 14:33:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 14:33:37 > > Modified files: > cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 > RsyncFile.m3 TokScan.m3 > UnixMisc.m3 m3makefile > cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: > release_branch_cm3_5_8 > DevT.m3 > > Log message: > copy from head > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Mon Feb 1 14:45:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:45:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134504.ADB032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:45:03 Modified files: cm3/doc/help/cm3/m3build/: exports.html Log message: copy from release (change from August 21 2009) From jkrell at elego.de Mon Feb 1 14:47:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:47:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134737.7AAA52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:47:36 Modified files: cm3/m3-comm/tcp/src/POSIX/: Tag: release_branch_cm3_5_8 HerrnoC.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 14:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134846.37AB02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:48:45 Modified files: cm3/m3-lectern/lecternclient/src/POSIX/: Tag: release_branch_cm3_5_8 LecternClient.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 15:05:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:05:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201140537.5DC1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:05:37 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 Target.m3 Log message: bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) From jkrell at elego.de Mon Feb 1 15:19:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:19:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201141907.65F192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:19:06 Modified files: cm3/m3-sys/m3gdb/gdb/gdb/: Tag: release_branch_cm3_5_8 m3-util.c Log message: copy from head: crude but effective platform sniffing -- if it contains '64' or 'ALPHA' it is 64bit, if it contains 'NT386' it is NT386 (what about I386_NT?), if it contains '32' it is not 64bit ('other') From jkrell at elego.de Mon Feb 1 15:21:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:21:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142125.596AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:21:24 Modified files: cm3/m3-ui/anim3D/src/win-opengl/: Tag: release_branch_cm3_5_8 Win_OpenGL_Base.m3 Log message: copy from head: fix asserts to be #False instead of =True, since any non-zero value is considered success, not just 1 From jkrell at elego.de Mon Feb 1 15:23:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:23:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142354.032332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:23:53 Modified files: cm3/www/uploaded-archives/: Tag: release_branch_cm3_5_8 targets.txt Log message: copy from head: add AMD64_NETBSD and AMD64_OPENBSD From jkrell at elego.de Mon Feb 1 15:34:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:34:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201143447.492802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:34:47 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$, it makes for noisy diffs one newline at ends of files is enough, some had two, remove one one had zero, add one From jkrell at elego.de Mon Feb 1 15:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144130.5C6672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:41:30 Modified files: cm3/scripts/: README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo-new.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/regression/: loop.py cm3/scripts/win/: clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$ ensure files end in one newline, not two, not zero From jkrell at elego.de Mon Feb 1 15:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144315.0A3D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:43:15 Modified files: cm3/m3-sys/mklib/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: copy minor changes from head: BYTE to UINT8, <*UNALIGNED*> TO (*UNALIGNED*) (nonexistant pragma to comment, BYTESIZE would be wrong here due to padding/alignment and isn't used From jay.krell at cornell.edu Mon Feb 1 15:47:54 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 14:47:54 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201140537.5DC1C2474001@birch.elegosoft.com> References: <20100201140537.5DC1C2474001@birch.elegosoft.com> Message-ID: actually I accidentally had a bunch of head files in my release tree, oops good that I caught it - Jay > Date: Mon, 1 Feb 2010 15:05:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 15:05:37 > > Modified files: > cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 > Target.m3 > > Log message: > bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 1 16:06:05 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:06:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201150606.1DF522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:06:05 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.m3 Log message: import Fmt From jkrell at elego.de Mon Feb 1 16:10:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:10:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151036.A85AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:10:36 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix warnings: remove unused consts (they were used with -defaultlib:libc that I removed) From jkrell at elego.de Mon Feb 1 16:11:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:11:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151147.8DC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:11:47 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 NTObjFile.m3 Log message: copy from head: remove -defaultlib:libc, add appendBytes that I think I might need, fold common code (albeit using unsafe, can we have it both ways? eliminate redundancy and keep safety?) From jkrell at elego.de Mon Feb 1 16:18:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:18:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151828.F2D992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:18:28 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: provide HasTrestle to replace HasGui From jkrell at elego.de Mon Feb 1 16:19:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:19:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151953.571D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:19:53 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: wrap HasTrestle, HasOpenGL in ifndef so that others can override From jkrell at elego.de Mon Feb 1 16:21:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:21:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201152134.D2EBC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:21:34 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace only, and only one of them at that From jkrell at elego.de Mon Feb 1 16:33:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:33:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201153309.E23092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:33:09 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 FileAttr.m3 RCSFile.m3 Log message: copy from head, I though I already had: fixes related to filesize=LONGINT From jkrell at elego.de Mon Feb 1 17:11:23 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 17:11:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201161124.032D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 17:11:23 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadInterix.c ThreadPThreadC.c m3makefile Log message: interix support (partial) From jkrell at elego.de Mon Feb 1 18:34:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 18:34:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201173421.6851C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 18:34:21 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: initial guesses for insert64 and extract64 (need to check if sign extension is ever requested, and of course we could optimize by providing two functions since sign extension is a constant early enough From jkrell at elego.de Mon Feb 1 20:17:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:17:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201191728.A55F42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. From jkrell at elego.de Mon Feb 1 20:31:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:31:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201193142.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:31:42 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 M3ObjFile.i3 Log message: I thought I commited this file already, oops. From jkrell at elego.de Tue Feb 2 09:21:31 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 2 Feb 2010 9:21:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100202082131.D18042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/02 09:21:31 Modified files: cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Log message: changfe parameter name from 'two' to 'to' From hosking at cs.purdue.edu Tue Feb 2 18:19:16 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 2 Feb 2010 12:19:16 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201191728.A55F42474001@birch.elegosoft.com> References: <20100201191728.A55F42474001@birch.elegosoft.com> Message-ID: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 3 06:22:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 05:22:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 3 06:52:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 00:52:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 3 06:53:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 6:53:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203055330.B58412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 06:53:30 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: The prior fix was broken. The problem lies elsewhere. From hosking at elego.de Wed Feb 3 07:26:21 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 7:26:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203062622.299E42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 07:26:21 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:31:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:31:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083130.5199E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:31:30 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: A cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:33:44 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:33:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083344.BA7002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:33:44 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: A cleaner fix for e029. From jay.krell at cornell.edu Wed Feb 3 12:43:50 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 11:43:50 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: That is legal? What does it mean? What can you do it with t? I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. - Jay From: hosking at cs.purdue.edu Date: Wed, 3 Feb 2010 00:52:34 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 14:50:56 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:50:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135057.949332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:50:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 M3x86.m3 Log message: 'two' => 'to' From jkrell at elego.de Wed Feb 3 14:53:45 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:53:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135345.9E9692474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:53:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce OperandPart = [0..1], OperandSize = [1..2], in support of int64/longint and the notion of multi-register operands (though unfortunately zero extending an INTEGER is going to eat a register for the zero instead of being split between register and immediate, but maybe we should sign extend anyway) From jkrell at elego.de Wed Feb 3 14:56:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:56:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135622.018912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:56:21 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Log message: some use of OperandPart, OperandSize From jkrell at elego.de Wed Feb 3 14:57:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:57:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135724.8FD0F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:57:24 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: use M3x86Rep.RegName instead of local nearly exact copy (debug output only) From jkrell at elego.de Wed Feb 3 15:00:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:00:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140048.103BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:00:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust some assertions From jkrell at elego.de Wed Feb 3 15:01:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:01:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140132.A83D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:01:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust error message From jkrell at elego.de Wed Feb 3 15:02:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:02:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140218.763622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:02:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust formating From jkrell at elego.de Wed Feb 3 15:04:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:04:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140457.E6DC32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:04:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add more asserts and diagnostics From jkrell at elego.de Wed Feb 3 15:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140616.4CFC12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:06:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix set_label debug output From jkrell at elego.de Wed Feb 3 15:26:53 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:26:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203142655.534F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:26:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: add operandPart parameters in many places possibly we could do this less via the data (to be) stored in reguse From jkrell at elego.de Wed Feb 3 15:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143140.0468B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:31:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add GetTypeSize and GetOperandSize: besides bits and bytes, a new unit of measure is 'words' or 'registers', maybe unfortunate but I've been weighing a while and it seems useful From jkrell at elego.de Wed Feb 3 15:37:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:37:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143723.7A4032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:37:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt pushnew1 for multi-part operands (int64/longint) From jkrell at elego.de Wed Feb 3 15:39:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:39:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143918.766C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:39:18 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'src_mvar' in procedure push From hosking at cs.purdue.edu Wed Feb 3 15:40:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 09:40:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: On 3 Feb 2010, at 06:43, Jay K wrote: > That is legal? What does it mean? What can you do it with t? It's a variable of type NULL. It can only hold the NIL reference. Agreed, it is not particularly useful. The warning is there to distinguish: VAR t: NULL which a programmer presumably intended to write, from VAR t:= complicated expression of type NULL (perhaps hidden through various type renaming) which the programmer possibly did not intend to write. > I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 3 Feb 2010 00:52:34 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Clearly the source code is not legal. It's just that your change breaks legal code: > > VAR t: NULL; > > which should emit a warning but nothing else. > > The problem lies elsewhere... > > > On 3 Feb 2010, at 00:22, Jay K wrote: > > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 15:44:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:44:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203144420.8934D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:44:20 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adaptions for push and pop for multipart operands (int64/longint) From jkrell at elego.de Wed Feb 3 16:45:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 16:45:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203154530.D35B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 16:45:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: end_init is seemingly the last call, so need to flush the debug output there (really I'm not sure it is the last, but I know its output is often truncated and near the end and flushing fixes that, could be we should flush for every function); also adapt 'Is64' => more abstract 'GetTypeSize' From jkrell at elego.de Wed Feb 3 17:23:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 17:23:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203162301.6E2D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 17:23:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86Rep.i3 Log message: move the register constants to M3x86 to show and preserve their correspondence with RegName From jkrell at elego.de Wed Feb 3 18:47:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:47:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174748.5F33E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:47:48 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: check_hi/lo/range/index/eq From jkrell at elego.de Wed Feb 3 18:48:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:48:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174841.4DE7B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:48:41 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Log message: remove old versions change not-yet-used functions to __stdcall From rodney_bates at lcwb.coop Wed Feb 3 20:13:48 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Wed, 03 Feb 2010 13:13:48 -0600 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: <4B69CAEC.7080308@lcwb.coop> Tony Hosking wrote: > On 3 Feb 2010, at 06:43, Jay K wrote: > >> That is legal? What does it mean? What can you do it with t? > > It's a variable of type NULL. It can only hold the NIL reference. > Agreed, it is not particularly useful. > > The warning is there to distinguish: > > VAR t: NULL > > which a programmer presumably intended to write, from > > VAR t:= complicated expression of type NULL (perhaps hidden through > various type renaming) > > which the programmer possibly did not intend to write. IMO, the appropriate thing for the front end to do is not to set the type of r to NULL, which is a perfectly valid Modula-3 type, but rather to an internal value named TypeUnknownBecauseOfAPriorError. Then make all warning/error checks silently succeed when applied to such unknown types, or anything else unknown in his way. > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and >> it didn't break anything. >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Wed, 3 Feb 2010 00:52:34 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> Clearly the source code is not legal. It's just that your change >> breaks legal code: >> >> VAR t: NULL; >> >> which should emit a warning but nothing else. >> >> The problem lies elsewhere... >> >> >> On 3 Feb 2010, at 00:22, Jay K wrote: >> >> The backend should be able to cope with almost anything, I guess. >> But is the source code really legal? >> Shouldn't the front end error? >> The front end should error on some things, obviously. >> >> Notice that all of the "internal errors" in this scenario are from >> the front end. Just the assertion failure is not. >> >> >> The front end doesn't handle its own stack correctly >> here, the errors come from its CG.m3 module that wraps >> the backend. >> >> If this code is truly illegal and has no valid meaning, I think >> this is an ok change. >> The NT386 backend I guess should be hardened against front end >> bugs though. >> >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Tue, 2 Feb 2010 12:19:16 -0500 >> To: jkrell at elego.de >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> That's the wrong approach. A warning is not an error. The >> backend should be able to cope with it... >> >> Antony Hosking | Associate Professor | Computer Science | Purdue >> University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> On 1 Feb 2010, at 20:17, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/01 20:17:28 >> >> Modified files: >> cm3/m3-sys/m3front/src/values/: Variable.m3 >> >> Log message: >> test case e0\e029: >> >> MODULE Main; >> TYPE Rec = RECORD a: INTEGER END; >> VAR r := Rec; (* warning: variable has type NULL *) >> BEGIN >> INC(r.a) >> END Main. >> >> followed by internal errors and an assertion failure in m3back >> >> Change warning to error, and then it never gets to the >> internal errors. >> >> >> >> >> > From jay.krell at cornell.edu Wed Feb 3 21:11:44 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 20:11:44 +0000 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: <4B69CAEC.7080308@lcwb.coop> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , , , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> , , <4B69CAEC.7080308@lcwb.coop> Message-ID: > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. The compiler does apparently do stuff like that in general. Tony put in use of "ErrType.T". - Jay > Date: Wed, 3 Feb 2010 13:13:48 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 (Warning, type is NULL) > > > > Tony Hosking wrote: > > On 3 Feb 2010, at 06:43, Jay K wrote: > > > >> That is legal? What does it mean? What can you do it with t? > > > > It's a variable of type NULL. It can only hold the NIL reference. > > Agreed, it is not particularly useful. > > > > The warning is there to distinguish: > > > > VAR t: NULL > > > > which a programmer presumably intended to write, from > > > > VAR t:= complicated expression of type NULL (perhaps hidden through > > various type renaming) > > > > which the programmer possibly did not intend to write. > > IMO, the appropriate thing for the front end to do is not to set the > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. > > > > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and > >> it didn't break anything. > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Wed, 3 Feb 2010 00:52:34 -0500 > >> To: jay.krell at cornell.edu > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> Clearly the source code is not legal. It's just that your change > >> breaks legal code: > >> > >> VAR t: NULL; > >> > >> which should emit a warning but nothing else. > >> > >> The problem lies elsewhere... > >> > >> > >> On 3 Feb 2010, at 00:22, Jay K wrote: > >> > >> The backend should be able to cope with almost anything, I guess. > >> But is the source code really legal? > >> Shouldn't the front end error? > >> The front end should error on some things, obviously. > >> > >> Notice that all of the "internal errors" in this scenario are from > >> the front end. Just the assertion failure is not. > >> > >> > >> The front end doesn't handle its own stack correctly > >> here, the errors come from its CG.m3 module that wraps > >> the backend. > >> > >> If this code is truly illegal and has no valid meaning, I think > >> this is an ok change. > >> The NT386 backend I guess should be hardened against front end > >> bugs though. > >> > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Tue, 2 Feb 2010 12:19:16 -0500 > >> To: jkrell at elego.de > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> That's the wrong approach. A warning is not an error. The > >> backend should be able to cope with it... > >> > >> Antony Hosking | Associate Professor | Computer Science | Purdue > >> University > >> 305 N. University Street | West Lafayette | IN 47907 | USA > >> Office +1 765 494 6001 | Mobile +1 765 427 5484 > >> > >> > >> > >> > >> On 1 Feb 2010, at 20:17, Jay Krell wrote: > >> > >> CVSROOT: /usr/cvs > >> Changes by: jkrell at birch. 10/02/01 20:17:28 > >> > >> Modified files: > >> cm3/m3-sys/m3front/src/values/: Variable.m3 > >> > >> Log message: > >> test case e0\e029: > >> > >> MODULE Main; > >> TYPE Rec = RECORD a: INTEGER END; > >> VAR r := Rec; (* warning: variable has type NULL *) > >> BEGIN > >> INC(r.a) > >> END Main. > >> > >> followed by internal errors and an assertion failure in m3back > >> > >> Change warning to error, and then it never gets to the > >> internal errors. > >> > >> > >> > >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 21:29:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:29:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203202908.83E2C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:29:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: return boolean instead From jkrell at elego.de Wed Feb 3 21:30:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:30:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203026.4F9672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:30:26 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: add eq, ne, lt, le, gt, ge, maybe we can avoid using these From jkrell at elego.de Wed Feb 3 21:31:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:31:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203201.4B3EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:31:59 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and unsigned lt,le,gt,ge From jkrell at elego.de Wed Feb 3 21:33:03 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:33:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203303.DC3D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:33:03 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and then all the check functions except range should be redundant From hosking at elego.de Thu Feb 4 03:02:57 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:02:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020257.DCA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:02:57 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:03:10 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:03:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020310.B64AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:03:10 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:04:00 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020400.9C6422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:00 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinWr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:04:16 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020416.506312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:16 Modified files: cm3/m3-sys/m3middle/src/: M3CG_Wr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:08:47 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:08:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020847.DF62A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:08:47 Removed files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXOr.mg Log message: Fixing capitalization. From hosking at elego.de Thu Feb 4 03:11:30 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:11:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204021130.A70942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:11:30 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg CompareSwap.mg FetchDec.mg FetchInc.mg Load.mg cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Added files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXor.mg Log message: Push through remaining atomics support. It will compile things now. But still needs testing... From jkrell at elego.de Thu Feb 4 07:21:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 4 Feb 2010 7:21:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204062104.93D0C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/04 07:21:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: some cosmetic ahead of other changes From hosking at elego.de Thu Feb 4 21:00:46 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 21:00:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204200046.D566A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 21:00:46 Modified files: cm3/m3-sys/m3front/src/builtinWord/: m3makefile word.tmpl Added files: cm3/m3-sys/m3front/src/builtinWord/: And.ig And.mg Divide.ig Divide.mg Extract.ig Extract.mg GE.ig GE.mg GT.ig GT.mg Insert.ig Insert.mg LE.ig LE.mg LT.ig LT.mg Minus.ig Minus.mg Mod.ig Mod.mg Module.ig Module.mg Not.ig Not.mg Or.ig Or.mg Plus.ig Plus.mg Rotate.ig Rotate.mg Shift.ig Shift.mg Times.ig Times.mg Xor.ig Xor.mg Removed files: cm3/m3-sys/m3front/src/builtinWord/: GenAnd.ig GenAnd.mg GenDivide.ig GenDivide.mg GenExtract.ig GenExtract.mg GenGE.ig GenGE.mg GenGT.ig GenGT.mg GenInsert.ig GenInsert.mg GenLE.ig GenLE.mg GenLT.ig GenLT.mg GenMinus.ig GenMinus.mg GenMod.ig GenMod.mg GenModule.ig GenModule.mg GenNot.ig GenNot.mg GenOr.ig GenOr.mg GenPlus.ig GenPlus.mg GenRotate.ig GenRotate.mg GenShift.ig GenShift.mg GenTimes.ig GenTimes.mg GenXor.ig GenXor.mg Log message: A more sensible naming scheme. From jkrell at elego.de Fri Feb 5 07:48:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:48:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205064852.D686A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:48:51 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: work in progress: adapt procedure find for int64/longint From jkrell at elego.de Fri Feb 5 07:56:03 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:56:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065605.2A5B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:56:03 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swapreg for int64/longint From jkrell at elego.de Fri Feb 5 07:59:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:59:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065936.68D2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:59:36 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure unlock for int64/longint From jkrell at elego.de Fri Feb 5 08:01:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:01:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205070148.820922474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:01:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure set_reg, loadreg, loadphantom for int64/longint From jkrell at elego.de Fri Feb 5 08:43:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:43:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205074345.C96B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:43:45 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure newdest for int64/longint From jkrell at elego.de Fri Feb 5 09:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 9:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205084023.0AA7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 09:40:22 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure sweep for int64/longint From jkrell at elego.de Fri Feb 5 10:05:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:05:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205090505.0613F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:05:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'dest_mvar' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205091053.77C032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:10:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'stack0' to 'src_stack0' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:20:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:20:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092012.D88AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:20:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:24:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:24:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092442.DEA2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:24:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: further adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:29:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:29:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092953.6EBC22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:29:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix previous to compile and a little more adjustment for int64/longint From jkrell at elego.de Fri Feb 5 10:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094130.C12BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:41:30 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swawp for int64/longint From jkrell at elego.de Fri Feb 5 10:48:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:48:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094842.55B522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:48:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. From jkrell at elego.de Fri Feb 5 11:12:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 11:12:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205101214.0DA182474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 11:12:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: in doloophole, use the locals that I added and add asserts From jkrell at elego.de Fri Feb 5 12:40:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:40:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114026.DA1762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:40:26 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'Is64' => 'GetTypeSize', so to speak (not a direct replacement, but close) From jkrell at elego.de Fri Feb 5 12:42:01 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:42:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114201.D31962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:42:01 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: add an assert (related to int64/longint) From jkrell at elego.de Fri Feb 5 12:45:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:45:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114503.0D0032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:45:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: make findbin less confusing but equivalent, more like the historical version From jkrell at elego.de Fri Feb 5 12:49:28 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:49:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114930.64E5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:49:28 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 M3x86.m3 Log message: flush the debug output at every newline (none of this is in the default path, you have to say cm3 -debug; it is very useful stuff though); otherwise the debug output would be truncated in the case of assertion failures, etc. From jkrell at elego.de Fri Feb 5 13:02:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:02:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205120234.B2F462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:02:34 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: oops on the flush: flush, don't recurse infinite From jkrell at elego.de Fri Feb 5 13:33:57 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:33:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205123358.040BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:33:57 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure discard fori nt64/longint From jkrell at elego.de Fri Feb 5 13:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124027.743592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:40:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: add NonVolatileRegisters, VolatileRegisters, AllRegisters they are const but the first two at least could become variables if/when we adapt to other platforms (depending on their calling conventions) not sure we'll get around to optimizing based on the distinction though, this backend always preserves all nonvolatile registers in every prologue/epilogue I believe, no matter which a function uses From jkrell at elego.de Fri Feb 5 13:43:21 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:43:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124321.534DF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:43:21 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: remove ESP and EBP from the register sets because they are 'special' (right, sorry, not a technical term..) From jkrell at elego.de Fri Feb 5 13:45:47 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:45:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124547.B58212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:45:47 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comments only From jkrell at elego.de Fri Feb 5 14:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131055.AECF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:10:55 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Codex86.m3 Log message: adapt load_indirect and store_indirect for int64/longint the structure here is oddly asymmetric load_indirect implementation is mostly in m3x86.m3 and adaption there store_indirect implementation is mostly in stackx86.m3 but I put adaption in codex86.m3, probably could be in stack though also inline_copy seems to do wierd things here..so the adaption is very conservative..maybe a sign it really belong in stackx86.m3 From jkrell at elego.de Fri Feb 5 14:15:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:15:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131515.2EB912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:15:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't know why in_proc_call is limited to 2; it seems fairly harmless to raise it (it'll waste memory on the fixed size arrays) so raise it to 10; enforce the limit with a subrange instead of an assert (that is better Modula-3 style, right?); we should try to construct some 'complex' code to see if we can get the value over 2 or even 10 From jkrell at elego.de Fri Feb 5 14:16:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:16:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131651.0E6502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:16:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: again 'Is64' => 'GetTypeSize', again somewhat apples/oranges, but the diff makes sense From jkrell at elego.de Fri Feb 5 14:34:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:34:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205133412.582522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:34:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: bring in all the code for add/sub/mult/check_hi/div/mod/check_lo/etc. the main known missing pieces at this point are: - check the return value of check_hi/lo/eq/range/index, generate call to reportfault currently I'm just discarding the return values - get the parameter orders all correct, I've been less than guessing - see about eliminating some of the functions; e.g. add/sub/and/or/xor/compares are the most inlinable, not much else is (mul/div/mod/shift/rotate/insert/extract) - also give the constant folding a chance instead of just always calling; that givces even mul/div/mod/shift/rotate/insert/extract a good chance, and the front end does use e.g. extract for division by powers of two or such; this really is easy, it amounts to just moving all this code "a few lines down", like into stackx86.m3 after it checks for the constant/immediate cases (note that most operations are binary, so there imm op imm, and non-imm op imm, and some of them are commutive e.g. plus, mult and some are not e.g. divide and shift) - implement compares (the "check" ones are here, the functions are in hand2.c, but I forgot to handle the normal cases) - see about loophole/val zero extending vs. sign extending (currently always zero extends which I'm sure is wrong, unless the frontend deals with it) - of course flipping the switch in Target.m3, which I've done frequently; consider a command line option for this for now - probably move hand2.c to hand.c so it is statically linked, which also saves an instruction per call (and lets off of the compatibility hook mostly, though the static linking was really put in due to the data, so the other options are only statically link the data, none of the functions, or, really, in fact, eliminate the data, it looks easily eliminatable) - exit_proc looks a little suspicious/fragile; it needs to be certain to get the high part in edx, the low part in eax, currently' it doesn't appear so deterministic; that will be easy - I can't get the C compiler to generate an unsigned multiply, so maybe signed is all we need, not two functions - consider a more portable rotate implementation, currently is Visual C++ specific; could use #ifdef, really, not difficult.. just shift in direction and or.. - test insert/extract in particular; they are a bit gnarly None of these are particularly difficult and many of them are not important, but some are very important. From jkrell at elego.de Fri Feb 5 14:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205134022.4867E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:40:22 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: drop the four operations which are the most trivially implemented by just two instructions without any regard for carry, borrow, etc. (ignoring load/store): and, or, xor, not notice they weren't used anyway (not in this case is flipping all the bits, xor -1, not the the logical value, I'm pretty sure) From jkrell at elego.de Fri Feb 5 14:52:31 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:52:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135232.4AA642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:52:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: rename 'l' to 'label' (they could have at least used 'L'..) From jkrell at elego.de Fri Feb 5 14:56:23 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:56:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135623.BB45B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:56:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: add a label parameter to dobin This will be used shortly for compare. Slightly experiment, but I expect it to work well. i.e. cmp hi1, hi2 jne label cmp lo1, lo2 label: I think will easily implement all the comparisons. If I'm being simple-minded, the label should be useful for the correct form. From jkrell at elego.de Fri Feb 5 15:05:43 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:05:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205140543.C8DB42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:05:43 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: strawman inline implementation of 64bit comparisons (should use this for check_hi/lo/eq/index also!) From jkrell at elego.de Fri Feb 5 15:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205142945.79B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:29:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce type Operand1 that resembles the old version of Operand; this isn't backsliding on the approach being used, but it'll probably let us clean things up a bit: the arrays can be of this type and the functions that only ever operate on words can use this, in particular, if nothing else, we can change many remaining uses of reg[0] (as opposed to reg[i]) to just reg; and we might use host integers here, might (consider however if this backend is adapted to 64bit, with 32bit host, and 64bit immediate parameters, without using LONGINT -- it might pay to avoid host INTEGER long term) From jkrell at elego.de Fri Feb 5 15:30:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:30:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143027.26D342474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:30:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment only From jkrell at elego.de Fri Feb 5 15:31:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:31:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143113.2AC6F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:31:12 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: minor edits to Operand1, which isn't in use yet, and won't be for now, it's not important From jkrell at elego.de Fri Feb 5 15:33:24 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:33:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143324.D8EA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:33:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: whitespace only From jkrell at elego.de Fri Feb 5 16:10:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151040.E2C592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:40 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151053.C34502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:53 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: forgot a file: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:13:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:13:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151304.2C4B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:13:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove function based 64bit add and subtract From jkrell at elego.de Fri Feb 5 16:24:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:24:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152402.E3F2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:24:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: NOT is a unary operation, doesn't belong in dobin From jkrell at elego.de Fri Feb 5 16:25:07 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:25:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152507.BADE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:25:07 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: implement 64bit NOT and NEG (something fishy here -- why dobin but unOp? probably should move the dobin code into binOp From jkrell at elego.de Fri Feb 5 17:04:14 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:04:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160414.59D932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:04:14 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: push dobin work down to binOp (for xor/and/or/not it should have already worked) inline all the 64bit check_lo/hi/eq/index via binOp handling oCMP From jkrell at elego.de Fri Feb 5 17:06:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:06:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160636.4E0742474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:06:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: abs64 and neg64 now handled inline, remove function stuff From jkrell at elego.de Fri Feb 5 17:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161450.C11932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:14:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: handle 64bit min and max inline (basically just comparisons) From jkrell at elego.de Fri Feb 5 17:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161702.EC31E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:17:02 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: remove min, max, add, sub, and, or, xor, compares, check_range, abs, not, neg From hosking at elego.de Fri Feb 5 17:38:23 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163823.2ED242474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:23 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchInc.mg FetchDec.mg Log message: Need to loophole INTEGER incr/decr as necessary to Rep.T (i.e., for LONGINT and ADDRESS). Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:38:41 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163841.58B602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:41 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchOr.mg FetchXor.mg Log message: Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:53:35 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:53:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205165336.1200C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:53:35 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchDec.mg FetchInc.mg FetchOr.mg FetchXor.mg Log message: Allow unsafe operations in AtomicAddress module (so we don't need to explicitly declare it unsafe). Other clients will still get a compile-time error unless they are also unsafe. From hosking at elego.de Fri Feb 5 18:09:51 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 18:09:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205170951.9BA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 18:09:51 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.ig atomic.tmpl m3makefile Added files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: Addressable implementations of the atomic builtins. From hosking at elego.de Fri Feb 5 19:09:50 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 19:09:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205180950.A09842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 19:09:50 Modified files: cm3/m3-libs/libm3/src/os/Common/: File.i3 Log message: Use LONGCARD for size (used to be CARDINAL). From jkrell at elego.de Sat Feb 6 11:17:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:17:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101718.90DE62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:17:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: immOp, binOp can allocate the compare_label themselves -- that's less code and it handles cases I had missed From jkrell at elego.de Sat Feb 6 11:18:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:18:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101838.1E2572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:18:38 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: 'l' => 'label' From jkrell at elego.de Sat Feb 6 11:25:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:25:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206102556.BD6782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:25:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the 64bit shifts/rotates to fold constants more to do here, both to handle more constant cases and to call the C compiler helpers directly instead of our wrappers for them (a little tricky given their custom calling conventions) From jkrell at elego.de Sat Feb 6 11:37:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:37:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206103732.634732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:37:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Removed files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: move NT386 64bit helpers back to static linking also saving an extra copy of div/mod still work to do here -- should use the C compiler helpers directly for e.g. 64bit shifts From jkrell at elego.de Sat Feb 6 12:52:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:52:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115253.D39D62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:52:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move the checking code out of unlock into separate functions; it has proven useful placing calls elsewhere to see where things go wrong From jkrell at elego.de Sat Feb 6 12:54:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:54:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115441.B5B292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:54:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: don't issue an error when converting Target.Word32.max to a host INTEGER overflows (this takes advantage of TInt.ToInt doing the conversion even if it overflows) From jkrell at elego.de Sat Feb 6 13:00:03 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:00:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120004.332A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:00:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more generally, don't error for anything less or equal to Target.Word32.max From jkrell at elego.de Sat Feb 6 13:02:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:02:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120251.298712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:02:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix indent on one line From jkrell at elego.de Sat Feb 6 13:05:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:05:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120526.F10852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:05:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the unlock calls in call_64, they don't match the patterns elsewhere From jkrell at elego.de Sat Feb 6 13:06:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:06:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120612.366792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:06:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the various 64bit compare functions, as we inline them now From jkrell at elego.de Sat Feb 6 13:38:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123812.D373D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:12 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:38:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123821.E420B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:21 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:59:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:59:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206125956.D1E772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:59:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 M3x86Rep.i3 M3x86.m3 Codex86.m3 Log message: go back a version, I'll do something else From jkrell at elego.de Sat Feb 6 15:01:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:01:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140104.E7CAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:01:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: replace 64bit shift left and right with the C compiler helpers _allshr, _allshl, ullshr From jkrell at elego.de Sat Feb 6 15:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140232.3AA732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:02:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove shift_left64 and shift_right64 (notice I had failed to implement signed shift right, but that is fixed now) From jkrell at elego.de Sat Feb 6 15:05:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:05:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140557.B643A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:05:57 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: hm, looks like shift_right is always supposed to be unsigned? From jkrell at elego.de Sat Feb 6 15:06:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:06:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140656.3BA132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:06:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments only, about custom calling convention of 64bit shift From jkrell at elego.de Sat Feb 6 15:19:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:19:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206141921.B864A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:19:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: call compiler helper directly for 64bit multiplication, there is just one for signed and unsigned From jkrell at elego.de Sat Feb 6 15:24:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:24:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142455.71E3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:24:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove whitespace from ends of lines From jkrell at elego.de Sat Feb 6 15:29:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:29:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142958.C295F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:29:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove m3_umul64 in favor of _allmul that it would call anyway From jkrell at elego.de Sat Feb 6 17:04:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:04:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206160428.454982474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:04:28 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: '_uallshr' => '_aullshr' From jkrell at elego.de Sat Feb 6 17:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161331.B63AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:13:31 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: go ahead and move TZero to M3x86Rep.i3 From jkrell at elego.de Sat Feb 6 17:15:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:15:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161528.B51842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:15:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt get_temp properly for int64/longint; this will be important very shortly, fixing the register preservation around int64 function calls From jkrell at elego.de Sat Feb 6 17:16:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:16:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161612.D2CF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:16:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: comment and whitespace in get_temp From jkrell at elego.de Sat Feb 6 17:19:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161941.A2F392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:41 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 17:19:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161956.9FE012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: forgot files: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 18:01:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:01:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170155.528372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:01:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect: the need for the offset is obvious; the need to do both dealloc_reg before either set_reg I don't understand, it seems like it should be ok either way From jkrell at elego.de Sat Feb 6 18:03:05 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:03:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170305.AEA8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:03:05 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information in the event of an assertion failure From rodney_bates at lcwb.coop Sat Feb 6 18:12:46 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:12:46 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100205094842.55B522474001@birch.elegosoft.com> References: <20100205094842.55B522474001@birch.elegosoft.com> Message-ID: <4B6DA30E.10004@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/05 10:48:42 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the two types to have the same size (or arranges it thus, for conversion to an open array). But then doloophole could conceivable be called in the compiler for some additional purpose besides translating source code LOOPHOLE. From jay.krell at cornell.edu Sat Feb 6 18:17:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 6 Feb 2010 17:17:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: > But then doloophole could conceivably be called in the compiler > for some additional purpose besides translating source code LOOPHOLE. It is. As the comment says -- VAL calls doloophole. In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. - Jay > Date: Sat, 6 Feb 2010 11:12:46 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > Modified files: > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > Log message: > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sat Feb 6 18:18:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:18:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206171854.2EDBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:18:54 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Stackx86.i3 M3x86.m3 Log message: load_indirect needs to set the resulting operand type, at least so my own assertions succed, and we get a little further.. From rodney_bates at lcwb.coop Sat Feb 6 18:25:02 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:25:02 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206140557.B643A2474001@birch.elegosoft.com> References: <20100206140557.B643A2474001@birch.elegosoft.com> Message-ID: <4B6DA5EE.7000909@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 15:05:57 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > hm, looks like shift_right is always supposed to be unsigned? > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) shifts zeros into vacated bits, in either direction. I have sometimes wanted a signed right shift, but realized eventually that DIV by 2^n will do it. But if n is variable, that takes another runtime operation. From jkrell at elego.de Sat Feb 6 18:30:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:30:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206173051.4E5362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:30:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: swapping differently sized things is legal, it occurs on line 189 of M3CBackEnd_C.m3; remove my assertion to the contrary, and we get the further (to line 1037 of same and another assertion failure) From hosking at cs.purdue.edu Sat Feb 6 19:15:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:15:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206161941.A2F392474001@birch.elegosoft.com> References: <20100206161941.A2F392474001@birch.elegosoft.com> Message-ID: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. On 6 Feb 2010, at 17:19, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 17:19:41 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From hosking at cs.purdue.edu Sat Feb 6 19:23:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:23:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com> <4B6DA30E.10004@lcwb.coop> Message-ID: <2852DEFD-F700-4103-98B2-94EFFA5DE0A2@cs.purdue.edu> I did overload use of m3cg_loophole for conversion to/from INTEGER/LONGINT. For those, we should sign-extend. The gcc-based backend handles that trivially. On 6 Feb 2010, at 12:12, Rodney M. Bates wrote: > > > Jay Krell wrote: >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/05 10:48:42 >> Modified files: >> cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: >> adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. From hosking at cs.purdue.edu Sat Feb 6 19:27:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:27:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: <9C5DCFCC-3974-4F8C-946C-AC17C9822D03@cs.purdue.edu> VAL is the only place that needs to handle the conversion On 6 Feb 2010, at 12:17, Jay K wrote: > > But then doloophole could conceivably be called in the compiler > > for some additional purpose besides translating source code LOOPHOLE. > > It is. As the comment says -- VAL calls doloophole. > In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. I probably could avoid that in most cases. It's only there for arrays whose index type is a subrange of LONGINT. > > - Jay > > > Date: Sat, 6 Feb 2010 11:12:46 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay Krell wrote: > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > > > Log message: > > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > > two types to have the same size (or arranges it thus, for conversion to an open array). > > > > But then doloophole could conceivable be called in the compiler for some additional purpose > > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 6 19:47:45 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 6 Feb 2010 19:47:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206184745.8241B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/06 19:47:45 Modified files: cm3/m3-sys/m3front/src/exprs/: SubscriptExpr.m3 Log message: Clean up LInt-based (i.e., arrays indexed by LONGINT subranges) indexing. Avoid CG.Loophole where not needed. From jay.krell at cornell.edu Sun Feb 7 07:56:39 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 06:56:39 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> References: <20100206161941.A2F392474001@birch.elegosoft.com>, <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Message-ID: The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:06:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:06:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207070605.CC6602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:06:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: another place where I failed to offset the high part of the load; something still wrong here though, we still get assertion failure at line 1036 of M3CBackEnd_C.m3 From jay.krell at cornell.edu Sun Feb 7 08:33:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 07:33:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100206161941.A2F392474001@birch.elegosoft.com>, , <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu>, Message-ID: Hm. I guess it would be more like: push 1 push 3 mov ecx, [esp+4] mov eax, [esp+8] add eax, ecx mov [esp+4], eax add esp,4 mov eax, [esp + 4] mov foo, eax add esp,4 and function calling isn't so hard. imagine the function int add(int a, int b). It'd go: push/eval a push/eval b mov eax, [esp + 4] push eax mov eax, [esp + 8] push eax call add add esp,16 That is, you would: 1) not "discard" from the "virtual stack" (merged with the machine stack) until after the call, cleaning up both it and the machine stack (for __cdecl) 2) As you build up the parameters, you'd maintain an offset to adjust virtual stack references by However, I still think you'd have to change all this for 32bit types as well, somewhat of a "rewrite" of the NT386 backend. (Not that I haven't changed it a bunch now to deal with types that don't fit in a single register.) You can't just do it for 64bit types. I think. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Sun, 7 Feb 2010 06:56:39 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:58:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:58:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207075812.B4D1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:58:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect to not free the register holding the upper part of an address (or whatever register number is sitting there, it is junk) From jkrell at elego.de Sun Feb 7 09:18:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:18:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207081856.8CDD62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:18:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: some cleanup now that things seem good From jkrell at elego.de Sun Feb 7 09:31:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:31:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083142.C6E782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:31:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: go back a version From jkrell at elego.de Sun Feb 7 09:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083254.A2E8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:32:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce CONST RegistersForByteOperations, should give a little cleanup From jkrell at elego.de Sun Feb 7 09:36:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:36:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083601.AEE822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:36:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: use RegistersForByteOperations From jkrell at elego.de Sun Feb 7 09:43:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:43:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084316.7F0EB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:43:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use C compiler helpers directly for unsigned div/mod From jkrell at elego.de Sun Feb 7 09:46:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:46:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084657.F33D52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:46:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove unsigned div/mod, add comment about 'missing' functions From jkrell at elego.de Sun Feb 7 09:55:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:55:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207085519.EC7BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:55:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: tweak set_range_new From jkrell at elego.de Sun Feb 7 10:00:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:00:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090025.3C35F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:00:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: add m3test_insert32 and m3test_extract32 so I can test the 64bit versions, by comparing the 32bit results of C and Modula-3 From jkrell at elego.de Sun Feb 7 10:01:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:01:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090129.BA66E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:01:29 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: small tweak to M3_INSERT From jkrell at elego.de Sun Feb 7 10:27:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:27:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207092745.B97D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:27:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: some test code for insert and extract From jkrell at elego.de Sun Feb 7 10:43:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:43:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094357.8A7852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:43:57 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: add PutLong and PutLongHex From jkrell at elego.de Sun Feb 7 10:44:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:44:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094433.B3F972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:44:33 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 Log message: use upper case for hex From jkrell at elego.de Sun Feb 7 10:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094633.8F5CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:46:28 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: split the notin of the compiler (msvc or gcc) and platform (win32 or not) with respect how uint64/int64 are defined, vs. using %I64X vs. %llX; also actually save and commit the uppercase change From jkrell at elego.de Sun Feb 7 12:12:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:12:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207111225.C92942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:12:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: use 32bit values for bit offsets and shift counts, m3back will need adjusting (it already does to get the parameter orders correct anyway) From jkrell at elego.de Sun Feb 7 12:48:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:48:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207114846.5D8D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:48:46 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386.common Log message: adjust the code that decides to statically link the files with data; I'm not sure there was a problem here or if it was something else, but this seems a little simpler From jkrell at elego.de Sun Feb 7 13:12:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:12:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121239.1D3F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:12:38 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: fix newlines From jkrell at elego.de Sun Feb 7 13:13:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:13:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121324.606142474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:13:24 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: leading 0x to match PutHex From jkrell at elego.de Sun Feb 7 13:15:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121504.7EE842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:04 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: adjust test code to non-windows %I64x vs. %llx From jkrell at elego.de Sun Feb 7 13:15:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121558.F3FD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: leading 0x to match RTIO.PutHex/PutLongHex that the parallel Modula-3 test code will use, and we're hoping they match From jkrell at elego.de Sun Feb 7 13:16:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:16:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121633.729052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:16:33 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: more leading 0x on hex From jkrell at elego.de Sun Feb 7 13:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122145.D00562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:21:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test far more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:22:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:22:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122245.124E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:22:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:26:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:26:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122642.279A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:26:42 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: put the test code under #ifdef M3CORE_TEST_HAND instead of #if 0, that is probably ok, and test still more values From jkrell at elego.de Sun Feb 7 13:27:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:27:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122708.4E3732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:27:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: back to safer #if 0 From jkrell at elego.de Sun Feb 7 13:28:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:28:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122801.CE16E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:28:01 Added files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: copy hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:29:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:29:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122934.551EE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:29:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: #include hand.c From jkrell at elego.de Sun Feb 7 13:30:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:30:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123028.E40C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:30:28 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove the test code (now in test_hand.c) From jkrell at elego.de Sun Feb 7 13:32:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:32:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123214.555332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:32:14 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: move the 32bit insert/extract functions from hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:44:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:44:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124450.096482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:44:50 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: add an option to merge stdout and stderr, because I use RTIO From jkrell at elego.de Sun Feb 7 13:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124642.37F702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:46:41 Added files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 m3makefile Log message: some test code for int64/longint, more to do (and it found a bug: inability to initialize longint variable (probably only with large values)) From jkrell at elego.de Sun Feb 7 13:48:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:48:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124831.44D052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:48:31 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: don't normalize stderr.pgm if merging stdout and stderr From jkrell at elego.de Sun Feb 7 13:54:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:54:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125419.52BBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:54:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 13:55:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:55:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125529.7A17F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:55:29 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 14:03:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:03:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207130357.1F1AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:03:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust and make terser; really the point now is to see if longints can be initialized on other platforms, not sure the bug is in m3back or not From jkrell at elego.de Sun Feb 7 14:32:35 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:32:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133235.197CE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:32:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: demonstrate some longint stuff working, though sign extension from negative integers doesn't From jkrell at elego.de Sun Feb 7 14:36:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:36:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133639.E75352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:36:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix the parameter orders and sizes to some/many/all of the 64bit helper functions From jkrell at elego.de Sun Feb 7 14:49:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:49:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207134929.E4F332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:49:29 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: LINUXLIBC6 Log message: -march=i586 required for atomics to compile, probably needed on all other 32bit architectures as well, but maybe/probably we can adjust m3cc/m3makefile finally From jkrell at elego.de Sun Feb 7 15:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207140709.7A0E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:07:09 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix shifting (to not assert when it tries to allocate registers for the custom calling convention) and fix a newline; still a problem getting 64bit return values in the correct order From jkrell at elego.de Sun Feb 7 15:13:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:13:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141358.7FA4D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:13:58 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: remove Codex86. from in front of register names -- flatten the namespace From jkrell at elego.de Sun Feb 7 15:16:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:16:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141636.64D842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:16:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: get the return value in the registers correctly for 64bit call_indirect, and slight reformat the same code in call_direct From jkrell at elego.de Sun Feb 7 15:18:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:18:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141848.291262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:18:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove a newline, this one keeps bugging me From jkrell at elego.de Sun Feb 7 15:51:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:51:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145138.904542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:51:37 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove another newline From jkrell at elego.de Sun Feb 7 15:55:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:55:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145558.260072474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:55:58 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: be sure 64bit return values are high in edx, low in eax From jkrell at elego.de Sun Feb 7 16:01:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:01:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150127.DF3F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:01:24 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: oops: fix the wierdo shift whose direction is based on sign as opposed to the explicit left and right shift that are optimized with a custom calling convention to the C compiler helper function while at it, length some names: do_shift_64 => do_custom_calling_convention_shift_64 do_rotate_64 => do_rotate_or_shift_64 (actually was correct before but now has another use) From jkrell at elego.de Sun Feb 7 16:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150232.B9F282474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:02:32 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: and bang: longint is now 64bits on NT386 From jkrell at elego.de Sun Feb 7 16:20:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:20:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152023.4AA622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:20:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix 32bit signed vs. unsigned multiplication, back to what it was instead of accidentally reversed, I'm not sure if it matters, given that the C compiler only generates one of the two instructions From jkrell at elego.de Sun Feb 7 16:21:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152101.EA88C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:01 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: reformat previous From jkrell at elego.de Sun Feb 7 16:21:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152139.1864D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: slightly more reformat previous From jkrell at elego.de Sun Feb 7 16:28:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:28:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152839.8D4872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:28:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add some tests of abs, min, max, neg; not all of which work! :( From jkrell at elego.de Sun Feb 7 16:38:00 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:38:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207153800.9CB0D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:38:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: assert that the constant and non-constant versions match -- this confirms there are some bugs, to be looked into shortly From jkrell at elego.de Sun Feb 7 16:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207154557.581352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: show that comparing negative numbers to 0 is a problem From jkrell at elego.de Sun Feb 7 17:05:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:05:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207160547.5FDB92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:05:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the problems in compares: Int32 is not the only signed type now, Int64 is there (these patterns repeat in a few places, look for 'unscond' and/or 'revcond') From jkrell at elego.de Sun Feb 7 17:11:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:11:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161136.4AABC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:11:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix problem with negate, I had read the C compiler output carelessly when learning how to do this From jkrell at elego.de Sun Feb 7 17:16:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:16:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161614.5CBD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:16:13 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: crude but adequate fix for absolute value of int64; probably I hadn't read the code here carefully the first time, to notice that it isn't alway implemented via comparing to zero and negating..the other branch seems like it should work though? From jkrell at elego.de Sun Feb 7 17:18:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:18:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161822.F250E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:18:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:19:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:19:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161937.79D532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:19:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:26:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:26:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207162613.23BA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:26:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: use easier to eyeball values From jkrell at elego.de Sun Feb 7 17:34:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:34:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207163413.579732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:34:13 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: terser but no less clear From jkrell at elego.de Sun Feb 7 19:59:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 19:59:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207185921.A6B202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 19:59:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: neuter atomics for now, they are hitting assertion failures in m3back From jkrell at elego.de Sun Feb 7 20:04:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 20:04:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207190423.7821F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 20:04:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: further neuter atomics for now From jay.krell at cornell.edu Mon Feb 8 01:13:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:13:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA5EE.7000909@lcwb.coop> References: <20100206140557.B643A2474001@birch.elegosoft.com>, <4B6DA5EE.7000909@lcwb.coop> Message-ID: It is trivial to add clear/direct SignedRightShift if there is any interest. And heck, I find the "direction specified by sign" shift just wierd. It makes little sense to me. Never should have been there imho. - Jay > Date: Sat, 6 Feb 2010 11:25:02 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 15:05:57 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > hm, looks like shift_right is always supposed to be unsigned? > > > > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) > shifts zeros into vacated bits, in either direction. > > I have sometimes wanted a signed right shift, but realized > eventually that DIV by 2^n will do it. But if n is variable, > that takes another runtime operation. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 01:18:13 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 1:18:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208001813.C07662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 01:18:13 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Fix bug for constant initialization of LONGINT static data: MODULE Main; VAR a := 1L; BEGIN END Main. From jay.krell at cornell.edu Mon Feb 8 01:49:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:49:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208001813.C07662474001@birch.elegosoft.com> References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 01:57:17 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sun, 7 Feb 2010 19:57:17 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:05:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:05:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com> , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Message-ID: I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:09:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:09:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, Message-ID: Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 02:12:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 2:12:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208011233.4E4D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 02:12:33 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: go back a version From jay.krell at cornell.edu Mon Feb 8 02:27:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:27:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , Message-ID: Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:40:46 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:40:46 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, ,,,,, , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , Message-ID: This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:47:59 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:47:59 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, , , , , , , , Message-ID: hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:15:00 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:15:00 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , ,,, , ,,,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, ,,,,, , , , , , , , Message-ID: I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:32:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:32:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , ,,,,, , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , ,,,,, , , , , , , , Message-ID: Tony, it is pretty distressing how much code in CG.m3 is identical except for replacing Target.Integer with Target.Longint, when they can be stored into a variable up front and then use common code. I'll work on that. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 02:15:00 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 05:07:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:07:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208040757.D2D8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:07:57 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure store_indirect From jkrell at elego.de Mon Feb 8 05:14:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:14:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208041424.3924E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:14:24 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: fold some common code in procedure Add_offset From jkrell at elego.de Mon Feb 8 05:39:12 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:39:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208043912.D9A272474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:39:12 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load From jkrell at elego.de Mon Feb 8 05:41:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:41:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208044151.B4C772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:41:51 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load_indirect From jkrell at elego.de Mon Feb 8 07:20:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 7:20:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208062058.580E52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 07:20:58 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: repair and more similar cleanup; still a lot to do, look how load, store, load_direct, store_direct repeat a lot of code.. From jkrell at elego.de Mon Feb 8 08:08:00 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:08:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208070800.980A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:08:00 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: a little better on NT: let the fc calls work; still requires bc and date in the path, and link must not be Cygwin's From jkrell at elego.de Mon Feb 8 08:17:14 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:17:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208071714.C1C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:17:14 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: allow unaligned load/stores on all x86/AMD64 targets; cleanup a bit From hosking at cs.purdue.edu Mon Feb 8 08:39:26 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:26 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: Nah, not necessary. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 21:15, Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:47:59 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > hm. Bug perhaps in TWord: > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > Shift (x, -i, r); > > > and maybe: > > > PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR yy, yyy, yyyy: Int; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > > > I propose that TWord.Extract interpret all values as infinitely extended with zeros. > Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). > And Insert widen infinitely to fit whatever is being inserted? > > > Will it break stuff? > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:40:46 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > This really puzzles me, that using TInt.Zero makes it fail. > I do see a subtle difference, n of TInt.Zero is always 8, > but the CG.m3 code uses 4 for for 32bit. > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:27:30 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Oddly, just using TInt.Zero apparently breaks it all. > Assertion failures all over ThreadWin32.m3. > I'll dig a *little*. > Well, er, maybe just try your change without the TInt.Zero part? > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:09:42 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Same thing on Linux/x86. > i.e. it breaks everything. > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:05:58 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'll look a bit. > I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. > > - Jay > > > Subject: Re: [M3commit] CVS Update: cm3 > From: hosking at cs.purdue.edu > Date: Sun, 7 Feb 2010 19:57:17 -0500 > CC: m3commit at elegosoft.com > To: jay.krell at cornell.edu > > Rats! I'll look into it. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 7 Feb 2010, at 19:49, Jay K wrote: > > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 08:39:53 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:53 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208040757.D2D8C2474001@birch.elegosoft.com> References: <20100208040757.D2D8C2474001@birch.elegosoft.com> Message-ID: <2EC2E14F-6D83-4002-9474-933062F0268F@cs.purdue.edu> Jay, back off. I'm trying to fix things. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 05:07, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 05:07:57 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > eliminate gross duplication of code for int vs. longint in procedure store_indirect -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 09:21:50 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:21:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208082150.192DA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:21:50 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Repair damage from improper merge of Integer/Longint cases for loads/stores. From hosking at elego.de Mon Feb 8 09:33:20 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:33:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208083320.38BD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:33:20 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Insert and Extract can use explicit shift directions. From hosking at elego.de Mon Feb 8 11:03:19 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 11:03:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208100319.E23C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 11:03:19 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Some more cleanup. Still needs fixing for LONGINT static constants. From hosking at elego.de Mon Feb 8 12:21:51 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 12:21:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208112151.F2A1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 12:21:51 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Get rid of TInt.IntI. Not necessary. From hosking at elego.de Mon Feb 8 13:03:31 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 13:03:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208120331.C78762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 13:03:31 Modified files: cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 IntegerExpr.m3 ReelExpr.m3 Log message: Check for out-of-range values in constructor when folding. From jkrell at elego.de Mon Feb 8 14:02:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:02:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208130222.40B752474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:02:20 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Bring back IntI, to fix: "..\src\float\Common\DragonInt.m3", line 114: value is not constant SigBits = Word.RightShift (Word.Not (0), Reserved); "..\src\time\WIN32\TimeWin32.m3", line 19: value is not constant I = Word.Plus(LAST(INTEGER), 1); The pain that is CVS: cvs -z3 upd -j 1.21 -j 1.20 TInt.i3 cvs -z3 upd -j 1.18 -j 1.17 TInt.m3 cvs -z3 upd -j 1.7 -j 1.6 IntegerExpr.m3 From jay.krell at cornell.edu Mon Feb 8 14:03:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:03:42 +0000 Subject: [M3commit] TInt.IntI In-Reply-To: <20100208112151.F2A1C2474001@birch.elegosoft.com> References: <20100208112151.F2A1C2474001@birch.elegosoft.com> Message-ID: This seemed to break things so I put it back. - Jay > Date: Mon, 8 Feb 2010 12:21:51 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 12:21:51 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 > cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 > > Log message: > Get rid of TInt.IntI. Not necessary. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:10:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:10:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208131006.8876B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:10:06 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: using TInt.Zero still seems to cause tremendous problems, so put back Target.Int{Target.Integer.bytes, Target.IBytes{0,..}} just a little bit From jay.krell at cornell.edu Mon Feb 8 14:13:13 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:13:13 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208100319.E23C42474001@birch.elegosoft.com> References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:37:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:37:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208133701.558F12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:37:01 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: split up m3_extract64(value, m, n, sign_extend) into m3_extract64(value, m, n) /* no sign extend */ and m3_extract_and_sign_extend64(value, m, n, sign_extend) still need to move this code to do constant folding From jkrell at elego.de Mon Feb 8 14:46:11 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:46:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208134612.1E20F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:46:11 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: Change the helpers all from __cdecl to __stdcall. It is smaller and therefore faster/better. granted: if you could only have one calling convention, it would have to be __cdecl, for its compatibility with printf However __stdcall is heavily used. This does break the ABI but I think that is ok. From jkrell at elego.de Mon Feb 8 14:55:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:55:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208135522.AD6D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:55:22 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: comments about why set_ne and set_eq are left in the NT386 platform even though they aren't used by it From jkrell at elego.de Mon Feb 8 15:05:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:05:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140550.79E992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:05:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_load From jkrell at elego.de Mon Feb 8 15:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140640.93B2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:06:40 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_store From jkrell at elego.de Mon Feb 8 15:10:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:10:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141034.E40832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:10:34 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: edit the comment to be clearer in m3cg_declare_segment From jkrell at elego.de Mon Feb 8 15:12:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:12:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141204.A73B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:12:04 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: go back a version, to previous comment From jkrell at elego.de Mon Feb 8 15:25:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:25:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142534.6E9942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:25:34 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyThree, to be used shortly From jkrell at elego.de Mon Feb 8 15:26:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:26:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142618.A51A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:26:18 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: move SixtyThree down a line From jkrell at elego.de Mon Feb 8 15:51:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:51:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208145131.EEBC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:51:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: fixing shift/rotate/insert/extract to all fold constants: pass type from m3x86 to stackx86, since often the stack code is what checks if we have constants (I propose we move this work to the frontend..) From jkrell at elego.de Mon Feb 8 16:04:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:04:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208150425.617492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:04:25 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: stack.shift/rotate/insert/extract now all return a boolean indicating if they did the work or not, so m3x86.shift/rotate/insert/extract can decide to generate a call or not This is really an artifact of the inconsistent splitting between stack and m3x86. Notice how sometimes the similar code is one, sometimes the other. Not the worst thing though. From jkrell at elego.de Mon Feb 8 16:32:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:32:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208153248.9ECAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:32:48 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: add CGTypeToIntType From jkrell at elego.de Mon Feb 8 16:47:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:47:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154709.48D732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:47:08 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: limit CGTypeToIntType to IType, even just unsigned would probably suffice From jkrell at elego.de Mon Feb 8 16:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154846.0E0162474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:48:45 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 Log message: add ToUnsignedType to map from int32,word32,int64,word64 to word32,word32,word64,word64 From hosking at cs.purdue.edu Mon Feb 8 16:49:20 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:49:20 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: > Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. > The RTIO was there for a reason that was still valid a day ago. > There is a test case that hits assertion failures. I'll see if that is still the case. > > - Jay > > > > Date: Mon, 8 Feb 2010 11:03:19 +0000 > > To: m3commit@ > > From: hosking@ > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 11:03:19 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Some more cleanup. > > Still needs fixing for LONGINT static constants. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 16:57:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:57:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208153248.9ECAE2474001@birch.elegosoft.com> References: <20100208153248.9ECAE2474001@birch.elegosoft.com> Message-ID: <664E362F-C2C5-4C0B-9B4A-509546E4C856@cs.purdue.edu> What do you need this mapping for? It is not needed anywhere in the front-end. If you really need something like this in your specialised backend can you please put it there. I see no need to add this unless they are really needed upstream in the front-end (as opposed to downstream in your backend). I will revert. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 16:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 16:32:48 > > Modified files: > cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 > > Log message: > add CGTypeToIntType -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 17:00:54 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 17:00:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208160054.9D38A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 17:00:54 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 Log message: Revert muddying of m3middle interfaces. These are engineered in support of the front-end. They should not be perturbed for down-stream back-end needs. From rodney_bates at lcwb.coop Mon Feb 8 17:02:58 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Mon, 08 Feb 2010 10:02:58 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: <4B7035B2.4030806@lcwb.coop> Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is > true for values with "quite different" behavior. I would have "thunk" > (thought without much thought) that anything TInt.EQ is more equivalent > than they actually are. > Hmm. I recall in a discussion a while back that the arithmetic on target ints was not coded to handle operands with mixed values of n. Could this have something to do with this? > > - Jay > > > From jay.krell at cornell.edu Mon Feb 8 17:13:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:13:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> References: <20100208100319.E23C42474001@birch.elegosoft.com>, , <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Message-ID: Major problems at runtime. Basically nothing works. I think, basically, initializing lots of stuff gets broken. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 10:49:20 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <068EFB68-5F49-4F6B-8228-49E005E855CC@cs.purdue.edu> I am working on these issues right now. Stay tuned... It will be much cleaner than what Jay proposes. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:02, Rodney M. Bates wrote: > > > Jay K wrote: >> I wonder if we need >> TInt8, TInt16, TInt32, TInt64, TInt, TLong >> TWord8, TWord16, TWord32, TWord64, TWord, TLongWord >> that accurately implement ints/words of the exact specified size, >> with TInt/TWord/TLong/TLongWord depending on the target. >> I wouldn't mind trying to remove this word "Word". >> And replace it with UInt or such. >> TInt, TUInt, TLong, TULong? >> TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? >> TInt, TUnsignedInt, TLong, TUnsignedLong? >> TInt.Zero is just always 8 bytes. >> The size is I believe meant to be fairly opaque to the user. >> This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. >> > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > >> - Jay >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:15:36 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208160054.9D38A2474001@birch.elegosoft.com> References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:18:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:18:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , ,,, , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:31:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:31:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com>, Message-ID: I'm also not sure the line between frontend and backend is so clear. They are immediately adjacent of course and do surprisingly similar things. You know, the front end does a lot of bit twiddling. I think a lot of what is in m3back belongs elsewhere, either in m3front or a nonexistant middle layer. It does a lot of target-independent optimization and bit twiddling. I guess ultimately the design is m3back would have M3sparc.m3, M3ppc.m3, M3alpha.m3, M3amd64.m3 ( possibly part of m3x86.m3), M3mips.m3, etc., and the existing x86 stuff would gradually get refactored so they'd share a lot of code. But ok, I've copied the stuff to m3back. - Jay From: jay.krell at cornell.edu To: hosking at elego.de; m3commit at elegosoft.com Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: Re: [M3commit] CVS Update: cm3 In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 17:42:44 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 17:42:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208164247.244F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 17:42:44 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyFour and MSixtyThree, likely used in support of constant folding of 64bit shifts in m3back From hosking at cs.purdue.edu Mon Feb 8 17:36:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:36:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:35:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:35:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: <48542AD1-2AF4-468D-B1A0-38368DA466A6@cs.purdue.edu> I would simply populate an array from TargetMap.Integer_types. cf StackType in CG.m3. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:15, Jay K wrote: > In the one case, there is a dependency on the ordering of the enumeration. > It seems to me that anything that depends on the order of an enumeration > belongs very near the definition of the enumeration. > > Stuff like this: > > SignedType = ARRAY CGType OF BOOLEAN { > FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) > FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) > TRUE, TRUE, TRUE, (* Reel .. XReel *) > FALSE, FALSE, FALSE (* Addr .. Void *) > }; > > CONST > ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF > [CGType.Word32..CGType.Word64] { > CGType.Word32, CGType.Word32, > CGType.Word64, CGType.Word64 }; > > I'm likely going to duplicate this exact stuff. > > - Jay > > > Date: Mon, 8 Feb 2010 17:00:54 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 17:00:54 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > > > Log message: > > Revert muddying of m3middle interfaces. These are engineered in support > > of the front-end. They should not be perturbed for down-stream back-end needs. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 18:08:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:08:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208170838.D415E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:08:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: whitespace From jkrell at elego.de Mon Feb 8 18:29:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:29:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208172930.D16582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:29:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: work in progress optimizing shift/rotate/insert/extract involving constants From jkrell at elego.de Tue Feb 9 07:56:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 7:56:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209065657.7543F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 07:56:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Stackx86.m3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms From jkrell at elego.de Tue Feb 9 08:19:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 8:19:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209071935.B842E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 08:19:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms; add rows for SHLD and SHRD, still trying to figure how how they should read, confusing stuff From jkrell at elego.de Tue Feb 9 10:42:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 10:42:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209094257.5FE552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 10:42:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: better formating From jkrell at elego.de Tue Feb 9 18:31:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:31:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173100.4C1032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:31:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173943.26DBE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:43:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:43:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174324.4FA4A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:43:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174540.519482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:45:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:50:25 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:50:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175025.EC6452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:50:25 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage; looks like bug found right shifting longint by count greater than 31 or so From jkrell at elego.de Tue Feb 9 18:52:03 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:52:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175205.516AF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:52:03 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:58:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:58:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175805.E0D322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:58:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: TInt.ThirtyOne => MaximumShift[t] fix shift/rotate longint by constant between 32 and 63 inclusive From jkrell at elego.de Tue Feb 9 19:07:30 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:07:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209180730.766C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:07:30 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 19:40:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:40:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184023.376E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:40:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: combinatorics'r'us (more test converage, and a little less tedium) From jkrell at elego.de Tue Feb 9 19:48:33 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:48:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184833.1D6822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:48:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a few more loops to reduce tedious code From jkrell at elego.de Tue Feb 9 19:55:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:55:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185505.88C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:55:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases, still missing all of rotate From jkrell at elego.de Tue Feb 9 19:56:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:56:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185600.AD7592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:56:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: whitespace From jkrell at elego.de Tue Feb 9 20:29:49 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:29:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209192949.5F98E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:29:49 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:27 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195827.8AF912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:27 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:55 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195855.5A1022474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 21:26:56 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:26:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209202656.DA9512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:26:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: inline 64bit shifts by a constant (and shifts of 64bit constant by constant) (and optimize away shift/rotate of constant 0) some of this seems backwards, and is commented as such, but the test case and disassembly show it to be correct, need to study that more still to handle 64bit rotate by constant.. From jkrell at elego.de Tue Feb 9 21:58:45 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:58:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209205845.A44ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:58:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases: value besides just 1 From jkrell at elego.de Tue Feb 9 22:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210616.272DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:16 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases From jkrell at elego.de Tue Feb 9 22:06:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210652.B88932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 22:08:19 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210819.AC0332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:19 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: comment about a bit of a 'trick' employed here From jkrell at elego.de Tue Feb 9 22:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210859.1783E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust comment From jkrell at elego.de Tue Feb 9 22:10:54 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:10:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211054.275112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:10:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: newline From jkrell at elego.de Tue Feb 9 22:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211450.645042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:14:50 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: line up columns; add coment From jay.krell at cornell.edu Wed Feb 10 10:47:02 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 09:47:02 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 10:57:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:57:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095720.B5CCA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:57:20 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: enable longer run From jkrell at elego.de Wed Feb 10 10:59:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:59:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095954.092662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:59:54 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: allow 32bit specific output, don't make 64bit look like the bad guy, they are peers From jkrell at elego.de Wed Feb 10 11:03:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:03:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210100316.923A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:03:15 Added files: cm3/m3-sys/m3tests/src/p2/p226/: Tag: release_branch_cm3_5_8 stderr.build stderr.pgm stdout.build stdout.pgm Main.m3 m3makefile cm3/m3-sys/m3tests/src/p2/p227/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: stake a claim on these test case numbers in release branch, in case new tests do come along in this brach -- sequential numbering is not compatible with branching and we've gotten into trouble here before..not likely to enable these tests in this branch From jkrell at elego.de Wed Feb 10 11:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104438.196C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:45:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:45:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104508.ACC4E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:45:08 Added files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:49:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:49:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104924.2E4CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:49:23 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:51:40 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:51:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105140.B719C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:51:40 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:53:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:53:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105329.6A5A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:53:28 Modified files: cm3/m3-libs/sysutils/src/: System.i3 Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:54:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:54:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105448.A3E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:54:48 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_pm3.m3 SystemPosix.m3 Log message: and remove unused imports From jkrell at elego.de Wed Feb 10 11:55:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:55:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105520.22F4C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:55:20 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 Log message: remove unused import From jkrell at elego.de Wed Feb 10 11:58:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:58:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105832.87B5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:58:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:00:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:00:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110032.EF1522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:00:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:03:27 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:03:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110328.EADF12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:03:27 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: remove unneeded #include From jkrell at elego.de Wed Feb 10 12:12:17 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:12:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210111217.08E7F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:12:17 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: checkin output from LINUXLIBC6 as probably correct, will compare against AMD64_DARWIN and NT386 From jkrell at elego.de Wed Feb 10 12:20:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:20:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210112056.6B5332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:20:55 Modified files: cm3/m3-libs/sysutils/src/POSIX/: m3makefile Log message: I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From jkrell at elego.de Wed Feb 10 12:58:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:58:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210115812.269A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) From jkrell at elego.de Wed Feb 10 13:00:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:00:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120020.921A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:00:20 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: This test does various bit twiddling with INTEGER. e.g. Word.Insert, Word.Extract duplicate all of it to use Long as well Note that I didn't extend it to use bigger/wider values that would get better coverage of what Long can do that Word cannot, I just left it using the same test values as for Word From jkrell at elego.de Wed Feb 10 13:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120642.687CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:06:42 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: change code to avoid overflow From jkrell at elego.de Wed Feb 10 13:07:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:07:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120731.3F8492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:07:31 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: oops, go back to not allowing overflow From jkrell at elego.de Wed Feb 10 13:10:37 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:10:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210121037.27B642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:10:37 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: extend test just *slightly* From jkrell at elego.de Wed Feb 10 13:58:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:58:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210125854.E3FFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:58:54 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use the new m3objfile appendBytes(array of [0..255]) instead of m3objfile append(integer) so that we have a chance of initializing longints, when the frontend is fixed in TInt.m3, fix ToBytes to return 1 byte for zero and -1 instead of zero bytes -- it should never return 0 bytes From jkrell at elego.de Wed Feb 10 14:03:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:03:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130308.6A59F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:03:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: strengthen assert: the intermediate result must be 0 for r=0 or r=-1; deobfuscate Mask, SignMask, Base: just set them to FF, 80, 100, instead of roundabout ways of saying the exact same thing From jkrell at elego.de Wed Feb 10 14:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130959.71D4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:09:59 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.21 diff -u -r1.21 TInt.m3 --- m3middle/src/TInt.m3 10 Feb 2010 13:03:07 -0000 1.21 +++ m3middle/src/TInt.m3 10 Feb 2010 13:09:01 -0000 @@ -116,8 +116,9 @@ VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO carry := a.x[i] + b.x[i] + carry; @@ -133,8 +134,9 @@ VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO borrow := a.x[i] - b.x[i] - borrow; @@ -167,8 +169,9 @@ p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; FOR i := 0 TO n-1 DO FOR j := 0 TO n-1 DO k := i + j; @@ -228,8 +231,9 @@ b_sign := CheckSign (b, n); min: Int; BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; @@ -294,8 +298,9 @@ PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = VAR n := MIN (a.n, b.n); BEGIN - IF CheckSign (a, n) = Sign.Bad THEN RETURN FALSE END; - IF CheckSign (b, n) = Sign.Bad THEN RETURN FALSE END; + IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN + RETURN FALSE; + END; FOR i := 0 TO n-1 DO IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; From jkrell at elego.de Wed Feb 10 14:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210134630.BE5032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:46:28 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Just remove the size check in Extract. It appears it will just naturally treat the value as zero extended, which is reasonable and allows the rest to work. This lets Tony's fix for initializing Longint work. To be reapplied shortly. Deobfuscate Mask and Base here as well, like in TInt. Cleanup my TWord.xEQ function (still could use further cleanup, clearly, once confidence is total) Index: src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.10 diff -u -r1.10 TWord.m3 --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 @@ -16,8 +16,8 @@ LShift = Word.LeftShift; CONST - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); - Base = Mask + 1; + Mask = 16_FF; + Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) @@ -278,8 +278,8 @@ BEGIN <*ASSERT n # 0*> FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN RETURN FALSE; - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; + IF a.x[i] # b.x[i] THEN + RETURN FALSE; END; END; FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; @@ -449,10 +449,7 @@ PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN - IF i + n > size THEN RETURN FALSE; END; - RightShift (x, i, r); w := n DIV BITSIZE (IByte); From jkrell at elego.de Wed Feb 10 14:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210135311.BFF6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:53:11 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: reapply Tony's fix for longint initialization compare with http://dcvs.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-sys/m3front/src/misc/CG.m3.diff?r1=1.21;r2=1.22 seemingly identical except in the mean time "n_bits" renamed to "excess" It works now that TWord.Extract has no size limit and just assumes zero extension. Index: CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.31 diff -u -r1.31 CG.m3 --- CG.m3 8 Feb 2010 13:10:06 -0000 1.31 +++ CG.m3 10 Feb 2010 13:51:58 -0000 @@ -107,6 +107,9 @@ PROCEDURE Init () = BEGIN + + <* ASSERT TInt.Zero.n = Target.Longint.bytes *> + Max_alignment := Target.Alignments [LAST (Target.Alignments)]; FOR t := FIRST (Type) TO LAST (Type) DO StackType[t] := t; END; @@ -143,7 +146,7 @@ fields[TRUE] := NIL; in_init := FALSE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; free_temps := NIL; busy_temps := NIL; free_values := NIL; @@ -797,7 +800,7 @@ cg.begin_init (v); in_init := TRUE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; END Begin_init; PROCEDURE End_init (v: Var) = @@ -940,10 +943,10 @@ (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; - excess := Target.Integer.size - size; + excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; ELSIF Target.Little_endian AND TWord.Extract (init_bits, 0, size, tmp) AND TWord.Extract (init_bits, size, excess, new_bits) THEN @@ -970,7 +973,7 @@ FOR i := LAST (TargetMap.Integer_types) TO FIRST (TargetMap.Integer_types) BY -1 DO WITH z = TargetMap.Integer_types[i] DO - IF (z.bytes <= n_bytes) AND (z.size <= Target.Integer.size) + IF (z.bytes <= n_bytes) AND (offset MOD z.align = 0) THEN t := z.cg_type; RETURN TRUE; @@ -994,7 +997,7 @@ AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; - ELSE bit_offset := Target.Integer.size - (o - init_pc) - s; + ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) From jkrell at elego.de Wed Feb 10 15:06:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:06:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140626.98A902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:06:26 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: darnit, something is broken, go back a version From jkrell at elego.de Wed Feb 10 15:09:33 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:09:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140935.04DD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:09:33 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: go back to m3objfile append(integer) instead of appendBytes(array of bytes) From jkrell at elego.de Wed Feb 10 15:23:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:23:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210142357.D51C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:23:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo (lots of deliberat copy/paste here) From jkrell at elego.de Wed Feb 10 15:54:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:54:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145402.ACDCB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:54:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: classify various parts as portable or not; portable = same output for 32bit and 64bit, for non portable, print 'notportable' so they file can be diffed; we might somehow allow for portable and specific though? From jkrell at elego.de Wed Feb 10 15:57:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:57:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145744.7A3642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:57:44 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: bounce to the AMD64_DARWIN output; most of the diff is changing to 'notportable' but there are definitely discrepancies between AMD64_DARWIN and LINUXLIBC6 that we need to investigate very soon, along with comparing to other platforms esp. NT386 and isolating the initialization issue (that could be related to these diffs) From jkrell at elego.de Wed Feb 10 16:11:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:11:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151159.38F482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:11:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: let's try this again, there was maybe something wierd on my machine, retesting.. go back a version: append(host integer) => appendBytes(array up to 8 bytes) We'll need this for initializing LONGINT, since they don't fit in host INTEGER From jkrell at elego.de Wed Feb 10 16:13:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:13:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151330.912062474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:13:30 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) From jkrell at elego.de Wed Feb 10 16:19:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:19:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151907.1F3C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:19:07 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: again, maybe was wierdness on my machine, or it was the m3front change: remove the size check from TWord.Extract, tested by running upgrade.py twice, and the code is fairly clear, it works From hosking at cs.purdue.edu Wed Feb 10 16:14:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:14:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210104438.196C42474001@birch.elegosoft.com> References: <20100210104438.196C42474001@birch.elegosoft.com> Message-ID: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:16:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:16:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210112056.6B5332474001@birch.elegosoft.com> References: <20100210112056.6B5332474001@birch.elegosoft.com> Message-ID: Huh? Cryptic comment. On 10 Feb 2010, at 12:20, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:20:55 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > Log message: > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From hosking at cs.purdue.edu Wed Feb 10 16:18:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:18:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210115812.269A12474001@birch.elegosoft.com> References: <20100210115812.269A12474001@birch.elegosoft.com> Message-ID: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:58:11 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > allow negating FIRST(INTEGER) even though it overflows > allows this test case to compile: > C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 > --- building in NT386 --- > > new source -> compiling Main.m3 > "..\Main.m3", line 35: doneg: Negate overflowed > 1 error encountered > compilation failed => not building program "pgm.exe" > Fatal Error: package build failed > > tempting to make TInt.Add/Subtract return the value > even if overflow, but for now, no. > This fix assumes two's complement, that is, > it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:25:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:25:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210151330.912062474001@birch.elegosoft.com> References: <20100210151330.912062474001@birch.elegosoft.com> Message-ID: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> On 10 Feb 2010, at 16:13, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 16:13:30 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! From hosking at cs.purdue.edu Wed Feb 10 16:23:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:23:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210134630.BE5032474001@birch.elegosoft.com> References: <20100210134630.BE5032474001@birch.elegosoft.com> Message-ID: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> What does xEQ do exactly? PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. On 10 Feb 2010, at 14:46, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 14:46:28 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > Just remove the size check in Extract. > It appears it will just naturally treat the value as zero extended, which > is reasonable and allows the rest to work. > > This lets Tony's fix for initializing Longint work. > To be reapplied shortly. > > Deobfuscate Mask and Base here as well, like in TInt. > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > once confidence is total) > > Index: src/TWord.m3 > =================================================================== > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > retrieving revision 1.10 > diff -u -r1.10 TWord.m3 > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > @@ -16,8 +16,8 @@ > LShift = Word.LeftShift; > > CONST > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > - Base = Mask + 1; > + Mask = 16_FF; > + Base = 16_100; > > (*------------------------------------------- unsigned integer operations ---*) > > @@ -278,8 +278,8 @@ > BEGIN > <*ASSERT n # 0*> > FOR i := n-1 TO 0 BY -1 DO > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > + IF a.x[i] # b.x[i] THEN > + RETURN FALSE; > END; > END; > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > @@ -449,10 +449,7 @@ > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > - size := x.n * BITSIZE (IByte); > BEGIN > - IF i + n > size THEN RETURN FALSE; END; > - > RightShift (x, i, r); > > w := n DIV BITSIZE (IByte); From hosking at cs.purdue.edu Wed Feb 10 16:32:29 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:32:29 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 16:35:23 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 16:35:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210153523.710832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 16:35:23 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert to including the overflow checks here. More changes coming. From hosking at cs.purdue.edu Wed Feb 10 16:13:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:13:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210160924.031B92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:09:23 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: granted I'm guessing a bit, but this seems to allow for longint initialization, and doesn't break initialization of everything else; the rationale, other than a load of guessing and taking hints from Tony's change, is to flush the initialization at integer boundaries, whether we hit them or go past them, though I'm not really all that familiar with this code..the change is pretty darn small and safe seeming.. From jkrell at elego.de Wed Feb 10 17:13:13 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:13:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161313.3F9042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:13:13 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: 1) mark more cases as non portable, that I missed before, because e.g. 0xABCD0000 < 10 depends on word size 2) go ahead and use longint intialization, of individual variables and of an array; this also reveals a bug in the test code where I was leaving one element of the array uninitialized, (see, I got all the way to the end, but I had missed [2] by accident) that could definitely account for some of the descrepancies, good news! From jkrell at elego.de Wed Feb 10 17:17:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:17:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161705.6D2BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:17:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: mark a few more cases as not portable (I'm being a little sloppy here but ok) From jay.krell at cornell.edu Wed Feb 10 17:22:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:22:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:26:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:26:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> , Message-ID: I did a mechanical transform from Word to TWord. Nearly all of the constant folding was there, but only for 32bit operations (the only ones that existed). I've "merely" been giving parity to the 64bit variants. If anything, so far I have added checks. Granted, there might be some missing. My experience though is that they are in there, somewhere, probably via the frontend calling check_hi/lo. You know, I write code like Word.Shift(a, 123), I get a compile time warning and a runtime error. The large shift count is what comes to mind. I can test the extract/insert n + i stuff. I'm going to test with TWord.Extract put back. It ended up not used by my fix. Sorry about that. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:32:29 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:31:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:31:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> References: <20100210115812.269A12474001@birch.elegosoft.com>, <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Message-ID: I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:33:10 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:33:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210163310.DC9C12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:33:10 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: put size check back in Extract, my longint initialization fix didn't require it after all; fix a newline it appears as well From jay.krell at cornell.edu Wed Feb 10 17:35:48 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:35:48 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , ,,, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, ,,, , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:37:23 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:37:23 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:43:52 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:43:52 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, Message-ID: (I also doubt the efficiency gained by IWord/ILongCard based implementations is worth the slight extra mental effort to understand. This code is already beyond a lot of people, keeping it bytes, with clear values, helps just a teeny tiny little bit to read it. I still haven't studied how divide works for example. A comment indicating the actual values I'd say is an ok compromise, I had it in there briefly. I realize people might be tempted to press this into work where performance matters, at which point a larger base becomes more interesting. (I assume the "arithmetic" package looks similar.)) - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:22:56 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:47:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:47:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:48:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:48:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: whoops didn't realize that had pasted in, I didn't see anything. Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:52:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:52:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:55:05 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:55:05 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: > be warned that your m3back code might break when I check things in. I have nothing outstanding on my machine. Please compile what is checked in, thanks. I do have a little more in mind, maybe. It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. We still have one or two word size cross issues. I looked into inlining rotates, the C compiler generates pretty big code though. - Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:00:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:00:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:06:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:06:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: I don't either but I'd just assume workaround it and move on. I get tired of fighting dependencies, I understand the code well enough, I just copy it around and give it the local module/interface name and move on.. Normally I don't like such duplication, but I know the code, and I just needed to get the system back up and running so I could compare longint test cases across multiple systems. There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:14:37 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:14:45 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:14:45 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Word.Insert and Word.Extract with large constants fail appropriately, via check_hi. I just checked. Long.Insert/Extract similar. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Wed, 10 Feb 2010 16:37:23 +0000 Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 18:29:19 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 18:29:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210172919.BBBCD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 18:29:19 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert From hosking at cs.purdue.edu Wed Feb 10 18:44:23 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:44:23 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: > You really anticipate it every changing? > Ever having machines that can't address bytes? > I know they used to exist, but it has been several decades. > The world's vast swaths of C, C++, Java, C# won't port easily to them. > If I understood you, you argued that it is clearly IByte, so I should > feel free to make up my own constants outside of TInt.i3/TWord.i3. > Though so far I haven't. > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:25:31 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:47:13 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:47:13 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> On 10 Feb 2010, at 11:35, Jay K wrote: > I was just trying to get longint initialization to work. > It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. > It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. > Maybe that is desirable. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:13:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you are trying to do or why. Can you provide further explanation? > > On 10 Feb 2010, at 04:47, Jay K wrote: > > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 18:50:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 18:50:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210175014.DD8C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 18:50:14 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Log message: correctly convert Int32 to Int64 using CDQ instruction: convert double to quad; it's inefficient because CDQ only operates on EDX:EAX pair we already correctly convert Word32 to Word64 via allocating and zeroing another register truncation conversions we throw out the upper registers (after wastefully forcing the value into registers) still to consider: range checks and unsigned<=>signed conversion There are many error cases here. Perhaps the frontend already deals with it? From hosking at cs.purdue.edu Wed Feb 10 18:49:56 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:56 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: OK, I'll work it through to m3back. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:55, Jay K wrote: > > be warned that your m3back code might break when I check things in. > > I have nothing outstanding on my machine. > Please compile what is checked in, thanks. > I do have a little more in mind, maybe. > It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. > We still have one or two word size cross issues. > I looked into inlining rotates, the C compiler generates pretty big code though. > > > - Jay > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:54:47 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:54:47 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: But it makes an untidy mess! On 10 Feb 2010, at 12:06, Jay K wrote: > I don't either but I'd just assume workaround it and move on. > I get tired of fighting dependencies, I understand the code well enough, > I just copy it around and give it the local module/interface name and move on.. > Normally I don't like such duplication, but I know the code, and I just needed > to get the system back up and running so I could compare longint test cases > across multiple systems. > > There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. > > - Jay > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:14:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Why? I don't understand how this can occur... > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 10 Feb 2010, at 11:44, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> , <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> Message-ID: I don't think they are the same. TInt.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => true, they are both -1 TWord.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => false, they are 255 and 65535. But maybe I'm confused. I should just test the above but not now. I guess..it'd help if n was a constant, always 8. Then TInt.EQ would work, and the CheckSign business would be gone/simpler. Except then, we'd know, all other beings equal, initialization would be horribly broken. I don't fully understand that, but we need a 4 byte value. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:49:32 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:49:32 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:32 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: > xEQ should be EQ but I wasn't confident I wrote it correctly. > So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. > Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. > It should be fairly clear from the code. > > - Jay > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:23:08 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > What does xEQ do exactly? > > > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > Just remove the size check in Extract. > > > It appears it will just naturally treat the value as zero extended, which > > > is reasonable and allows the rest to work. > > > > > > This lets Tony's fix for initializing Longint work. > > > To be reapplied shortly. > > > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > > once confidence is total) > > > > > > Index: src/TWord.m3 > > > =================================================================== > > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > > retrieving revision 1.10 > > > diff -u -r1.10 TWord.m3 > > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > > @@ -16,8 +16,8 @@ > > > LShift = Word.LeftShift; > > > > > > CONST > > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > > - Base = Mask + 1; > > > + Mask = 16_FF; > > > + Base = 16_100; > > > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > > > @@ -278,8 +278,8 @@ > > > BEGIN > > > <*ASSERT n # 0*> > > > FOR i := n-1 TO 0 BY -1 DO > > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > > + IF a.x[i] # b.x[i] THEN > > > + RETURN FALSE; > > > END; > > > END; > > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > > @@ -449,10 +449,7 @@ > > > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > > VAR w, b: INTEGER; > > > - size := x.n * BITSIZE (IByte); > > > BEGIN > > > - IF i + n > size THEN RETURN FALSE; END; > > > - > > > RightShift (x, i, r); > > > > > > w := n DIV BITSIZE (IByte); > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:53:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:53:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: > sysutils has somewhat of a need to know if it is using user threads. > We've been over this multiple times through the years. > Never seems to be 100% resolved, but a solid 99%. > > > It runs a process and waits. > Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. > It was identified by people as a major performance problem. > Because the process exits fairly quickly but you have to wait for the sleep to finish. > Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. > By and by, most platforms got kernel threads. Changing it to be wait(hang) > became good, faster, no deadlock. But openbsd comes along with lame > pthreads, usermode at that, so we use user threads, and wait(hang) > could deadlock.. > > > There is an interface in m3core to handle this stuff, but if > you bootstrap from an old build, it isn't there. > > > Mitigating factor as I understand that we don't use threads agressively, > so the deadlock isn't actually likely. > "we" meaning code that launches processes. > > > I understand that ideally you don't care if you are using userthreads or kernelthreads. > But the abstraction historically was incomplete. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:16:24 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Huh? Cryptic comment. > > > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > > > Modified files: > > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > > > Log message: > > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:03:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:03:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,, , , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, , ,,<4B7035B2.4030806@lcwb.coop>, ,,, , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , , , , , <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> Message-ID: One might imagine that: VAR a,b:Target.Int; TInt.EQ(a, b) implies TWord.Extract(a, 10, 8) = TWord.Extract(b, 10, 8) (for various values of 10 and 8). but it doesn't. a could be a one byte zero, b a two byte zero, they are EQ, but Extract offset 10 will fail on a. I believe the right way to say this is "referential integrity is broken". EQ should imply equivalent in all observable ways, but it doesn't. Because two numbers with different size can be EQ, but different size leads to other varying behavior. I'm not 100% certain of any of this, but at least 50%. And then, I realize, given a Long.T and a Word.T, you can't directly compare them. You have to go through VAL, which makes them the same size. So there's a missing analog sort of. Target.Int is more loosely typed than its analogs Long.T and Word.T. Target.Int allows mixing arithmetic on different sized operands, for better and worse. In one hand TWord.Extract should just act like the value is infinitely zero extended. On the other, as you point out, that's not what its callers really expect. It's probably a useful semantic, but in some other context. And in that imaginary context, TWord.Insert might grow the data to fit. And likewise TInt.Add/Subtract would grow the value, not overflow.. I realize, this is not the context we care about, we just need something for the compiler. (Though I'm not even sure what for, esp. why all the operations, other than for the constant folding in the NT386 backend, which makes good use of it all.) - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:47:13 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 10 Feb 2010, at 11:35, Jay K wrote: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:05:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:05:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> References: <20100210112056.6B5332474001@birch.elegosoft.com>, , <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> Message-ID: I understand but I have a variety of systems and a variety of installs lying around. I usually make do with whatever I have. It is untidy, but only slightly. For some definition of "only slightly". I keep hoping we can say 5.8 release is the new base, abandon all others, but we don't have it yet. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:53:39 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:08:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:08:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, , <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Message-ID: BITS 16, I know, but I like BITS 8. Using integer directly is viable and efficient, but I doubt worthwhile in this context. If they must be abstracted, I think a comment next to them giving their actual values would be good. I was tempted to change all the bitsize(x) and bitsize(x) - 1 expressions to 8 and 7. So much little layering here and there, can really slow down one's reading comprehension.. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:44:23 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 11 09:42:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:42:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211084251.9F81A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:42:51 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: encode constant shifts by 1 in two bytes instead of three; though the right approach is actually to do an add to self, we'll get to that as part of a broader pass following the optimization guidelines, like decomposing multiplication as adds/shifts, division by constant to multiplication by reciprocal, etc. From jkrell at elego.de Thu Feb 11 09:59:03 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:59:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211085903.17EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:59:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add comment for previous change, though I still expect to change it to an add From jkrell at elego.de Thu Feb 11 11:50:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:50:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105058.3F3B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:50:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c hand.c Log message: enable testing the insert/extract functions on non-Win32, establish what the other low/highbits table is, so we can eliminate it From jkrell at elego.de Thu Feb 11 11:51:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:51:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105134.C9EF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:51:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: cleanup From jkrell at elego.de Thu Feb 11 13:12:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:12:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211121251.456312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:12:51 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable test p227 some longint/integer stuff, might not quite work or on all platforms but is very close if not From jkrell at elego.de Thu Feb 11 13:20:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:20:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122022.935972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:20:22 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: restore Tony's version 1.10 from April 2008 that depends on a 64bit longint, now that NT386 has it From jkrell at elego.de Thu Feb 11 13:24:33 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:24:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122433.A6F3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:24:33 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: reduce diff against 64bit version by making unsigned_long_int = Word.T 'restated' instead of equating to unsigned_int which is also Word.T; really we should look into removing any such thing called Ctypes.unsigned_long Ctypes.long_int due to it NOT being the same size in all 64bit C environments, it is therefore useless; pointer sized integer is INTEGER or Word.T or size_t or ptrdiff_t, NOT long, long int, unsigned long (see Win64) From jkrell at elego.de Thu Feb 11 13:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122945.814F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:29:45 Modified files: cm3/m3-sys/m3tests/src/e0/e029/: stdout.build Log message: update output From jkrell at elego.de Thu Feb 11 13:32:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:32:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211123212.6EAEA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:32:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current NT386 output; we'll see how it compares to others From jkrell at elego.de Thu Feb 11 13:45:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:45:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124513.24F902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:45:12 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: we can now provide UINT32_MAX, though its type isn't perhaps what is wanted (LONGINT instead of INTEGER or Word.T) From jkrell at elego.de Thu Feb 11 13:47:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:47:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124755.D14382474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:47:55 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: line up the columns From jkrell at elego.de Thu Feb 11 13:52:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:52:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125204.840CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:52:04 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: comments From jkrell at elego.de Thu Feb 11 13:59:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125900.17A472474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:00 Modified files: cm3/m3-libs/m3core/src/C/ALPHA_OSF/: Csetjmp.i3 Log message: replace long with INTEGER From jkrell at elego.de Thu Feb 11 13:59:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125930.00A772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:29 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstddef.i3 Log message: replace long with INTEGER, unsigned_long with Word.T From jkrell at elego.de Thu Feb 11 14:04:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:04:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130453.133D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:04:53 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: allow for 64bit integers now, comment out the cas/casp stuff which I'll shortly change to the new atomic interface From jkrell at elego.de Thu Feb 11 14:07:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:07:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130740.08B7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:07:40 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: space after comma From jkrell at elego.de Thu Feb 11 14:45:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:45:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134529.530432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:45:29 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information for assertion failures: hits when trying atomics -- popping addr into int64, actually there's an indirection and it should be ok From jkrell at elego.de Thu Feb 11 14:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134642.0A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:46:41 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'size' => 'srcSize' or 'destSize' for clarity From jkrell at elego.de Thu Feb 11 14:48:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:48:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134828.1AA8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:48:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move common repeated code out to common path From jkrell at elego.de Thu Feb 11 15:00:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:00:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211140056.891E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:00:56 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: start filling in combinatorial code (maybe I should use generics?); some stuff is commented out because it causes backend assertion failures because the backend currently doesn't even manage the virtual stack correctly for atomics yet From jkrell at elego.de Thu Feb 11 15:59:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:59:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211145952.102AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:59:52 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Log message: make fence work it is a little sleazy any xchg that references memory is serializing the simplest would be push eax xchg [esp+4], eax pop eax however the push/pop are usually a waste The approach here is to have a fence local variable, allocate a register, and xchg fence, reg (a global would also do, but that'd cause artifical contention) however the tricky/sleazy part is that our code generator is so good that it'll want to enregister fence, and xchg reg1, reg2 is not serializing. Many of my attempts did that. The pattern here seems to do the trick reliably. I think in particular because of the "overwritesdest" boolean. Test case has multiple fences in a row, and they still all go to memory. The other sleazy part is how I've filled in the table for shld, shrd, xchg. I need to understand this better, and need to be certain the bogus entries won't be used. From jkrell at elego.de Thu Feb 11 16:15:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:15:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211151505.4F0112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:15:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add the usual debugging output and uncomment store_ordered, at least for int32 (not really possible for int64, not sure about smaller); implementation is just fence; store; fence; the generated code is a bit fishy in its efficiency and correctness, will dig more and possibly email.. From jkrell at elego.de Thu Feb 11 16:20:46 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:20:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211152046.2FF352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:20:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix store_ordered to store indirect instead of direct, looks better now, though still many extra instructions From jkrell at elego.de Thu Feb 11 16:38:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:38:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153834.75B5C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:38:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: load_ordered is fence; load_indirect; fence -- I'm worried the optimizer will inhibit duplicate ordered loads/stores though, we'll have to be watchful From jkrell at elego.de Thu Feb 11 16:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153943.399C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: combine load/store tests -- hopefully compiler won't remember enough -- I need to change it to use locals, whose address might be passed across threads, then I'll know better, as we don't optimize away stores to globals, I guess From jkrell at elego.de Thu Feb 11 16:43:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:43:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211154329.8921B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:43:29 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: augment test code some From jkrell at elego.de Fri Feb 12 11:02:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:02:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100246.F2B3C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:02:46 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: actually write the lock prefix, not just in the debug output From jkrell at elego.de Fri Feb 12 11:04:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:04:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100427.186BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:04:27 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100535.4D04A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:05:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: enable the atomics code I had, some fixes there, I think CG.i3 is broken for compare_exchange though, still need to look into exchange and fetch_and_op more, see if they are working From jkrell at elego.de Fri Feb 12 11:06:18 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100618.521352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:18 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:06:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100659.1AB152474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:59 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: remove some newlines, suppress longint code for now From jkrell at elego.de Fri Feb 12 11:45:54 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:45:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212104555.1E36B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:45:54 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: fix compare_exchange by hand-building the modrm part of the instruction Still, it would be better if compare_exchange took a Var parameter in the function call instead of on the stack. Witness the code: 0000018E: 8D3538000000 LEA ESI gv.2[_MM_Main]+56 00000194: 8D3D98000000 LEA EDI gv.2[_MM_Main]+152 0000019A: 8BC7 MOV EAX EDI 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG ESI EBX should really be more like: 00000194: 8D3D98000000 MOV EAX gv.2[_MM_Main]+152 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG gv.2[_MM_Main]+56 EBX which should be easy to achieve if compare_exchange took its parameters in the function call instead of on the stack. 3 instructions instead of 5! From jkrell at elego.de Fri Feb 12 12:11:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:11:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111116.0790C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:11:15 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: work in progress: atomics, note that Visual C++ interlockedor/and/xor are cmpxchg loops, probably wrong approach taken here currently, the code doesn't disasm as intended and I need to check if the intended operations exist From jkrell at elego.de Fri Feb 12 12:19:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:19:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111926.E75D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:19:26 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: atomics: better, important to not generate escape byte for most operations, still looks like the indirection problem compxchg had, if not other problems (such as returning the before vs. after value which I haven't checked on) From jkrell at elego.de Fri Feb 12 13:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124315.E87CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:43:15 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: use inc/dec for atomic add/sub of 1 or -1 before: lea esi,[_MM_Main+38h] mov ebx, 1 lock inc dword ptr [esi], ebx mov dword ptr [_MM_Main+9Ch],esi after: lea esi,[_MM_Main+38h] lock inc dword ptr [esi] mov dword ptr [_MM_Main+9Ch],esi ideal: lock inc dword ptr [_MM_Main+38h] aha but I think I know why, will try for ideal I thought this was only going to save one byte: add foo,1 vs. inc foo but we were loading 1 into a register as well (we could have gotten to add foo,1, but no point now) the unop changes not actually used here no unop is atomic, inc/dec are implemented separately I tried using the table based stuff but it is confusing diff: Index: Codex86.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.i3,v retrieving revision 1.18 diff -u -r1.18 Codex86.i3 --- Codex86.i3 11 Feb 2010 14:59:51 -0000 1.18 +++ Codex86.i3 12 Feb 2010 12:41:14 -0000 @@ -60,8 +60,9 @@ lock_compare_exchange (READONLY dest, src: Operand); pushOp (READONLY src: Operand); popOp (READONLY dest: Operand); - decOp (READONLY op: Operand); - unOp (op: Op; READONLY dest: Operand); + decOp (READONLY op: Operand; locked := FALSE); + incOp (READONLY op: Operand; locked := FALSE); + unOp (op: Op; READONLY dest: Operand; locked := FALSE); mulOp (READONLY src: Operand); imulOp (READONLY dest, src: Operand); imulImm (READONLY dest, src: Operand; imm, imsize: INTEGER); Index: Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.55 diff -u -r1.55 Codex86.m3 --- Codex86.m3 12 Feb 2010 11:19:26 -0000 1.55 +++ Codex86.m3 12 Feb 2010 12:41:14 -0000 @@ -92,6 +92,7 @@ pushOp := pushOp; popOp := popOp; decOp := decOp; + incOp := incOp; unOp := unOp; mulOp := mulOp; imulOp := imulOp; @@ -1019,26 +1020,49 @@ END; END popOp; -PROCEDURE decOp (t: T; READONLY op: Operand) = + +PROCEDURE incOrDecOp (t: T; READONLY op: Operand; locked: BOOLEAN; incOrDec: [0..1]) = VAR ins: Instruction; + name := ARRAY [0..1] OF TEXT{"INC", "DEC"}[incOrDec]; BEGIN - Mn(t, "DEC"); MnOp(t, op); + ins.lock := locked; + Mn(t, name); MnOp(t, op); + <* ASSERT op.loc = OLoc.mem OR op.loc = OLoc.register *> - IF op.loc = OLoc.register THEN - ins.opcode := 16_48 + op.reg[0]; + + IF locked THEN + ins.mrmpres := TRUE; + ins.disp := 0; + ins.dsize := 0; + ins.modrm := 8 * incOrDec + op.reg[0]; + ins.opcode := 16_FF; + writecode(t, ins); + ELSIF op.loc = OLoc.register THEN + ins.opcode := 16_40 + 8 * incOrDec + op.reg[0]; writecode(t, ins); ELSE <* ASSERT op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 4 *> - build_modrm(t, op, t.opcode[1], ins); + build_modrm(t, op, t.opcode[incOrDec], ins); ins.opcode := 16_FF; writecode(t, ins); log_global_var(t, op.mvar, -4); END + END incOrDecOp; + +PROCEDURE incOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 0); + END incOp; + +PROCEDURE decOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 1); END decOp; -PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR ins: Instruction; BEGIN + ins.lock := locked; ins.opcode := opcode[op].imm32; IF dest.loc = OLoc.mem THEN get_op_size(dest.mvar.mvar_type, ins); @@ -1057,11 +1081,14 @@ END END unOp1; -PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR destA: ARRAY OperandPart OF Operand; destSize := SplitOperand(dest, destA); BEGIN + (* future: we could use cmpxchg loop *) + <* ASSERT (destSize = 1) OR (NOT locked) *> + IF destSize = 2 AND (op IN SET OF Op{Op.oNEG, Op.oNOT}) THEN CASE op OF | Op.oNOT => @@ -1079,7 +1106,7 @@ <* ASSERT NOT Is64(destA[destSize - 1].optype) *> FOR i := 0 TO destSize - 1 DO - unOp1(t, op, destA[i]); + unOp1(t, op, destA[i], locked); END; END; END unOp; Index: M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.110 diff -u -r1.110 M3x86.m3 --- M3x86.m3 12 Feb 2010 11:11:15 -0000 1.110 +++ M3x86.m3 12 Feb 2010 12:41:15 -0000 @@ -3004,7 +3004,8 @@ u.vstack.newdest(u.cg.reg[EDI]); ELSE - WITH stack0 = u.vstack.pos(0, "zero"), stop0 = u.vstack.op(stack0) DO + WITH stack0 = u.vstack.pos(0, "zero"), + stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, @@ -4297,15 +4298,16 @@ CONST AtomicOpToOp = ARRAY AtomicOp OF Op { Op.oADD, Op.oSUB, Op.oOR, Op.oAND, Op.oXOR }; CONST AtomicOpName = ARRAY AtomicOp OF TEXT { "add", "sub", "or", "and", "xor" }; -PROCEDURE fetch_and_op (x: U; op: AtomicOp; t: MType; z: ZType; +PROCEDURE fetch_and_op (x: U; atomic_op: AtomicOp; t: MType; z: ZType; <*UNUSED*>order: MemoryOrder) = (* tmp := Mem [s1.A].t; Mem [s1.A].t := tmp op s0.u; s1.u := tmp op s0.u; pop *) + VAR op := AtomicOpToOp[atomic_op]; BEGIN IF x.debug THEN x.wr.Cmd ("fetch_and_op"); - x.wr.OutT (AtomicOpName[op]); + x.wr.OutT (AtomicOpName[atomic_op]); x.wr.TName (t); x.wr.TName (z); x.wr.NL (); @@ -4318,7 +4320,35 @@ RETURN; END; - EVAL x.vstack.dobin(AtomicOpToOp[op], (*symmetric*) op # AtomicOp.Sub, (*overwritesdest*) TRUE, t, locked := TRUE); + (* optimize add 1 => inc, add -1 => dec, sub 1 => dec, sub -1 => inc + * to save a byte encoding the immediate value. + * NOTE: We should do this for reg where t.reguse[reg].last_imm = 1 or -1 also. + *) + + WITH stack0 = x.vstack.pos(0, "fetch_and_op"), + stack1 = x.vstack.pos(1, "fetch_and_op"), + stop0 = x.vstack.op(stack0) DO + IF op IN SET OF Op{Op.oADD, Op.oSUB} THEN + IF stop0.loc = OLoc.imm THEN + WITH imm = stop0.imm DO + IF (TInt.EQ(imm, TInt.One) OR TInt.EQ(imm, TInt.MOne)) THEN + x.vstack.unlock(); + x.vstack.find(stack1, Force.anyreg); + IF (op = Op.oADD) = TInt.EQ(imm, TInt.One) THEN + x.cg.incOp(x.vstack.op(stack1), locked := TRUE); + ELSE + x.cg.decOp(x.vstack.op(stack1), locked := TRUE); + END; + x.vstack.newdest(x.vstack.op(stack1)); + x.vstack.discard(1); + RETURN; + END; + END; + END; + END; + END; + + EVAL x.vstack.dobin(op, (*symmetric*) (*op # AtomicOp.Sub*) FALSE, (*overwritesdest*) TRUE, t, locked := TRUE); END fetch_and_op; From jkrell at elego.de Fri Feb 12 13:45:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:45:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124559.AB8B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:45:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments From jkrell at elego.de Fri Feb 12 13:50:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:50:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212125040.6D9B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:50:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: don't force into a register, but, alas, too late, it already is, unnecessarily, really could use passing a var here instead of pushing a load_address From jkrell at elego.de Fri Feb 12 14:17:44 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:17:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212131744.60EAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:17:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Stackx86.m3 Log message: a little more atomic work hack around the wrong level of indirection we now have: _Main__Test_AtomicInteger_FetchAnd: 000001BA: 55 push ebp 000001BB: 8B EC mov ebp,esp 000001BD: 81 EC 00 00 00 00 sub esp,0 000001C3: 53 push ebx 000001C4: 56 push esi 000001C5: 57 push edi 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 000001D2: F0 21 1E lock and dword ptr [esi],ebx 000001D5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001DB: 5F pop edi 000001DC: 5E pop esi 000001DD: 5B pop ebx 000001DE: C9 leave 000001DF: C3 ret _Main__Test_AtomicInteger_FetchDec: 000001E0: 55 push ebp 000001E1: 8B EC mov ebp,esp 000001E3: 81 EC 00 00 00 00 sub esp,0 000001E9: 53 push ebx 000001EA: 56 push esi 000001EB: 57 push edi 000001EC: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001F2: F0 FF 0E lock dec dword ptr [esi] 000001F5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001FB: 5F pop edi 000001FC: 5E pop esi 000001FD: 5B pop ebx 000001FE: C9 leave 000001FF: C3 ret notice that: - the lea esi is not needed - the mov foo, esi is *wrong* and wrecks the result From jkrell at elego.de Fri Feb 12 14:36:19 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:36:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212133622.B64D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:36:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: nevermind, this is all wrong except for store, load, fence, exchange, and compare_exchange The atomic interface really does *not* expose a bunch of functionality on x86. x86 generally stores the result in memory. We cannot then return the result because we'd have to reread memory. Therefore all these functions will require cmpxchg loops. Probably just write wrapper functions for the C compiler intrinsics.. From jkrell at elego.de Fri Feb 12 14:43:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:43:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212134317.A83ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:43:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: remove all the passing around of "locked" since the lock prefix isn't going to be useful except for compare_exchange and lock_compare_exchange (and not even for exchange actually, it doesn't need it) we will be able to do some of add/sub with xadd probably but or/xor/and will just use cmpxchg loops, probably functions From hosking at cs.purdue.edu Fri Feb 12 16:26:04 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 12 Feb 2010 10:26:04 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100212133622.B64D92474001@birch.elegosoft.com> References: <20100212133622.B64D92474001@birch.elegosoft.com> Message-ID: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. On 12 Feb 2010, at 14:36, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/12 14:36:19 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > nevermind, this is all wrong except for store, load, fence, exchange, > and compare_exchange > The atomic interface really does *not* expose a bunch of > functionality on x86. x86 generally stores the result in memory. > We cannot then return the result because we'd have to reread memory. > Therefore all these functions will require cmpxchg loops. > Probably just write wrapper functions for the C compiler intrinsics.. From jay.krell at cornell.edu Fri Feb 12 18:10:47 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 12 Feb 2010 17:10:47 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> References: <20100212133622.B64D92474001@birch.elegosoft.com>, <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> Message-ID: Value could change in the meantime. I'll implement fetch_and_op with cmpxchg loops soon. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 12 Feb 2010 10:26:04 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. > > On 12 Feb 2010, at 14:36, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/12 14:36:19 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > nevermind, this is all wrong except for store, load, fence, exchange, > > and compare_exchange > > The atomic interface really does *not* expose a bunch of > > functionality on x86. x86 generally stores the result in memory. > > We cannot then return the result because we'd have to reread memory. > > Therefore all these functions will require cmpxchg loops. > > Probably just write wrapper functions for the C compiler intrinsics.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wagner at elego.de Sat Feb 13 11:59:24 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 11:59:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213105924.47CFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 11:59:24 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: we need to run upgrade from scratch From wagner at elego.de Sat Feb 13 17:02:11 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 17:02:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213160211.B739F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 17:02:11 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: don't ship anything too early From jkrell at elego.de Sun Feb 14 08:23:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:23:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214072326.B75172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:23:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: atomic fetch_op work in progress almost works, but the levels of indirection are wrong: _Main__Test_AtomicInteger_FetchAnd: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax,esi needs indirection, doesn't need to be use esi but that is ok 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [ebx],esi parameters reversed, odd, given that compare_exchange works 000001DC: 75 F6 jne 000001D4 000001DE: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi ... should be more like: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax, [_MM_Main+38h] or DWORD PTR [esi] ** 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [esi],ebx OR lock cmpxchg dword ptr [_MM_Main+98h],ebx 000001DC: 75 F6 jne 000001D4 ... From jkrell at elego.de Sun Feb 14 08:40:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:40:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214074053.0CCCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:40:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: very slight restructure to make it simpler, given that in at least two places order seems to get reversed, though they are only related to 32bit operations so this won't likely clear things up...Modula-3 seems to lack a 'next' or 'continue' statement, so I have to reindent a bunch where in C I avoid indentation whereever I can (no 'with', use goto for error handling; heck 'with' always confuses me, I don't know which part of it is 'reevaluated' vs. 'captured' -- does it introduce pointers, or cached copies, or just shortand for long expressions? All three are useful and with can only be done.. From jkrell at elego.de Sun Feb 14 09:33:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:33:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083355.B85172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:33:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: clarify comment, after checking documentation From jkrell at elego.de Sun Feb 14 09:35:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083509.EE9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:09 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 09:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083546.CEE592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix comment From jkrell at elego.de Sun Feb 14 09:38:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:38:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083855.A512E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:38:54 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 10:49:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:49:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214094907.25CC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:49:06 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix parameter order and indirect in atomic fetch_op; the last store is actually ok, still one wrong indirection to fix From jkrell at elego.de Sun Feb 14 10:59:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:59:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214095950.0B5BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:59:50 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup: one statement per line From jkrell at elego.de Sun Feb 14 11:44:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:44:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104417.DCF392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:44:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup formating, remove general lock prefix support (only used once, not worth it) From jkrell at elego.de Sun Feb 14 11:45:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:45:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104536.446A72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:45:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: 'o' => 'offset' From jkrell at elego.de Sun Feb 14 11:57:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:57:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105732.415672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:57:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: when loading from register + offset, and offset is 0, use different flags in the instruction so we don't have to waste a byte on the index; more to do here, but this case is known to occur From jkrell at elego.de Sun Feb 14 11:58:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:58:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105818.85EAC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:58:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add a comment From jkrell at elego.de Sun Feb 14 11:59:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:59:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105945.E37FA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:59:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: one statement per line From jkrell at elego.de Sun Feb 14 12:01:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:01:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110142.771C02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:01:42 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "sibpres" => "sib_present" "sib" is the x86 "scale index byte" or such, very often refernced in x86 literature, probably ok to leave cryptic asis From jkrell at elego.de Sun Feb 14 12:03:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:03:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110311.E964B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:03:11 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "mrmpres" => "mrm_present" "mrm" is short for "mod/rm" or such, which is often referenced in x86 literatue so probably ok to leave cryptic From jkrell at elego.de Sun Feb 14 12:06:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:06:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110633.F13C82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:06:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more formatting repair: THEN goes at end of line, ELSE takes its entire line From jkrell at elego.de Sun Feb 14 12:35:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:35:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214113548.46E1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:35:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: shorten other cases for offset=0 From jkrell at elego.de Sun Feb 14 12:42:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:42:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214114206.7F3B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:42:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Sun Feb 14 13:02:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:02:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214120221.50CFC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:02:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix indirection in atomic fetch_and_op just my ignorance using movOp instead of load_ind code is like: _Main__Test_AtomicInteger_FetchOr: 00000250: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] ; atomic variable 00000256: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] ; value to or with 0000025C: 8B 06 mov eax,dword ptr [esi] ; fetch old value 0000025E: 8B D8 mov ebx,eax ; move old value to tmp (this is needed) 00000260: 0B DA or ebx,edx ; compute new value 00000262: F0 0F B1 1E lock cmpxchg dword ptr [esi],ebx ; try to swap 00000266: 75 F6 jne 0000025E ; old value is in eax (always eax; or edx:eax pair for 64bit operations, not yet implemented) ; new value is in, in this case, ebx still could be better, could be: mov edx,dword ptr [_MM_Main+98h] mov eax,[_MM_Main+38h] retry: mov ebx,eax or ebx,edx lock cmpxchg [_MM_Main+38h],ebx jne retry ; old value is in eax ; new value is in, in this case, ebx six instructions instead of seven three registers (eax, ebx, edx) instead of four (eax, ebx, edx, esi) (problem is that we get load_address on the variable first, and we go ahead and enregister that address unnecessarily) And even so: if six instructions is considered too large, we can use a function instead. As well, add, sub, we can do more efficiently with xadd. (still need to check what libatomic does here) also we can probably optimize or(-1) => store_ordered(-1) or(0) => do nothing and(-1) => do nothing and(0) => store_ordered(0) probably they are rare/nonexistant From jkrell at elego.de Sun Feb 14 13:30:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:30:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123045.0EDF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:30:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: fix level of indirection in atomic swap Like compareExchange, it suffers from unnecessary enregistration of the address of the atomic variable: 0000034A: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 00000350: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 00000356: F0 87 1E lock xchg ebx,dword ptr [esi] which should be more like: mov ebx,dword ptr [_MM_Main+98h] lock xchg ebx,[_MM_Main+38h] two instructions instead of three, one register instead of two Though Visual C++ seems to do similar: ; 2 : long __fastcall F1(long b) { return _InterlockedExchange(&a, b); } 00000 8b c1 mov eax, ecx 00002 b9 00 00 00 00 mov ecx, OFFSET _a 00007 87 01 xchg DWORD PTR [ecx], eax 00009 c3 ret 0 notice that it uses a smaller mov to generate the address, because, you know, the instruction needs relocation anyway, you might as well have the relocation include the +38; This is probably something we should look into improving across the board in m3back. From jkrell at elego.de Sun Feb 14 13:36:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:36:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123626.6E3C22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:36:26 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: stderr.pgm stdout.build Log message: commit current output; needs work, but an ok start (it just compiles and runs, some atomic integer stuff; the printouts are just leftover from cas/casp stuff, the results of atomic aren't yet verified/printed, I just look at the disasm, and only integer is tested so far, not any other type) From jkrell at elego.de Sun Feb 14 13:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124522.ADD402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:45:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: slight update, fix newlines, only more nonportable stuff, but output should change slightly, hm? From jkrell at elego.de Sun Feb 14 13:46:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:46:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124606.739AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:46:06 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p227 atomics, doesn't test much yet, just compiles, runs, no output From jkrell at elego.de Sun Feb 14 14:18:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:18:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214131856.A81402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:18:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: add back underlying inc support, so we can soon optimize add/sub by +1/-1 (including atomic case) to be inc/dec From jkrell at elego.de Sun Feb 14 14:23:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:23:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214132342.3625E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:23:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove more a bit of the generalized lock support that ended up not used From jkrell at elego.de Sun Feb 14 14:38:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:38:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214133804.A7B872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:38:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: verify comment about procedure FixReturnValue and wordsmith it appropriately (half the comment appears to have gone obsolete/incorrect circa Visual C++ 5.0 but let's just stay compatible with older -- the only difference is for calling functions that return 16bit return types) From jkrell at elego.de Sun Feb 14 14:45:27 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134527.704EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:27 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Sun Feb 14 14:45:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134544.165C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 06:00:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:00:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050037.DB9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:00:37 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c Added files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 m3makefile Log message: test for sign/zero extension of the return values of functions that return types smaller than 32bits. I'm about to change the code here: the AMD manual recommends specific sequences that are shorter or equal in length to what we use, but in 3 of the 4 cases what we use doesn't match the recommendation From hosking at elego.de Mon Feb 15 06:07:07 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 15 Feb 2010 6:07:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050707.87E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/15 06:07:07 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Cleaner fix for LONGINT static initialization. From jkrell at elego.de Mon Feb 15 06:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050900.3057A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly, I think I found a bug From jkrell at elego.de Mon Feb 15 06:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050948.28DF32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:09:48 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly From jkrell at elego.de Mon Feb 15 06:18:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:18:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215051818.EA8AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:18:18 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test coverage to converting positive values too From jkrell at elego.de Mon Feb 15 06:44:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:44:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215054452.C6A512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:44:51 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: some refinements, esp. to give some contenxt to diffs From jkrell at elego.de Mon Feb 15 06:51:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:51:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215055136.E791E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:51:36 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 07:03:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:03:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215060353.57CED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:03:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: add line numbers From jkrell at elego.de Mon Feb 15 07:14:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:14:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215061433.DEF602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:14:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case; there is a bug here, different output on NT386 vs. LINUXLIBC6, not yet sure which is correct From jkrell at elego.de Mon Feb 15 07:24:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:24:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062435.991372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:24:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more From jkrell at elego.de Mon Feb 15 07:26:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:26:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062634.512542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:26:34 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more, there is a crash in here.. From jkrell at elego.de Mon Feb 15 07:37:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:37:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063735.EFDE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:37:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix mistake in dec when I put in the inc code; this broke division From jkrell at elego.de Mon Feb 15 07:38:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:38:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063825.DF4B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:38:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove two newlines From jkrell at elego.de Mon Feb 15 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064124.D73422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:41:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: move and modify assert (maybe we can make it tighter?) From jkrell at elego.de Mon Feb 15 07:42:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:42:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064244.A2D462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:42:42 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: flush more often (at newlines), for debugability From jkrell at elego.de Mon Feb 15 07:55:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:55:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215065531.B786D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:55:31 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 08:39:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:39:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215073958.C32CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:39:58 Added files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 m3makefile Log message: new smaller test that fails on NT386, non-const int64 division by 1 From jkrell at elego.de Mon Feb 15 08:40:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:40:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215074045.663582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:40:45 Modified files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 Log message: reduce, still fails From jkrell at elego.de Mon Feb 15 09:01:26 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:01:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215080127.EC77D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:01:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix div parameter order, and presumably mod From jkrell at elego.de Mon Feb 15 09:32:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:32:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083209.84A102474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:32:09 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 09:38:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:38:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083837.C1C312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:38:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: update output From jkrell at elego.de Mon Feb 15 09:59:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:59:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215085901.B20C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:59:01 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: add newlines to output, remove 'bug?' comment: uint8 and uint16 are full range in 8 and 16 bits, but uint32 is not, that isn't possible without going to 64bit representation From jkrell at elego.de Mon Feb 15 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090043.F3D7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:00:43 Added files: cm3/m3-sys/m3tests/src/p2/p228/: stdout.pgm Log message: add expected output From jkrell at elego.de Mon Feb 15 10:06:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:06:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090608.6D3C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:06:08 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p228 sign/zero extend return values of functions returning types smaller than 32bits; enable p229 minimal 64bit divide test, that was failing (still need mod, and more) From jkrell at elego.de Mon Feb 15 10:25:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:25:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215092508.1AE792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:25:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: remove unused functions: get_addsize must_extend aligned From hosking at cs.purdue.edu Mon Feb 15 16:17:12 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 15 Feb 2010 10:17:12 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100215083209.84A102474001@birch.elegosoft.com> References: <20100215083209.84A102474001@birch.elegosoft.com> Message-ID: <05565123-28DB-4C46-B2B2-AE087FB1DCB6@cs.purdue.edu> Good catch! Thanks Jay. On 15 Feb 2010, at 09:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/15 09:32:09 > > Modified files: > cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c > > Log message: > fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 18:44:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:44:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174416.15E552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:44:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174522.E3A852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:45:22 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174857.E37212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:48:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 18:56:19 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:56:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175621.70FF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:56:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Mon Feb 15 18:58:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:58:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175821.92A7A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:58:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Wed Feb 17 05:06:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:06:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040644.0A0402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:06:43 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: avoid returning out of a deep nested loop to workaround apparently problem in older releases such as 5.4.0 (if using current config files) From jkrell at elego.de Wed Feb 17 05:08:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:08:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040849.6D5B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:08:49 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040923.601552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:09:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:10:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:10:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041030.7BB172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:10:30 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: remove newline from middle of short comment From jkrell at elego.de Wed Feb 17 05:17:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:17:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041757.7F2A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:17:57 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial merge with head to support older cm3 (more to do); also reduce intent in this deeply indented functions to 2 spaces from 4 spaces From jkrell at elego.de Wed Feb 17 05:20:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:20:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042039.892BE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:20:39 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial, very partial undo From jkrell at elego.de Wed Feb 17 05:26:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:26:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042656.1560B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:26:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: slight variation on the fix for building with older cm3 From jkrell at elego.de Wed Feb 17 05:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043311.5CB372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:33:11 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace and a little cleanup of repetitive code From jkrell at elego.de Wed Feb 17 05:35:06 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:35:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043506.A9F962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:35:06 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: whitespace From jkrell at elego.de Wed Feb 17 05:41:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:41:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044121.848AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:41:21 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: mostly merge with head From jkrell at elego.de Wed Feb 17 05:42:35 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:42:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044236.22B4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:42:35 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: mostly merge with release From jkrell at elego.de Wed Feb 17 06:03:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:03:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050355.C74942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:03:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: AMD64_SOLARIS Darwin.common HPUX.common Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Solaris.common Unix.common cm3cfg.common Log message: remove whitspace from ends of lines From jkrell at elego.de Wed Feb 17 06:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050616.C20BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:06:16 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 AMD64_SOLARIS Darwin.common HPUX.common I386_SOLARIS Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Unix.common cm3cfg.common Log message: remove whitespace from ends of lines From jkrell at elego.de Wed Feb 17 06:12:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:12:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051255.5D0CA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:12:54 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Darwin.common NT386 NT386.common NT386GNU NT386MINGNU Solaris.common cm3.cfg cm3cfg.common Log message: consistent support/workaround for MxConfig always define all of CR, EOL, M3_PROFILING, SL, in that order From jkrell at elego.de Wed Feb 17 06:16:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:16:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051607.A784F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:16:07 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:17:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:17:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051742.10BE32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:17:41 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:20:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:20:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217052002.6D5732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:20:01 Modified files: cm3/m3-sys/cminstall/src/config/: Tag: release_branch_cm3_5_8 ALPHA_OSF FreeBSD3 FreeBSD4 HPPA IBMR2 IRIX5 LINUXELF LINUXLIBC6 NetBSD2_i386 PPC_LINUX SOLgnu SOLsun SPARC Log message: remove whitespace from ends of lines (dead files) From jkrell at elego.de Wed Feb 17 06:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217054439.649B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:44:38 Added files: cm3/m3-sys/m3tests/src/p2/p228/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile stdout.pgm cm3/m3-sys/m3tests/src/p2/p229/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: new files from head (branching incompatible with sequential numbers so it behooves us to at least keep the directory listing in sync) From jkrell at elego.de Wed Feb 17 07:25:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:25:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217062500.EE3F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:25:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll stuff for Interix now that I found I don't need it (more stuff here to try removing when I get back to it) From jkrell at elego.de Wed Feb 17 07:31:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:31:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063149.1FF4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:31:48 Removed files: cm3/m3-win/ntdll/: .cvsignore cm3/m3-win/ntdll/src/: m3makefile ntdll.c cm3/m3-win/w32api/: CONTRIBUTIONS Makefile.in README.w32api TODO aclocal.m4 config.guess config.sub configure configure.in install-sh cm3/m3-win/w32api/include/: accctrl.h aclapi.h aclui.h adsprop.h afxres.h amaudio.h amvideo.h audevcod.h aviriff.h aygshell.h basetsd.h basetyps.h bdatypes.h cderr.h cguid.h cmnquery.h comcat.h commctrl.h commdlg.h control.h cpl.h cplext.h custcntl.h dbt.h dde.h ddeml.h devguid.h dhcpcsdk.h dlgs.h docobj.h dsadmin.h dsclient.h dsgetdc.h dshow.h dsquery.h dsrole.h dvdevcod.h dvdmedia.h edevdefs.h errorrep.h errors.h evcode.h exdisp.h exdispid.h fltdefs.h httpext.h icm.h idispids.h il21dec.h imagehlp.h imm.h initguid.h intshcut.h ipexport.h iphlpapi.h ipifcons.h ipinfoid.h iprtrmib.h iptypes.h ipxconst.h ipxrtdef.h ipxtfflt.h isguids.h ks.h ksmedia.h largeint.h lm.h lmaccess.h lmalert.h lmapibuf.h lmat.h lmaudit.h lmbrowsr.h lmchdev.h lmconfig.h lmcons.h lmerr.h lmerrlog.h lmmsg.h lmremutl.h lmrepl.h lmserver.h lmshare.h lmsname.h lmstats.h lmsvc.h lmuse.h lmuseflg.h lmwksta.h lzexpand.h mapi.h mciavi.h mcx.h mgm.h mgmtapi.h mlang.h mmreg.h mmsystem.h mpegtype.h mprapi.h mq.h msacm.h mshtml.h mswsock.h nb30.h nddeapi.h nspapi.h ntdef.h ntdll.h ntdsapi.h ntdsbcli.h ntldap.h ntsecapi.h ntsecpkg.h oaidl.h objbase.h objfwd.h objidl.h objsafe.h objsel.h ocidl.h odbcinst.h ole.h ole2.h ole2ver.h oleacc.h oleauto.h olectl.h olectlid.h oledlg.h oleidl.h pbt.h poppack.h powrprof.h prsht.h psapi.h pshpack1.h pshpack2.h pshpack4.h pshpack8.h qedit.h rapi.h ras.h rasdlg.h raserror.h rassapi.h reason.h regstr.h richedit.h richole.h routprot.h rpc.h rpcdce.h rpcdce2.h rpcdcep.h rpcndr.h rpcnsi.h rpcnsip.h rpcnterr.h rpcproxy.h rtutils.h schannel.h schnlsp.h scrnsave.h sddl.h secext.h security.h servprov.h setupapi.h shellapi.h shldisp.h shlguid.h shlobj.h shlwapi.h snmp.h specstrings.h sql.h sqlext.h sqltypes.h sqlucode.h sspi.h stm.h strmif.h subauth.h svcguid.h tlhelp32.h tmschema.h unknwn.h userenv.h usp10.h uxtheme.h vfw.h vidcap.h vmr9.h vptype.h w32api.h winable.h winbase.h winber.h wincon.h wincrypt.h windef.h windns.h windows.h windowsx.h winerror.h wingdi.h wininet.h winioctl.h winldap.h winnetwk.h winnls.h winnt.h winperf.h winreg.h winresrc.h winsnmp.h winsock.h winsock2.h winspool.h winsvc.h winuser.h winver.h ws2spi.h ws2tcpip.h wsahelp.h wsipx.h wsnetbs.h wtsapi32.h wtypes.h xprtdefs.h zmouse.h cm3/m3-win/w32api/include/ddk/: atm.h batclass.h cfg.h cfgmgr32.h d4drvif.h d4iface.h ddkmapi.h hidclass.h hidpi.h hidsdi.h hidusage.h kbdmou.h mcd.h miniport.h minitape.h mountdev.h mountmgr.h ndis.h ndisguid.h ndistapi.h ndiswan.h netevent.h netpnp.h newdev.h ntapi.h ntdd8042.h ntddbeep.h ntddcdrm.h ntddcdvd.h ntddchgr.h ntdddisk.h ntddk.h ntddkbd.h ntddmou.h ntddndis.h ntddpar.h ntddpcm.h ntddscsi.h ntddser.h ntddstor.h ntddtape.h ntddtdi.h ntddvdeo.h ntddvol.h ntifs.h ntpoapi.h ntstatus.h parallel.h pfhook.h poclass.h scsi.h scsiscan.h scsiwmi.h smbus.h srb.h storport.h tdi.h tdiinfo.h tdikrnl.h tdistat.h tvout.h upssvc.h usb.h usb100.h usbcamdi.h usbdi.h usbioctl.h usbiodef.h usbscan.h usbuser.h video.h videoagp.h win2k.h winddi.h winddk.h winnt4.h winxp.h ws2san.h xfilter.h cm3/m3-win/w32api/lib/: Makefile.in ntdll.def Log message: remove ntdll/w32api stuff w32api might be useful to reduce dependency on C compiler (ie: compiler and linker and C runtime, but not win32 headers/libraries; ie some of the express versions) From jkrell at elego.de Wed Feb 17 07:36:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:36:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063618.E1F2B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:36:18 Modified files: cm3/scripts/python/: pylib.py Log message: remove most ntdll/w32api stuff (need to look into the rest another time) From jkrell at elego.de Wed Feb 17 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064124.D9C052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:41:24 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: bring over "AdjustShared" from head Specifically what this does is when using older toolsets, it turns building of anything "shared" into "not shared". This way these config files can deal less with the vagaries of older toolsets. The point being, when mixing these config files with older tools, only to handle building cm3. "old toolset" is defined as "not defining install_symbolic_link" Perhaps we should have something like cm3 -DBOOT or cm3 -DNO_SHARED to better encapsulate this. Note that this is placed in such a way that it doesn't affect all targets. But probably it should. Also this disabled building "shared" on Interix, pending more investigation. (This is what head does.) From jkrell at elego.de Wed Feb 17 07:47:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:47:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064729.1328B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:47:28 Modified files: cm3/scripts/: README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh cm3/scripts/python/: do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: upgrade.cmd Log message: remove m3staloneback from various lists leave it only in tool/std It is not needed in front/core/boot etc. From jkrell at elego.de Wed Feb 17 07:53:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:53:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065306.2DA532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:53:05 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd upgrade.cmd Log message: m3staloneback not needed in many places -- just tool/std -- it isn't any special part of front/back/boot/core -- it isn't actually used anywhere, it also doesn't need to be filtered out of non-Win32 platforms, since it should build and work everywhere (just, again, we don't use it) From jkrell at elego.de Wed Feb 17 07:58:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:58:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065815.5BDD92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:58:14 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: libdump, fix_nl also not needed in upgrade/cross stuff add m3staloneback back to 'core' group, because in fact 'core' is never used, useless, no need to mess with it (should just remove it, pylib.py should be updated to use the other data files..) From jkrell at elego.de Wed Feb 17 08:22:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:22:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072229.61EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:22:28 Modified files: cm3/scripts/python/: pylib.py cm3/scripts/win/: pkginfo.cmd Log message: fix_nl, libdump not so important, and don't need filtering From jkrell at elego.de Wed Feb 17 08:23:50 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:23:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072351.10EF42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:23:50 Modified files: cm3/scripts/: boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh Log message: adjust filters: fix_nl, libdump ought to be, and may already be, very portable From jkrell at elego.de Wed Feb 17 08:25:51 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:25:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072551.343612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:25:51 Removed files: cm3/scripts/python/: do-cm3-comm.py do-cm3-core.py do-cm3-gui.py do-cm3-base.py Log message: remove useless stuff From jkrell at elego.de Wed Feb 17 08:26:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:26:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072649.D2C9C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:26:49 Removed files: cm3/scripts/python/: do-cm3-caltech-parser.py do-cm3-front.py Log message: remove more useless From jkrell at elego.de Wed Feb 17 08:30:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:30:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073058.49A002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:30:57 Modified files: cm3/scripts/python/: pylib.py Log message: remove 'core' and 'base' groups, they aren't useful From jkrell at elego.de Wed Feb 17 08:32:04 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:32:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073207.854852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:32:04 Modified files: cm3/scripts/python/: pylib.py Log message: comments From jkrell at elego.de Wed Feb 17 08:34:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:34:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073455.39C712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:34:55 Modified files: cm3/scripts/: backup-pkgs.sh Log message: fix_nl, libdump not so important From jkrell at elego.de Wed Feb 17 08:35:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:35:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073531.7E0F82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:35:31 Modified files: cm3/scripts/python/: upgrade.py Log message: ok to build mklib in first pass, its dependency on m3core has been reduced From jkrell at elego.de Wed Feb 17 08:39:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:39:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073956.10AAD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:39:55 Modified files: cm3/scripts/python/: make-dist.py pylib.py Log message: ok to build mklib early, no need to list m3objfile twice From jkrell at elego.de Wed Feb 17 08:47:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:47:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074726.86A542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:47:25 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: remove dependency on m3core/WinNT in order to work with older Unix m3core From jkrell at elego.de Wed Feb 17 08:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074858.0DFDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:48:57 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: cleanup From jkrell at elego.de Wed Feb 17 08:58:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:58:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217075801.CA9A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:58:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll/interix stuff, I thought I already had From jkrell at elego.de Wed Feb 17 09:16:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:16:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217081623.522202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:16:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove ConvertLibsToStandalone, it is in cm3cfg.common now From jkrell at elego.de Wed Feb 17 09:42:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:42:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217084202.347572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:42:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 09:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085152.287D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:51:52 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and partial merge with head (mainly whitespace, also stuff under ifdef) From jkrell at elego.de Wed Feb 17 09:53:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:53:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085301.72C8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:53:01 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and reorder 'a and b and c' to 'a and c and b' or such to put faster parts earlier From jkrell at elego.de Wed Feb 17 09:54:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:54:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085457.EBC092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:54:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: a little more test coverage, forgot the output file From jkrell at elego.de Wed Feb 17 11:40:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:40:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104014.16E3E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:40:14 Modified files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 m3makefile RTIO.i3 Added files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 RTIOc.c Log message: some longint int support from head From jkrell at elego.de Wed Feb 17 11:46:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:46:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104614.4A1642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:46:14 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: Tag: release_branch_cm3_5_8 parse.c Log message: from head: fix longint div and presumably mod From jkrell at elego.de Wed Feb 17 12:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217111834.4EECB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:18:34 Modified files: cm3/m3-sys/libdump/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: from head: reduce dependency on newer m3core From jkrell at elego.de Wed Feb 17 12:25:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:25:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217112544.C37E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:25:44 Modified files: cm3/m3-libs/libm3/src/os/WIN32/: FSWin32.m3 FileWin32.m3 Log message: don't truncate file sizes to 32bits From jkrell at elego.de Wed Feb 17 12:43:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:43:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217114354.C6B212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:43:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 12:54:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:54:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217115443.E7E722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:54:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 13:17:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:17:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217121752.C30AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:17:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing: in particular I want to verify that 32bit div/mod doesn't generate a function call, when we alter m3cg From jkrell at elego.de Wed Feb 17 13:25:46 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:25:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217122547.038012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:25:46 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: we don't need m3_div, m3_divL, m3_mod, m3_modL We can "just" use gcc's support "directly". Granted, on many targets, that will generate calls to __divdi3, __udivdi3, __moddi3, __umoddi3, but heck, our hand.c code generated such calls as well, and for platforms for which gcc is not the compiler/linker, we have libgcc.c. This *might* be a deoptimization on some platforms, e.g. SOLsun. That is, if we are going to call a function, better to call their helpers instead of our libgcc stand-ins. However it is likely an optimization on all 64bit platforms all gcc platforms all 32bit operations leaving the deoptimization only on 32bit non-gcc platforms when using longint (Note that m3_divL, m3_modL still used by NT386; m3_div, m3_mod never were) From jkrell at elego.de Wed Feb 17 13:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217124556.0D9AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 13:55:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:55:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217125525.5CF8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:55:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: remove 32bit helpers: m3_div_old m3_div m3_mod_old m3_mod TestDiv32 leaving, at least, 64bit helpers for m3back: m3_div64 (Win32 only, else static) m3_mod64 (Win32 only, else static) From hosking at elego.de Wed Feb 17 22:40:49 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 17 Feb 2010 22:40:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217214049.A3D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/17 22:40:49 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: Add UNUSED_SIGN macro. From hosking at elego.de Thu Feb 18 03:33:15 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 3:33:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218023315.67F322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 03:33:15 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinRd.m3 M3CG_Rd.m3 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg cm3/m3-sys/m3front/src/builtinInfo/: InfoThisLine.m3 cm3/m3-sys/m3front/src/builtinOps/: BitSize.m3 Dec.m3 Number.m3 cm3/m3-sys/m3front/src/builtinWord/: And.mg Divide.mg Extract.mg GE.mg GT.mg Insert.mg LE.mg LT.mg Minus.mg Mod.mg Module.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddExpr.m3 AddressExpr.m3 ArrayExpr.m3 Expr.m3 IntegerExpr.m3 ModExpr.m3 ReelExpr.m3 SetExpr.m3 SubtractExpr.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Scanner.m3 TipeDesc.m3 cm3/m3-sys/m3front/src/stmts/: CaseStmt.m3 cm3/m3-sys/m3front/src/types/: ArrayType.m3 EnumType.m3 OpenArrayType.m3 SubrangeType.m3 Type.m3 cm3/m3-sys/m3tools/src/: M3Builtin.m3 M3Const.m3 M3Lexer.m3 M3Type.m3 Log message: Drastic simplification of TInt/TWord. These no longer simulate INTEGER arithmetic directly, but simply provide support for arithmetic up to the precision of any target. As a result, users of these interfaces must explicitly ensure that their results do not exceed the bounds of their target integer precision. One side-effect has been fixes to some remaining bugs in range-checking for CARDINAL/LONGCARD. Index: m3middle/src/M3CG_BinRd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_BinRd.m3,v retrieving revision 1.9 diff -c -r1.9 M3CG_BinRd.m3 *** m3middle/src/M3CG_BinRd.m3 11 Jan 2010 22:04:48 -0000 1.9 --- m3middle/src/M3CG_BinRd.m3 18 Feb 2010 02:30:47 -0000 *************** *** 407,426 **** | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, NUMBER (val.x), val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), NUMBER (byte.x), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN ! TWord.Subtract (TInt.Zero, val, val); ! END; RETURN val; END Scan_Tint; --- 407,424 ---- | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN TWord.Subtract (TInt.Zero, val, val); END; RETURN val; END Scan_Tint; Index: m3middle/src/M3CG_Rd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_Rd.m3,v retrieving revision 1.7 diff -c -r1.7 M3CG_Rd.m3 *** m3middle/src/M3CG_Rd.m3 30 Jan 2010 21:28:34 -0000 1.7 --- m3middle/src/M3CG_Rd.m3 18 Feb 2010 02:30:48 -0000 *************** *** 364,377 **** result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, NUMBER (result.x), result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), NUMBER (result.x), result) THEN ! RETURN result; ! END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), NUMBER (tmp.x), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; --- 364,375 ---- result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), result) THEN RETURN result END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; Index: m3middle/src/TInt.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.i3,v retrieving revision 1.25 diff -c -r1.25 TInt.i3 *** m3middle/src/TInt.i3 8 Feb 2010 16:42:41 -0000 1.25 --- m3middle/src/TInt.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,74 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! signed integer operations. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new target value, otherwise they return FALSE. *) ! FROM Target IMPORT Int, IBytes; CONST ! Zero = Int{NUMBER (IBytes), IBytes{ 0,0,..}}; ! One = Int{NUMBER (IBytes), IBytes{ 1,0,..}}; ! Two = Int{NUMBER (IBytes), IBytes{ 2,0,..}}; ! Three = Int{NUMBER (IBytes), IBytes{ 3,0,..}}; ! Four = Int{NUMBER (IBytes), IBytes{ 4,0,..}}; ! Eight = Int{NUMBER (IBytes), IBytes{ 8,0,..}}; ! Ten = Int{NUMBER (IBytes), IBytes{10,0,..}}; ! ThirtyOne = Int{NUMBER (IBytes), IBytes{31,0,..}}; ! ThirtyTwo = Int{NUMBER (IBytes), IBytes{32,0,..}}; ! SixtyThree= Int{NUMBER (IBytes), IBytes{63,0,..}}; ! SixtyFour = Int{NUMBER (IBytes), IBytes{64,0,..}}; ! F3FF = Int{NUMBER (IBytes), IBytes{16_FF,16_F3,0,..}}; ! x0400 = Int{NUMBER (IBytes), IBytes{0,4,0,..}}; ! x0800 = Int{NUMBER (IBytes), IBytes{0,8,0,..}}; ! x0F00 = Int{NUMBER (IBytes), IBytes{0,16_F,0,..}}; ! ! (* 'M' for Minus (negative) *) ! ! MOne = Int{NUMBER (IBytes), IBytes{16_FF,..}}; ! MThirtyOne = Int{NUMBER (IBytes), IBytes{16_E1,16_FF,..}}; ! MSixtyThree= Int{NUMBER (IBytes), IBytes{16_C1,16_FF,..}}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) - PROCEDURE IntI (READONLY x: Int; n: CARDINAL; VAR i: Int): BOOLEAN; - (* converts a target integer 'x' to a target integer 'i' *) - PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; n: CARDINAL; ! VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns a if a >= 0, -a if a < 0, or overflow *) - PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns '-a' unless there's an overflow *) - PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) --- 10,48 ---- (* Modula-3 target description ! This interface provides simulations of signed integer operations, ! at the maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new value, otherwise they return FALSE. *) ! FROM Target IMPORT Int; ! ! CONST Size = BITSIZE(Int); CONST ! Zero = Int{ 0, 0,..}; ! One = Int{ 1, 0,..}; ! MOne = Int{16_FF,..}; ! PROCEDURE FromInt (x: INTEGER; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) *************** *** 81,101 **** PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* returns 'a = b' *) - PROCEDURE NE (READONLY a, b: Int): BOOLEAN; - (* returns 'a # b' *) - PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* returns 'a < b' *) - PROCEDURE GT (READONLY a, b: Int): BOOLEAN; - (* returns 'a > b' *) - PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* returns 'a <= b' *) - PROCEDURE GE (READONLY a, b: Int): BOOLEAN; - (* returns 'a >= b' *) - PROCEDURE ToText (READONLY i: Int): TEXT; (* converts 'i' to a printable string. *) --- 55,66 ---- *************** *** 103,111 **** (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): INTEGER; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns -1 if 'buf' is too short. *) END TInt. --- 68,79 ---- (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): CARDINAL; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns 0 if 'buf' is too short. *) ! ! PROCEDURE Chop (VAR i: Int; n: CARDINAL); ! (* Extract the low-order 'n' bytes of 'i', sign extended. *) END TInt. Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.22 diff -c -r1.22 TInt.m3 *** m3middle/src/TInt.m3 10 Feb 2010 13:09:59 -0000 1.22 --- m3middle/src/TInt.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,15 **** MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; --- 9,15 ---- MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; *************** *** 17,109 **** And = Word.And; CONST ! Mask = 16_FF; ! SignMask = 16_80; ! Base = 16_100; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR r: Int): BOOLEAN = BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := And (x, Mask); x := x DIV Base; END; ! RETURN (n > 0) AND (x = 0 OR x = -1); END FromInt; ! TYPE Sign = {Bad, Neg, Pos}; ! ! PROCEDURE CheckSign (READONLY r: Int; n: CARDINAL): Sign = BEGIN ! <*ASSERT n # 0*> ! IF And (r.x[r.n-1], SignMask) = 0 THEN ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) # 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # 0 THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Pos; ! ELSE ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) = 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # Mask THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Neg; END; - END CheckSign; - PROCEDURE IntI (READONLY r: Int; n: CARDINAL; VAR x: Int): BOOLEAN = - VAR sign := CheckSign (r, n); j := 0; result := TRUE; - BEGIN - CASE sign OF - | Sign.Bad => result := FALSE; - | Sign.Pos => j := 0; - | Sign.Neg => j := Mask; - END; - x.n := n; - FOR i := 0 TO r.n-1 DO x.x[i] := r.x[i] END; - FOR i := r.n TO n-1 DO x.x[i] := j END; - RETURN result; - END IntI; - - PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = - VAR sign := CheckSign (r, BITSIZE (INTEGER) DIV BITSIZE (IByte)); - result := TRUE; - BEGIN (* ensure the result has the right sign extension *) ! CASE sign OF ! | Sign.Bad => result := FALSE; ! | Sign.Pos => x := 0; ! | Sign.Neg => x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := r.n-1 TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r.x[i]); END; ! RETURN result; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; n: CARDINAL; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; IF (NUMBER (x) = 1) THEN ! r.x[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r.x[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ! digit.x[0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; --- 17,74 ---- And = Word.And; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! SignMask = LShift (1, BITSIZE (IByte) - 1); ! Base = Mask + 1; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; + Ten = Int{10,0,..}; ! PROCEDURE FromInt (x: INTEGER; VAR r: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := And (x, Mask); x := x DIV Base; END; ! RETURN (x = 0 OR x = -1); END FromInt; ! PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = ! CONST Extras = BITSIZE (INTEGER) DIV BITSIZE (IByte); ! VAR j := 0; sign_chunk := MIN (Extras - 1, LAST(Int)); BEGIN ! (* check that any extra bits are the same as the sign bit *) ! IF And (r [sign_chunk], SignMask) # 0 THEN j := Mask; END; ! FOR i := Extras TO LAST(Int) DO ! IF r [i] # j THEN RETURN FALSE; END; END; (* ensure the result has the right sign extension *) ! IF j = 0 ! THEN x := 0; ! ELSE x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := LAST(Int) TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r[i]); END; ! RETURN TRUE; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! r := Zero; IF (NUMBER (x) = 1) THEN ! r[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Zero; FOR i := FIRST (x) TO LAST (x) DO ! digit [0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; *************** *** 113,206 **** PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - RETURN Subtract(Zero, a, r); - END Negate; - - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - IF GE(a, Zero) THEN - r := a; - RETURN TRUE; - END; - RETURN Negate(a, r); - END Abs; - PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! n := MIN (a.n, b.n); k, carry: INTEGER; q: Int; ! p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO k := i + j; ! carry := Word.Times (a.x[i], b.x[j]); WHILE carry # 0 DO ! carry := carry + p[k]; ! p[k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! r.n := n; FOR i := 0 TO n-1 DO r.x[i] := p[i]; END; ! q.n := n; FOR i := 0 TO n-1 DO q.x[i] := p[i+n]; END; (* compute the top half *) ! IF And (a.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! CASE CheckSign (r, n) OF ! | Sign.Bad => <*ASSERT FALSE*> ! | Sign.Pos => carry := 0; ! | Sign.Neg => carry := Mask; ! END; ! FOR i := 0 TO n-1 DO ! IF q.x[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; --- 78,145 ---- PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR carry := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a [i] + b [i] + carry; ! r [i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR borrow := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! k, carry: INTEGER; ! q: Int; ! p := ARRAY [0.. 2 * NUMBER(Int) - 1] OF IByte {0, ..}; BEGIN ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO k := i + j; ! carry := Word.Times (a [i], b [j]); WHILE carry # 0 DO ! carry := carry + p [k]; ! p [k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! FOR i := 0 TO LAST(Int) DO r[i] := p[i]; END; ! FOR i := 0 TO LAST(Int) DO q[i] := p[i+NUMBER(Int)]; END; (* compute the top half *) ! IF And (a [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! carry := 0; ! IF And (r [LAST(Int)], SignMask) # 0 THEN carry := Mask; END; ! FOR i := 0 TO LAST(Int) DO ! IF q[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; *************** *** 224,250 **** VAR num := a; den := b; ! num_neg: BOOLEAN; ! den_neg: BOOLEAN; ! n := MIN (a.n, b.n); ! a_sign := CheckSign (a, n); ! b_sign := CheckSign (b, n); ! min: Int; BEGIN - IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN - RETURN FALSE - END; - IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := a_sign = Sign.Neg; ! den_neg := b_sign = Sign.Neg; ! (* check for the only possible overflow: FIRST DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; --- 163,182 ---- VAR num := a; den := b; ! num_neg : BOOLEAN; ! den_neg : BOOLEAN; ! min : Int; BEGIN IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := And (a [LAST(Int)], SignMask) # 0; ! den_neg := And (b [LAST(Int)], SignMask) # 0; ! (* check for the only possible overflow: FIRST(Int) DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; *************** *** 296,327 **** *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN ! RETURN FALSE; ! END; ! FOR i := 0 TO n-1 DO ! IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := CheckSign (a, a.n); ! b_sign := CheckSign (b, b.n); ! n := MIN (a.n, b.n); ! BEGIN ! <*ASSERT a_sign # Sign.Bad*> ! <*ASSERT b_sign # Sign.Bad*> ! IF (a_sign # b_sign) THEN RETURN (a_sign = Sign.Neg); END; ! ! IF CheckSign (a, n) = Sign.Bad THEN RETURN a_sign = Sign.Neg END; ! IF CheckSign (b, n) = Sign.Bad THEN RETURN b_sign = Sign.Pos END; ! ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; --- 228,249 ---- *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! IF a[i] # b[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! BEGIN ! IF (a_sign # b_sign) THEN RETURN (a_sign # 0); END; ! ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; *************** *** 333,355 **** RETURN EQ (a, b) OR LT (a, b); END LE; - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN NOT EQ (a, b); - END NE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT (b, a); - END GT; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; --- 255,262 ---- RETURN EQ (a, b) OR LT (a, b); END LE; PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result: ARRAY [0..BITSIZE (Int)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; *************** *** 360,369 **** minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; rr := r; ! quo, rem, min: Int; ! n := r.n; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; --- 267,276 ---- minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..Size] OF CHAR; rr := r; ! quo, rem: Int; ! min : Int; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; *************** *** 372,381 **** ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r.x[n-1], SignMask) # 0 THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; --- 279,288 ---- ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r [LAST(Int)], SignMask) # 0 THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST(Int) a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; *************** *** 386,397 **** (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem.x [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST *) IF (bump) THEN result [nDigits] := '0'; j := 0; --- 293,304 ---- (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST (Int) *) IF (bump) THEN result [nDigits] := '0'; j := 0; *************** *** 399,405 **** i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; --- 306,312 ---- i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; *************** *** 416,422 **** (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO --- 323,329 ---- (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO *************** *** 426,447 **** RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): INTEGER = ! VAR n := r.n; j := 0; k := n; BEGIN (* strip the sign extension *) ! IF And (r.x[n-1], SignMask) # 0 THEN j := Mask END; ! FOR i := n-1 TO 0 BY -1 DO ! IF r.x[i] # j THEN EXIT END; ! DEC (k); ! END; ! <* ASSERT (k = 0) = (EQ(r, Zero) OR EQ(r, MOne)) *> ! INC(k, ORD(k = 0)); (* increment if 0 *) ! IF k > NUMBER (buf) THEN RETURN -1 END; (* unpack the bytes *) ! FOR i := 0 TO k-1 DO buf[i] := r.x[i] END; ! RETURN k; END ToBytes; BEGIN END TInt. --- 333,365 ---- RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): CARDINAL = ! VAR j := NUMBER(Int); BEGIN (* strip the sign extension *) ! DEC (j); ! IF (r[j] = 0) THEN ! WHILE (j > 0) AND (r[j] = 0) AND (r[j-1] < 16_80) DO DEC (j); END; ! ELSIF (r[j] = 16_ff) THEN ! WHILE (j > 0) AND (r[j] = 16_ff) AND (r[j-1] >= 16_80) DO DEC (j); END; ! END; ! INC (j); ! ! IF j > NUMBER (buf) THEN RETURN 0 END; ! (* unpack the bytes *) ! FOR i := 0 TO j-1 DO buf[i] := r[i] END; ! ! RETURN j; END ToBytes; + PROCEDURE Chop (VAR r: Int; n: CARDINAL) = + BEGIN + IF And (r [n-1], SignMask) = 0 + THEN FOR i := n TO LAST(Int) DO r [i] := 0 END; + ELSE FOR i := n TO LAST(Int) DO r [i] := Mask END; + END; + END Chop; + BEGIN END TInt. Index: m3middle/src/TWord.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.i3,v retrieving revision 1.8 diff -c -r1.8 TWord.i3 *** m3middle/src/TWord.i3 24 Jan 2010 12:29:14 -0000 1.8 --- m3middle/src/TWord.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,17 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! unsigned integer operations. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, --- 10,17 ---- (* Modula-3 target description ! This interface provides simulations of unsigned integer operations, at the ! maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, *************** *** 20,26 **** FROM Target IMPORT Int; ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) --- 20,28 ---- FROM Target IMPORT Int; ! CONST Size = BITSIZE(Int); ! ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) *************** *** 43,54 **** PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* a < b *) ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* a <= b *) ! PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* a = b *) ! PROCEDURE NE (READONLY a, b: Int): BOOLEAN; (* a # b *) ! PROCEDURE GE (READONLY a, b: Int): BOOLEAN; (* a >= b *) ! PROCEDURE GT (READONLY a, b: Int): BOOLEAN; (* a > b *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) --- 45,55 ---- PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LT (a, b)' *) ! ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LE (a, b)' *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) *************** *** 62,83 **** PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (x, n)' *) ! PROCEDURE LeftShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.LeftShift (x, n)' *) ! PROCEDURE RightShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.RightShift (x, n)' *) ! PROCEDURE Rotate (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Rotate (x, n)' *) ! PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (x, i, n)' *) ! PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (x, y, i, n)' *) END TWord. --- 63,84 ---- PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (a, b)' *) ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.LeftShift (a, b)' *) ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.RightShift (a, b)' *) ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int); ! (* returns 'Word.Rotate (a, b)' *) ! PROCEDURE Extract (READONLY a: Int; b, c: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (a, b, c)' *) ! PROCEDURE Insert (READONLY a, b: Int; c, d: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (a, b, c, d)' *) END TWord. Index: m3middle/src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.15 diff -c -r1.15 TWord.m3 *** m3middle/src/TWord.m3 10 Feb 2010 16:33:10 -0000 1.15 --- m3middle/src/TWord.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,32 **** MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = 16_FF; ! Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; ! VAR r: Int): BOOLEAN = ! VAR rr: IBytes; digit: INTEGER; ch: CHAR; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); --- 9,30 ---- MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! Base = Mask + 1; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; VAR r: Int): BOOLEAN = ! VAR rr: Int; digit: INTEGER; ch: CHAR; BEGIN ! r := TInt.Zero; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); *************** *** 36,49 **** END; (* rr := r * base *) ! rr := IBytes {0,..}; ! FOR i := 0 TO n-1 DO ! VAR carry := Word.Times (r.x[i], base); BEGIN ! FOR j := i TO n-1 DO IF carry = 0 THEN EXIT END; ! INC (carry, rr[j]); ! rr[j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 34,47 ---- END; (* rr := r * base *) ! rr := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! VAR carry := Word.Times (r[i], base); BEGIN ! FOR j := i TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! INC (carry, rr [j]); ! rr [j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 53,61 **** (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO n-1 DO ! INC (carry, rr[i]); ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 51,59 ---- (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO LAST(Int) DO ! INC (carry, rr [i]); ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 66,106 **** END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO ! carry := Word.Times (a.x[i], b.x[j]); ! FOR k := i + j TO n-1 DO IF carry = 0 THEN EXIT END; ! carry := carry + r.x[k]; ! r.x[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; --- 64,99 ---- END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a[i] + b[i] + carry; ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; BEGIN ! r := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO ! carry := Word.Times (a[i], b[j]); ! FOR k := i + j TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! carry := carry + r[k]; ! r[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; *************** *** 136,168 **** quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den: ARRAY [0..NUMBER (IBytes)+1] OF INTEGER; ! n := MIN (x.n, y.n); BEGIN - <*ASSERT n # 0*> (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO n-1 DO ! num[i] := x.x[i]; IF num[i] # 0 THEN max_num := i END; ! den[i] := y.x[i]; IF den[i] # 0 THEN max_den := i END; ! END; ! FOR i := n TO LAST (num) DO ! num[i] := 0; ! den[i] := 0; END; ! q := Int{n}; ! r := Int{n}; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q.x [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r.x[0] := carry; RETURN; END; --- 129,155 ---- quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den := ARRAY [0..NUMBER (Int)+1] OF INTEGER {0,..}; BEGIN (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO LAST(Int) DO ! num[i] := x[i]; IF num[i] # 0 THEN max_num := i; END; ! den[i] := y[i]; IF den[i] # 0 THEN max_den := i; END; END; ! q := TInt.Zero; ! r := TInt.Zero; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r[0] := carry; RETURN; END; *************** *** 237,243 **** END; (* store the quotient digit. *) ! q.x [i - 1] := quo_est; END; (* finally, compute the remainder *) --- 224,230 ---- END; (* store the quotient digit. *) ! q [i - 1] := quo_est; END; (* finally, compute the remainder *) *************** *** 246,420 **** END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; - PROCEDURE xEQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); - BEGIN - <*ASSERT n # 0*> - FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN - RETURN FALSE; - END; - END; - FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; - FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN FALSE END END; - RETURN TRUE; - END xEQ; - - PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR x := xEQ(a, b); - BEGIN - <* ASSERT x = xEQ(b, a) *> - <* ASSERT x = (LE(a, b) AND LE(b, a)) *> - RETURN x; - END EQ; - - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - VAR x := NOT xEQ(a, b); - BEGIN - <* ASSERT x = (NOT xEQ(b, a)) *> - <* ASSERT x = (LT(a, b) OR LT(b, a)) *> - RETURN x; - END NE; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT(b, a); - END GT; - PROCEDURE And (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (a.x[i], b.x[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Or (a.x[i], b.x[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Xor (a.x[i], b.x[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = - VAR n := a.n; BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (Word.Not (a.x[i]), Mask); END; END Not; ! PROCEDURE LeftShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := n-1 TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a.x[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a.x[z-1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! IF z <= n-1 THEN x1 := RShift (a.x[z], i); END; ! IF z+1 <= n-1 THEN x2 := LShift (a.x[z+1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END RightShift; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF b > 0 THEN (* left shift *) ! LeftShift(a, b, r); ! ELSE (* right shift *) ! RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: IBytes; ! n := a.n; size := n * BITSIZE (IByte); BEGIN - <*ASSERT n # 0*> b := b MOD size; IF b = 0 THEN --- 233,338 ---- END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; PROCEDURE And (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (a [i], b[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Or (a [i], b[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Xor (a [i], b[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (Word.Not (a [i]), Mask); END; END Not; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF ABS (b) >= Size THEN ! r := TInt.Zero; ! ELSIF b > 0 ! THEN LeftShift(a, b, r); ! ELSE RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := LAST(Int) TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a[z-1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO LAST(Int) DO z := k + w; x1 := 0; x2 := 0; ! IF z <= LAST(Int) THEN x1 := RShift (a[z], i); END; ! IF z+1 <= LAST(Int) THEN x2 := LShift (a[z+1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END RightShift; ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: Int; ! size := n * BITSIZE (IByte); BEGIN b := b MOD size; IF b = 0 THEN *************** *** 426,436 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a.x[z MOD n], i); ! x2 := RShift (a.x[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); --- 344,354 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a[z MOD n], i); ! x2 := RShift (a[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); *************** *** 438,485 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a.x[z MOD n], i); ! x2 := LShift (a.x[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r.x[w] := Word.And (r.x[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST (IBytes) DO r.x[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i + n, yy); ! LeftShift (yy, n, r); ! LeftShift (y, size - n, yy); ! RightShift (yy, size - n, yyy); Or (r, yyy, r); ! LeftShift (r, i, yyyy); r := yyyy; ! LeftShift (x, size - i, yy); ! RightShift (yy, size - i, yyy); Or (r, yyy, r); RETURN TRUE; --- 356,401 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a[z MOD n], i); ! x2 := LShift (a[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r[w] := Word.And (r[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST(Int) DO r[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -(i + n), yy); ! Shift (yy, n, r); ! Shift (y, Size - n, yy); ! Shift (yy, -(Size - n), yyy); Or (r, yyy, r); ! Shift (r, i, yyyy); r := yyyy; ! Shift (x, Size - i, yy); ! Shift (yy, -(Size - i), yyy); Or (r, yyy, r); RETURN TRUE; Index: m3middle/src/Target.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.i3,v retrieving revision 1.49 diff -c -r1.49 Target.i3 *** m3middle/src/Target.i3 8 Feb 2010 16:00:54 -0000 1.49 --- m3middle/src/Target.i3 18 Feb 2010 02:30:49 -0000 *************** *** 191,210 **** (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target INTEGER (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) RECORD ! n: CARDINAL; (* only bytes [0..n-1] contain valid bits *) ! x := IBytes{0,..}; (* default is Zero *) ! END; ! IBytes = ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; - PROCEDURE TargetIntToDiagnosticText(a: Int): TEXT; - TYPE Int_type = RECORD cg_type : CGType; (* representation *) --- 191,204 ---- (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target integer (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; TYPE Int_type = RECORD cg_type : CGType; (* representation *) Index: m3middle/src/Target.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.m3,v retrieving revision 1.85 diff -c -r1.85 Target.m3 *** m3middle/src/Target.m3 8 Feb 2010 07:17:14 -0000 1.85 --- m3middle/src/Target.m3 18 Feb 2010 02:30:49 -0000 *************** *** 8,33 **** MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils, Fmt; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; - 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; - PROCEDURE Init64 () = BEGIN Integer := Int64; --- 8,18 ---- MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; PROCEDURE Init64 () = BEGIN Integer := Int64; *************** *** 82,131 **** Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{NUMBER(IBytes), IBytes{16_80,FF,..}}; ! Int8.max := Int{NUMBER(IBytes), IBytes{16_7f,00,..}}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{NUMBER(IBytes), IBytes{00,16_80,FF,..}}; ! Int16.max := Int{NUMBER(IBytes), IBytes{FF,16_7f,00,..}}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{NUMBER(IBytes), IBytes{00,00,00,16_80,FF,..}}; ! Int32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,16_7f,00,..}}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,16_80}}; ! Int64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,16_7f}}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{NUMBER(IBytes), IBytes{00,00,..}}; ! Word8.max := Int{NUMBER(IBytes), IBytes{FF,00,..}}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{NUMBER(IBytes), IBytes{00,00,00,..}}; ! Word16.max := Int{NUMBER(IBytes), IBytes{FF,FF,00,..}}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,..}}; ! Word32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,00,..}}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,00}}; ! Word64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,FF}}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; --- 67,116 ---- Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{16_80,FF,..}; ! Int8.max := Int{16_7f,00,..}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{00,16_80,FF,..}; ! Int16.max := Int{FF,16_7f,00,..}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{00,00,00,16_80,FF,..}; ! Int32.max := Int{FF,FF,FF,16_7f,00,..}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{00,00,00,00,00,00,00,16_80}; ! Int64.max := Int{FF,FF,FF,FF,FF,FF,FF,16_7f}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{00,00,..}; ! Word8.max := Int{FF,00,..}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{00,00,00,..}; ! Word16.max := Int{FF,FF,00,..}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{00,00,00,00,00,..}; ! Word32.max := Int{FF,FF,FF,FF,00,..}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{00,00,00,00,00,00,00,00}; ! Word64.max := Int{FF,FF,FF,FF,FF,FF,FF,FF}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; *************** *** 137,144 **** Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0}; ! Void.max := Int{0}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; --- 122,129 ---- Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0,..}; ! Void.max := Int{0,..}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; Index: m3back/src/Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.79 diff -c -r1.79 Codex86.m3 *** m3back/src/Codex86.m3 15 Feb 2010 17:48:57 -0000 1.79 --- m3back/src/Codex86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 9,15 **** MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord; FROM TargetMap IMPORT CG_Bytes; --- 9,15 ---- MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord, Text; FROM TargetMap IMPORT CG_Bytes; *************** *** 18,24 **** FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize, TZero; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; --- 18,24 ---- FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; *************** *** 252,258 **** op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TZero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; --- 252,258 ---- op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TInt.Zero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; *************** *** 379,392 **** PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; ! IF TInt.GE(imm, Target.Int8.min) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; --- 379,395 ---- PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; ! IF TInt.LE(Target.Int8.min, imm) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; *************** *** 465,473 **** t.set_label(compare_label); | Op.oSHL => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); --- 468,476 ---- t.set_label(compare_label); | Op.oSHL => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); *************** *** 482,490 **** END | Op.oSHR => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); --- 485,493 ---- END | Op.oSHR => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); *************** *** 513,518 **** --- 516,522 ---- PROCEDURE binOp1WithShiftCount (t: T; op: Op; READONLY dest, src: Operand; READONLY shiftCount: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT NOT Is64(src.optype) *> *************** *** 549,559 **** <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.GE(shiftCount.imm, Target.Int8.min) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; ELSE --- 553,564 ---- <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.LE(Target.Int8.min, shiftCount.imm) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(shiftCount.imm, buf)))); END; ins.imsize := 1; ELSE *************** *** 908,916 **** PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> --- 913,924 ---- PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> *************** *** 921,927 **** ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TZero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; --- 929,935 ---- ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TInt.Zero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; *************** *** 934,940 **** PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, BYTESIZE(imm), immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); --- 942,948 ---- PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); *************** *** 942,954 **** PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 950,966 ---- PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("pushOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1073,1079 **** unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TZero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> --- 1085,1091 ---- unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TInt.Zero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> *************** *** 1104,1109 **** --- 1116,1122 ---- PROCEDURE imulOp (t: T; READONLY dest, src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register *> <* ASSERT src.loc # OLoc.mem OR CG_Bytes[src.mvar.mvar_type] = 4 *> *************** *** 1111,1118 **** IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("imulOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 1124,1134 ---- IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("imulOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1195,1201 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) --- 1211,1217 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) *************** *** 1221,1227 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) --- 1237,1243 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) *************** *** 1479,1492 **** PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) AND (NOT TWord.LE(val.imm, Target.Word32.max)) THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(val.imm)); END; ins.imsize := CG_Bytes[type]; END; --- 1495,1512 ---- PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) ! AND (NOT TWord.LE(val.imm, Target.Word32.max)) ! THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(val.imm, buf)))); END; ins.imsize := CG_Bytes[type]; END; *************** *** 2324,2330 **** 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); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; --- 2344,2350 ---- WHILE f_lit # NIL DO FOR i := 0 TO f_lit.flit_size - 1 DO ! EVAL TInt.FromInt(f_lit.arr[i], tint); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; *************** *** 2332,2338 **** END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TZero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; --- 2352,2358 ---- END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TInt.Zero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; Index: m3back/src/M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.126 diff -c -r1.126 M3x86.m3 *** m3back/src/M3x86.m3 15 Feb 2010 17:58:21 -0000 1.126 --- m3back/src/M3x86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 1105,1117 **** pad_init(u, o); len := TInt.ToBytes(value, bytes); - IF NOT (len <= NUMBER(bytes) AND len <= CG_Bytes[t] AND len > 0) THEN - u.Err("init_int: len:" & Fmt.Int(len) & " type:" & Target.TypeNames[t] & " value:" & Target.TargetIntToDiagnosticText(value)); - END; <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TZero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; --- 1105,1114 ---- pad_init(u, o); len := TInt.ToBytes(value, bytes); <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TInt.Zero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; *************** *** 1506,1512 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; --- 1503,1509 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; *************** *** 1520,1526 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; --- 1517,1523 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; *************** *** 1802,1808 **** END; u.vstack.unlock(); ! u.vstack.pushimmT(TZero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = --- 1799,1805 ---- END; u.vstack.unlock(); ! u.vstack.pushimmT(TInt.Zero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = *************** *** 2166,2172 **** pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TZero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; --- 2163,2169 ---- pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TInt.Zero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; *************** *** 2323,2336 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR TInt.NE(u.vstack.op(stack1).imm, TZero) THEN (* shift non-constant *) --- 2320,2333 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero) THEN (* shift non-constant *) *************** *** 2385,2391 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); --- 2382,2388 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); *************** *** 2395,2401 **** (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (TInt.NE(u.vstack.op(stack1).imm, TZero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; --- 2392,2398 ---- (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; *************** *** 2452,2458 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2449,2456 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2505,2511 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2503,2510 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2749,2757 **** u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in copy_n"); END; --- 2748,2756 ---- u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in copy_n"); END; *************** *** 2806,2815 **** IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN --- 2805,2814 ---- IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN *************** *** 2940,2948 **** u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in zero_n"); END; --- 2939,2947 ---- u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in zero_n"); END; *************** *** 2953,2959 **** start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TZero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); --- 2952,2958 ---- start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TInt.Zero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); *************** *** 3013,3019 **** stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, stop0, i * size, faketype[size]); END END --- 3012,3018 ---- stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TInt.Zero, optype := t }, stop0, i * size, faketype[size]); END END *************** *** 3155,3168 **** u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TZero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TZero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); --- 3154,3167 ---- u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TInt.Zero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); *************** *** 3194,3200 **** END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.GE(u.vstack.lower(u.vstack.reg(stack0)), i) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); --- 3193,3199 ---- END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.LE(i, u.vstack.lower(u.vstack.reg(stack0))) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); *************** *** 3232,3238 **** u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.GT(u.vstack.lower(u.vstack.reg(stack0)), i) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); --- 3231,3237 ---- u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.LT(i, u.vstack.lower(u.vstack.reg(stack0))) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); *************** *** 3279,3287 **** reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.GE(lo, a) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TZero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); --- 3278,3286 ---- reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.LE(a, lo) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TInt.Zero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); *************** *** 3457,3463 **** u.wr.NL (); END; ! IF NOT TInt.FromInt(i, Target.Integer.bytes, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; --- 3456,3462 ---- u.wr.NL (); END; ! IF NOT TInt.FromInt(i, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; *************** *** 3642,3650 **** IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Four); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Eight); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE --- 3641,3649 ---- IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{4,0,..}); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{8,0,..}); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE *************** *** 3694,3706 **** WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, Target.Integer.bytes, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.GT(ts, TInt.ThirtyTwo) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); --- 3693,3705 ---- WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.LT(Target.Int{32,0,..}, ts) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); *************** *** 3880,3886 **** IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); --- 3879,3885 ---- IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); *************** *** 3939,3945 **** (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; --- 3938,3944 ---- (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; *************** *** 4027,4033 **** u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TZero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], --- 4026,4032 ---- u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TInt.Zero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], *************** *** 4047,4053 **** IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TZero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); --- 4046,4052 ---- IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TInt.Zero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); *************** *** 4060,4066 **** PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TZero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); --- 4059,4065 ---- PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TInt.Zero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); Index: m3back/src/M3x86Rep.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86Rep.i3,v retrieving revision 1.28 diff -c -r1.28 M3x86Rep.i3 *** m3back/src/M3x86Rep.i3 14 Feb 2010 08:35:08 -0000 1.28 --- m3back/src/M3x86Rep.i3 18 Feb 2010 02:30:50 -0000 *************** *** 146,161 **** PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST TZero = TInt.Zero; ! CONST UnsignedType = ARRAY IType OF IType { Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { TInt.ThirtyOne, TInt.ThirtyOne, ! TInt.SixtyThree, TInt.SixtyThree }; ! ! CONST MinimumShift = ARRAY IType OF Target.Int { TInt.MThirtyOne, TInt.MThirtyOne, ! TInt.MSixtyThree, TInt.MSixtyThree }; CONST BitCountMask = MaximumShift; --- 146,162 ---- PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST UnsignedType = ARRAY IType OF IType { ! Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; ! CONST MinimumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; CONST BitCountMask = MaximumShift; Index: m3back/src/Stackx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Stackx86.m3,v retrieving revision 1.93 diff -c -r1.93 Stackx86.m3 *** m3back/src/Stackx86.m3 14 Feb 2010 13:23:42 -0000 1.93 --- m3back/src/Stackx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 16,22 **** FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize, TZero; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; --- 16,22 ---- FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; *************** *** 101,107 **** Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TZero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; --- 101,107 ---- Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TInt.Zero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; *************** *** 780,786 **** PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, Target.Integer.bytes, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); --- 780,786 ---- PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); *************** *** 974,983 **** WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, Target.Integer.bytes, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, Target.Integer.bytes, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN --- 974,983 ---- WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN *************** *** 1234,1240 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1234,1240 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1294,1300 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1294,1300 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1323,1329 **** IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.GT(imm, Target.Int8.max) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE --- 1323,1329 ---- IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.LT(Target.Int8.max, imm) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE *************** *** 1347,1353 **** WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Negate(stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; --- 1347,1353 ---- WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; *************** *** 1367,1380 **** WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Abs(stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TZero); lab := t.cg.reserve_labels(1, TRUE); --- 1367,1382 ---- WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF TInt.LT (stop0.imm, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); ! END; END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); lab := t.cg.reserve_labels(1, TRUE); *************** *** 1426,1452 **** (* shift non-constant by a constant *) ! IF TInt.NE(stop0.imm, TZero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, MaximumShift[type]) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.GT(stop0.imm, TZero) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; --- 1428,1454 ---- (* shift non-constant by a constant *) ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.LT(MaximumShift[type], stop0.imm) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.LT(TInt.Zero, stop0.imm) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; *************** *** 1461,1467 **** END ELSE ! IF ((stop1.loc # OLoc.imm) OR (TInt.NE(stop1.imm, TZero))) THEN (* shift by a non-constant *) --- 1463,1469 ---- END ELSE ! IF ((stop1.loc # OLoc.imm) OR (NOT TInt.EQ(stop1.imm, TInt.Zero))) THEN (* shift by a non-constant *) *************** *** 1476,1482 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); --- 1478,1484 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); *************** *** 1484,1490 **** t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); --- 1486,1492 ---- t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); *************** *** 1494,1500 **** t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); --- 1496,1502 ---- t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); *************** *** 1528,1536 **** IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, stop1.imm); ELSE ! IF TInt.NE(stop0.imm, TZero) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1530,1539 ---- IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, ! Target.Integer.bytes, stop1.imm); ELSE ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1538,1548 **** find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, TZero) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); --- 1541,1551 ---- find(t, stack1, Force.anytemp); ! IF TInt.LT(TInt.Zero, stop0.imm) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); *************** *** 1554,1560 **** END ELSE ! IF ((stop0.loc # OLoc.imm) OR (TInt.NE(stop0.imm, TZero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1557,1563 ---- END ELSE ! IF ((stop0.loc # OLoc.imm) OR (NOT TInt.EQ(stop0.imm, TInt.Zero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1567,1573 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); --- 1570,1576 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); *************** *** 1705,1715 **** find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(TInt.ThirtyTwo, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; --- 1708,1718 ---- find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(Target.Int{32,0,..}, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; *************** *** 1759,1765 **** IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF TInt.NE(tint, TZero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; --- 1762,1768 ---- IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF NOT TInt.EQ(tint, TInt.Zero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; *************** *** 1770,1783 **** IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); --- 1773,1786 ---- IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); *************** *** 1790,1796 **** END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); --- 1793,1799 ---- END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); *************** *** 1858,1864 **** t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF TInt.NE(stop1.imm, TZero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END --- 1861,1867 ---- t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF NOT TInt.EQ(stop1.imm, TInt.Zero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END *************** *** 1997,2003 **** END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); --- 2000,2006 ---- END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); *************** *** 2008,2014 **** TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF TWord.NE(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE --- 2011,2017 ---- TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF NOT TInt.EQ(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE *************** *** 2021,2032 **** TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; --- 2024,2035 ---- TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; *************** *** 2209,2215 **** find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN --- 2212,2218 ---- find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN *************** *** 2244,2250 **** END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, Target.Integer.bytes, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); --- 2247,2253 ---- END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); *************** *** 2383,2391 **** t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], TInt.F3FF); ! IF TInt.NE(t.rmode[mode], TZero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; --- 2386,2394 ---- t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], Target.Int{16_FF,16_F3,0,..}); ! IF NOT TInt.EQ(t.rmode[mode], TInt.Zero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; *************** *** 2540,2546 **** END; t.rmode := ARRAY FlToInt OF Target.Int ! { TZero, TInt.x0400, TInt.x0800, TInt.x0F00 }; t.lowset_table := NIL; t.highset_table := NIL; END init; --- 2543,2552 ---- END; t.rmode := ARRAY FlToInt OF Target.Int ! { Target.Int{0,0,0,..}, ! Target.Int{0,4,0,..}, ! Target.Int{0,8,0,..}, ! Target.Int{0,16_F,0,..}}; t.lowset_table := NIL; t.highset_table := NIL; END init; *************** *** 2633,2639 **** IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TZero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN --- 2639,2645 ---- IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TInt.Zero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN Index: m3back/src/Wrx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Wrx86.m3,v retrieving revision 1.6 diff -c -r1.6 Wrx86.m3 *** m3back/src/Wrx86.m3 15 Feb 2010 17:45:22 -0000 1.6 --- m3back/src/Wrx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 153,164 **** PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; - len := TargetInt.ToChars (i, buf); BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, len)); ! OutC (t, ' '); ! OutT (t, Target.TargetIntToDiagnosticText(i)); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = --- 153,161 ---- PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, TargetInt.ToChars (i, buf))); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = Index: m3front/src/builtinAtomic/AtomicModule.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinAtomic/AtomicModule.mg,v retrieving revision 1.2 diff -c -r1.2 AtomicModule.mg *** m3front/src/builtinAtomic/AtomicModule.mg 4 Feb 2010 02:11:30 -0000 1.2 --- m3front/src/builtinAtomic/AtomicModule.mg 18 Feb 2010 02:30:51 -0000 *************** *** 10,20 **** Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, TInt; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); --- 10,26 ---- Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, Target; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = + CONST + Zero = Target.Int{0,0,..}; + One = Target.Int{1,0,..}; + Two = Target.Int{2,0,..}; + Three = Target.Int{3,0,..}; + Four = Target.Int{4,0,..}; VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); *************** *** 40,55 **** elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), TInt.Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), TInt.One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), TInt.Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), TInt.Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), TInt.Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, TInt.Four); IsLockFree.Initialize (); Store.Initialize (); --- 46,61 ---- elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, Four); IsLockFree.Initialize (); Store.Initialize (); Index: m3front/src/builtinInfo/InfoThisLine.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinInfo/InfoThisLine.m3,v retrieving revision 1.4 diff -c -r1.4 InfoThisLine.m3 *** m3front/src/builtinInfo/InfoThisLine.m3 18 Sep 2007 20:25:21 -0000 1.4 --- m3front/src/builtinInfo/InfoThisLine.m3 18 Feb 2010 02:30:51 -0000 *************** *** 28,34 **** BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, Target.Integer.bytes, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; --- 28,34 ---- BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; Index: m3front/src/builtinOps/BitSize.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/BitSize.m3,v retrieving revision 1.3 diff -c -r1.3 BitSize.m3 *** m3front/src/builtinOps/BitSize.m3 18 Sep 2007 20:25:35 -0000 1.3 --- m3front/src/builtinOps/BitSize.m3 18 Feb 2010 02:30:51 -0000 *************** *** 111,121 **** IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, Target.Integer.bytes, size) ! AND TInt.FromInt (unit, Target.Integer.bytes, a) ! AND TInt.FromInt (unit - 1, Target.Integer.bytes, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; --- 111,123 ---- IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, size) ! AND TInt.FromInt (unit, a) ! AND TInt.FromInt (unit - 1, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) + AND NOT TInt.LT (d, Target.Integer.min) + AND NOT TInt.LT (Target.Integer.max, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; Index: m3front/src/builtinOps/Dec.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Dec.m3,v retrieving revision 1.12 diff -c -r1.12 Dec.m3 *** m3front/src/builtinOps/Dec.m3 10 Jan 2010 10:46:35 -0000 1.12 --- m3front/src/builtinOps/Dec.m3 18 Feb 2010 02:30:51 -0000 *************** *** 71,77 **** dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); --- 71,77 ---- dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! tmin, tmax, bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); *************** *** 79,100 **** THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSIF tlhs = LInt.T ! THEN dec := IntegerExpr.New (LInt.T, TInt.One); Expr.Prep (dec); ! ELSE dec := IntegerExpr.New (Int.T, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF tlhs = LInt.T THEN ! IF TInt.LT (Target.Longint.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Longint.max) THEN INC (check, 2) END; ! ELSE ! IF TInt.LT (Target.Integer.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Integer.max) THEN INC (check, 2) END; ! END; END; Expr.CompileLValue (lhs, traced := FALSE); --- 79,94 ---- THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; + EVAL Type.GetBounds (tlhs, tmin, tmax); IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSE dec := IntegerExpr.New (tlhs, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF TInt.LT (tmin, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, tmax) THEN INC (check, 2) END; END; Expr.CompileLValue (lhs, traced := FALSE); Index: m3front/src/builtinOps/Number.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Number.m3,v retrieving revision 1.4 diff -c -r1.4 Number.m3 *** m3front/src/builtinOps/Number.m3 18 Sep 2007 20:25:36 -0000 1.4 --- m3front/src/builtinOps/Number.m3 18 Feb 2010 02:30:51 -0000 *************** *** 64,70 **** e := ce.args[0]; t, index, element: Type.T; min, max, tmp, num: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN IF NOT TypeExpr.Split (e, t) THEN t := Expr.TypeOf (e) END; IF ArrayType.Split (t, index, element) THEN t := index END; --- 64,69 ---- *************** *** 77,83 **** IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); --- 76,83 ---- IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); *************** *** 90,96 **** PROCEDURE Fold (ce: CallExpr.T): Expr.T = VAR min, max, tmp, num: Target.Int; t, index, elem: Type.T; e: Expr.T; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN e := ce.args[0]; IF NOT TypeExpr.Split (e, t) THEN --- 90,95 ---- *************** *** 102,108 **** IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; --- 101,109 ---- IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (num, Target.Integer.max) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; *************** *** 114,120 **** IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; --- 115,122 ---- IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; Index: m3front/src/builtinWord/And.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/And.mg,v retrieving revision 1.1 diff -c -r1.1 And.mg *** m3front/src/builtinWord/And.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/And.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,17 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.And (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Divide.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Divide.mg,v retrieving revision 1.1 diff -c -r1.1 Divide.mg *** m3front/src/builtinWord/Divide.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Divide.mg 18 Feb 2010 02:30:51 -0000 *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Extract.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Extract.mg,v retrieving revision 1.1 diff -c -r1.1 Extract.mg *** m3front/src/builtinWord/Extract.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Extract.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 32,67 **** IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Integer_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Integer_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Integer_types[rep].size - i2, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Integer_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Integer_types[rep].size - i1, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) --- 32,65 ---- IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Word_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Word_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Word_types[rep].size - i2, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Word_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Word_types[rep].size - i1, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) *************** *** 72,79 **** CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); --- 70,76 ---- CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); *************** *** 85,91 **** CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; --- 82,88 ---- CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; *************** *** 95,115 **** BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) AND (0 <= i) AND (i <= Integer_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.ToInt (e1, i1)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 92,114 ---- BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) ! AND (0 <= i) AND (i <= Word_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! IF (e0 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT GetBitIndex (ce.args[1], i1) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR i1 + i2 > Word_types[rep].size ! OR NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; *************** *** 117,123 **** VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Integer_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; --- 116,122 ---- VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Word_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; Index: m3front/src/builtinWord/GE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GE.mg,v retrieving revision 1.1 diff -c -r1.1 GE.mg *** m3front/src/builtinWord/GE.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/GT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GT.mg,v retrieving revision 1.1 diff -c -r1.1 GT.mg *** m3front/src/builtinWord/GT.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Insert.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Insert.mg,v retrieving revision 1.1 diff -c -r1.1 Insert.mg *** m3front/src/builtinWord/Insert.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Insert.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 30,37 **** CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); --- 30,36 ---- CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); *************** *** 45,70 **** CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Integer_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2, e3: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; ! t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! e3 := Expr.ConstValue (ce.args[3]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.Split (e1, w1, t)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! (e3 = NIL) OR (NOT IntegerExpr.ToInt (e3, i3)) OR ! NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 44,77 ---- CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Word_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; + PROCEDURE GetBitIndex (e: Expr.T; VAR i: INTEGER): BOOLEAN = + BEGIN + e := Expr.ConstValue (e); + IF (e = NIL) THEN RETURN FALSE END; + RETURN IntegerExpr.ToInt (e, i) + AND (0 <= i) AND (i <= Word_types[rep].size); + END GetBitIndex; + PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! IF (e0 = NIL) OR (e1 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT IntegerExpr.Split (e1, w1, t) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR NOT GetBitIndex (ce.args[3], i3) ! OR i2 + i3 > Word_types[rep].size ! OR NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; Index: m3front/src/builtinWord/LE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LE.mg,v retrieving revision 1.1 diff -c -r1.1 LE.mg *** m3front/src/builtinWord/LE.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/LT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LT.mg,v retrieving revision 1.1 diff -c -r1.1 LT.mg *** m3front/src/builtinWord/LT.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Minus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Minus.mg,v retrieving revision 1.1 diff -c -r1.1 Minus.mg *** m3front/src/builtinWord/Minus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Minus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Subtract (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Mod.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Mod.mg,v retrieving revision 1.1 diff -c -r1.1 Mod.mg *** m3front/src/builtinWord/Mod.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Mod.mg 18 Feb 2010 02:30:51 -0000 *************** *** 32,37 **** --- 32,38 ---- VAR w0, w1, result: Target.Int; BEGIN IF GetArgs (ce.args, w0, w1) AND TWord.Mod (w0, w1, result) THEN + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = --- 43,57 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = *************** *** 56,61 **** --- 64,70 ---- ELSE min := TInt.Zero; TWord.Subtract (max_b, TInt.One, max); + TInt.Chop (max, Word_types[rep].bytes); END; END GetBounds; Index: m3front/src/builtinWord/Module.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Module.mg,v retrieving revision 1.1 diff -c -r1.1 Module.mg *** m3front/src/builtinWord/Module.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Module.mg 18 Feb 2010 02:30:51 -0000 *************** *** 15,22 **** PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); ! <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN --- 15,21 ---- PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN *************** *** 30,37 **** PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, Target.Integer.bytes, size); ! <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order --- 29,35 ---- PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, size); <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order Index: m3front/src/builtinWord/Not.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Not.mg,v retrieving revision 1.1 diff -c -r1.1 Not.mg *** m3front/src/builtinWord/Not.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Not.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; --- 5,11 ---- GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; *************** *** 31,36 **** --- 31,37 ---- e := Expr.ConstValue (ce.args[0]); IF (e # NIL) AND IntegerExpr.Split (e, w, t) THEN TWord.Not (w, result); + TInt.Chop (result, Integer_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Or.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Or.mg,v retrieving revision 1.1 diff -c -r1.1 Or.mg *** m3front/src/builtinWord/Or.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Or.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Or (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Plus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Plus.mg,v retrieving revision 1.1 diff -c -r1.1 Plus.mg *** m3front/src/builtinWord/Plus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Plus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 4,10 **** GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 4,10 ---- GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord, TInt; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Add (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Rotate.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Rotate.mg,v retrieving revision 1.1 diff -c -r1.1 Rotate.mg *** m3front/src/builtinWord/Rotate.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Rotate.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max : Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, -i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Shift.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Shift.mg,v retrieving revision 1.1 diff -c -r1.1 Shift.mg *** m3front/src/builtinWord/Shift.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Shift.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max: Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, -i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Times.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Times.mg,v retrieving revision 1.1 diff -c -r1.1 Times.mg *** m3front/src/builtinWord/Times.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Times.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Multiply (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 41,48 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Xor.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Xor.mg,v retrieving revision 1.1 diff -c -r1.1 Xor.mg *** m3front/src/builtinWord/Xor.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Xor.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Xor (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/exprs/AddExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddExpr.m3,v retrieving revision 1.4 diff -c -r1.4 AddExpr.m3 *** m3front/src/exprs/AddExpr.m3 10 Jan 2010 05:12:05 -0000 1.4 --- m3front/src/exprs/AddExpr.m3 18 Feb 2010 02:30:51 -0000 *************** *** 172,178 **** EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) AND TInt.Add (max_a, max_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 172,181 ---- EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Add (max_a, max_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/exprs/AddressExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddressExpr.m3,v retrieving revision 1.8 diff -c -r1.8 AddressExpr.m3 *** m3front/src/exprs/AddressExpr.m3 8 Feb 2010 12:03:30 -0000 1.8 --- m3front/src/exprs/AddressExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 39,45 **** PROCEDURE New (READONLY value: Target.Int): Expr.T = VAR p: P; BEGIN - IF TWord.LT (Target.Address.max, value) THEN RETURN NIL END; p := NEW (P); ExprRep.Init (p); p.value := value; --- 39,44 ---- *************** *** 66,72 **** IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => TWord.Add (p.value, i, j); c := New (j); RETURN c # NIL; ELSE RETURN FALSE; END; END Add; --- 65,75 ---- IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Add (p.value, i, j); ! TInt.Chop (j, Target.Address.bytes); ! c := New (j); ! RETURN TRUE; ELSE RETURN FALSE; END; END Add; *************** *** 82,102 **** IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => TWord.Subtract (i, p.value, k); c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN c # NIL; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN --- 85,111 ---- IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); + TInt.Chop (k, Target.Address.bytes); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Subtract (i, p.value, k); ! TInt.Chop (k, Target.Address.bytes); ! c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN TRUE; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; + TWord.And (x, Target.Address.max, x); + TWord.And (y, Target.Address.max, y); IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN Index: m3front/src/exprs/ArrayExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ArrayExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ArrayExpr.m3 *** m3front/src/exprs/ArrayExpr.m3 18 Sep 2007 20:25:54 -0000 1.6 --- m3front/src/exprs/ArrayExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 103,117 **** END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); --- 103,116 ---- END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); *************** *** 125,140 **** BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE RETURN FALSE; END; END GetBounds; --- 124,140 ---- BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => ! IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE ! RETURN FALSE; END; END GetBounds; *************** *** 214,220 **** END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), Target.Integer.bytes, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); --- 214,222 ---- END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), nn) ! AND NOT TInt.LT (nn, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); *************** *** 335,341 **** EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, Target.Integer.bytes, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. --- 337,343 ---- EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. Index: m3front/src/exprs/Expr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/Expr.m3,v retrieving revision 1.8 diff -c -r1.8 Expr.m3 *** m3front/src/exprs/Expr.m3 25 Sep 2009 02:42:12 -0000 1.8 --- m3front/src/exprs/Expr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 98,104 **** GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; --- 98,104 ---- GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; Index: m3front/src/exprs/IntegerExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/IntegerExpr.m3,v retrieving revision 1.9 diff -c -r1.9 IntegerExpr.m3 *** m3front/src/exprs/IntegerExpr.m3 8 Feb 2010 13:02:20 -0000 1.9 --- m3front/src/exprs/IntegerExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 38,58 **** VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; v: Target.Int; t := type = LInt.T; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF type = Int.T THEN ! IF NOT TInt.IntI (value, Target.Integer.bytes, v) THEN RETURN NIL END; ! ELSIF type = LInt.T THEN ! IF NOT TInt.IntI (value, Target.Longint.bytes, v) THEN RETURN NIL END; ! ELSE RETURN NIL END; p := NEW (P); ExprRep.Init (p); ! p.value := v; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) --- 38,59 ---- VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; t := Type.IsSubtype (type, LInt.T); ! min, max: Target.Int; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF NOT Type.GetBounds (type, min, max) ! OR TInt.LT (value, min) ! OR TInt.LT (max, value) THEN ! <*ASSERT FALSE*> ! END; p := NEW (P); ExprRep.Init (p); ! p.value := value; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) *************** *** 94,127 **** END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 95,134 ---- END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 129,140 **** RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 136,149 ---- RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 142,190 **** RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; ! END; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF TInt.LE (TInt.Zero, p.value) THEN ! c := a; RETURN TRUE; ! END; ! IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; END; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.ToInt (p.value, i) THEN ! RETURN FALSE; ! END; ! RETURN TRUE; ! ELSE RETURN FALSE; ! END; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): --- 151,194 ---- RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! RETURN TRUE; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF TInt.LT (x, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! ELSE ! c := a; END; + RETURN TRUE; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = + VAR x: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.ToInt (x, i) THEN RETURN FALSE END; ! RETURN TRUE; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): Index: m3front/src/exprs/ModExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ModExpr.m3,v retrieving revision 1.5 diff -c -r1.5 ModExpr.m3 *** m3front/src/exprs/ModExpr.m3 4 May 2008 11:03:46 -0000 1.5 --- m3front/src/exprs/ModExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 181,202 **** END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR min_b, max_b: Target.Int; ! OneI := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; ! OneL := Target.Int{Target.Longint.bytes, Target.IBytes{1,0,..}}; ! One := ARRAY[Class.cINT..Class.cLINT] OF Target.Int { OneI, OneL }; ! MaxI := Target.Integer.max; ! MaxL := Target.Longint.max; ! Max := ARRAY [Class.cINT..Class.cLINT] OF Target.Int { MaxI, MaxL }; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, One[p.class], max) THEN ! max := Max[p.class]; END; END; ELSE --- 181,198 ---- END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR tmin, tmax, min_b, max_b: Target.Int; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN + EVAL Type.GetBounds (p.type, tmin, tmax); Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, TInt.One, max) ! OR TInt.LT (max, tmin) OR TInt.LT (tmax, max) THEN ! max := tmax; END; END; ELSE Index: m3front/src/exprs/ReelExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ReelExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ReelExpr.m3 *** m3front/src/exprs/ReelExpr.m3 8 Feb 2010 12:03:31 -0000 1.6 --- m3front/src/exprs/ReelExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 9,15 **** MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Int, LInt, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT --- 9,15 ---- MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT *************** *** 172,222 **** END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = --- 172,218 ---- END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = Index: m3front/src/exprs/SetExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SetExpr.m3,v retrieving revision 1.6 diff -c -r1.6 SetExpr.m3 *** m3front/src/exprs/SetExpr.m3 2 Jan 2010 21:31:48 -0000 1.6 --- m3front/src/exprs/SetExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 10,16 **** IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module; TYPE Node = REF RECORD --- 10,16 ---- IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module, Text; TYPE Node = REF RECORD *************** *** 564,579 **** END; END Compile; - PROCEDURE TargetIntToDiagnosticText(name: TEXT; a: Target.Int): TEXT = - VAR t := ""; - b: INTEGER; - BEGIN - IF NOT TInt.ToInt(a, b) THEN - t := "**"; - END; - RETURN t & name & ":" & Target.TargetIntToDiagnosticText(a); - END TargetIntToDiagnosticText; - PROCEDURE CompileBig (p: P; VAR info: Type.Info): CG.Var = VAR range : Type.T; --- 564,569 ---- *************** *** 590,603 **** n : Node; b : BOOLEAN; tmp : Target.Int; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 580,594 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 659,666 **** PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = BEGIN ! CG.Load_integer (Target.Integer.cg_type, value); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; --- 650,659 ---- PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = + VAR tmp := value; BEGIN ! TInt.Chop (tmp, Target.Integer.bytes); ! CG.Load_integer (Target.Integer.cg_type, tmp); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; *************** *** 689,694 **** --- 682,688 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN Type.Compile (p.tipe); nWords := info.size DIV Grain; *************** *** 699,707 **** EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 693,701 ---- EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 793,800 **** IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; curWord := w1; curMask := TInt.Zero; --- 787,796 ---- IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; curWord := w1; curMask := TInt.Zero; *************** *** 802,812 **** IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! full, is_const); END; curWord := w2; curMask := right [b2]; --- 798,811 ---- IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO + tmp := full; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! tmp, is_const); END; curWord := w2; curMask := right [b2]; *************** *** 819,837 **** (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; END GenLiteral; PROCEDURE Init () = - VAR Zero := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (Zero, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); TWord.Shift (full, i, left [i]); END; END Init; --- 818,840 ---- (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; END GenLiteral; PROCEDURE Init () = BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (TInt.Zero, full); ! TWord.And (full, Target.Word.max, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); + TWord.And (right[i], Target.Word.max, right[i]); TWord.Shift (full, i, left [i]); + TWord.And (left[i], Target.Word.max, left[i]); END; END Init; Index: m3front/src/exprs/SubtractExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SubtractExpr.m3,v retrieving revision 1.5 diff -c -r1.5 SubtractExpr.m3 *** m3front/src/exprs/SubtractExpr.m3 10 Jan 2010 05:12:18 -0000 1.5 --- m3front/src/exprs/SubtractExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 62,68 **** VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN --- 62,68 ---- VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) AND EnumType.Is (ta) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN *************** *** 189,195 **** ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN --- 189,197 ---- ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) ! AND NOT TInt.LT (x3, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN *************** *** 205,211 **** Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND TInt.Subtract (max_a, min_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 207,215 ---- Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Subtract (max_a, min_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/misc/CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.35 diff -c -r1.35 CG.m3 *** m3front/src/misc/CG.m3 15 Feb 2010 05:07:07 -0000 1.35 --- m3front/src/misc/CG.m3 18 Feb 2010 02:30:53 -0000 *************** *** 940,946 **** (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; --- 940,946 ---- (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := TWord.Size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; *************** *** 984,1001 **** PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; v, tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; - EVAL TInt.IntI (value, Target.Longint.bytes, v); AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) --- 984,1000 ---- PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := TWord.Size - (o - init_pc) - s; END; IF (o = init_pc) *************** *** 1003,1010 **** AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, v, itype); ! ELSIF TWord.Insert (init_bits, v, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); --- 1002,1009 ---- AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, value, itype); ! ELSIF TWord.Insert (init_bits, value, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); *************** *** 1013,1021 **** END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; --- 1012,1023 ---- END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; *************** *** 1807,1815 **** END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; --- 1809,1820 ---- END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; *************** *** 2760,2768 **** END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; --- 2765,2776 ---- END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; Index: m3front/src/misc/Scanner.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/Scanner.m3,v retrieving revision 1.7 diff -c -r1.7 Scanner.m3 *** m3front/src/misc/Scanner.m3 4 May 2008 11:03:47 -0000 1.7 --- m3front/src/misc/Scanner.m3 18 Feb 2010 02:30:53 -0000 *************** *** 509,515 **** IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), Target.Integer.bytes, val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN --- 509,515 ---- IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN *************** *** 524,542 **** END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Long.bytes, val)) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Word.bytes, val)) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; cur.token := TK.tINTEGERCONST; cur.int := val; END; --- 524,546 ---- END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) ! OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, val)) ! OR TWord.LT (Target.Long.max, val) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Longint.bytes); cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) ! OR NOT TWord.New (SUBARRAY (buf, 0, len), base, val) ! OR TWord.LT (Target.Word.max, val) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Integer.bytes); cur.token := TK.tINTEGERCONST; cur.int := val; END; *************** *** 551,558 **** (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 555,563 ---- (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 617,632 **** (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Longint.bytes, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 622,639 ---- (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Longint.min) ! OR TInt.LT (Target.Longint.max, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 675,681 **** THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, Target.Integer.bytes, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; --- 682,688 ---- THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; Index: m3front/src/misc/TipeDesc.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/TipeDesc.m3,v retrieving revision 1.5 diff -c -r1.5 TipeDesc.m3 *** m3front/src/misc/TipeDesc.m3 1 Apr 2008 00:02:58 -0000 1.5 --- m3front/src/misc/TipeDesc.m3 18 Feb 2010 02:30:53 -0000 *************** *** 145,155 **** PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.IBytes)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN TWord.Subtract (TInt.Zero, ii, i); END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); --- 145,158 ---- PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.Int)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN ! TWord.Subtract (TInt.Zero, ii, i); ! TInt.Chop (i, Target.Integer.bytes); ! END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); Index: m3front/src/stmts/CaseStmt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/stmts/CaseStmt.m3,v retrieving revision 1.4 diff -c -r1.4 CaseStmt.m3 *** m3front/src/stmts/CaseStmt.m3 4 May 2008 11:03:48 -0000 1.4 --- m3front/src/stmts/CaseStmt.m3 18 Feb 2010 02:30:53 -0000 *************** *** 247,253 **** PROCEDURE CompleteTree (t: Tree; min, max: Target.Int): BOOLEAN = VAR x, y: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN WHILE (t # NIL) DO IF TInt.LT (t.max, min) OR TInt.LT (max, t.min) THEN --- 247,252 ---- *************** *** 256,273 **** IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, One, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, One, max) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, One, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, One, min) THEN RETURN TRUE; END; t := t.greater; --- 255,280 ---- IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, TInt.One, max) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, TInt.One, min) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.greater; *************** *** 458,464 **** next: Target.Int; oc, xc: Stmt.Outcomes; l_bodies, l_else, l_end: INTEGER; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN p.tree := CollapseTree (p.tree); l_bodies := CG.Next_label (p.nCases); --- 465,470 ---- *************** *** 485,491 **** CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, One, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; --- 491,499 ---- CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, TInt.One, next) ! OR TInt.LT (next, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; Index: m3front/src/types/ArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/ArrayType.m3,v retrieving revision 1.5 diff -c -r1.5 ArrayType.m3 *** m3front/src/types/ArrayType.m3 4 May 2008 11:03:48 -0000 1.5 --- m3front/src/types/ArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 309,315 **** VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, Target.Integer.bytes, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); --- 309,315 ---- VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); Index: m3front/src/types/EnumType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/EnumType.m3,v retrieving revision 1.7 diff -c -r1.7 EnumType.m3 *** m3front/src/types/EnumType.m3 4 May 2008 11:03:49 -0000 1.7 --- m3front/src/types/EnumType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 44,50 **** n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); --- 44,50 ---- n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); *************** *** 70,76 **** BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); --- 70,76 ---- BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); *************** *** 121,127 **** PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO --- 121,129 ---- PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, max) ! OR TInt.LT (max, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO *************** *** 158,164 **** p.info.hash := hash; END Check; - PROCEDURE CheckAlign (p: P; offset: INTEGER): BOOLEAN = VAR sz := TargetMap.Word_types [p.rep].size; --- 160,165 ---- *************** *** 172,178 **** RETURN (offset + sz) <= (z0 + Target.Integer.size); END CheckAlign; - PROCEDURE Compiler (p: P) = VAR v := Scope.ToList (p.scope); BEGIN --- 173,178 ---- *************** *** 222,230 **** VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN ! RETURN 1; ! END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; --- 222,228 ---- VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, max) THEN RETURN 1 END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; Index: m3front/src/types/OpenArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/OpenArrayType.m3,v retrieving revision 1.4 diff -c -r1.4 OpenArrayType.m3 *** m3front/src/types/OpenArrayType.m3 18 Sep 2007 20:26:11 -0000 1.4 --- m3front/src/types/OpenArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 209,217 **** PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), ! Target.Integer.bytes, m) ! AND TInt.FromInt (20, Target.Integer.bytes, n) (* guess 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; --- 209,216 ---- PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), m) ! AND TInt.FromInt (20, n) (* guess that there are 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; Index: m3front/src/types/SubrangeType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/SubrangeType.m3,v retrieving revision 1.7 diff -c -r1.7 SubrangeType.m3 *** m3front/src/types/SubrangeType.m3 15 Jan 2010 21:50:12 -0000 1.7 --- m3front/src/types/SubrangeType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 78,91 **** PROCEDURE SetRep (p: P) = BEGIN - IF Type.IsSubtype (p.baseType, LInt.T) - THEN p.rep := Target.Longint.cg_type; - ELSE p.rep := Target.Integer.cg_type; - END; - IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; RETURN; END; --- 78,90 ---- PROCEDURE SetRep (p: P) = BEGIN IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; + IF Type.IsSubtype (p.baseType, LInt.T) + THEN p.rep := Target.Longint.cg_type; + ELSE p.rep := Target.Integer.cg_type; + END; RETURN; END; *************** *** 102,109 **** (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) ! AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; --- 101,107 ---- (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; *************** *** 277,283 **** END BitWidth; VAR (*CONST*) ! power : ARRAY [0..BITSIZE (Target.Int)] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = --- 275,281 ---- END BitWidth; VAR (*CONST*) ! power : ARRAY [0..TInt.Size] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = *************** *** 306,312 **** rep_max := Target.Integer.max; END; ! IF zeroed AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; --- 304,311 ---- rep_max := Target.Integer.max; END; ! IF zeroed ! AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; *************** *** 340,347 **** VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) ! OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN --- 339,345 ---- VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN Index: m3front/src/types/Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/Type.m3,v retrieving revision 1.8 diff -c -r1.8 Type.m3 *** m3front/src/types/Type.m3 4 May 2008 11:03:49 -0000 1.8 --- m3front/src/types/Type.m3 18 Feb 2010 02:30:53 -0000 *************** *** 392,399 **** IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, max); ! <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; --- 392,398 ---- IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), max); <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; *************** *** 411,417 **** END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND TInt.LE (max, Target.Integer.max) THEN RETURN max; END; Error.Msg ("type has too many elements"); --- 410,417 ---- END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND NOT TInt.LT (max, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, max) THEN RETURN max; END; Error.Msg ("type has too many elements"); *************** *** 425,432 **** b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, min); ! <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; --- 425,431 ---- b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), min); <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; Index: m3tools/src/M3Builtin.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Builtin.m3,v retrieving revision 1.5 diff -c -r1.5 M3Builtin.m3 *** m3tools/src/M3Builtin.m3 18 Sep 2007 20:26:30 -0000 1.5 --- m3tools/src/M3Builtin.m3 18 Feb 2010 02:30:54 -0000 *************** *** 111,117 **** val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, Target.Integer.bytes, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); --- 111,117 ---- val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); Index: m3tools/src/M3Const.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Const.m3,v retrieving revision 1.6 diff -c -r1.6 M3Const.m3 *** m3tools/src/M3Const.m3 16 Jan 2010 02:29:10 -0000 1.6 --- m3tools/src/M3Const.m3 18 Feb 2010 02:30:54 -0000 *************** *** 861,868 **** Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) ! AND TInt.FromInt (b.info, Target.Integer.bytes, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); --- 861,867 ---- Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) AND TInt.FromInt (b.info, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); *************** *** 1161,1167 **** BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, Target.Integer.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalInt; --- 1160,1166 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalInt; *************** *** 1171,1177 **** BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, Target.Longint.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; --- 1170,1176 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; Index: m3tools/src/M3Lexer.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Lexer.m3,v retrieving revision 1.4 diff -c -r1.4 M3Lexer.m3 *** m3tools/src/M3Lexer.m3 18 Sep 2007 20:26:30 -0000 1.4 --- m3tools/src/M3Lexer.m3 18 Feb 2010 02:30:54 -0000 *************** *** 89,96 **** SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t, Target.Integer.bytes); ! | TK_Long_const => FixInt (t, Target.Longint.bytes); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); --- 89,96 ---- SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t); ! | TK_Long_const => FixInt (t); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); *************** *** 108,114 **** t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T; bytes: CARDINAL) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO --- 108,114 ---- t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO *************** *** 120,135 **** END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), bytes, t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), bytes, t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, bytes, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; --- 120,135 ---- END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; Index: m3tools/src/M3Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Type.m3,v retrieving revision 1.6 diff -c -r1.6 M3Type.m3 *** m3tools/src/M3Type.m3 16 Jan 2010 02:29:11 -0000 1.6 --- m3tools/src/M3Type.m3 18 Feb 2010 02:30:54 -0000 *************** *** 45,55 **** PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; - One := Target.Int{Target.Integer.bytes, TInt.One.x}; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, max) THEN RETURN max; END; RETURN Target.Integer.max; --- 45,54 ---- PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, max) THEN RETURN max; END; RETURN Target.Integer.max; *************** *** 248,254 **** PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, Target.Integer.bytes, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); --- 247,253 ---- PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); *************** *** 289,296 **** VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, Target.Integer.size, max); ! <*ASSERT b*> RETURN TRUE; END EnumBounds; --- 288,294 ---- VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, max); <*ASSERT b*> RETURN TRUE; END EnumBounds; From hosking at elego.de Thu Feb 18 04:01:14 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 4:01:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218030114.E3D712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 04:01:14 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Avoid warning for 64-bit INTEGER. From jkrell at elego.de Thu Feb 18 08:30:35 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 8:30:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218073035.2628C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 08:30:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: more information when this assertion fails, as it now does: == package C:\dev2\cm3.2\m3-libs\m3core == +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 new source -> compiling RTHooks.i3 "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 *** *** runtime error: *** <*ASSERT*> failed. *** file "..\src\M3x86.m3", line 1114 *** Stack trace: FP PC Procedure --------- --------- ------------------------------- 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 confusion here about signed vs. unsigned integers; the signed number 158 requires 2 bytes but the unsigned number 158 only requirs 1 byte From jay.krell at cornell.edu Thu Feb 18 09:09:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100218073035.2628C2474001@birch.elegosoft.com> References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 09:54:16 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 9:54:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218085416.592572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 09:54:16 Added files: cm3/m3-sys/m3back/src/: TWordOld.i3 TWordOld.m3 TIntOld.i3 TIntOld.m3 Log message: initial copies of previous versions, we'll have to adapt to put them into place, and then gradually maybe turn them into the new versions, keeping things working as we go; I'm not too keen on debugging things otherwise right now From jkrell at elego.de Thu Feb 18 10:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 10:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218090709.D28FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 10:07:09 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsWord => TypeIsUnsignedInt IsInt => TypeIsSignedInt Is64 => TypeIs64 From jay.krell at cornell.edu Thu Feb 18 11:05:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 10:05:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: Another problem now is that 64bit rotate of constants doesn't get the type size correct. Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? - Jay From: jay.krell at cornell.edu To: jkrell at elego.de; m3commit at elegosoft.com Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: Re: [M3commit] CVS Update: cm3 Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 12:31:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:31:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113110.D1F722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:31:10 Added files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Removed files: cm3/m3-sys/m3back/src/: TIntOld.m3 TIntOld.i3 TWordOld.i3 TWordOld.m3 Log message: rename these files; they derive directly from m3middle/TInt, TWord From jkrell at elego.de Thu Feb 18 12:38:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:38:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113822.D8B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:38:22 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 Log message: go back a few versions: cvs -z3 upd -r 1.126 M3x86.m3 cvs -z3 upd -r 1.93 Stackx86.m3 cvs -z3 upd -r 1.79 Codex86.m3 cvs -z3 upd -r 1.28 M3x86Rep.i3 cvs -z3 upd -r 1.6 Wrx86.m3 This does not build, but the previous didn't work anyway. The history will be easier to see here when I commit something that builds and works (I already have it). From jkrell at elego.de Thu Feb 18 12:41:37 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:41:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218114137.81CF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:41:37 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: rename the interface/end from TInt/TWord to M3BackInt/M3BackWord (yes, I realize it sounds like 'backward') From jkrell at elego.de Thu Feb 18 14:05:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:05:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130500.4C0A52474001@birch.elegosoft.com> 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") From jkrell at elego.de Thu Feb 18 14:08:24 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:08:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130824.62F942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:08:24 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: assert earlier From jkrell at elego.de Thu Feb 18 14:12:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:12:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131234.32E2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:12:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix dumb out of order initialization, should fix the problem building showheap From jkrell at elego.de Thu Feb 18 14:13:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:13:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131314.E78672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:13:14 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: remove procuedures New and IntI that we don't use From jkrell at elego.de Thu Feb 18 15:09:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:09:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218140956.2E5F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:09:56 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Log message: fix converting Target.Int to M3Back.Int, test p227 much better now but still a problem with 1 MODUL 1 (wierd considering that 1 MODL 1 works); all this was working but still recovering from TInt changes From jkrell at elego.de Thu Feb 18 15:20:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:20:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218142048.257322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:20:48 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo in test case, duh From hosking at cs.purdue.edu Thu Feb 18 18:07:57 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:07:57 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). On 18 Feb 2010, at 05:05, Jay K wrote: > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > - Jay > > > From: jay.krell at cornell.edu > To: jkrell at elego.de; m3commit at elegosoft.com > Date: Thu, 18 Feb 2010 08:09:30 +0000 > Subject: Re: [M3commit] CVS Update: cm3 > > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > From hosking at cs.purdue.edu Thu Feb 18 18:02:18 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:02:18 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: It probably makes sense for me to repair this in the front-end. Let me look into it. On 18 Feb 2010, at 03:09, Jay K wrote: > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Thu Feb 18 22:08:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 21:08:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: You had changed TWord.Rotate() uses to assume Target.Integer.bytes. x: M3x86Rep.Operand; TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) What probably would have worked is more like: TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. Precision affects the intermediate results. That's the only possible problem that stood out to me on a quick read. Whatever it all was though, the compiler no longer worked, basically not at all, even if I removed the assertions about integers fitting in their claimed types. I wasn't too keen on debugging that right now but I should before much longer. I'd rather not keep a separate copy of TInt/TWord.. - Jay > From: hosking at cs.purdue.edu > Date: Thu, 18 Feb 2010 12:07:57 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > - Jay > > > > > > From: jay.krell at cornell.edu > > To: jkrell at elego.de; m3commit at elegosoft.com > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Tony there are multiple related problems here. > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > e.g. in InitTypecell. > > And maybe similar for 16/32/64, I don't know. > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > I'll see what I can do. > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > - Jay > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > To: m3commit at elegosoft.com > > > From: jkrell at elego.de > > > Subject: [M3commit] CVS Update: cm3 > > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > Log message: > > > more information when this assertion fails, as it now does: > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > new source -> compiling RTHooks.i3 > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > *** > > > *** runtime error: > > > *** <*ASSERT*> failed. > > > *** file "..\src\M3x86.m3", line 1114 > > > *** > > > > > > Stack trace: > > > FP PC Procedure > > > --------- --------- ------------------------------- > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > confusion here about signed vs. unsigned integers; > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > only requirs 1 byte > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 18 23:11:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 17:11:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: <357F3AF3-577B-4346-875F-613135F023E7@cs.purdue.edu> Rotate now has an extra parameter to indicate the bytes rotated. You do need to use TInt.Chop to treat the result as having the correct size. (See how folding is done in m3front/src/builtinWord operations.) Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 18 Feb 2010, at 16:08, Jay K wrote: > You had changed TWord.Rotate() uses to assume Target.Integer.bytes. > x: M3x86Rep.Operand; > TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) > What probably would have worked is more like: > TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) > > > Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. > Precision affects the intermediate results. > > > That's the only possible problem that stood out to me on a quick read. > Whatever it all was though, the compiler no longer worked, basically not at all, > even if I removed the assertions about integers fitting in their claimed types. > I wasn't too keen on debugging that right now but I should before much longer. > I'd rather not keep a separate copy of TInt/TWord.. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Thu, 18 Feb 2010 12:07:57 -0500 > > To: jay.krell at cornell.edu > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > > > - Jay > > > > > > > > > From: jay.krell at cornell.edu > > > To: jkrell at elego.de; m3commit at elegosoft.com > > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > Tony there are multiple related problems here. > > > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > > e.g. in InitTypecell. > > > And maybe similar for 16/32/64, I don't know. > > > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > > > I'll see what I can do. > > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > > > - Jay > > > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > > To: m3commit at elegosoft.com > > > > From: jkrell at elego.de > > > > Subject: [M3commit] CVS Update: cm3 > > > > > > > > CVSROOT: /usr/cvs > > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > > > Modified files: > > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > > > Log message: > > > > more information when this assertion fails, as it now does: > > > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > > > new source -> compiling RTHooks.i3 > > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > > > *** > > > > *** runtime error: > > > > *** <*ASSERT*> failed. > > > > *** file "..\src\M3x86.m3", line 1114 > > > > *** > > > > > > > > Stack trace: > > > > FP PC Procedure > > > > --------- --------- ------------------------------- > > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > > > confusion here about signed vs. unsigned integers; > > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > > only requirs 1 byte > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 12:28:32 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 12:28:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219112832.B05CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 12:28:32 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: Expand test coverage to more sizes of sets. Something is really odd here. A set of >32 elements is being correctly handled as a set of two integers, for purposes of comparison, but I don't see where the code to do that is. A set of one integer, I see that. The code is correct, but I don't know where it is coming from. From jay.krell at cornell.edu Fri Feb 19 13:17:17 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 19 Feb 2010 12:17:17 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100219112832.B05CD2474001@birch.elegosoft.com> References: <20100219112832.B05CD2474001@birch.elegosoft.com> Message-ID: > Something is really odd here. Finally found it. There is a general notion of "solid" types. For which equality comparison can be an inlined word by word comparison. See EqualExpr.m3 / Max_unroll. - Jay > Date: Fri, 19 Feb 2010 12:28:32 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/19 12:28:32 > > Modified files: > cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 > > Log message: > Expand test coverage to more sizes of sets. > Something is really odd here. > A set of >32 elements is being correctly handled > as a set of two integers, for purposes of comparison, > but I don't see where the code to do that is. > A set of one integer, I see that. > The code is correct, but I don't know where it is coming from. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 14:13:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:13:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219131345.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:13:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current output From jkrell at elego.de Fri Feb 19 14:28:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:28:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132855.959C72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:28:55 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: replace set_ne (not equal) and seq_eq (equal) with !memcmp or !!memcmp From jkrell at elego.de Fri Feb 19 14:29:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:29:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132955.B63AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:29:55 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: eliminate set_eq and set_ne From jkrell at elego.de Sun Feb 21 10:52:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 10:52:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221095250.D74B82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 10:52:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: UNUSED_INTEGER is a long not an int From jkrell at elego.de Sun Feb 21 12:25:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 12:25:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221112506.112E32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 12:25:06 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: restore losting cleanup: THEN goes at end of line and go beyond that: factor common code into a function (original authors seemed very keen on manual inlining, which is kind of nice, but leads to a lot of duplicate code; we should strongly consider adding inlining in m3back) simple guard against a form of overflow that I have trouble believing is possible, but the guard is super cheap From jkrell at elego.de Sun Feb 21 14:56:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 14:56:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221135624.71EEF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 14:56:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.m3 M3BackInt.i3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 02:42:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 2:42:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222014204.55A562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 02:42:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I somehow missed this file as part of: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 03:25:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 3:25:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222022522.BFCD32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 03:25:22 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: gut M3BackWord such that TWord does most of the work; each function is basically zero extend, call TWord, Chop; Insert/Extract have more stringent size limit; still more to do in M3BackInt From jkrell at elego.de Mon Feb 22 09:59:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 9:59:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222085938.C29A22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 09:59:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 Log message: temporary version that does all the world old way and new way and asserts they match, including making copies because aliasing does exist (in this very file, look at the uses of subtract in divide) From jkrell at elego.de Mon Feb 22 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222090043.937532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 10:00:43 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: comment, formating (don't bury major semantics in VAR) From jkrell at elego.de Mon Feb 22 11:25:55 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:25:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102555.EA0EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:25:55 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version, something is wrong and I should do the version where everything is done both ways and checked From jkrell at elego.de Mon Feb 22 11:27:17 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102717.5A3482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:17 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: remove another IMPORT Foo AS Bar renaming From jkrell at elego.de Mon Feb 22 11:27:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102759.71ECF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:59 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: remove unused procedure New From jkrell at elego.de Mon Feb 22 13:43:52 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 13:43:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222124352.AD5252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 13:43:52 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: temporary version that does everything old and new and asserts they match; beware of aliasing, when you do things twice, the inputs tend to get clobbered From jkrell at elego.de Mon Feb 22 14:01:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:01:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222130125.BC64D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:01:25 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: go back to only doing things once this time with a different Chop function though, not sure that matters From jkrell at elego.de Mon Feb 22 14:24:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:24:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222132450.D4FCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:24:50 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "ToTargetInt" => "ZeroExtend" remove unused: LShift, RShift, Word, IByte, IBytes From jkrell at elego.de Mon Feb 22 14:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135721.A49DC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "Chop" => "UnsignedTruncate" From jkrell at elego.de Mon Feb 22 14:57:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135751.996A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:51 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove most of the code -- delegating to TInt Add Subtract Multiply Div Mod (DivMod) -- which I understood least well EQ LT the following significant functions remain and might merit further attention: SignExtend ZeroExtend SignedTruncate UnsignedTruncate ToBytes ToBytes I haven't looked into much. It could be that TInt.ToBytes can work. But possible problems already reported. TInt.Chop might be useful, but I'm sure we are missing some functionality in terms of signed vs. unsigned. Two functions are needed for widening and two for narrowing. As well, ToChars should have signed and unsigned variations, though we only use it for debug code and we aren't sensitive to incorrect printing of large positive numbers. Something is also still fishy with ToInt and/or FromInt. Whenever I convert them, I hit problems (assertion failures in RTCollector/RTAllocator) I haven't tried the double work + assert approach to them. They look so simple.. From jkrell at elego.de Mon Feb 22 22:16:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:16:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222211635.665C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:16:35 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: temporary version that does double work + assert in ToInt and FromInt From jkrell at elego.de Mon Feb 22 22:21:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:21:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212102.750822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:21:02 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Wrx86.m3 Log message: TargetIntToDiagnosticText => ToDiagnosticText TIntToDiagnosticText => TargetIntToDiagnosticText From jkrell at elego.de Mon Feb 22 22:23:10 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:23:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212310.DC54C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:23:10 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: use FIRST and LAST instead of 0 and 7 From jkrell at elego.de Mon Feb 22 22:34:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:34:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222213402.9534E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:34:02 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: fix typo From jkrell at elego.de Mon Feb 22 23:54:32 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:54:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225432.E87372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:54:32 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: in TInt.ToInt, pack the bytes even if there is overflow; caller can pay attention to the overflow or not From jkrell at elego.de Mon Feb 22 23:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225722.056AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:01:02 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:01:02 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100222225722.056AE2474001@birch.elegosoft.com> References: <20100222225722.056AE2474001@birch.elegosoft.com> Message-ID: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:03:03 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:03:03 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com> <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Message-ID: P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 02:30:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 01:30:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: I'm still a bit leary of Chop and ToBytes. I *suspect* we need a bit more in TWord to make this all hold together. Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > From hosking at cs.purdue.edu Tue Feb 23 03:10:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 21:10:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> On 22 Feb 2010, at 20:30, Jay K wrote: > I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. > I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 20:03:03 -0500 >> To: hosking at cs.purdue.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> >> >> P.S. The assumption is that results from operations that overflow should be discarded. >> >> >> Antony Hosking | Associate Professor | Computer Science | Purdue University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> >> >> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >> >> Jay, If you want that behavior, just do: >> >> TInt.Chop(x, BYTESIZE(INTEGER), x); >> TInt.ToInt(x, i) >> >> On 22 Feb 2010, at 23:57, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >> >> From jay.krell at cornell.edu Tue Feb 23 03:30:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 02:30:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > >> I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > >> I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > >> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >> >> >> I don't entirely ignore ToInt's boolean. >> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >> >> >> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >> >> >> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >> >> >> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >> >> >> And then rewriting hand.c in Modula-3. >> >> >> And then other stuff. >> >> >> ..Jay >> >> >> ________________________________ >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>> To: hosking at cs.purdue.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> >>> >>> P.S. The assumption is that results from operations that overflow should be discarded. >>> >>> >>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>> 305 N. University Street | West Lafayette | IN 47907 | USA >>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>> >>> >>> >>> >>> >>> >>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>> >>> Jay, If you want that behavior, just do: >>> >>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>> TInt.ToInt(x, i) >>> >>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>> >>> CVSROOT: /usr/cvs >>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>> >>> Modified files: >>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>> >>> Log message: >>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>> >>> > From jkrell at elego.de Tue Feb 23 12:11:38 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:11:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223111138.C3F5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:11:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: remove TargetIntToDiagnosticText, no callers outside of M3BackInt.m3 From jkrell at elego.de Tue Feb 23 12:54:04 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:54:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223115404.4A5E02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:54:04 Added files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 m3makefile stdout.pgm Log message: add test case for set_singleton This might be endian and/or word size specific. But heck, I can at least compare NT386, LINUXLIBC6, I386_DARWIN. And maybe adjust the infrastructure to cope with it. From jkrell at elego.de Tue Feb 23 13:04:17 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 13:04:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223120417.D92412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 13:04:17 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: add to test case From jkrell at elego.de Tue Feb 23 14:00:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 14:00:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223130057.614652474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 14:00:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: ulong => size_t in the interest of Win64, the only platform for which these are different, and size_t is probably the intent From hosking at cs.purdue.edu Tue Feb 23 14:35:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 08:35:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 21:10:10 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> On 22 Feb 2010, at 20:30, Jay K wrote: >> >>> I'm still a bit leary of Chop and ToBytes. >> >> Chop is just the same as a C cast. >> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >> >> ToBytes simply returns the significant bytes. >> >>> I *suspect* we need a bit more in TWord to make this all hold together. >> >> I don't see the need. I think this speaks to confusion on your part... >> >>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>> >>> >>> I don't entirely ignore ToInt's boolean. >>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>> >>> >>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>> >>> >>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>> >>> >>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>> >>> >>> And then rewriting hand.c in Modula-3. >>> >>> >>> And then other stuff. >>> >>> >>> ..Jay >>> >>> >>> ________________________________ >>>> From: hosking at cs.purdue.edu >>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>> To: hosking at cs.purdue.edu >>>> CC: m3commit at elegosoft.com >>>> Subject: Re: [M3commit] CVS Update: cm3 >>>> >>>> >>>> >>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>> >>>> >>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>> >>>> >>>> >>>> >>>> >>>> >>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>> >>>> Jay, If you want that behavior, just do: >>>> >>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>> TInt.ToInt(x, i) >>>> >>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>> >>>> CVSROOT: /usr/cvs >>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>> >>>> Modified files: >>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>> >>>> Log message: >>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>> >>>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150535.710962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:05:35 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: more testing From jkrell at elego.de Tue Feb 23 16:06:37 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:06:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150637.B7D3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:06:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3x86.m3 Log message: another not very useful function in hand.c bites the dust, at least under #ifdef use bts instruction instead of calling set_singleton bts's notion of how to index bits happens to line up with set_singleton (assuming test p230 is complete enough) bts isn't fast, but surely this is better overall due to drastically fewer instructions note that set_singleton test cases tend to generate very large code zeroing stuff I was not able to get coverage of several addressing modes, so they are left issuing errors and asserts. That is, among: bts mem, reg bts reg, imm8 bts reg, reg possibly bts mem, imm8 I was only able to get bts reg, reg to hit. Still to ponder gcc backend? I had hoped to get this done in the frontend but became stumped. ? It's just a shift and and, should be achievable portably. ? From jkrell at elego.de Tue Feb 23 16:11:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:11:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223151139.450FB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:11:39 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_singleton from NT386 maybe we can remove it from others too? From jay.krell at cornell.edu Tue Feb 23 16:27:06 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 15:27:06 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: I'd rather move along to other things.. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 08:35:39 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223155153.166A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:51:52 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: implementation of direct thread suspend/resume for interix been sitting on it and almost deleted it direct suspend/resume can be achieve by writing certain control codes to the correct files in /procfs the context of a suspended thread can be gotten by reading a file However I'd like to at least avoid opening the files repeatedly. Here we open them in thread create. I don't remember why Interix can't use the portable code. It doesn't have SA_SIGINFO but that doesn't prove it. It is empirically showable that the context is on the stack. So maybe we just have a single parameter signal handler and a null context? From hosking at cs.purdue.edu Tue Feb 23 18:39:49 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 12:39:49 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > >> >> ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? >> I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. >> >> >> - Jay >> >> >> ---------------------------------------- >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 21:10:10 -0500 >>> To: jay.krell at cornell.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> On 22 Feb 2010, at 20:30, Jay K wrote: >>> >>>> I'm still a bit leary of Chop and ToBytes. >>> >>> Chop is just the same as a C cast. >>> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >>> >>> ToBytes simply returns the significant bytes. >>> >>>> I *suspect* we need a bit more in TWord to make this all hold together. >>> >>> I don't see the need. I think this speaks to confusion on your part... >>> >>>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>>> >>>> >>>> I don't entirely ignore ToInt's boolean. >>>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>>> >>>> >>>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>>> >>>> >>>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>>> >>>> >>>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>>> >>>> >>>> And then rewriting hand.c in Modula-3. >>>> >>>> >>>> And then other stuff. >>>> >>>> >>>> ..Jay >>>> >>>> >>>> ________________________________ >>>>> From: hosking at cs.purdue.edu >>>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>>> To: hosking at cs.purdue.edu >>>>> CC: m3commit at elegosoft.com >>>>> Subject: Re: [M3commit] CVS Update: cm3 >>>>> >>>>> >>>>> >>>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>>> >>>>> >>>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>>> >>>>> Jay, If you want that behavior, just do: >>>>> >>>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>>> TInt.ToInt(x, i) >>>>> >>>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>>> >>>>> CVSROOT: /usr/cvs >>>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>>> >>>>> Modified files: >>>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>>> >>>>> Log message: >>>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>>> >>>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 19:15:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 18:15:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Tue Feb 23 20:00:07 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 14:00:07 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: > So we need TWord.ToBytes? > > - Jay > > From: hosking at cs.purdue.edu > Date: Tue, 23 Feb 2010 12:39:49 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com; jay.krell at cornell.edu > Subject: Re: [M3commit] CVS Update: cm3 > > Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. > These TInt functions should be interpreted as having C arithmetic semantics. > > On 23 Feb 2010, at 08:35, Tony Hosking wrote: > > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > > I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > > I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 24 00:08:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 23:08:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , ,,, ,,, , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , , , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, , <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu>, , Message-ID: I'll have to show you where the values are coming from. I don't know offhand. Could be from m3back, or m3front, I don't know. This stuff largely is runnable/testable from arbitrary hosts. cd scripts/python ./do-cm3-std.py realclean NT386 ./do-cm3-std.py buildship NT386 to get the data we are interested in, would want to change this code e.g.: C:\dev2\cm3.2\m3-sys\m3back\src\Codex86.m3(386): IF (NOT M3BackInt.ToInt(imm, ins.imm)) AND (NOT M3BackWord.LE(imm, M3BackInt.Word32.max)) THEN Note that most of the uses of ToInt in m3back don't do that, e.g.: IF shiftCount.loc = OLoc.imm THEN IF NOT M3BackInt.ToInt(shiftCount.imm, ins.imm) THEN t.Err("binOp: unable to convert immediate to INTEGER:" & M3BackInt.ToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; And at least one of these examples is so far unreachable -- the one in bitTestAndSet that I added yesterday. But some are not, I didn't go here randomly. bitTestAndSet seems unusual but ok in that many x86 instructions can take a one byte signed immediate value, but bitTestAndSet seems to take a one byte unsigned immediate value. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 14:00:07 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 24 00:26:36 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 0:26:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223232636.612802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 00:26:35 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: 1UL => ((size_t)1) again with Win64 in mind From jkrell at elego.de Wed Feb 24 08:56:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 8:56:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224075620.035032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 08:56:15 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case to cover constants From jkrell at elego.de Wed Feb 24 09:05:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 9:05:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224080554.A1B902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 09:05:54 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case From jkrell at elego.de Wed Feb 24 12:33:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:33:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224113329.3FC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:33:28 Modified files: cm3/m3-ui/bicycle/src/: m3makefile cm3/m3-ui/cmvbt/src/: m3makefile cm3/m3-ui/codeview/src/: m3makefile cm3/m3-ui/formsedit/src/: m3makefile cm3/m3-ui/formsvbt/src/: m3makefile cm3/m3-ui/formsview/src/: m3makefile cm3/m3-ui/images/src/: m3makefile cm3/m3-ui/juno-2/juno-app/src/: m3makefile cm3/m3-ui/mg/src/: m3makefile cm3/m3-ui/mgkit/src/: m3makefile cm3/m3-ui/ui/test/Argus/src/: m3makefile cm3/m3-ui/ui/test/BadBricks/src/: m3makefile cm3/m3-ui/ui/test/ButtonTest/src/: m3makefile cm3/m3-ui/ui/test/Cards/src/: m3makefile cm3/m3-ui/ui/test/ColorMonster/src/: m3makefile cm3/m3-ui/ui/test/Draw/src/: m3makefile cm3/m3-ui/ui/test/EyesVBT/src/: m3makefile cm3/m3-ui/ui/test/Hello/src/: m3makefile cm3/m3-ui/ui/test/Monster/src/: m3makefile cm3/m3-ui/ui/test/Sketch2/src/: m3makefile cm3/m3-ui/ui/test/StarAnim/src/: m3makefile cm3/m3-ui/ui/test/Track/src/: m3makefile cm3/m3-ui/ui/test/TypeInTest/src/: m3makefile cm3/m3-ui/ui-tests/pixmapcomtest/src/: m3makefile cm3/m3-ui/ui-tests/test25/src/: m3makefile cm3/m3-ui/ui-tests/texturecomtest/src/: m3makefile cm3/m3-ui/vbtkit/src/: m3makefile cm3/m3-ui/videovbt/src/: m3makefile cm3/m3-ui/webvbt/src/: m3makefile cm3/m3-ui/webvbt/src/hyperpage/src/: m3makefile cm3/m3-ui/zeus/src/: m3makefile Log message: HasGui => HasTrestle I suspect this won't matter shortly, I think I know what is wrong with X on Interix, just need to configure it as not having the shared memory extension.. From jkrell at elego.de Wed Feb 24 12:57:09 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:57:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224115709.67B632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:57:09 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test -- this gets more addressing modes From jkrell at elego.de Wed Feb 24 13:23:29 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:23:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122329.71DBF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:23:29 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: extend test From jkrell at elego.de Wed Feb 24 13:28:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:28:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122800.E307A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:28:00 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: another little helper function bites the dust, at least for NT386 replace size_t __stdcall set_member(size_t elt, size_t* set) { register size_t word = elt / SET_GRAIN; register size_t bit = elt % SET_GRAIN; return (set[word] & (((size_t)1) << bit)) != 0; } with bt instruction which does it all, and leaves the result in the carry flag (some gymnastics then to get the carry flag) before: 0000003C: 56 push esi 0000003D: 53 push ebx 0000003E: FF 15 30 00 00 00 call dword ptr [T$111+30h] Shouldn't this be a direct call, save a byte? 00000044: 89 45 F4 mov dword ptr [ebp-0Ch],eax 11 bytes, 4 instructions (plus the function!) after, attempt #1 0000003C: 0F A3 1E bt dword ptr [esi],ebx 0000003F: 0F 92 45 F0 setb byte ptr [ebp-10h] 00000043: 33 D2 xor edx,edx 00000045: 8A 55 F0 mov dl,byte ptr [ebp-10h] 00000048: 89 55 F4 mov dword ptr [ebp-0Ch],edx 15 bytes, 5 instructions so many to extract the carry! Probably a win, but larger. Attempt #2: Let's try a different approach to capturing the result: 000000D1: 0F A3 1E bt dword ptr [esi],ebx 000000D4: 1B D2 sbb edx,edx 000000D6: F7 DA neg edx 000000D8: 89 55 F8 mov dword ptr [ebp-8],edx 10 bytes, 4 instructions (though I think the old approach could get by with 10, using a direct call) We can probably replace setcc other places similarly (see below). I had tried: xor eax, eax adc eax, 0 That didn't work. I suspect xor clobbered the carry. We could make that work by reserving and clearing the register earlier. However it is 11 bytes instead of 1 and this sbb, neg is how Visual C++ compiles: int F(unsigned a, unsigned b) { return a < b; } (further note: > is < but reversed, <= is < but inc instead of neg, and, importantly == and != are xor, op, sete regL, should be a nice win over our current strategy, if we can reserve/xor the register ahead of op) Note that now we get the various addressing modes (where set_singleton did not), however I couldn't get them to work, probably not encoding them with the right amount of indirection, so I force reg/reg addressing. Not ideal but probably still much better. Note that set_member is pretty heavily used, though none of these changes affects set that fit in 32 bits. We really should try to improve gcc backend? From jkrell at elego.de Wed Feb 24 13:30:19 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:30:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224123019.7CBDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:30:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_member on NT386, see m3back changes, m3back generates x86 bt (bit test) instruction instead From jkrell at elego.de Thu Feb 25 08:15:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:15:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225071542.1EA6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:15:42 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: replace cat with fs_contents From jkrell at elego.de Thu Feb 25 08:29:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:29:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225072914.6F3F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:29:14 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: on non-posix, look for \cygwin\bin\date.exe \cygwin\bin\bc.exe \cygwin\bin\awk.exe \cygwin\bin\cat.exe and use them if they exist Still, this won't let date even work on Solaris. Notice how pkgmap.sh just builds its own from one line of portable C. Awk I think we can remove just by using wc -l instead of wc? cat multiple files could be concating fs_contents? wc via split with newlines as the delimiter? bc we can just use "0" if it isn't there or maybe actually write an expression evaluator? more to do here later.. From jkrell at elego.de Thu Feb 25 08:47:21 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:47:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225074721.9D9462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:47:21 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: Remove unncessary use of awk, cat, wc, replacing with fairly portable quake. There is some issue here regarding splitting on \r or \n or both. Date and bc remain. From jkrell at elego.de Thu Feb 25 09:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225083142.8EF262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:31:39 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: Go back a version, I think I showed these changes aren't needed, since the context is on the stack in Interix, just not exposed. From jkrell at elego.de Thu Feb 25 09:40:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:40:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084038.8ABE72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:40:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: when splitting 8 byte constants into two 4 byte constants, do chop them into 4 bytes, this fixes the ToInt overflow problem, so that we get e.g. 4:0 0 0 80 instead of 8:0 0 0 80 0 0 0 0 From jkrell at elego.de Thu Feb 25 09:48:23 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:48:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084823.A37792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:48:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: undo previous, there is a problem From jkrell at elego.de Thu Feb 25 10:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091055.B3B8D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:10:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.m3 Log message: fix to not need result when TInt.ToInt overflows -- chop at 4 bytes in M3BackInt.ToInt From jkrell at elego.de Thu Feb 25 10:12:36 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:12:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091236.8196D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:12:36 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt From jkrell at elego.de Thu Feb 25 10:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091702.A79892474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:17:02 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 Log message: scientific names instead of goofy names char => UINT8 u_short => UINT16 short => INT16 long => INT32 From jkrell at elego.de Thu Feb 25 11:07:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:07:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100729.E4C8A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:07:29 Modified files: cm3/m3-sys/m3objfile/src/: MasmObjFile.m3 NTObjFile.m3 Log message: spaces around binary operators: len-1 => len - 1 cnt-1 => cnt - 1 etc. (except not on ^. or "->") From jkrell at elego.de Thu Feb 25 11:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100948.460292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:09:48 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: THEN usually at end of line, ELSE usually on its own line From jkrell at elego.de Thu Feb 25 11:10:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:10:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101052.EEE1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:10:52 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: Grow objfile buffer from 2K to 64K. If anyone thinks this is too piggy, I'm ok with anything: 2K, 4K, 512, etc. From jkrell at elego.de Thu Feb 25 11:19:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:19:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101938.4581B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:19:38 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 From jkrell at elego.de Thu Feb 25 11:30:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:30:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103040.EC33C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:30:40 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 CHAR => UINT8 (requires a loophole array of uint8 to array of char) UINT8 != CHAR UINT8 = BITS 8 FOR [0..255] From jkrell at elego.de Thu Feb 25 11:32:01 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:32:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103202.735AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:32:01 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: OutP => OutPathChar; DO on its own line, THEN at end of line From jkrell at elego.de Thu Feb 25 11:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103311.61C422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:33:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: DO at end of line (meant to say that in previous) From jkrell at elego.de Thu Feb 25 11:40:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:40:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104043.6E18A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:40:43 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 MasmObjFile.m3 Log message: upcase hex (ff => FF) From jkrell at elego.de Thu Feb 25 11:42:08 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:42:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104208.3A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:42:08 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: spaces around binary minus and plus From jkrell at elego.de Thu Feb 25 11:46:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:46:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104652.DBBD42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:46:51 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: sometimes put two spaces after Out8/N to line up with Out16, Out32 there is some value to the names OutC/S/I but I think 8/16/32 is more sensible implement Out16/32 as small loops over Out8 From jkrell at elego.de Thu Feb 25 11:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105312.17B1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:53:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix newlines From jkrell at elego.de Thu Feb 25 11:56:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:56:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105606.052012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:56:05 Modified files: cm3/m3-sys/m3objfile/src/: M3ObjFile.i3 NTObjFile.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Log message: Change m3objfile appendBytes from taking ARRAY of 0..255 to array of bits 8 for 0..255 (aka UINT8) pass the bytes of a Target.Int directly to appendBytes thereby removing our own M3BackInt.ToBytes function, and not even calling TInt.ToBytes violating the abstraction boundary, granted (which Tony declared to be a little fuzzy) From jkrell at elego.de Thu Feb 25 14:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225130640.5FF452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:06:40 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Removed files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: eliminate M3BackWord drastically reduce M3BackInt to just: FromInt ToInt FromTargetInt ToDiagnosticText which can probably all go into TInt as something like FromIntAndChop ChopAndToInt CopyAndChop ToTextVerbose or somesuch, or caller synthesize add TInt.NE, GT, GE, Abs, Negate TWord.GE, GT which make for a smoother transition for m3back, even if the caller can inline them change TInt.EQ and NE to use structural (infix) comparison move the constants all to TInt to reduce abstraction boundary violations: Three, Four, Eight ThirtyOne, ThirtyTwo, SixtyThree, F3FF x0400, x0800, x0F00, MaxU8 -- changed to Target.Word8.max MThirtyOne, MSixtyThree perhaps not the best choice. At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. Some of the others are encodings for x87 status flags for example. Converting from strings is another not bad idea. The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int where the bytes are passed directly to m3objfile.AppendBytes This should perhaps be revisited. Granted, inconsistency with regard to where I violate the boundary. I have to look into ToBytes again. From jay.krell at cornell.edu Thu Feb 25 14:08:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:08:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Thu Feb 25 14:09:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:09:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From wagner at elegosoft.com Thu Feb 25 14:25:40 2010 From: wagner at elegosoft.com (Olaf Wagner) Date: Thu, 25 Feb 2010 14:25:40 +0100 Subject: [M3commit] CM3 CVS commit hooks on birch, was: Re: CVS Update: cm3 In-Reply-To: References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: <20100225142540.ji0dypxy8kco4oco@mail.elegosoft.com> Quoting Jay K : > Given the current setup..I still think worthwhile to send diffs > (just not in check comments..), attached. Can we easily (without much efforts) add udiffs to the commit mails sent by the Perl scripts triggered by CVS commits from the cm3 repository? Of course only for text files. If somebody could have a quick look and let us know that would be appreciated. Olaf > - Jay > >> Date: Thu, 25 Feb 2010 14:06:40 +0000 >> To: m3commit at elegosoft.com >> From: jkrell at elego.de >> Subject: [M3commit] CVS Update: cm3 >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 14:06:40 >> >> Modified files: >> cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 >> M3BackInt.m3 M3x86.m3 M3x86Rep.i3 >> Stackx86.i3 Stackx86.m3 Wrx86.i3 >> Wrx86.m3 m3makefile >> cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 >> Removed files: >> cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 >> >> Log message: >> eliminate M3BackWord >> >> drastically reduce M3BackInt to just: >> FromInt >> ToInt >> FromTargetInt >> ToDiagnosticText >> which can probably all go into TInt as something like >> FromIntAndChop >> ChopAndToInt >> CopyAndChop >> ToTextVerbose >> or somesuch, or caller synthesize >> >> add TInt.NE, GT, GE, Abs, Negate >> TWord.GE, GT >> >> which make for a smoother transition for m3back, even if the caller >> can inline them >> >> change TInt.EQ and NE to use structural (infix) comparison >> >> move the constants all to TInt to reduce abstraction boundary violations: >> Three, Four, Eight >> ThirtyOne, ThirtyTwo, >> SixtyThree, >> F3FF >> x0400, x0800, x0F00, >> MaxU8 -- changed to Target.Word8.max >> MThirtyOne, MSixtyThree >> >> perhaps not the best choice. >> At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. >> Some of the others are encodings for x87 status flags for example. >> Converting from strings is another not bad idea. >> >> The only abstraction boundary violation remaining now is the >> avoidance of ToBytes in init_int >> where the bytes are passed directly to m3objfile.AppendBytes >> This should perhaps be revisited. >> Granted, inconsistency with regard to where I violate the boundary. >> I have to look into ToBytes again. > -- Olaf Wagner -- elego Software Solutions GmbH Gustav-Meyer-Allee 25 / Geb?ude 12, 13355 Berlin, Germany phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95 http://www.elegosoft.com | Gesch?ftsf?hrer: Olaf Wagner | Sitz: Berlin Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194 From jkrell at elego.de Thu Feb 25 14:32:25 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:32:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225133225.255292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:32:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix typos in comments From jkrell at elego.de Thu Feb 25 14:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134539.B61462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:39 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:45:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134557.D58222474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:57 Modified files: cm3/scripts/python/: make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:47:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:47:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134713.7CFA72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:47:12 Modified files: cm3/scripts/python/: pylib.py Log message: merge function MakeDebianPackage from release to head (I'll probably get these comments wrong sometimes though!) From jkrell at elego.de Thu Feb 25 14:50:54 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:50:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135054.94D522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:50:54 Modified files: cm3/scripts/python/: make-deb.py Log message: copy make-deb.py from release to head head made "min" and "std" packages release just makes one -- much simpler to test, and talk about, albeit contributes to bloat when people can't install bits/pieces There are other aspects changed here, like how to specify the input, but it is really just a few lines either way. (current version is 15 lines, previous was 19) From jkrell at elego.de Thu Feb 25 14:55:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:55:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135510.A4D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:55:10 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-core.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:56:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:56:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135611.6A2F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:56:11 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-with-m3.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:57:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:57:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135753.505202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:57:53 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 copy-bootarchives.sh Log message: unimportant reconciliation with head (very very tempting to just delete the file..nobody uses this cross build stuff; I have done many cross builds, and not using this stuff..and these *.sh variations build more than needed..) From jkrell at elego.de Thu Feb 25 14:59:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:59:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135942.F108D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:59:42 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 do-cm3-all.sh Log message: unimportant reconciliation with head (getting a little more interesting, but it is only whitespace and 'all' works for 'realclean' but not generally for 'buildship', 'std' is the useful one) From jkrell at elego.de Thu Feb 25 15:00:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:00:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140030.4E6372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:00:28 Modified files: cm3/scripts/: find-packages.sh Log message: remove a space, match release From jkrell at elego.de Thu Feb 25 15:02:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:02:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140222.BC2E12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:02:22 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 pack-crossbuild.sh Log message: unimportant reconciliation with head (can we just delete all the old cross/boot/core stuff?) From jkrell at elego.de Thu Feb 25 15:05:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:05:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140540.C92612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:05:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: some minor reconciliation with head From jkrell at elego.de Thu Feb 25 15:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140644.771F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:06:42 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 upgrade.py Log message: some minor reconciliation with head From hosking at cs.purdue.edu Thu Feb 25 18:22:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 12:22:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225091236.8196D2474001@birch.elegosoft.com> References: <20100225091236.8196D2474001@birch.elegosoft.com> Message-ID: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> WTF!!!!!! What are you messing with Tint for? I just cleaned it up. Jay, this is getting very annoying. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 10:12, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 10:12:36 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.m3 > > Log message: > go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 25 20:49:06 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 14:49:06 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> References: <20100225091236.8196D2474001@birch.elegosoft.com> <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> Message-ID: <1D5CAE14-317E-4759-9351-DE963FF781EC@cs.purdue.edu> Jay, my apologies. My response was inappropriate and misplaced. I should have looked more closely at the details of your commits before complaining... It seems you have just added back some of the constants you use, and some of the additional comparisons you use. Again, my apologies. -- Tony Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 12:22, Tony Hosking wrote: > WTF!!!!!! > > What are you messing with Tint for? I just cleaned it up. > Jay, this is getting very annoying. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 25 Feb 2010, at 10:12, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 10:12:36 >> >> Modified files: >> cm3/m3-sys/m3middle/src/: TInt.m3 >> >> Log message: >> go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 12:02:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:02:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110233.645722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:02:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version on these files, two versions on Codex86.m3 bringing back overflow checking for every compile time integer operation cvs -z3 upd -r1.28 Codex86.i3 cvs -z3 upd -r1.89 Codex86.m3 cvs -z3 upd -r1.13 M3BackInt.i3 cvs -z3 upd -r1.15 M3BackInt.m3 cvs -z3 upd -r1.140 M3x86.m3 cvs -z3 upd -r1.34 M3x86Rep.i3 cvs -z3 upd -r1.18 Stackx86.i3 cvs -z3 upd -r1.98 Stackx86.m3 cvs -z3 upd -r1.4 Wrx86.i3 cvs -z3 upd -r1.12 Wrx86.m3 cvs -z3 upd -r1.4 m3makefile cvs -z3 upd -r1.6 M3BackWord.i3 cvs -z3 upd -r1.14 M3BackWord.m3 From jkrell at elego.de Fri Feb 26 12:05:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:05:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110517.C94DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:05:17 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: 'BITESIZE(IByte) * NUMBER(IBytes)' => 'BITSIZE(Int)' From jkrell at elego.de Fri Feb 26 12:08:56 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:08:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110856.552C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:08:56 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add MaxU8 (Yes I know there is Target.Word8.max) From jkrell at elego.de Fri Feb 26 12:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110959.63F8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:09:59 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse the constants from TInt (but wrapping them with an explicit precision From jkrell at elego.de Fri Feb 26 12:11:05 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:11:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111105.CEC0E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:11:05 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse more constants from TInt (but wrapping them with an explicit precision); IBytes => Target.Int; remove IByte From jkrell at elego.de Fri Feb 26 12:14:58 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:14:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111458.91C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:14:58 Added files: cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 Log message: initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 13:30:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:30:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226123048.CDFDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:30:48 Added files: cm3/m3-sys/m3middle/src/: TIntN.m3 Log message: initial copy of m3back/src/M3BackInt.m3 From jkrell at elego.de Fri Feb 26 13:48:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:48:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226124834.9AB1D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:48:34 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: introduce type Target.IntN which is Int plus a precision just like the old Target.Int (previously M3BackInt.Int) make TIntN and TWordN support it they are just thin wrappers over TInt, TWord previously named M3BackInt, M3BackWord add small amount of support to TInt: SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate These could, if desired, go into their only users: TIntN, TWordN. (with the understanding that that Target.Int is "revealed" to them.) add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged This is "just" additions. (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) (A little unsatisfactory that N is bytes instead of bits.) (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) While at it, in TIntN, rename things slightly: FromInt => FromHostInteger ToInt => ToHostInteger "Int" is "Target.Int" "HostInteger" is "INTEGER" again, TInt/TWord/m3front/m3middle not much affected. One fishy/uncertain thing in all of this, something to test out, is cross builds that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we really need INTEGER to be 4 bytes throughout m3back? (I know that mklib has little endian dependency.) From jay.krell at cornell.edu Fri Feb 26 13:50:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 12:50:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: diff attached > Date: Fri, 26 Feb 2010 13:48:34 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Fri Feb 26 14:12:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131202.EC20C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:02 Modified files: cm3/m3-sys/cm3/src/: version.quake Log message: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:12:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131259.569732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:59 Modified files: cm3/m3-sys/cm3/src/: Tag: release_branch_cm3_5_8 version.quake Log message: from head: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:17:38 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:17:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131740.37D642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:17:38 Modified files: cm3/scripts/: sysinfo.sh Log message: put back echo that I removed in version 1.89 Nov 26 2009, it seems critical for correctness, and the purported reason for removing it has been worked around elsewise, and I'm somewhat suspicious of the stated reason; suspicious of my original changes here too -- the issue is what does cm3 call itself. I think people complained about the inability to build cm3 as easily as other things, or that doing so made it identify itself as some sort of 'unknown' version. Another fix would be to checkin version.quake over here in scripts next to version, or such, not requiring anything to transform it over in m3-sys/cm3/src/m3makefile, maybe I can get Olaf to look at this..it's not very interesting (and I only like interesting things.. :) ) anyway, not critical; the point here is really to make head and release identical From jkrell at elego.de Fri Feb 26 14:26:41 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:26:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132644.F23E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:26:41 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:29:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:29:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132933.C3B5D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:29:33 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133548.3AFF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:35:46 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:39:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:39:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133930.CBA3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:39:30 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: make m3cc first; shipping is separate, so not sure why this matters (and if we did buildship, m3cc should probably be last, but it wasn't last before anyway) From jkrell at elego.de Fri Feb 26 14:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134027.C5F1B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:40:27 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: formating only From jkrell at elego.de Fri Feb 26 14:44:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:44:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134412.EFEDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:44:12 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: always install mklib (i.e. for cross builds that target NT386, though we need go fix endian/alignment bugs in it) From jkrell at elego.de Fri Feb 26 14:51:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:51:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135129.18C0A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:51:26 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: put back support for old config files (really? Maybe we should just remove it from release); 'fix' the stub config for the sake of hobbled quake readers such as cm3ide (ust earlier build time TARGET to write the file instead of later build time HOST) From jkrell at elego.de Fri Feb 26 14:53:37 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:53:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135337.C17C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:53:37 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: complete merge/copy of this file with release From jkrell at elego.de Fri Feb 26 15:01:08 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:01:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140109.63AAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:01:08 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release (we can just copy?) From jkrell at elego.de Fri Feb 26 15:03:09 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:03:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140309.808672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:03:09 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release: formating and echoing From hosking at cs.purdue.edu Fri Feb 26 16:10:42 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:10:42 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226110856.552C32474001@birch.elegosoft.com> References: <20100226110856.552C32474001@birch.elegosoft.com> Message-ID: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> On 26 Feb 2010, at 12:08, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:08:56 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 > > Log message: > add MaxU8 (Yes I know there is Target.Word8.max) So, why? From hosking at cs.purdue.edu Fri Feb 26 16:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226111458.91C632474001@birch.elegosoft.com> References: <20100226111458.91C632474001@birch.elegosoft.com> Message-ID: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> These don't belong here! Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. On 26 Feb 2010, at 12:14, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:14:58 > > Added files: > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > Log message: > initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 20:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226192146.05C3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:21:45 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 cm3/m3-sys/m3middle/src/: TInt.i3 TIntN.i3 Log message: replace MaxU8 with Target.Word8.maxN that I didn't think of until later fix diagnostic in non-occuring internal diagnostic (the stack overflow messages in the backend, which are 'just' a form of assertion) ('fetch_and_op' => 'exchange') From jay.krell at cornell.edu Fri Feb 26 20:22:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:22:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Fri Feb 26 20:35:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:35:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> References: <20100226111458.91C632474001@birch.elegosoft.com>, <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> Message-ID: Tony, I don't think this complicated TInt/TWord. Whatever I did add to them, we could move. I didn't change their existing code. I just added like four functions to TInt. >>> I want compile time arithmetic that does overflow checks to a specified precision. I actually suspect precision should be given in bits, or perhaps via a CGType, but that is a smaller matter. Currently precision is specified in bytes. It is a small layering over TInt/TWord, but one I'd rather not foist on their clients, since it, as far as I can tell, requires "doubling" the function calls. If every single function is always paired with another, or multiple other, that seems ripe for wrapping up in their own functions. Doesn't it? And then, it turns out, carrying along a precision seems reasonable too, so there is a new type. I understand it'd be more efficient to inline in the caller but I don't like that approach, of having good abstraction boundaries, and then manually partially inlining across them. At the very least therefore, I'd want to add, say: M3x86Rep.Add, Sub, Multiply, Shift that are all one liners over TInt/TWord. Those one liners I have simply put in TIntN/TWordN. Which is just perhaps a nicer factoring. Very hypothetically, other backends could use them. In reality there's only two, without much danger of their being more. I think the best we could hope for is I can "extend" m3back, but it'd still just be m3back and the code could still go there if you really want. By adding four small functions to TInt I avoid TIntN/TWordN knowing the representation. However, by virtue of their living in m3middle, I also made it ok for them to know the representation. As well, as you said, it is only partly opaque. All that is to say, there are many almost identical options here. The code could go in m3back if you really want. Or the functions I added to TInt could go in TIntN/TWordN. Or I could even, in a stretch, not have the overflow checking -- it historically wasn't there. But I think having it is an improvement. I still do blatantly violate the abstraction boundary here: PROCEDURE init_int (u: U; o: ByteOffset; READONLY value: Target.Int; t: Type) = BEGIN ... u.obj.appendBytes(u.init_varstore.seg, SUBARRAY(value, 0, CG_Bytes[t])); appendBytes (s: Seg; READONLY bytes: ARRAY OF UINT8); That is really imho the main outstanding problem in this area. I should try using ToBytes. And if I just ignore its return value, should work. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:14:34 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > These don't belong here! > > Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. > > On 26 Feb 2010, at 12:14, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:14:58 > > > > Added files: > > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > > > Log message: > > initial copies from m3back/M3BackInt, M3BackWord > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 20:40:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:40:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226194040.F12FC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:40:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: cleanup, at least until some future time that we generate more debug info, which is sorely lacking From jay.krell at cornell.edu Fri Feb 26 21:39:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 20:39:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Oops, not a different type, but a constant instead of a variable. Anyway, it is gone. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Fri, 26 Feb 2010 19:22:27 +0000 Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 27 01:43:08 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:43:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004309.8C2492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:43:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3middle/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate. From hosking at elego.de Sat Feb 27 01:49:47 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:49:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004948.3278B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:49:47 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate m3middle (TInt and TWord). Add back deprecated TIntN and TWordN until someone has time to fix m3back. It currently manifests significant confusion regarding target integer types. There is sufficient type information around for this confusion to be repaired. I just don't have the time for this. From hosking at cs.purdue.edu Sat Feb 27 01:51:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 19:51:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: <7E4207F1-C6FD-4421-8A4A-6C08DF566E35@cs.purdue.edu> I've just spent most of the day decontaminating m3middle and putting TIntN and TWordN back into m3back as deprecated modules. m3back needs to be fixed to get rid of these. I don't have time to mess with this stuff and I am peeved that I wasted a whole day on this. On 26 Feb 2010, at 13:48, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) From jkrell at elego.de Sat Feb 27 13:02:59 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:02:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120259.761E92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:02:59 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix one whitespace From jkrell at elego.de Sat Feb 27 13:09:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:09:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120945.000952474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:09:44 Modified files: cm3/m3-demo/calculator/src/: m3makefile cm3/m3-demo/cube/src/: m3makefile cm3/m3-demo/fisheye/src/: m3makefile cm3/m3-demo/mentor/src/: m3makefile cm3/m3-demo/sharedboard/boardclient/src/: m3makefile Log message: 'HasGui' => 'HasTrestle'; fix newlines From jkrell at elego.de Sat Feb 27 13:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121206.3A1B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:12:06 Modified files: cm3/m3-obliq/obliqbinanim/src/: m3makefile cm3/m3-obliq/obliqbinui/src/: m3makefile cm3/m3-obliq/obliqsrvui/src/: m3makefile cm3/m3-obliq/visualobliq/src/: m3makefile cm3/m3-obliq/voquery/src/: m3makefile cm3/m3-obliq/vorun/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:14:40 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:14:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121440.EB5A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:14:40 Modified files: cm3/m3-tools/rehearsecode/src/: m3makefile cm3/m3-tools/replayheap/src/: m3makefile cm3/m3-tools/showheap/src/: m3makefile cm3/m3-tools/shownew/src/: m3makefile cm3/m3-tools/showthread/src/: m3makefile cm3/m3-www/deckscape/src/: m3makefile cm3/m3-www/webscape/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:16:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:16:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121611.ADCAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:16:11 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix so it compiles, and pass correct parameters (debug code only) From jkrell at elego.de Sat Feb 27 13:20:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:20:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227122009.380132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:20:09 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: put back Chop() so that m3front compiles From jkrell at elego.de Sat Feb 27 13:35:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:35:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227123517.5741C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:35:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: go back to the versions that work since some files are absent here, this does *not* actually compile, but the history will be more sensible this way Codex86.i3 1.31 Codex86.m3 1.93 M3x86.m3 1.145 M3x86Pre.i3 1.37 Stackx86.i3 1.21 Stackx86.m3 1.102 Wrx86.m3 1.15 Wrx86.i3 1.7 NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) fixes to let it build shall be made very soon From jay.krell at cornell.edu Sat Feb 27 13:36:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 12:36:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227123517.5741C2474001@birch.elegosoft.com> References: <20100227123517.5741C2474001@birch.elegosoft.com> Message-ID: attached - Jay > Date: Sat, 27 Feb 2010 13:35:17 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 13:35:17 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > go back to the versions that work > since some files are absent here, this does *not* actually compile, > but the history will be more sensible this way > > Codex86.i3 1.31 > Codex86.m3 1.93 > M3x86.m3 1.145 > M3x86Pre.i3 1.37 > Stackx86.i3 1.21 > Stackx86.m3 1.102 > Wrx86.m3 1.15 > Wrx86.i3 1.7 > > NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) > > fixes to let it build shall be made very soon > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Sat Feb 27 14:55:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 14:55:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227135518.93B1F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 14:55:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Wrx86.i3 Wrx86.m3 Log message: make it work again possible new issue noticed: range checking on longint, or rather longint subranges and longcard: code might assume the values are already in integer range, and only range check for values not known to be within integer range, or something like that, I need to read this code more.. From jay.krell at cornell.edu Sat Feb 27 14:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 13:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Sat Feb 27 15:01:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 14:01:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: attached > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From hosking at elego.de Sat Feb 27 17:15:06 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:15:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161506.2B9482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:15:06 Modified files: cm3/m3-sys/m3front/src/builtinWord/: And.mg Extract.mg Insert.mg Minus.mg Mod.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 SetExpr.m3 cm3/m3-sys/m3front/src/misc/: Scanner.m3 TipeDesc.m3 Log message: Forgot to commit Chop => Extend! From hosking at elego.de Sat Feb 27 17:16:43 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:16:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161643.D72132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:16:43 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: Chop Chop. :-) It is the same as Extend. From jkrell at elego.de Sat Feb 27 20:54:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:54:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195408.910F72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:54:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsInt => TypeIsSigned IsWord => TypeIsUnsigned Is64 => TypeIs64 TIntN.T{n := NUMBER(Target.Int), x := ...} => TIntN.T{x := ...} n's default is NUMBER(Target.Int) uint_type.size => typeBitSize (new local) Modula-3 hides pointers vs. values from me, which normally I think is syntacic inconvenience in C, "." vs. "->", I should just be able to always say ".", but maybe there is a pointer after all adjust comments to be less scary when they are about efficiency and not correctness e.g. a few 64bit operations involving constants generate function calls when they could/should be implemented inline interesting point from a code size point of view though, is that we could inline "everything", and a caller who doesn't like the bloat could generally wrap up the operations in a function, if they notice, though we have some obligation to be efficient for people that don't bother looking (specifically, we don't inline some things that Visual C++ does, e.g. rotate64, and we do outline some things same as Visual C++ that processor manual suggests inlining e.g. 64bit shifts) GetOperandSize => OperandGetSize I know the first one reads more like an English sentence, but the second "scales" better I think, more mechanical and higher odds of success to always say TypeOperation than to find a nice English sentence From jkrell at elego.de Sat Feb 27 20:58:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:58:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195833.B32C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:58:33 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: the number '32' is suspicious to the reader who knows 64 bit integers are supported, add assert not is64 to indicate that shouldn't get here (at least until we implement that obvious optimization) From jkrell at elego.de Sat Feb 27 21:17:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:17:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227201716.B67FF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:17:16 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: looking for more "32", fix likely problems in insert/extract of 64bit numbers, esp. with bit offsets/sizes beyond 32 need to add more tests! From jkrell at elego.de Sat Feb 27 21:55:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:55:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205506.49D9F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:55:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't like the phrase 'in words' in a comment, because it sounds like an English usage for 'in summary', so try to clarify by saying 'in 'words' or 'registers'; I'm also not entirely happey that I've introduced yet another unit of measure, bad enough that we have both bits and bytes, maybe we can reduce this From jkrell at elego.de Sat Feb 27 21:58:20 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:58:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205820.5D4FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:58:20 Modified files: cm3/m3-sys/m3back/src/: TIntN.i3 TWordN.i3 Log message: comment out some unused constants: torn between providing the obvious simple clear more complete interface, vs. strictly what is used; this leaves unused probably in TInt/TWord as well, but again, reasonable to also leave them all in From jkrell at elego.de Sat Feb 27 22:03:02 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 22:03:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227210302.986F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 22:03:02 Modified files: cm3/m3-sys/m3back/src/: TWordN.i3 TWordN.m3 Log message: No need for DivMod here, we just call through to TInt/TWord. From wagner at elego.de Sun Feb 28 00:11:00 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:11:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227231101.259432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:11:00 Modified files: cm3/scripts/: make-src-dist-all.sh make-src-dist-sys.sh pkginfo.txt Added files: cm3/scripts/: all-deps get-all-deps.sh cm3/scripts/regression/: hudson_build_system.sh hudson_pkg_tests.sh cm3/scripts/win/: cvs.c Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:22:01 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:22:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227232201.BADFF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:22:01 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:30:54 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:30:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233054.3428C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:30:54 Modified files: cm3/scripts/regression/: defs.sh Log message: partial merge of changes from the 5.8 release branch From jkrell at elego.de Sun Feb 28 00:35:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:35:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233528.369AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:35:28 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: print all labels in the -debug output From jkrell at elego.de Sun Feb 28 00:52:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:52:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227235238.AF45E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:52:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: mostly resolve the double shift source vs. dest problem the underlying helper function sometimes reverses dest and src, in the interest of getting reg, mem These helper functions need cleanup and unification. build_modrm, load_like_helper, etc. abtract out some assumptions of 32bit sizes to be type-based so that we might inline some shift/insert/extract no actual bug here, only 32bit types get here currently, the rest generate function calls From jay.krell at cornell.edu Sun Feb 28 00:58:34 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 23:58:34 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227235238.AF45E2474001@birch.elegosoft.com> References: <20100227235238.AF45E2474001@birch.elegosoft.com> Message-ID: > mostly resolve the double shift source vs. dest problem Clarification, I don't know of any bug here, just that - the code looked wrong but acted right - the debug output was probably wrong and definitely a little bit missing (I'm sure nobody ever runs cm3 -debug and looks at NT386/foo.molog, but I've been doing that a lot lately, it is similar to cm3cg -y, but shows the generated code as well, interleaved). The actual generated code seemed ok, based on stuff in m3-sys/m3tests. "mostly resolve" as in, the code reads more sensibly now, though there is too much code duplication, build_modrm isn't as useful as it should be.. Also "double shift" doesn't mean "extra shift", but "double precision shift" -- 64bit shift. x86 has the instructions shld and shrd, shift left double, shift right double. You shift a register "into" another a register, instead of shifting in zeros or sign bits. - Jay > Date: Sun, 28 Feb 2010 00:52:38 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/28 00:52:37 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.m3 > > Log message: > mostly resolve the double shift source vs. dest problem > the underlying helper function sometimes reverses dest and src, in the > interest of getting reg, mem > These helper functions need cleanup and unification. > build_modrm, load_like_helper, etc. > > abtract out some assumptions of 32bit sizes to be type-based > so that we might inline some shift/insert/extract > no actual bug here, only 32bit types get here currently, the > rest generate function calls > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 28 01:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 1:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228003254.C2D702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 01:32:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: inline 64bit shifts by a constant, or at least more instances (e.g. shifting a non-const by a const?) Oh, actually left_shift and right_shift already did this, this now affects "signed shift", which I just don't see much utility in really... including: before: < start_call_direct p.71[_m3_shift64 at 12] 0 Word.64 < load_stack_param Word.32 0 < 00004803: 68FFFFFFFF PUSH $-1 < load_stack_param Word.64 0 < 00004808: 8B5DF8 MOV EBX tv.71[_a] < 0000480B: 8B55FC MOV EDX tv.71[_a]+4 < 0000480E: 52 PUSH EDX < 0000480F: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004810: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004803: 8B5DF8 MOV EBX tv.71[_a] > 00004806: 8B55FC MOV EDX tv.71[_a]+4 > 00004809: 0FACD301 SHRD EBX EDX $1 > 0000480D: D1EA SHR EDX $1 (though this really should use other addressing modes and that'd probably save an instruction) and then tricks like, shifting by more than 32: before: < 00004CA7: 6828000000 PUSH $40 < load_stack_param Word.64 0 < 00004CAC: 8B5DF8 MOV EBX tv.71[_a] < 00004CAF: 8B55FC MOV EDX tv.71[_a]+4 < 00004CB2: 52 PUSH EDX < 00004CB3: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004CB4: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004B50: 8B5DF8 MOV EBX tv.71[_a] > 00004B53: 8B55FC MOV EDX tv.71[_a]+4 > 00004B56: 8BD3 MOV EDX EBX > 00004B58: C1E208 SHL EDX $8 > 00004B5B: 33DB XOR EBX EBX move low to high, zero low, shift high by count - 32 though this too could be a lot better, at the very least, move edx ebx could be replaced just with a "virtual move" that reassigns the registers I'm strongly considering inlining all shifts and rotates, though I couldn't get it to work yet. This is a step. also notice this is less than one line changed, just to let the code run that was already there From jkrell at elego.de Sun Feb 28 09:41:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 9:41:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228084123.101D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 09:41:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add command line switch: -include-less-portable-output which triggers program to print all the output, including word size and/or endian-dependent output None of the output is "fully target dependent", there aren't n different less portable outputs, just 2 or 4 It might be nice to have finer control: -include-endian-specific-output -include-wordsize-specific-output that way we could, e.g. compare PPC_LINUX output with I386_LINUX, etc. instead of forcing PPC_LINUX to only be comparable to e.g. SPARC32_LINUX However I think this is a reasonable compromise. If a test truly *only* has endian-specifity or word-size specifity, that will be allowed for ('infrastructure' coming soon, just a few lines of code in m3makefile), but if a test has any of both, then so far my thinking is all or nothing (otherwise the logic to pick output file will be trickier) From jkrell at elego.de Sun Feb 28 10:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091206.D8F5A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:12:06 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Main.m3 Log message: remove line numbers, leave it as an option developer can uncomment to aid debugging From jkrell at elego.de Sun Feb 28 10:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091834.588532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:18:34 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm-little_endian32 Log message: add little endian 32bit output (we'll want at least big_endian32 (PPC, SPARC) and little_endian64 (AMD64); big endian 64 are currently not quite there but close (SPARC64, PPC64, MIPS64) From jkrell at elego.de Sun Feb 28 10:48:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:48:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228094801.912362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:48:01 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: two improvements - zero sized file compare equal to missing files so we don't have to checkin all the little stdout.build, stderr.build files - allow for stuff like stdout.pgm-littleendian32,etc and running a test without and without -include-less-portable-output flag when the flag is omitted, comparison is done to stdout.pgm etc. when the flag is included, a somewhat target specific file is probed for Having "fully target specific" stdout.pgm-NT386 would prevent automatic comparison across targets, ok but not great, and is not allowed here you can have stdout.pgm32 stdout.pgm64 stdout.pgm-little_endian32 stdout.pgm-little_endian64 stdout.pgm-little_endian stdout.pgm-big_endian32 stdout.pgm-big_endian64 stdout.pgm-big_endian pick 2 or 4 of them (though again, big_endian64 is not well represented, and littleendian64 is only one architecture) TARGET_ENDIAN must be defined in the config files All the checked in ones have it. Really cm3 should set this, but things aren't run in the right order. Maybe later (much). p227 uses this to get additional coverage, but some others should use it too -- so that we don't probe for all tests, only the ones that need it, and maybe these test can get the -include-less-portable-output flag That is, we already have some word size specific tests, and so our default is to probe for all tests. This new feature runs specified tests with and without probing. mixed_portability_test() is the name of the new one, though I'm open to other names rename pb_test to build_flags_test rename pr_test to p_run_flags_test This will allow proceeding with less worry, more testing, changing the NT386 insert/extract operations, for example, and gcc backend set_singleton/member, since we can get more testing coverage, don't have to be limited by full portability (though there is still a shortage of some variants, e.g. no working big endian 64bit and only one working little endian 64bit (AMD64) hopefully we can fill these gaps before much longer with MIPS64, SPARC64, PPC64, IA64) What is the difference between "cmp_file" and "compare_file". Someone should do source analysis, flag synonyms in the same context, and error, make the programmer use longer names... go ahead and combine run_test and run_test2, there aren't so many uses of each that it is so disruptive From jkrell at elego.de Sun Feb 28 11:09:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:09:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228100953.B33862474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:09:53 Modified files: cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: partial merge with release: mklib is portable enough, doesn't need a filter (it can compile/link on all platforms, even with old m3core, though it might not work esp. on big endian hosts) From jkrell at elego.de Sun Feb 28 11:11:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:11:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101114.696F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:11:14 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: partial merge with head: add mklib From jkrell at elego.de Sun Feb 28 11:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101331.723192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:13:31 Modified files: cm3/scripts/win/: pkginfo.cmd Log message: partial merge with release: m3staloneback doesn't need a filter, it is very portable, even if it isn't important and nobody ever uses it (it is command line access I believe to code linked into cm3) From hosking at elego.de Mon Feb 1 07:18:34 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 1 Feb 2010 7:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201061835.0A5662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/01 07:18:34 Modified files: cm3/doc/reference/: syntax.html Log message: Correction: include "~" in OtherChar. From jkrell at elego.de Mon Feb 1 12:45:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:45:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201114521.3DAD82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:45:20 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup to std, variable to add -debug to switches (I use this while working on longint/int64 for nt386) From jkrell at elego.de Mon Feb 1 12:58:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:58:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201115840.1CCB62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:58:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 13:00:07 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 13:00:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201120007.4C5F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 13:00:07 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 14:25:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:25:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132503.EC58D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:25:03 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: fix Abs for positive input From jkrell at elego.de Mon Feb 1 14:28:46 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:28:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132846.450302474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:28:46 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Log message: copy TInt, TWord from head; in particular because I was hitting an assertion failure in TInt line 42 building cvsup; taking everything is overkill and maybe won't even fix it, but should be ok From jkrell at elego.de Mon Feb 1 14:33:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:33:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133338.172582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:33:37 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 RsyncFile.m3 TokScan.m3 UnixMisc.m3 m3makefile cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: release_branch_cm3_5_8 DevT.m3 Log message: copy from head From jkrell at elego.de Mon Feb 1 14:37:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:37:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133737.F1E252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:37:37 Modified files: cm3/m3-tools/cvsup/suptcp/src/common/: Tag: release_branch_cm3_5_8 SupErrnoC.c Log message: copy from head: #define _REENTRANT on Interix, I think this code is dead anyway From jay.krell at cornell.edu Mon Feb 1 14:34:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 13:34:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201133338.172582474001@birch.elegosoft.com> References: <20100201133338.172582474001@birch.elegosoft.com> Message-ID: diff attached > Date: Mon, 1 Feb 2010 14:33:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 14:33:37 > > Modified files: > cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 > RsyncFile.m3 TokScan.m3 > UnixMisc.m3 m3makefile > cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: > release_branch_cm3_5_8 > DevT.m3 > > Log message: > copy from head > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Mon Feb 1 14:45:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:45:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134504.ADB032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:45:03 Modified files: cm3/doc/help/cm3/m3build/: exports.html Log message: copy from release (change from August 21 2009) From jkrell at elego.de Mon Feb 1 14:47:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:47:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134737.7AAA52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:47:36 Modified files: cm3/m3-comm/tcp/src/POSIX/: Tag: release_branch_cm3_5_8 HerrnoC.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 14:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134846.37AB02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:48:45 Modified files: cm3/m3-lectern/lecternclient/src/POSIX/: Tag: release_branch_cm3_5_8 LecternClient.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 15:05:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:05:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201140537.5DC1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:05:37 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 Target.m3 Log message: bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) From jkrell at elego.de Mon Feb 1 15:19:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:19:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201141907.65F192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:19:06 Modified files: cm3/m3-sys/m3gdb/gdb/gdb/: Tag: release_branch_cm3_5_8 m3-util.c Log message: copy from head: crude but effective platform sniffing -- if it contains '64' or 'ALPHA' it is 64bit, if it contains 'NT386' it is NT386 (what about I386_NT?), if it contains '32' it is not 64bit ('other') From jkrell at elego.de Mon Feb 1 15:21:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:21:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142125.596AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:21:24 Modified files: cm3/m3-ui/anim3D/src/win-opengl/: Tag: release_branch_cm3_5_8 Win_OpenGL_Base.m3 Log message: copy from head: fix asserts to be #False instead of =True, since any non-zero value is considered success, not just 1 From jkrell at elego.de Mon Feb 1 15:23:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:23:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142354.032332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:23:53 Modified files: cm3/www/uploaded-archives/: Tag: release_branch_cm3_5_8 targets.txt Log message: copy from head: add AMD64_NETBSD and AMD64_OPENBSD From jkrell at elego.de Mon Feb 1 15:34:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:34:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201143447.492802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:34:47 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$, it makes for noisy diffs one newline at ends of files is enough, some had two, remove one one had zero, add one From jkrell at elego.de Mon Feb 1 15:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144130.5C6672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:41:30 Modified files: cm3/scripts/: README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo-new.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/regression/: loop.py cm3/scripts/win/: clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$ ensure files end in one newline, not two, not zero From jkrell at elego.de Mon Feb 1 15:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144315.0A3D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:43:15 Modified files: cm3/m3-sys/mklib/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: copy minor changes from head: BYTE to UINT8, <*UNALIGNED*> TO (*UNALIGNED*) (nonexistant pragma to comment, BYTESIZE would be wrong here due to padding/alignment and isn't used From jay.krell at cornell.edu Mon Feb 1 15:47:54 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 14:47:54 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201140537.5DC1C2474001@birch.elegosoft.com> References: <20100201140537.5DC1C2474001@birch.elegosoft.com> Message-ID: actually I accidentally had a bunch of head files in my release tree, oops good that I caught it - Jay > Date: Mon, 1 Feb 2010 15:05:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 15:05:37 > > Modified files: > cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 > Target.m3 > > Log message: > bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 1 16:06:05 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:06:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201150606.1DF522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:06:05 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.m3 Log message: import Fmt From jkrell at elego.de Mon Feb 1 16:10:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:10:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151036.A85AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:10:36 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix warnings: remove unused consts (they were used with -defaultlib:libc that I removed) From jkrell at elego.de Mon Feb 1 16:11:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:11:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151147.8DC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:11:47 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 NTObjFile.m3 Log message: copy from head: remove -defaultlib:libc, add appendBytes that I think I might need, fold common code (albeit using unsafe, can we have it both ways? eliminate redundancy and keep safety?) From jkrell at elego.de Mon Feb 1 16:18:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:18:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151828.F2D992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:18:28 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: provide HasTrestle to replace HasGui From jkrell at elego.de Mon Feb 1 16:19:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:19:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151953.571D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:19:53 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: wrap HasTrestle, HasOpenGL in ifndef so that others can override From jkrell at elego.de Mon Feb 1 16:21:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:21:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201152134.D2EBC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:21:34 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace only, and only one of them at that From jkrell at elego.de Mon Feb 1 16:33:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:33:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201153309.E23092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:33:09 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 FileAttr.m3 RCSFile.m3 Log message: copy from head, I though I already had: fixes related to filesize=LONGINT From jkrell at elego.de Mon Feb 1 17:11:23 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 17:11:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201161124.032D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 17:11:23 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadInterix.c ThreadPThreadC.c m3makefile Log message: interix support (partial) From jkrell at elego.de Mon Feb 1 18:34:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 18:34:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201173421.6851C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 18:34:21 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: initial guesses for insert64 and extract64 (need to check if sign extension is ever requested, and of course we could optimize by providing two functions since sign extension is a constant early enough From jkrell at elego.de Mon Feb 1 20:17:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:17:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201191728.A55F42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. From jkrell at elego.de Mon Feb 1 20:31:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:31:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201193142.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:31:42 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 M3ObjFile.i3 Log message: I thought I commited this file already, oops. From jkrell at elego.de Tue Feb 2 09:21:31 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 2 Feb 2010 9:21:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100202082131.D18042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/02 09:21:31 Modified files: cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Log message: changfe parameter name from 'two' to 'to' From hosking at cs.purdue.edu Tue Feb 2 18:19:16 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 2 Feb 2010 12:19:16 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201191728.A55F42474001@birch.elegosoft.com> References: <20100201191728.A55F42474001@birch.elegosoft.com> Message-ID: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 3 06:22:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 05:22:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 3 06:52:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 00:52:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 3 06:53:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 6:53:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203055330.B58412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 06:53:30 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: The prior fix was broken. The problem lies elsewhere. From hosking at elego.de Wed Feb 3 07:26:21 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 7:26:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203062622.299E42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 07:26:21 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:31:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:31:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083130.5199E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:31:30 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: A cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:33:44 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:33:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083344.BA7002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:33:44 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: A cleaner fix for e029. From jay.krell at cornell.edu Wed Feb 3 12:43:50 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 11:43:50 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: That is legal? What does it mean? What can you do it with t? I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. - Jay From: hosking at cs.purdue.edu Date: Wed, 3 Feb 2010 00:52:34 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 14:50:56 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:50:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135057.949332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:50:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 M3x86.m3 Log message: 'two' => 'to' From jkrell at elego.de Wed Feb 3 14:53:45 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:53:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135345.9E9692474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:53:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce OperandPart = [0..1], OperandSize = [1..2], in support of int64/longint and the notion of multi-register operands (though unfortunately zero extending an INTEGER is going to eat a register for the zero instead of being split between register and immediate, but maybe we should sign extend anyway) From jkrell at elego.de Wed Feb 3 14:56:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:56:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135622.018912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:56:21 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Log message: some use of OperandPart, OperandSize From jkrell at elego.de Wed Feb 3 14:57:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:57:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135724.8FD0F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:57:24 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: use M3x86Rep.RegName instead of local nearly exact copy (debug output only) From jkrell at elego.de Wed Feb 3 15:00:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:00:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140048.103BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:00:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust some assertions From jkrell at elego.de Wed Feb 3 15:01:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:01:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140132.A83D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:01:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust error message From jkrell at elego.de Wed Feb 3 15:02:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:02:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140218.763622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:02:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust formating From jkrell at elego.de Wed Feb 3 15:04:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:04:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140457.E6DC32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:04:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add more asserts and diagnostics From jkrell at elego.de Wed Feb 3 15:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140616.4CFC12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:06:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix set_label debug output From jkrell at elego.de Wed Feb 3 15:26:53 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:26:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203142655.534F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:26:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: add operandPart parameters in many places possibly we could do this less via the data (to be) stored in reguse From jkrell at elego.de Wed Feb 3 15:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143140.0468B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:31:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add GetTypeSize and GetOperandSize: besides bits and bytes, a new unit of measure is 'words' or 'registers', maybe unfortunate but I've been weighing a while and it seems useful From jkrell at elego.de Wed Feb 3 15:37:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:37:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143723.7A4032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:37:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt pushnew1 for multi-part operands (int64/longint) From jkrell at elego.de Wed Feb 3 15:39:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:39:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143918.766C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:39:18 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'src_mvar' in procedure push From hosking at cs.purdue.edu Wed Feb 3 15:40:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 09:40:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: On 3 Feb 2010, at 06:43, Jay K wrote: > That is legal? What does it mean? What can you do it with t? It's a variable of type NULL. It can only hold the NIL reference. Agreed, it is not particularly useful. The warning is there to distinguish: VAR t: NULL which a programmer presumably intended to write, from VAR t:= complicated expression of type NULL (perhaps hidden through various type renaming) which the programmer possibly did not intend to write. > I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 3 Feb 2010 00:52:34 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Clearly the source code is not legal. It's just that your change breaks legal code: > > VAR t: NULL; > > which should emit a warning but nothing else. > > The problem lies elsewhere... > > > On 3 Feb 2010, at 00:22, Jay K wrote: > > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 15:44:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:44:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203144420.8934D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:44:20 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adaptions for push and pop for multipart operands (int64/longint) From jkrell at elego.de Wed Feb 3 16:45:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 16:45:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203154530.D35B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 16:45:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: end_init is seemingly the last call, so need to flush the debug output there (really I'm not sure it is the last, but I know its output is often truncated and near the end and flushing fixes that, could be we should flush for every function); also adapt 'Is64' => more abstract 'GetTypeSize' From jkrell at elego.de Wed Feb 3 17:23:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 17:23:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203162301.6E2D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 17:23:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86Rep.i3 Log message: move the register constants to M3x86 to show and preserve their correspondence with RegName From jkrell at elego.de Wed Feb 3 18:47:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:47:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174748.5F33E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:47:48 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: check_hi/lo/range/index/eq From jkrell at elego.de Wed Feb 3 18:48:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:48:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174841.4DE7B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:48:41 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Log message: remove old versions change not-yet-used functions to __stdcall From rodney_bates at lcwb.coop Wed Feb 3 20:13:48 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Wed, 03 Feb 2010 13:13:48 -0600 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: <4B69CAEC.7080308@lcwb.coop> Tony Hosking wrote: > On 3 Feb 2010, at 06:43, Jay K wrote: > >> That is legal? What does it mean? What can you do it with t? > > It's a variable of type NULL. It can only hold the NIL reference. > Agreed, it is not particularly useful. > > The warning is there to distinguish: > > VAR t: NULL > > which a programmer presumably intended to write, from > > VAR t:= complicated expression of type NULL (perhaps hidden through > various type renaming) > > which the programmer possibly did not intend to write. IMO, the appropriate thing for the front end to do is not to set the type of r to NULL, which is a perfectly valid Modula-3 type, but rather to an internal value named TypeUnknownBecauseOfAPriorError. Then make all warning/error checks silently succeed when applied to such unknown types, or anything else unknown in his way. > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and >> it didn't break anything. >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Wed, 3 Feb 2010 00:52:34 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> Clearly the source code is not legal. It's just that your change >> breaks legal code: >> >> VAR t: NULL; >> >> which should emit a warning but nothing else. >> >> The problem lies elsewhere... >> >> >> On 3 Feb 2010, at 00:22, Jay K wrote: >> >> The backend should be able to cope with almost anything, I guess. >> But is the source code really legal? >> Shouldn't the front end error? >> The front end should error on some things, obviously. >> >> Notice that all of the "internal errors" in this scenario are from >> the front end. Just the assertion failure is not. >> >> >> The front end doesn't handle its own stack correctly >> here, the errors come from its CG.m3 module that wraps >> the backend. >> >> If this code is truly illegal and has no valid meaning, I think >> this is an ok change. >> The NT386 backend I guess should be hardened against front end >> bugs though. >> >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Tue, 2 Feb 2010 12:19:16 -0500 >> To: jkrell at elego.de >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> That's the wrong approach. A warning is not an error. The >> backend should be able to cope with it... >> >> Antony Hosking | Associate Professor | Computer Science | Purdue >> University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> On 1 Feb 2010, at 20:17, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/01 20:17:28 >> >> Modified files: >> cm3/m3-sys/m3front/src/values/: Variable.m3 >> >> Log message: >> test case e0\e029: >> >> MODULE Main; >> TYPE Rec = RECORD a: INTEGER END; >> VAR r := Rec; (* warning: variable has type NULL *) >> BEGIN >> INC(r.a) >> END Main. >> >> followed by internal errors and an assertion failure in m3back >> >> Change warning to error, and then it never gets to the >> internal errors. >> >> >> >> >> > From jay.krell at cornell.edu Wed Feb 3 21:11:44 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 20:11:44 +0000 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: <4B69CAEC.7080308@lcwb.coop> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , , , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> , , <4B69CAEC.7080308@lcwb.coop> Message-ID: > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. The compiler does apparently do stuff like that in general. Tony put in use of "ErrType.T". - Jay > Date: Wed, 3 Feb 2010 13:13:48 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 (Warning, type is NULL) > > > > Tony Hosking wrote: > > On 3 Feb 2010, at 06:43, Jay K wrote: > > > >> That is legal? What does it mean? What can you do it with t? > > > > It's a variable of type NULL. It can only hold the NIL reference. > > Agreed, it is not particularly useful. > > > > The warning is there to distinguish: > > > > VAR t: NULL > > > > which a programmer presumably intended to write, from > > > > VAR t:= complicated expression of type NULL (perhaps hidden through > > various type renaming) > > > > which the programmer possibly did not intend to write. > > IMO, the appropriate thing for the front end to do is not to set the > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. > > > > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and > >> it didn't break anything. > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Wed, 3 Feb 2010 00:52:34 -0500 > >> To: jay.krell at cornell.edu > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> Clearly the source code is not legal. It's just that your change > >> breaks legal code: > >> > >> VAR t: NULL; > >> > >> which should emit a warning but nothing else. > >> > >> The problem lies elsewhere... > >> > >> > >> On 3 Feb 2010, at 00:22, Jay K wrote: > >> > >> The backend should be able to cope with almost anything, I guess. > >> But is the source code really legal? > >> Shouldn't the front end error? > >> The front end should error on some things, obviously. > >> > >> Notice that all of the "internal errors" in this scenario are from > >> the front end. Just the assertion failure is not. > >> > >> > >> The front end doesn't handle its own stack correctly > >> here, the errors come from its CG.m3 module that wraps > >> the backend. > >> > >> If this code is truly illegal and has no valid meaning, I think > >> this is an ok change. > >> The NT386 backend I guess should be hardened against front end > >> bugs though. > >> > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Tue, 2 Feb 2010 12:19:16 -0500 > >> To: jkrell at elego.de > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> That's the wrong approach. A warning is not an error. The > >> backend should be able to cope with it... > >> > >> Antony Hosking | Associate Professor | Computer Science | Purdue > >> University > >> 305 N. University Street | West Lafayette | IN 47907 | USA > >> Office +1 765 494 6001 | Mobile +1 765 427 5484 > >> > >> > >> > >> > >> On 1 Feb 2010, at 20:17, Jay Krell wrote: > >> > >> CVSROOT: /usr/cvs > >> Changes by: jkrell at birch. 10/02/01 20:17:28 > >> > >> Modified files: > >> cm3/m3-sys/m3front/src/values/: Variable.m3 > >> > >> Log message: > >> test case e0\e029: > >> > >> MODULE Main; > >> TYPE Rec = RECORD a: INTEGER END; > >> VAR r := Rec; (* warning: variable has type NULL *) > >> BEGIN > >> INC(r.a) > >> END Main. > >> > >> followed by internal errors and an assertion failure in m3back > >> > >> Change warning to error, and then it never gets to the > >> internal errors. > >> > >> > >> > >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 21:29:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:29:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203202908.83E2C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:29:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: return boolean instead From jkrell at elego.de Wed Feb 3 21:30:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:30:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203026.4F9672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:30:26 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: add eq, ne, lt, le, gt, ge, maybe we can avoid using these From jkrell at elego.de Wed Feb 3 21:31:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:31:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203201.4B3EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:31:59 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and unsigned lt,le,gt,ge From jkrell at elego.de Wed Feb 3 21:33:03 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:33:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203303.DC3D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:33:03 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and then all the check functions except range should be redundant From hosking at elego.de Thu Feb 4 03:02:57 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:02:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020257.DCA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:02:57 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:03:10 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:03:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020310.B64AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:03:10 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:04:00 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020400.9C6422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:00 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinWr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:04:16 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020416.506312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:16 Modified files: cm3/m3-sys/m3middle/src/: M3CG_Wr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:08:47 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:08:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020847.DF62A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:08:47 Removed files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXOr.mg Log message: Fixing capitalization. From hosking at elego.de Thu Feb 4 03:11:30 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:11:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204021130.A70942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:11:30 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg CompareSwap.mg FetchDec.mg FetchInc.mg Load.mg cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Added files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXor.mg Log message: Push through remaining atomics support. It will compile things now. But still needs testing... From jkrell at elego.de Thu Feb 4 07:21:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 4 Feb 2010 7:21:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204062104.93D0C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/04 07:21:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: some cosmetic ahead of other changes From hosking at elego.de Thu Feb 4 21:00:46 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 21:00:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204200046.D566A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 21:00:46 Modified files: cm3/m3-sys/m3front/src/builtinWord/: m3makefile word.tmpl Added files: cm3/m3-sys/m3front/src/builtinWord/: And.ig And.mg Divide.ig Divide.mg Extract.ig Extract.mg GE.ig GE.mg GT.ig GT.mg Insert.ig Insert.mg LE.ig LE.mg LT.ig LT.mg Minus.ig Minus.mg Mod.ig Mod.mg Module.ig Module.mg Not.ig Not.mg Or.ig Or.mg Plus.ig Plus.mg Rotate.ig Rotate.mg Shift.ig Shift.mg Times.ig Times.mg Xor.ig Xor.mg Removed files: cm3/m3-sys/m3front/src/builtinWord/: GenAnd.ig GenAnd.mg GenDivide.ig GenDivide.mg GenExtract.ig GenExtract.mg GenGE.ig GenGE.mg GenGT.ig GenGT.mg GenInsert.ig GenInsert.mg GenLE.ig GenLE.mg GenLT.ig GenLT.mg GenMinus.ig GenMinus.mg GenMod.ig GenMod.mg GenModule.ig GenModule.mg GenNot.ig GenNot.mg GenOr.ig GenOr.mg GenPlus.ig GenPlus.mg GenRotate.ig GenRotate.mg GenShift.ig GenShift.mg GenTimes.ig GenTimes.mg GenXor.ig GenXor.mg Log message: A more sensible naming scheme. From jkrell at elego.de Fri Feb 5 07:48:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:48:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205064852.D686A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:48:51 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: work in progress: adapt procedure find for int64/longint From jkrell at elego.de Fri Feb 5 07:56:03 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:56:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065605.2A5B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:56:03 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swapreg for int64/longint From jkrell at elego.de Fri Feb 5 07:59:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:59:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065936.68D2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:59:36 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure unlock for int64/longint From jkrell at elego.de Fri Feb 5 08:01:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:01:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205070148.820922474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:01:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure set_reg, loadreg, loadphantom for int64/longint From jkrell at elego.de Fri Feb 5 08:43:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:43:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205074345.C96B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:43:45 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure newdest for int64/longint From jkrell at elego.de Fri Feb 5 09:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 9:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205084023.0AA7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 09:40:22 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure sweep for int64/longint From jkrell at elego.de Fri Feb 5 10:05:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:05:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205090505.0613F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:05:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'dest_mvar' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205091053.77C032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:10:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'stack0' to 'src_stack0' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:20:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:20:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092012.D88AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:20:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:24:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:24:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092442.DEA2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:24:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: further adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:29:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:29:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092953.6EBC22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:29:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix previous to compile and a little more adjustment for int64/longint From jkrell at elego.de Fri Feb 5 10:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094130.C12BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:41:30 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swawp for int64/longint From jkrell at elego.de Fri Feb 5 10:48:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:48:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094842.55B522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:48:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. From jkrell at elego.de Fri Feb 5 11:12:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 11:12:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205101214.0DA182474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 11:12:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: in doloophole, use the locals that I added and add asserts From jkrell at elego.de Fri Feb 5 12:40:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:40:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114026.DA1762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:40:26 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'Is64' => 'GetTypeSize', so to speak (not a direct replacement, but close) From jkrell at elego.de Fri Feb 5 12:42:01 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:42:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114201.D31962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:42:01 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: add an assert (related to int64/longint) From jkrell at elego.de Fri Feb 5 12:45:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:45:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114503.0D0032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:45:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: make findbin less confusing but equivalent, more like the historical version From jkrell at elego.de Fri Feb 5 12:49:28 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:49:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114930.64E5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:49:28 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 M3x86.m3 Log message: flush the debug output at every newline (none of this is in the default path, you have to say cm3 -debug; it is very useful stuff though); otherwise the debug output would be truncated in the case of assertion failures, etc. From jkrell at elego.de Fri Feb 5 13:02:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:02:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205120234.B2F462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:02:34 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: oops on the flush: flush, don't recurse infinite From jkrell at elego.de Fri Feb 5 13:33:57 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:33:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205123358.040BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:33:57 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure discard fori nt64/longint From jkrell at elego.de Fri Feb 5 13:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124027.743592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:40:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: add NonVolatileRegisters, VolatileRegisters, AllRegisters they are const but the first two at least could become variables if/when we adapt to other platforms (depending on their calling conventions) not sure we'll get around to optimizing based on the distinction though, this backend always preserves all nonvolatile registers in every prologue/epilogue I believe, no matter which a function uses From jkrell at elego.de Fri Feb 5 13:43:21 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:43:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124321.534DF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:43:21 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: remove ESP and EBP from the register sets because they are 'special' (right, sorry, not a technical term..) From jkrell at elego.de Fri Feb 5 13:45:47 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:45:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124547.B58212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:45:47 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comments only From jkrell at elego.de Fri Feb 5 14:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131055.AECF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:10:55 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Codex86.m3 Log message: adapt load_indirect and store_indirect for int64/longint the structure here is oddly asymmetric load_indirect implementation is mostly in m3x86.m3 and adaption there store_indirect implementation is mostly in stackx86.m3 but I put adaption in codex86.m3, probably could be in stack though also inline_copy seems to do wierd things here..so the adaption is very conservative..maybe a sign it really belong in stackx86.m3 From jkrell at elego.de Fri Feb 5 14:15:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:15:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131515.2EB912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:15:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't know why in_proc_call is limited to 2; it seems fairly harmless to raise it (it'll waste memory on the fixed size arrays) so raise it to 10; enforce the limit with a subrange instead of an assert (that is better Modula-3 style, right?); we should try to construct some 'complex' code to see if we can get the value over 2 or even 10 From jkrell at elego.de Fri Feb 5 14:16:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:16:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131651.0E6502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:16:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: again 'Is64' => 'GetTypeSize', again somewhat apples/oranges, but the diff makes sense From jkrell at elego.de Fri Feb 5 14:34:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:34:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205133412.582522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:34:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: bring in all the code for add/sub/mult/check_hi/div/mod/check_lo/etc. the main known missing pieces at this point are: - check the return value of check_hi/lo/eq/range/index, generate call to reportfault currently I'm just discarding the return values - get the parameter orders all correct, I've been less than guessing - see about eliminating some of the functions; e.g. add/sub/and/or/xor/compares are the most inlinable, not much else is (mul/div/mod/shift/rotate/insert/extract) - also give the constant folding a chance instead of just always calling; that givces even mul/div/mod/shift/rotate/insert/extract a good chance, and the front end does use e.g. extract for division by powers of two or such; this really is easy, it amounts to just moving all this code "a few lines down", like into stackx86.m3 after it checks for the constant/immediate cases (note that most operations are binary, so there imm op imm, and non-imm op imm, and some of them are commutive e.g. plus, mult and some are not e.g. divide and shift) - implement compares (the "check" ones are here, the functions are in hand2.c, but I forgot to handle the normal cases) - see about loophole/val zero extending vs. sign extending (currently always zero extends which I'm sure is wrong, unless the frontend deals with it) - of course flipping the switch in Target.m3, which I've done frequently; consider a command line option for this for now - probably move hand2.c to hand.c so it is statically linked, which also saves an instruction per call (and lets off of the compatibility hook mostly, though the static linking was really put in due to the data, so the other options are only statically link the data, none of the functions, or, really, in fact, eliminate the data, it looks easily eliminatable) - exit_proc looks a little suspicious/fragile; it needs to be certain to get the high part in edx, the low part in eax, currently' it doesn't appear so deterministic; that will be easy - I can't get the C compiler to generate an unsigned multiply, so maybe signed is all we need, not two functions - consider a more portable rotate implementation, currently is Visual C++ specific; could use #ifdef, really, not difficult.. just shift in direction and or.. - test insert/extract in particular; they are a bit gnarly None of these are particularly difficult and many of them are not important, but some are very important. From jkrell at elego.de Fri Feb 5 14:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205134022.4867E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:40:22 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: drop the four operations which are the most trivially implemented by just two instructions without any regard for carry, borrow, etc. (ignoring load/store): and, or, xor, not notice they weren't used anyway (not in this case is flipping all the bits, xor -1, not the the logical value, I'm pretty sure) From jkrell at elego.de Fri Feb 5 14:52:31 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:52:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135232.4AA642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:52:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: rename 'l' to 'label' (they could have at least used 'L'..) From jkrell at elego.de Fri Feb 5 14:56:23 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:56:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135623.BB45B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:56:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: add a label parameter to dobin This will be used shortly for compare. Slightly experiment, but I expect it to work well. i.e. cmp hi1, hi2 jne label cmp lo1, lo2 label: I think will easily implement all the comparisons. If I'm being simple-minded, the label should be useful for the correct form. From jkrell at elego.de Fri Feb 5 15:05:43 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:05:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205140543.C8DB42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:05:43 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: strawman inline implementation of 64bit comparisons (should use this for check_hi/lo/eq/index also!) From jkrell at elego.de Fri Feb 5 15:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205142945.79B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:29:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce type Operand1 that resembles the old version of Operand; this isn't backsliding on the approach being used, but it'll probably let us clean things up a bit: the arrays can be of this type and the functions that only ever operate on words can use this, in particular, if nothing else, we can change many remaining uses of reg[0] (as opposed to reg[i]) to just reg; and we might use host integers here, might (consider however if this backend is adapted to 64bit, with 32bit host, and 64bit immediate parameters, without using LONGINT -- it might pay to avoid host INTEGER long term) From jkrell at elego.de Fri Feb 5 15:30:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:30:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143027.26D342474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:30:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment only From jkrell at elego.de Fri Feb 5 15:31:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:31:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143113.2AC6F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:31:12 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: minor edits to Operand1, which isn't in use yet, and won't be for now, it's not important From jkrell at elego.de Fri Feb 5 15:33:24 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:33:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143324.D8EA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:33:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: whitespace only From jkrell at elego.de Fri Feb 5 16:10:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151040.E2C592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:40 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151053.C34502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:53 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: forgot a file: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:13:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:13:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151304.2C4B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:13:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove function based 64bit add and subtract From jkrell at elego.de Fri Feb 5 16:24:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:24:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152402.E3F2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:24:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: NOT is a unary operation, doesn't belong in dobin From jkrell at elego.de Fri Feb 5 16:25:07 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:25:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152507.BADE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:25:07 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: implement 64bit NOT and NEG (something fishy here -- why dobin but unOp? probably should move the dobin code into binOp From jkrell at elego.de Fri Feb 5 17:04:14 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:04:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160414.59D932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:04:14 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: push dobin work down to binOp (for xor/and/or/not it should have already worked) inline all the 64bit check_lo/hi/eq/index via binOp handling oCMP From jkrell at elego.de Fri Feb 5 17:06:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:06:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160636.4E0742474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:06:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: abs64 and neg64 now handled inline, remove function stuff From jkrell at elego.de Fri Feb 5 17:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161450.C11932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:14:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: handle 64bit min and max inline (basically just comparisons) From jkrell at elego.de Fri Feb 5 17:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161702.EC31E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:17:02 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: remove min, max, add, sub, and, or, xor, compares, check_range, abs, not, neg From hosking at elego.de Fri Feb 5 17:38:23 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163823.2ED242474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:23 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchInc.mg FetchDec.mg Log message: Need to loophole INTEGER incr/decr as necessary to Rep.T (i.e., for LONGINT and ADDRESS). Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:38:41 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163841.58B602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:41 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchOr.mg FetchXor.mg Log message: Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:53:35 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:53:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205165336.1200C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:53:35 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchDec.mg FetchInc.mg FetchOr.mg FetchXor.mg Log message: Allow unsafe operations in AtomicAddress module (so we don't need to explicitly declare it unsafe). Other clients will still get a compile-time error unless they are also unsafe. From hosking at elego.de Fri Feb 5 18:09:51 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 18:09:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205170951.9BA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 18:09:51 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.ig atomic.tmpl m3makefile Added files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: Addressable implementations of the atomic builtins. From hosking at elego.de Fri Feb 5 19:09:50 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 19:09:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205180950.A09842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 19:09:50 Modified files: cm3/m3-libs/libm3/src/os/Common/: File.i3 Log message: Use LONGCARD for size (used to be CARDINAL). From jkrell at elego.de Sat Feb 6 11:17:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:17:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101718.90DE62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:17:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: immOp, binOp can allocate the compare_label themselves -- that's less code and it handles cases I had missed From jkrell at elego.de Sat Feb 6 11:18:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:18:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101838.1E2572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:18:38 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: 'l' => 'label' From jkrell at elego.de Sat Feb 6 11:25:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:25:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206102556.BD6782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:25:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the 64bit shifts/rotates to fold constants more to do here, both to handle more constant cases and to call the C compiler helpers directly instead of our wrappers for them (a little tricky given their custom calling conventions) From jkrell at elego.de Sat Feb 6 11:37:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:37:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206103732.634732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:37:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Removed files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: move NT386 64bit helpers back to static linking also saving an extra copy of div/mod still work to do here -- should use the C compiler helpers directly for e.g. 64bit shifts From jkrell at elego.de Sat Feb 6 12:52:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:52:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115253.D39D62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:52:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move the checking code out of unlock into separate functions; it has proven useful placing calls elsewhere to see where things go wrong From jkrell at elego.de Sat Feb 6 12:54:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:54:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115441.B5B292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:54:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: don't issue an error when converting Target.Word32.max to a host INTEGER overflows (this takes advantage of TInt.ToInt doing the conversion even if it overflows) From jkrell at elego.de Sat Feb 6 13:00:03 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:00:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120004.332A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:00:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more generally, don't error for anything less or equal to Target.Word32.max From jkrell at elego.de Sat Feb 6 13:02:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:02:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120251.298712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:02:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix indent on one line From jkrell at elego.de Sat Feb 6 13:05:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:05:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120526.F10852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:05:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the unlock calls in call_64, they don't match the patterns elsewhere From jkrell at elego.de Sat Feb 6 13:06:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:06:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120612.366792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:06:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the various 64bit compare functions, as we inline them now From jkrell at elego.de Sat Feb 6 13:38:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123812.D373D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:12 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:38:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123821.E420B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:21 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:59:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:59:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206125956.D1E772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:59:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 M3x86Rep.i3 M3x86.m3 Codex86.m3 Log message: go back a version, I'll do something else From jkrell at elego.de Sat Feb 6 15:01:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:01:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140104.E7CAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:01:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: replace 64bit shift left and right with the C compiler helpers _allshr, _allshl, ullshr From jkrell at elego.de Sat Feb 6 15:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140232.3AA732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:02:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove shift_left64 and shift_right64 (notice I had failed to implement signed shift right, but that is fixed now) From jkrell at elego.de Sat Feb 6 15:05:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:05:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140557.B643A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:05:57 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: hm, looks like shift_right is always supposed to be unsigned? From jkrell at elego.de Sat Feb 6 15:06:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:06:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140656.3BA132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:06:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments only, about custom calling convention of 64bit shift From jkrell at elego.de Sat Feb 6 15:19:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:19:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206141921.B864A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:19:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: call compiler helper directly for 64bit multiplication, there is just one for signed and unsigned From jkrell at elego.de Sat Feb 6 15:24:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:24:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142455.71E3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:24:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove whitespace from ends of lines From jkrell at elego.de Sat Feb 6 15:29:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:29:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142958.C295F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:29:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove m3_umul64 in favor of _allmul that it would call anyway From jkrell at elego.de Sat Feb 6 17:04:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:04:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206160428.454982474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:04:28 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: '_uallshr' => '_aullshr' From jkrell at elego.de Sat Feb 6 17:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161331.B63AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:13:31 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: go ahead and move TZero to M3x86Rep.i3 From jkrell at elego.de Sat Feb 6 17:15:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:15:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161528.B51842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:15:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt get_temp properly for int64/longint; this will be important very shortly, fixing the register preservation around int64 function calls From jkrell at elego.de Sat Feb 6 17:16:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:16:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161612.D2CF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:16:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: comment and whitespace in get_temp From jkrell at elego.de Sat Feb 6 17:19:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161941.A2F392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:41 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 17:19:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161956.9FE012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: forgot files: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 18:01:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:01:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170155.528372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:01:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect: the need for the offset is obvious; the need to do both dealloc_reg before either set_reg I don't understand, it seems like it should be ok either way From jkrell at elego.de Sat Feb 6 18:03:05 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:03:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170305.AEA8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:03:05 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information in the event of an assertion failure From rodney_bates at lcwb.coop Sat Feb 6 18:12:46 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:12:46 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100205094842.55B522474001@birch.elegosoft.com> References: <20100205094842.55B522474001@birch.elegosoft.com> Message-ID: <4B6DA30E.10004@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/05 10:48:42 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the two types to have the same size (or arranges it thus, for conversion to an open array). But then doloophole could conceivable be called in the compiler for some additional purpose besides translating source code LOOPHOLE. From jay.krell at cornell.edu Sat Feb 6 18:17:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 6 Feb 2010 17:17:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: > But then doloophole could conceivably be called in the compiler > for some additional purpose besides translating source code LOOPHOLE. It is. As the comment says -- VAL calls doloophole. In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. - Jay > Date: Sat, 6 Feb 2010 11:12:46 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > Modified files: > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > Log message: > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sat Feb 6 18:18:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:18:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206171854.2EDBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:18:54 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Stackx86.i3 M3x86.m3 Log message: load_indirect needs to set the resulting operand type, at least so my own assertions succed, and we get a little further.. From rodney_bates at lcwb.coop Sat Feb 6 18:25:02 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:25:02 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206140557.B643A2474001@birch.elegosoft.com> References: <20100206140557.B643A2474001@birch.elegosoft.com> Message-ID: <4B6DA5EE.7000909@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 15:05:57 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > hm, looks like shift_right is always supposed to be unsigned? > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) shifts zeros into vacated bits, in either direction. I have sometimes wanted a signed right shift, but realized eventually that DIV by 2^n will do it. But if n is variable, that takes another runtime operation. From jkrell at elego.de Sat Feb 6 18:30:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:30:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206173051.4E5362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:30:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: swapping differently sized things is legal, it occurs on line 189 of M3CBackEnd_C.m3; remove my assertion to the contrary, and we get the further (to line 1037 of same and another assertion failure) From hosking at cs.purdue.edu Sat Feb 6 19:15:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:15:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206161941.A2F392474001@birch.elegosoft.com> References: <20100206161941.A2F392474001@birch.elegosoft.com> Message-ID: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. On 6 Feb 2010, at 17:19, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 17:19:41 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From hosking at cs.purdue.edu Sat Feb 6 19:23:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:23:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com> <4B6DA30E.10004@lcwb.coop> Message-ID: <2852DEFD-F700-4103-98B2-94EFFA5DE0A2@cs.purdue.edu> I did overload use of m3cg_loophole for conversion to/from INTEGER/LONGINT. For those, we should sign-extend. The gcc-based backend handles that trivially. On 6 Feb 2010, at 12:12, Rodney M. Bates wrote: > > > Jay Krell wrote: >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/05 10:48:42 >> Modified files: >> cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: >> adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. From hosking at cs.purdue.edu Sat Feb 6 19:27:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:27:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: <9C5DCFCC-3974-4F8C-946C-AC17C9822D03@cs.purdue.edu> VAL is the only place that needs to handle the conversion On 6 Feb 2010, at 12:17, Jay K wrote: > > But then doloophole could conceivably be called in the compiler > > for some additional purpose besides translating source code LOOPHOLE. > > It is. As the comment says -- VAL calls doloophole. > In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. I probably could avoid that in most cases. It's only there for arrays whose index type is a subrange of LONGINT. > > - Jay > > > Date: Sat, 6 Feb 2010 11:12:46 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay Krell wrote: > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > > > Log message: > > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > > two types to have the same size (or arranges it thus, for conversion to an open array). > > > > But then doloophole could conceivable be called in the compiler for some additional purpose > > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 6 19:47:45 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 6 Feb 2010 19:47:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206184745.8241B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/06 19:47:45 Modified files: cm3/m3-sys/m3front/src/exprs/: SubscriptExpr.m3 Log message: Clean up LInt-based (i.e., arrays indexed by LONGINT subranges) indexing. Avoid CG.Loophole where not needed. From jay.krell at cornell.edu Sun Feb 7 07:56:39 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 06:56:39 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> References: <20100206161941.A2F392474001@birch.elegosoft.com>, <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Message-ID: The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:06:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:06:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207070605.CC6602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:06:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: another place where I failed to offset the high part of the load; something still wrong here though, we still get assertion failure at line 1036 of M3CBackEnd_C.m3 From jay.krell at cornell.edu Sun Feb 7 08:33:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 07:33:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100206161941.A2F392474001@birch.elegosoft.com>, , <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu>, Message-ID: Hm. I guess it would be more like: push 1 push 3 mov ecx, [esp+4] mov eax, [esp+8] add eax, ecx mov [esp+4], eax add esp,4 mov eax, [esp + 4] mov foo, eax add esp,4 and function calling isn't so hard. imagine the function int add(int a, int b). It'd go: push/eval a push/eval b mov eax, [esp + 4] push eax mov eax, [esp + 8] push eax call add add esp,16 That is, you would: 1) not "discard" from the "virtual stack" (merged with the machine stack) until after the call, cleaning up both it and the machine stack (for __cdecl) 2) As you build up the parameters, you'd maintain an offset to adjust virtual stack references by However, I still think you'd have to change all this for 32bit types as well, somewhat of a "rewrite" of the NT386 backend. (Not that I haven't changed it a bunch now to deal with types that don't fit in a single register.) You can't just do it for 64bit types. I think. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Sun, 7 Feb 2010 06:56:39 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:58:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:58:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207075812.B4D1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:58:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect to not free the register holding the upper part of an address (or whatever register number is sitting there, it is junk) From jkrell at elego.de Sun Feb 7 09:18:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:18:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207081856.8CDD62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:18:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: some cleanup now that things seem good From jkrell at elego.de Sun Feb 7 09:31:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:31:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083142.C6E782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:31:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: go back a version From jkrell at elego.de Sun Feb 7 09:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083254.A2E8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:32:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce CONST RegistersForByteOperations, should give a little cleanup From jkrell at elego.de Sun Feb 7 09:36:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:36:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083601.AEE822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:36:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: use RegistersForByteOperations From jkrell at elego.de Sun Feb 7 09:43:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:43:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084316.7F0EB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:43:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use C compiler helpers directly for unsigned div/mod From jkrell at elego.de Sun Feb 7 09:46:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:46:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084657.F33D52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:46:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove unsigned div/mod, add comment about 'missing' functions From jkrell at elego.de Sun Feb 7 09:55:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:55:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207085519.EC7BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:55:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: tweak set_range_new From jkrell at elego.de Sun Feb 7 10:00:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:00:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090025.3C35F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:00:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: add m3test_insert32 and m3test_extract32 so I can test the 64bit versions, by comparing the 32bit results of C and Modula-3 From jkrell at elego.de Sun Feb 7 10:01:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:01:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090129.BA66E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:01:29 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: small tweak to M3_INSERT From jkrell at elego.de Sun Feb 7 10:27:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:27:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207092745.B97D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:27:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: some test code for insert and extract From jkrell at elego.de Sun Feb 7 10:43:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:43:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094357.8A7852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:43:57 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: add PutLong and PutLongHex From jkrell at elego.de Sun Feb 7 10:44:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:44:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094433.B3F972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:44:33 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 Log message: use upper case for hex From jkrell at elego.de Sun Feb 7 10:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094633.8F5CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:46:28 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: split the notin of the compiler (msvc or gcc) and platform (win32 or not) with respect how uint64/int64 are defined, vs. using %I64X vs. %llX; also actually save and commit the uppercase change From jkrell at elego.de Sun Feb 7 12:12:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:12:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207111225.C92942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:12:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: use 32bit values for bit offsets and shift counts, m3back will need adjusting (it already does to get the parameter orders correct anyway) From jkrell at elego.de Sun Feb 7 12:48:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:48:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207114846.5D8D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:48:46 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386.common Log message: adjust the code that decides to statically link the files with data; I'm not sure there was a problem here or if it was something else, but this seems a little simpler From jkrell at elego.de Sun Feb 7 13:12:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:12:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121239.1D3F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:12:38 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: fix newlines From jkrell at elego.de Sun Feb 7 13:13:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:13:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121324.606142474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:13:24 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: leading 0x to match PutHex From jkrell at elego.de Sun Feb 7 13:15:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121504.7EE842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:04 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: adjust test code to non-windows %I64x vs. %llx From jkrell at elego.de Sun Feb 7 13:15:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121558.F3FD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: leading 0x to match RTIO.PutHex/PutLongHex that the parallel Modula-3 test code will use, and we're hoping they match From jkrell at elego.de Sun Feb 7 13:16:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:16:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121633.729052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:16:33 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: more leading 0x on hex From jkrell at elego.de Sun Feb 7 13:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122145.D00562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:21:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test far more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:22:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:22:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122245.124E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:22:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:26:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:26:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122642.279A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:26:42 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: put the test code under #ifdef M3CORE_TEST_HAND instead of #if 0, that is probably ok, and test still more values From jkrell at elego.de Sun Feb 7 13:27:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:27:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122708.4E3732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:27:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: back to safer #if 0 From jkrell at elego.de Sun Feb 7 13:28:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:28:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122801.CE16E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:28:01 Added files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: copy hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:29:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:29:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122934.551EE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:29:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: #include hand.c From jkrell at elego.de Sun Feb 7 13:30:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:30:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123028.E40C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:30:28 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove the test code (now in test_hand.c) From jkrell at elego.de Sun Feb 7 13:32:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:32:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123214.555332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:32:14 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: move the 32bit insert/extract functions from hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:44:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:44:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124450.096482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:44:50 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: add an option to merge stdout and stderr, because I use RTIO From jkrell at elego.de Sun Feb 7 13:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124642.37F702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:46:41 Added files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 m3makefile Log message: some test code for int64/longint, more to do (and it found a bug: inability to initialize longint variable (probably only with large values)) From jkrell at elego.de Sun Feb 7 13:48:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:48:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124831.44D052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:48:31 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: don't normalize stderr.pgm if merging stdout and stderr From jkrell at elego.de Sun Feb 7 13:54:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:54:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125419.52BBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:54:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 13:55:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:55:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125529.7A17F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:55:29 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 14:03:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:03:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207130357.1F1AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:03:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust and make terser; really the point now is to see if longints can be initialized on other platforms, not sure the bug is in m3back or not From jkrell at elego.de Sun Feb 7 14:32:35 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:32:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133235.197CE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:32:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: demonstrate some longint stuff working, though sign extension from negative integers doesn't From jkrell at elego.de Sun Feb 7 14:36:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:36:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133639.E75352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:36:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix the parameter orders and sizes to some/many/all of the 64bit helper functions From jkrell at elego.de Sun Feb 7 14:49:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:49:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207134929.E4F332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:49:29 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: LINUXLIBC6 Log message: -march=i586 required for atomics to compile, probably needed on all other 32bit architectures as well, but maybe/probably we can adjust m3cc/m3makefile finally From jkrell at elego.de Sun Feb 7 15:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207140709.7A0E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:07:09 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix shifting (to not assert when it tries to allocate registers for the custom calling convention) and fix a newline; still a problem getting 64bit return values in the correct order From jkrell at elego.de Sun Feb 7 15:13:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:13:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141358.7FA4D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:13:58 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: remove Codex86. from in front of register names -- flatten the namespace From jkrell at elego.de Sun Feb 7 15:16:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:16:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141636.64D842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:16:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: get the return value in the registers correctly for 64bit call_indirect, and slight reformat the same code in call_direct From jkrell at elego.de Sun Feb 7 15:18:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:18:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141848.291262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:18:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove a newline, this one keeps bugging me From jkrell at elego.de Sun Feb 7 15:51:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:51:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145138.904542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:51:37 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove another newline From jkrell at elego.de Sun Feb 7 15:55:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:55:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145558.260072474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:55:58 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: be sure 64bit return values are high in edx, low in eax From jkrell at elego.de Sun Feb 7 16:01:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:01:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150127.DF3F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:01:24 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: oops: fix the wierdo shift whose direction is based on sign as opposed to the explicit left and right shift that are optimized with a custom calling convention to the C compiler helper function while at it, length some names: do_shift_64 => do_custom_calling_convention_shift_64 do_rotate_64 => do_rotate_or_shift_64 (actually was correct before but now has another use) From jkrell at elego.de Sun Feb 7 16:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150232.B9F282474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:02:32 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: and bang: longint is now 64bits on NT386 From jkrell at elego.de Sun Feb 7 16:20:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:20:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152023.4AA622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:20:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix 32bit signed vs. unsigned multiplication, back to what it was instead of accidentally reversed, I'm not sure if it matters, given that the C compiler only generates one of the two instructions From jkrell at elego.de Sun Feb 7 16:21:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152101.EA88C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:01 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: reformat previous From jkrell at elego.de Sun Feb 7 16:21:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152139.1864D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: slightly more reformat previous From jkrell at elego.de Sun Feb 7 16:28:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:28:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152839.8D4872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:28:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add some tests of abs, min, max, neg; not all of which work! :( From jkrell at elego.de Sun Feb 7 16:38:00 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:38:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207153800.9CB0D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:38:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: assert that the constant and non-constant versions match -- this confirms there are some bugs, to be looked into shortly From jkrell at elego.de Sun Feb 7 16:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207154557.581352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: show that comparing negative numbers to 0 is a problem From jkrell at elego.de Sun Feb 7 17:05:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:05:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207160547.5FDB92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:05:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the problems in compares: Int32 is not the only signed type now, Int64 is there (these patterns repeat in a few places, look for 'unscond' and/or 'revcond') From jkrell at elego.de Sun Feb 7 17:11:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:11:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161136.4AABC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:11:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix problem with negate, I had read the C compiler output carelessly when learning how to do this From jkrell at elego.de Sun Feb 7 17:16:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:16:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161614.5CBD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:16:13 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: crude but adequate fix for absolute value of int64; probably I hadn't read the code here carefully the first time, to notice that it isn't alway implemented via comparing to zero and negating..the other branch seems like it should work though? From jkrell at elego.de Sun Feb 7 17:18:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:18:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161822.F250E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:18:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:19:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:19:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161937.79D532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:19:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:26:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:26:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207162613.23BA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:26:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: use easier to eyeball values From jkrell at elego.de Sun Feb 7 17:34:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:34:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207163413.579732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:34:13 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: terser but no less clear From jkrell at elego.de Sun Feb 7 19:59:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 19:59:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207185921.A6B202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 19:59:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: neuter atomics for now, they are hitting assertion failures in m3back From jkrell at elego.de Sun Feb 7 20:04:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 20:04:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207190423.7821F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 20:04:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: further neuter atomics for now From jay.krell at cornell.edu Mon Feb 8 01:13:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:13:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA5EE.7000909@lcwb.coop> References: <20100206140557.B643A2474001@birch.elegosoft.com>, <4B6DA5EE.7000909@lcwb.coop> Message-ID: It is trivial to add clear/direct SignedRightShift if there is any interest. And heck, I find the "direction specified by sign" shift just wierd. It makes little sense to me. Never should have been there imho. - Jay > Date: Sat, 6 Feb 2010 11:25:02 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 15:05:57 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > hm, looks like shift_right is always supposed to be unsigned? > > > > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) > shifts zeros into vacated bits, in either direction. > > I have sometimes wanted a signed right shift, but realized > eventually that DIV by 2^n will do it. But if n is variable, > that takes another runtime operation. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 01:18:13 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 1:18:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208001813.C07662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 01:18:13 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Fix bug for constant initialization of LONGINT static data: MODULE Main; VAR a := 1L; BEGIN END Main. From jay.krell at cornell.edu Mon Feb 8 01:49:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:49:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208001813.C07662474001@birch.elegosoft.com> References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 01:57:17 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sun, 7 Feb 2010 19:57:17 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:05:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:05:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com> , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Message-ID: I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:09:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:09:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, Message-ID: Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 02:12:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 2:12:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208011233.4E4D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 02:12:33 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: go back a version From jay.krell at cornell.edu Mon Feb 8 02:27:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:27:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , Message-ID: Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:40:46 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:40:46 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, ,,,,, , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , Message-ID: This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:47:59 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:47:59 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, , , , , , , , Message-ID: hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:15:00 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:15:00 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , ,,, , ,,,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, ,,,,, , , , , , , , Message-ID: I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:32:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:32:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , ,,,,, , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , ,,,,, , , , , , , , Message-ID: Tony, it is pretty distressing how much code in CG.m3 is identical except for replacing Target.Integer with Target.Longint, when they can be stored into a variable up front and then use common code. I'll work on that. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 02:15:00 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 05:07:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:07:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208040757.D2D8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:07:57 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure store_indirect From jkrell at elego.de Mon Feb 8 05:14:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:14:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208041424.3924E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:14:24 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: fold some common code in procedure Add_offset From jkrell at elego.de Mon Feb 8 05:39:12 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:39:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208043912.D9A272474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:39:12 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load From jkrell at elego.de Mon Feb 8 05:41:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:41:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208044151.B4C772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:41:51 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load_indirect From jkrell at elego.de Mon Feb 8 07:20:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 7:20:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208062058.580E52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 07:20:58 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: repair and more similar cleanup; still a lot to do, look how load, store, load_direct, store_direct repeat a lot of code.. From jkrell at elego.de Mon Feb 8 08:08:00 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:08:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208070800.980A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:08:00 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: a little better on NT: let the fc calls work; still requires bc and date in the path, and link must not be Cygwin's From jkrell at elego.de Mon Feb 8 08:17:14 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:17:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208071714.C1C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:17:14 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: allow unaligned load/stores on all x86/AMD64 targets; cleanup a bit From hosking at cs.purdue.edu Mon Feb 8 08:39:26 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:26 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: Nah, not necessary. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 21:15, Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:47:59 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > hm. Bug perhaps in TWord: > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > Shift (x, -i, r); > > > and maybe: > > > PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR yy, yyy, yyyy: Int; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > > > I propose that TWord.Extract interpret all values as infinitely extended with zeros. > Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). > And Insert widen infinitely to fit whatever is being inserted? > > > Will it break stuff? > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:40:46 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > This really puzzles me, that using TInt.Zero makes it fail. > I do see a subtle difference, n of TInt.Zero is always 8, > but the CG.m3 code uses 4 for for 32bit. > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:27:30 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Oddly, just using TInt.Zero apparently breaks it all. > Assertion failures all over ThreadWin32.m3. > I'll dig a *little*. > Well, er, maybe just try your change without the TInt.Zero part? > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:09:42 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Same thing on Linux/x86. > i.e. it breaks everything. > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:05:58 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'll look a bit. > I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. > > - Jay > > > Subject: Re: [M3commit] CVS Update: cm3 > From: hosking at cs.purdue.edu > Date: Sun, 7 Feb 2010 19:57:17 -0500 > CC: m3commit at elegosoft.com > To: jay.krell at cornell.edu > > Rats! I'll look into it. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 7 Feb 2010, at 19:49, Jay K wrote: > > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 08:39:53 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:53 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208040757.D2D8C2474001@birch.elegosoft.com> References: <20100208040757.D2D8C2474001@birch.elegosoft.com> Message-ID: <2EC2E14F-6D83-4002-9474-933062F0268F@cs.purdue.edu> Jay, back off. I'm trying to fix things. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 05:07, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 05:07:57 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > eliminate gross duplication of code for int vs. longint in procedure store_indirect -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 09:21:50 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:21:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208082150.192DA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:21:50 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Repair damage from improper merge of Integer/Longint cases for loads/stores. From hosking at elego.de Mon Feb 8 09:33:20 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:33:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208083320.38BD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:33:20 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Insert and Extract can use explicit shift directions. From hosking at elego.de Mon Feb 8 11:03:19 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 11:03:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208100319.E23C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 11:03:19 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Some more cleanup. Still needs fixing for LONGINT static constants. From hosking at elego.de Mon Feb 8 12:21:51 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 12:21:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208112151.F2A1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 12:21:51 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Get rid of TInt.IntI. Not necessary. From hosking at elego.de Mon Feb 8 13:03:31 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 13:03:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208120331.C78762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 13:03:31 Modified files: cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 IntegerExpr.m3 ReelExpr.m3 Log message: Check for out-of-range values in constructor when folding. From jkrell at elego.de Mon Feb 8 14:02:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:02:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208130222.40B752474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:02:20 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Bring back IntI, to fix: "..\src\float\Common\DragonInt.m3", line 114: value is not constant SigBits = Word.RightShift (Word.Not (0), Reserved); "..\src\time\WIN32\TimeWin32.m3", line 19: value is not constant I = Word.Plus(LAST(INTEGER), 1); The pain that is CVS: cvs -z3 upd -j 1.21 -j 1.20 TInt.i3 cvs -z3 upd -j 1.18 -j 1.17 TInt.m3 cvs -z3 upd -j 1.7 -j 1.6 IntegerExpr.m3 From jay.krell at cornell.edu Mon Feb 8 14:03:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:03:42 +0000 Subject: [M3commit] TInt.IntI In-Reply-To: <20100208112151.F2A1C2474001@birch.elegosoft.com> References: <20100208112151.F2A1C2474001@birch.elegosoft.com> Message-ID: This seemed to break things so I put it back. - Jay > Date: Mon, 8 Feb 2010 12:21:51 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 12:21:51 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 > cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 > > Log message: > Get rid of TInt.IntI. Not necessary. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:10:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:10:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208131006.8876B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:10:06 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: using TInt.Zero still seems to cause tremendous problems, so put back Target.Int{Target.Integer.bytes, Target.IBytes{0,..}} just a little bit From jay.krell at cornell.edu Mon Feb 8 14:13:13 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:13:13 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208100319.E23C42474001@birch.elegosoft.com> References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:37:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:37:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208133701.558F12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:37:01 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: split up m3_extract64(value, m, n, sign_extend) into m3_extract64(value, m, n) /* no sign extend */ and m3_extract_and_sign_extend64(value, m, n, sign_extend) still need to move this code to do constant folding From jkrell at elego.de Mon Feb 8 14:46:11 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:46:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208134612.1E20F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:46:11 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: Change the helpers all from __cdecl to __stdcall. It is smaller and therefore faster/better. granted: if you could only have one calling convention, it would have to be __cdecl, for its compatibility with printf However __stdcall is heavily used. This does break the ABI but I think that is ok. From jkrell at elego.de Mon Feb 8 14:55:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:55:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208135522.AD6D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:55:22 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: comments about why set_ne and set_eq are left in the NT386 platform even though they aren't used by it From jkrell at elego.de Mon Feb 8 15:05:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:05:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140550.79E992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:05:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_load From jkrell at elego.de Mon Feb 8 15:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140640.93B2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:06:40 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_store From jkrell at elego.de Mon Feb 8 15:10:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:10:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141034.E40832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:10:34 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: edit the comment to be clearer in m3cg_declare_segment From jkrell at elego.de Mon Feb 8 15:12:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:12:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141204.A73B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:12:04 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: go back a version, to previous comment From jkrell at elego.de Mon Feb 8 15:25:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:25:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142534.6E9942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:25:34 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyThree, to be used shortly From jkrell at elego.de Mon Feb 8 15:26:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:26:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142618.A51A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:26:18 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: move SixtyThree down a line From jkrell at elego.de Mon Feb 8 15:51:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:51:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208145131.EEBC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:51:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: fixing shift/rotate/insert/extract to all fold constants: pass type from m3x86 to stackx86, since often the stack code is what checks if we have constants (I propose we move this work to the frontend..) From jkrell at elego.de Mon Feb 8 16:04:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:04:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208150425.617492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:04:25 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: stack.shift/rotate/insert/extract now all return a boolean indicating if they did the work or not, so m3x86.shift/rotate/insert/extract can decide to generate a call or not This is really an artifact of the inconsistent splitting between stack and m3x86. Notice how sometimes the similar code is one, sometimes the other. Not the worst thing though. From jkrell at elego.de Mon Feb 8 16:32:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:32:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208153248.9ECAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:32:48 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: add CGTypeToIntType From jkrell at elego.de Mon Feb 8 16:47:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:47:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154709.48D732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:47:08 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: limit CGTypeToIntType to IType, even just unsigned would probably suffice From jkrell at elego.de Mon Feb 8 16:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154846.0E0162474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:48:45 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 Log message: add ToUnsignedType to map from int32,word32,int64,word64 to word32,word32,word64,word64 From hosking at cs.purdue.edu Mon Feb 8 16:49:20 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:49:20 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: > Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. > The RTIO was there for a reason that was still valid a day ago. > There is a test case that hits assertion failures. I'll see if that is still the case. > > - Jay > > > > Date: Mon, 8 Feb 2010 11:03:19 +0000 > > To: m3commit@ > > From: hosking@ > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 11:03:19 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Some more cleanup. > > Still needs fixing for LONGINT static constants. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 16:57:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:57:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208153248.9ECAE2474001@birch.elegosoft.com> References: <20100208153248.9ECAE2474001@birch.elegosoft.com> Message-ID: <664E362F-C2C5-4C0B-9B4A-509546E4C856@cs.purdue.edu> What do you need this mapping for? It is not needed anywhere in the front-end. If you really need something like this in your specialised backend can you please put it there. I see no need to add this unless they are really needed upstream in the front-end (as opposed to downstream in your backend). I will revert. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 16:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 16:32:48 > > Modified files: > cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 > > Log message: > add CGTypeToIntType -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 17:00:54 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 17:00:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208160054.9D38A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 17:00:54 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 Log message: Revert muddying of m3middle interfaces. These are engineered in support of the front-end. They should not be perturbed for down-stream back-end needs. From rodney_bates at lcwb.coop Mon Feb 8 17:02:58 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Mon, 08 Feb 2010 10:02:58 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: <4B7035B2.4030806@lcwb.coop> Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is > true for values with "quite different" behavior. I would have "thunk" > (thought without much thought) that anything TInt.EQ is more equivalent > than they actually are. > Hmm. I recall in a discussion a while back that the arithmetic on target ints was not coded to handle operands with mixed values of n. Could this have something to do with this? > > - Jay > > > From jay.krell at cornell.edu Mon Feb 8 17:13:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:13:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> References: <20100208100319.E23C42474001@birch.elegosoft.com>, , <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Message-ID: Major problems at runtime. Basically nothing works. I think, basically, initializing lots of stuff gets broken. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 10:49:20 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <068EFB68-5F49-4F6B-8228-49E005E855CC@cs.purdue.edu> I am working on these issues right now. Stay tuned... It will be much cleaner than what Jay proposes. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:02, Rodney M. Bates wrote: > > > Jay K wrote: >> I wonder if we need >> TInt8, TInt16, TInt32, TInt64, TInt, TLong >> TWord8, TWord16, TWord32, TWord64, TWord, TLongWord >> that accurately implement ints/words of the exact specified size, >> with TInt/TWord/TLong/TLongWord depending on the target. >> I wouldn't mind trying to remove this word "Word". >> And replace it with UInt or such. >> TInt, TUInt, TLong, TULong? >> TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? >> TInt, TUnsignedInt, TLong, TUnsignedLong? >> TInt.Zero is just always 8 bytes. >> The size is I believe meant to be fairly opaque to the user. >> This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. >> > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > >> - Jay >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:15:36 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208160054.9D38A2474001@birch.elegosoft.com> References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:18:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:18:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , ,,, , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:31:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:31:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com>, Message-ID: I'm also not sure the line between frontend and backend is so clear. They are immediately adjacent of course and do surprisingly similar things. You know, the front end does a lot of bit twiddling. I think a lot of what is in m3back belongs elsewhere, either in m3front or a nonexistant middle layer. It does a lot of target-independent optimization and bit twiddling. I guess ultimately the design is m3back would have M3sparc.m3, M3ppc.m3, M3alpha.m3, M3amd64.m3 ( possibly part of m3x86.m3), M3mips.m3, etc., and the existing x86 stuff would gradually get refactored so they'd share a lot of code. But ok, I've copied the stuff to m3back. - Jay From: jay.krell at cornell.edu To: hosking at elego.de; m3commit at elegosoft.com Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: Re: [M3commit] CVS Update: cm3 In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 17:42:44 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 17:42:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208164247.244F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 17:42:44 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyFour and MSixtyThree, likely used in support of constant folding of 64bit shifts in m3back From hosking at cs.purdue.edu Mon Feb 8 17:36:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:36:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:35:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:35:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: <48542AD1-2AF4-468D-B1A0-38368DA466A6@cs.purdue.edu> I would simply populate an array from TargetMap.Integer_types. cf StackType in CG.m3. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:15, Jay K wrote: > In the one case, there is a dependency on the ordering of the enumeration. > It seems to me that anything that depends on the order of an enumeration > belongs very near the definition of the enumeration. > > Stuff like this: > > SignedType = ARRAY CGType OF BOOLEAN { > FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) > FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) > TRUE, TRUE, TRUE, (* Reel .. XReel *) > FALSE, FALSE, FALSE (* Addr .. Void *) > }; > > CONST > ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF > [CGType.Word32..CGType.Word64] { > CGType.Word32, CGType.Word32, > CGType.Word64, CGType.Word64 }; > > I'm likely going to duplicate this exact stuff. > > - Jay > > > Date: Mon, 8 Feb 2010 17:00:54 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 17:00:54 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > > > Log message: > > Revert muddying of m3middle interfaces. These are engineered in support > > of the front-end. They should not be perturbed for down-stream back-end needs. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 18:08:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:08:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208170838.D415E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:08:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: whitespace From jkrell at elego.de Mon Feb 8 18:29:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:29:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208172930.D16582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:29:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: work in progress optimizing shift/rotate/insert/extract involving constants From jkrell at elego.de Tue Feb 9 07:56:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 7:56:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209065657.7543F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 07:56:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Stackx86.m3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms From jkrell at elego.de Tue Feb 9 08:19:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 8:19:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209071935.B842E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 08:19:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms; add rows for SHLD and SHRD, still trying to figure how how they should read, confusing stuff From jkrell at elego.de Tue Feb 9 10:42:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 10:42:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209094257.5FE552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 10:42:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: better formating From jkrell at elego.de Tue Feb 9 18:31:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:31:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173100.4C1032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:31:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173943.26DBE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:43:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:43:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174324.4FA4A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:43:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174540.519482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:45:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:50:25 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:50:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175025.EC6452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:50:25 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage; looks like bug found right shifting longint by count greater than 31 or so From jkrell at elego.de Tue Feb 9 18:52:03 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:52:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175205.516AF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:52:03 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:58:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:58:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175805.E0D322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:58:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: TInt.ThirtyOne => MaximumShift[t] fix shift/rotate longint by constant between 32 and 63 inclusive From jkrell at elego.de Tue Feb 9 19:07:30 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:07:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209180730.766C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:07:30 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 19:40:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:40:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184023.376E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:40:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: combinatorics'r'us (more test converage, and a little less tedium) From jkrell at elego.de Tue Feb 9 19:48:33 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:48:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184833.1D6822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:48:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a few more loops to reduce tedious code From jkrell at elego.de Tue Feb 9 19:55:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:55:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185505.88C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:55:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases, still missing all of rotate From jkrell at elego.de Tue Feb 9 19:56:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:56:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185600.AD7592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:56:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: whitespace From jkrell at elego.de Tue Feb 9 20:29:49 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:29:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209192949.5F98E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:29:49 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:27 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195827.8AF912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:27 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:55 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195855.5A1022474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 21:26:56 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:26:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209202656.DA9512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:26:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: inline 64bit shifts by a constant (and shifts of 64bit constant by constant) (and optimize away shift/rotate of constant 0) some of this seems backwards, and is commented as such, but the test case and disassembly show it to be correct, need to study that more still to handle 64bit rotate by constant.. From jkrell at elego.de Tue Feb 9 21:58:45 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:58:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209205845.A44ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:58:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases: value besides just 1 From jkrell at elego.de Tue Feb 9 22:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210616.272DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:16 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases From jkrell at elego.de Tue Feb 9 22:06:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210652.B88932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 22:08:19 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210819.AC0332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:19 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: comment about a bit of a 'trick' employed here From jkrell at elego.de Tue Feb 9 22:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210859.1783E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust comment From jkrell at elego.de Tue Feb 9 22:10:54 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:10:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211054.275112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:10:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: newline From jkrell at elego.de Tue Feb 9 22:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211450.645042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:14:50 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: line up columns; add coment From jay.krell at cornell.edu Wed Feb 10 10:47:02 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 09:47:02 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 10:57:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:57:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095720.B5CCA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:57:20 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: enable longer run From jkrell at elego.de Wed Feb 10 10:59:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:59:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095954.092662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:59:54 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: allow 32bit specific output, don't make 64bit look like the bad guy, they are peers From jkrell at elego.de Wed Feb 10 11:03:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:03:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210100316.923A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:03:15 Added files: cm3/m3-sys/m3tests/src/p2/p226/: Tag: release_branch_cm3_5_8 stderr.build stderr.pgm stdout.build stdout.pgm Main.m3 m3makefile cm3/m3-sys/m3tests/src/p2/p227/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: stake a claim on these test case numbers in release branch, in case new tests do come along in this brach -- sequential numbering is not compatible with branching and we've gotten into trouble here before..not likely to enable these tests in this branch From jkrell at elego.de Wed Feb 10 11:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104438.196C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:45:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:45:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104508.ACC4E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:45:08 Added files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:49:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:49:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104924.2E4CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:49:23 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:51:40 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:51:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105140.B719C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:51:40 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:53:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:53:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105329.6A5A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:53:28 Modified files: cm3/m3-libs/sysutils/src/: System.i3 Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:54:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:54:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105448.A3E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:54:48 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_pm3.m3 SystemPosix.m3 Log message: and remove unused imports From jkrell at elego.de Wed Feb 10 11:55:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:55:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105520.22F4C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:55:20 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 Log message: remove unused import From jkrell at elego.de Wed Feb 10 11:58:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:58:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105832.87B5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:58:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:00:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:00:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110032.EF1522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:00:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:03:27 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:03:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110328.EADF12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:03:27 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: remove unneeded #include From jkrell at elego.de Wed Feb 10 12:12:17 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:12:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210111217.08E7F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:12:17 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: checkin output from LINUXLIBC6 as probably correct, will compare against AMD64_DARWIN and NT386 From jkrell at elego.de Wed Feb 10 12:20:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:20:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210112056.6B5332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:20:55 Modified files: cm3/m3-libs/sysutils/src/POSIX/: m3makefile Log message: I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From jkrell at elego.de Wed Feb 10 12:58:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:58:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210115812.269A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) From jkrell at elego.de Wed Feb 10 13:00:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:00:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120020.921A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:00:20 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: This test does various bit twiddling with INTEGER. e.g. Word.Insert, Word.Extract duplicate all of it to use Long as well Note that I didn't extend it to use bigger/wider values that would get better coverage of what Long can do that Word cannot, I just left it using the same test values as for Word From jkrell at elego.de Wed Feb 10 13:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120642.687CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:06:42 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: change code to avoid overflow From jkrell at elego.de Wed Feb 10 13:07:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:07:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120731.3F8492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:07:31 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: oops, go back to not allowing overflow From jkrell at elego.de Wed Feb 10 13:10:37 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:10:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210121037.27B642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:10:37 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: extend test just *slightly* From jkrell at elego.de Wed Feb 10 13:58:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:58:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210125854.E3FFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:58:54 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use the new m3objfile appendBytes(array of [0..255]) instead of m3objfile append(integer) so that we have a chance of initializing longints, when the frontend is fixed in TInt.m3, fix ToBytes to return 1 byte for zero and -1 instead of zero bytes -- it should never return 0 bytes From jkrell at elego.de Wed Feb 10 14:03:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:03:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130308.6A59F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:03:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: strengthen assert: the intermediate result must be 0 for r=0 or r=-1; deobfuscate Mask, SignMask, Base: just set them to FF, 80, 100, instead of roundabout ways of saying the exact same thing From jkrell at elego.de Wed Feb 10 14:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130959.71D4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:09:59 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.21 diff -u -r1.21 TInt.m3 --- m3middle/src/TInt.m3 10 Feb 2010 13:03:07 -0000 1.21 +++ m3middle/src/TInt.m3 10 Feb 2010 13:09:01 -0000 @@ -116,8 +116,9 @@ VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO carry := a.x[i] + b.x[i] + carry; @@ -133,8 +134,9 @@ VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO borrow := a.x[i] - b.x[i] - borrow; @@ -167,8 +169,9 @@ p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; FOR i := 0 TO n-1 DO FOR j := 0 TO n-1 DO k := i + j; @@ -228,8 +231,9 @@ b_sign := CheckSign (b, n); min: Int; BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; @@ -294,8 +298,9 @@ PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = VAR n := MIN (a.n, b.n); BEGIN - IF CheckSign (a, n) = Sign.Bad THEN RETURN FALSE END; - IF CheckSign (b, n) = Sign.Bad THEN RETURN FALSE END; + IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN + RETURN FALSE; + END; FOR i := 0 TO n-1 DO IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; From jkrell at elego.de Wed Feb 10 14:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210134630.BE5032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:46:28 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Just remove the size check in Extract. It appears it will just naturally treat the value as zero extended, which is reasonable and allows the rest to work. This lets Tony's fix for initializing Longint work. To be reapplied shortly. Deobfuscate Mask and Base here as well, like in TInt. Cleanup my TWord.xEQ function (still could use further cleanup, clearly, once confidence is total) Index: src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.10 diff -u -r1.10 TWord.m3 --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 @@ -16,8 +16,8 @@ LShift = Word.LeftShift; CONST - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); - Base = Mask + 1; + Mask = 16_FF; + Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) @@ -278,8 +278,8 @@ BEGIN <*ASSERT n # 0*> FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN RETURN FALSE; - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; + IF a.x[i] # b.x[i] THEN + RETURN FALSE; END; END; FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; @@ -449,10 +449,7 @@ PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN - IF i + n > size THEN RETURN FALSE; END; - RightShift (x, i, r); w := n DIV BITSIZE (IByte); From jkrell at elego.de Wed Feb 10 14:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210135311.BFF6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:53:11 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: reapply Tony's fix for longint initialization compare with http://dcvs.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-sys/m3front/src/misc/CG.m3.diff?r1=1.21;r2=1.22 seemingly identical except in the mean time "n_bits" renamed to "excess" It works now that TWord.Extract has no size limit and just assumes zero extension. Index: CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.31 diff -u -r1.31 CG.m3 --- CG.m3 8 Feb 2010 13:10:06 -0000 1.31 +++ CG.m3 10 Feb 2010 13:51:58 -0000 @@ -107,6 +107,9 @@ PROCEDURE Init () = BEGIN + + <* ASSERT TInt.Zero.n = Target.Longint.bytes *> + Max_alignment := Target.Alignments [LAST (Target.Alignments)]; FOR t := FIRST (Type) TO LAST (Type) DO StackType[t] := t; END; @@ -143,7 +146,7 @@ fields[TRUE] := NIL; in_init := FALSE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; free_temps := NIL; busy_temps := NIL; free_values := NIL; @@ -797,7 +800,7 @@ cg.begin_init (v); in_init := TRUE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; END Begin_init; PROCEDURE End_init (v: Var) = @@ -940,10 +943,10 @@ (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; - excess := Target.Integer.size - size; + excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; ELSIF Target.Little_endian AND TWord.Extract (init_bits, 0, size, tmp) AND TWord.Extract (init_bits, size, excess, new_bits) THEN @@ -970,7 +973,7 @@ FOR i := LAST (TargetMap.Integer_types) TO FIRST (TargetMap.Integer_types) BY -1 DO WITH z = TargetMap.Integer_types[i] DO - IF (z.bytes <= n_bytes) AND (z.size <= Target.Integer.size) + IF (z.bytes <= n_bytes) AND (offset MOD z.align = 0) THEN t := z.cg_type; RETURN TRUE; @@ -994,7 +997,7 @@ AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; - ELSE bit_offset := Target.Integer.size - (o - init_pc) - s; + ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) From jkrell at elego.de Wed Feb 10 15:06:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:06:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140626.98A902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:06:26 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: darnit, something is broken, go back a version From jkrell at elego.de Wed Feb 10 15:09:33 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:09:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140935.04DD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:09:33 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: go back to m3objfile append(integer) instead of appendBytes(array of bytes) From jkrell at elego.de Wed Feb 10 15:23:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:23:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210142357.D51C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:23:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo (lots of deliberat copy/paste here) From jkrell at elego.de Wed Feb 10 15:54:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:54:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145402.ACDCB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:54:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: classify various parts as portable or not; portable = same output for 32bit and 64bit, for non portable, print 'notportable' so they file can be diffed; we might somehow allow for portable and specific though? From jkrell at elego.de Wed Feb 10 15:57:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:57:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145744.7A3642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:57:44 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: bounce to the AMD64_DARWIN output; most of the diff is changing to 'notportable' but there are definitely discrepancies between AMD64_DARWIN and LINUXLIBC6 that we need to investigate very soon, along with comparing to other platforms esp. NT386 and isolating the initialization issue (that could be related to these diffs) From jkrell at elego.de Wed Feb 10 16:11:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:11:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151159.38F482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:11:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: let's try this again, there was maybe something wierd on my machine, retesting.. go back a version: append(host integer) => appendBytes(array up to 8 bytes) We'll need this for initializing LONGINT, since they don't fit in host INTEGER From jkrell at elego.de Wed Feb 10 16:13:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:13:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151330.912062474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:13:30 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) From jkrell at elego.de Wed Feb 10 16:19:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:19:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151907.1F3C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:19:07 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: again, maybe was wierdness on my machine, or it was the m3front change: remove the size check from TWord.Extract, tested by running upgrade.py twice, and the code is fairly clear, it works From hosking at cs.purdue.edu Wed Feb 10 16:14:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:14:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210104438.196C42474001@birch.elegosoft.com> References: <20100210104438.196C42474001@birch.elegosoft.com> Message-ID: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:16:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:16:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210112056.6B5332474001@birch.elegosoft.com> References: <20100210112056.6B5332474001@birch.elegosoft.com> Message-ID: Huh? Cryptic comment. On 10 Feb 2010, at 12:20, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:20:55 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > Log message: > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From hosking at cs.purdue.edu Wed Feb 10 16:18:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:18:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210115812.269A12474001@birch.elegosoft.com> References: <20100210115812.269A12474001@birch.elegosoft.com> Message-ID: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:58:11 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > allow negating FIRST(INTEGER) even though it overflows > allows this test case to compile: > C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 > --- building in NT386 --- > > new source -> compiling Main.m3 > "..\Main.m3", line 35: doneg: Negate overflowed > 1 error encountered > compilation failed => not building program "pgm.exe" > Fatal Error: package build failed > > tempting to make TInt.Add/Subtract return the value > even if overflow, but for now, no. > This fix assumes two's complement, that is, > it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:25:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:25:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210151330.912062474001@birch.elegosoft.com> References: <20100210151330.912062474001@birch.elegosoft.com> Message-ID: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> On 10 Feb 2010, at 16:13, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 16:13:30 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! From hosking at cs.purdue.edu Wed Feb 10 16:23:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:23:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210134630.BE5032474001@birch.elegosoft.com> References: <20100210134630.BE5032474001@birch.elegosoft.com> Message-ID: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> What does xEQ do exactly? PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. On 10 Feb 2010, at 14:46, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 14:46:28 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > Just remove the size check in Extract. > It appears it will just naturally treat the value as zero extended, which > is reasonable and allows the rest to work. > > This lets Tony's fix for initializing Longint work. > To be reapplied shortly. > > Deobfuscate Mask and Base here as well, like in TInt. > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > once confidence is total) > > Index: src/TWord.m3 > =================================================================== > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > retrieving revision 1.10 > diff -u -r1.10 TWord.m3 > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > @@ -16,8 +16,8 @@ > LShift = Word.LeftShift; > > CONST > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > - Base = Mask + 1; > + Mask = 16_FF; > + Base = 16_100; > > (*------------------------------------------- unsigned integer operations ---*) > > @@ -278,8 +278,8 @@ > BEGIN > <*ASSERT n # 0*> > FOR i := n-1 TO 0 BY -1 DO > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > + IF a.x[i] # b.x[i] THEN > + RETURN FALSE; > END; > END; > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > @@ -449,10 +449,7 @@ > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > - size := x.n * BITSIZE (IByte); > BEGIN > - IF i + n > size THEN RETURN FALSE; END; > - > RightShift (x, i, r); > > w := n DIV BITSIZE (IByte); From hosking at cs.purdue.edu Wed Feb 10 16:32:29 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:32:29 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 16:35:23 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 16:35:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210153523.710832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 16:35:23 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert to including the overflow checks here. More changes coming. From hosking at cs.purdue.edu Wed Feb 10 16:13:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:13:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210160924.031B92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:09:23 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: granted I'm guessing a bit, but this seems to allow for longint initialization, and doesn't break initialization of everything else; the rationale, other than a load of guessing and taking hints from Tony's change, is to flush the initialization at integer boundaries, whether we hit them or go past them, though I'm not really all that familiar with this code..the change is pretty darn small and safe seeming.. From jkrell at elego.de Wed Feb 10 17:13:13 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:13:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161313.3F9042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:13:13 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: 1) mark more cases as non portable, that I missed before, because e.g. 0xABCD0000 < 10 depends on word size 2) go ahead and use longint intialization, of individual variables and of an array; this also reveals a bug in the test code where I was leaving one element of the array uninitialized, (see, I got all the way to the end, but I had missed [2] by accident) that could definitely account for some of the descrepancies, good news! From jkrell at elego.de Wed Feb 10 17:17:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:17:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161705.6D2BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:17:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: mark a few more cases as not portable (I'm being a little sloppy here but ok) From jay.krell at cornell.edu Wed Feb 10 17:22:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:22:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:26:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:26:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> , Message-ID: I did a mechanical transform from Word to TWord. Nearly all of the constant folding was there, but only for 32bit operations (the only ones that existed). I've "merely" been giving parity to the 64bit variants. If anything, so far I have added checks. Granted, there might be some missing. My experience though is that they are in there, somewhere, probably via the frontend calling check_hi/lo. You know, I write code like Word.Shift(a, 123), I get a compile time warning and a runtime error. The large shift count is what comes to mind. I can test the extract/insert n + i stuff. I'm going to test with TWord.Extract put back. It ended up not used by my fix. Sorry about that. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:32:29 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:31:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:31:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> References: <20100210115812.269A12474001@birch.elegosoft.com>, <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Message-ID: I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:33:10 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:33:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210163310.DC9C12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:33:10 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: put size check back in Extract, my longint initialization fix didn't require it after all; fix a newline it appears as well From jay.krell at cornell.edu Wed Feb 10 17:35:48 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:35:48 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , ,,, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, ,,, , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:37:23 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:37:23 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:43:52 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:43:52 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, Message-ID: (I also doubt the efficiency gained by IWord/ILongCard based implementations is worth the slight extra mental effort to understand. This code is already beyond a lot of people, keeping it bytes, with clear values, helps just a teeny tiny little bit to read it. I still haven't studied how divide works for example. A comment indicating the actual values I'd say is an ok compromise, I had it in there briefly. I realize people might be tempted to press this into work where performance matters, at which point a larger base becomes more interesting. (I assume the "arithmetic" package looks similar.)) - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:22:56 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:47:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:47:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:48:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:48:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: whoops didn't realize that had pasted in, I didn't see anything. Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:52:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:52:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:55:05 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:55:05 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: > be warned that your m3back code might break when I check things in. I have nothing outstanding on my machine. Please compile what is checked in, thanks. I do have a little more in mind, maybe. It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. We still have one or two word size cross issues. I looked into inlining rotates, the C compiler generates pretty big code though. - Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:00:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:00:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:06:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:06:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: I don't either but I'd just assume workaround it and move on. I get tired of fighting dependencies, I understand the code well enough, I just copy it around and give it the local module/interface name and move on.. Normally I don't like such duplication, but I know the code, and I just needed to get the system back up and running so I could compare longint test cases across multiple systems. There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:14:37 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:14:45 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:14:45 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Word.Insert and Word.Extract with large constants fail appropriately, via check_hi. I just checked. Long.Insert/Extract similar. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Wed, 10 Feb 2010 16:37:23 +0000 Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 18:29:19 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 18:29:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210172919.BBBCD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 18:29:19 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert From hosking at cs.purdue.edu Wed Feb 10 18:44:23 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:44:23 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: > You really anticipate it every changing? > Ever having machines that can't address bytes? > I know they used to exist, but it has been several decades. > The world's vast swaths of C, C++, Java, C# won't port easily to them. > If I understood you, you argued that it is clearly IByte, so I should > feel free to make up my own constants outside of TInt.i3/TWord.i3. > Though so far I haven't. > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:25:31 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:47:13 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:47:13 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> On 10 Feb 2010, at 11:35, Jay K wrote: > I was just trying to get longint initialization to work. > It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. > It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. > Maybe that is desirable. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:13:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you are trying to do or why. Can you provide further explanation? > > On 10 Feb 2010, at 04:47, Jay K wrote: > > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 18:50:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 18:50:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210175014.DD8C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 18:50:14 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Log message: correctly convert Int32 to Int64 using CDQ instruction: convert double to quad; it's inefficient because CDQ only operates on EDX:EAX pair we already correctly convert Word32 to Word64 via allocating and zeroing another register truncation conversions we throw out the upper registers (after wastefully forcing the value into registers) still to consider: range checks and unsigned<=>signed conversion There are many error cases here. Perhaps the frontend already deals with it? From hosking at cs.purdue.edu Wed Feb 10 18:49:56 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:56 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: OK, I'll work it through to m3back. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:55, Jay K wrote: > > be warned that your m3back code might break when I check things in. > > I have nothing outstanding on my machine. > Please compile what is checked in, thanks. > I do have a little more in mind, maybe. > It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. > We still have one or two word size cross issues. > I looked into inlining rotates, the C compiler generates pretty big code though. > > > - Jay > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:54:47 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:54:47 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: But it makes an untidy mess! On 10 Feb 2010, at 12:06, Jay K wrote: > I don't either but I'd just assume workaround it and move on. > I get tired of fighting dependencies, I understand the code well enough, > I just copy it around and give it the local module/interface name and move on.. > Normally I don't like such duplication, but I know the code, and I just needed > to get the system back up and running so I could compare longint test cases > across multiple systems. > > There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. > > - Jay > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:14:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Why? I don't understand how this can occur... > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 10 Feb 2010, at 11:44, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> , <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> Message-ID: I don't think they are the same. TInt.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => true, they are both -1 TWord.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => false, they are 255 and 65535. But maybe I'm confused. I should just test the above but not now. I guess..it'd help if n was a constant, always 8. Then TInt.EQ would work, and the CheckSign business would be gone/simpler. Except then, we'd know, all other beings equal, initialization would be horribly broken. I don't fully understand that, but we need a 4 byte value. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:49:32 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:49:32 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:32 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: > xEQ should be EQ but I wasn't confident I wrote it correctly. > So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. > Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. > It should be fairly clear from the code. > > - Jay > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:23:08 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > What does xEQ do exactly? > > > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > Just remove the size check in Extract. > > > It appears it will just naturally treat the value as zero extended, which > > > is reasonable and allows the rest to work. > > > > > > This lets Tony's fix for initializing Longint work. > > > To be reapplied shortly. > > > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > > once confidence is total) > > > > > > Index: src/TWord.m3 > > > =================================================================== > > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > > retrieving revision 1.10 > > > diff -u -r1.10 TWord.m3 > > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > > @@ -16,8 +16,8 @@ > > > LShift = Word.LeftShift; > > > > > > CONST > > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > > - Base = Mask + 1; > > > + Mask = 16_FF; > > > + Base = 16_100; > > > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > > > @@ -278,8 +278,8 @@ > > > BEGIN > > > <*ASSERT n # 0*> > > > FOR i := n-1 TO 0 BY -1 DO > > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > > + IF a.x[i] # b.x[i] THEN > > > + RETURN FALSE; > > > END; > > > END; > > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > > @@ -449,10 +449,7 @@ > > > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > > VAR w, b: INTEGER; > > > - size := x.n * BITSIZE (IByte); > > > BEGIN > > > - IF i + n > size THEN RETURN FALSE; END; > > > - > > > RightShift (x, i, r); > > > > > > w := n DIV BITSIZE (IByte); > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:53:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:53:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: > sysutils has somewhat of a need to know if it is using user threads. > We've been over this multiple times through the years. > Never seems to be 100% resolved, but a solid 99%. > > > It runs a process and waits. > Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. > It was identified by people as a major performance problem. > Because the process exits fairly quickly but you have to wait for the sleep to finish. > Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. > By and by, most platforms got kernel threads. Changing it to be wait(hang) > became good, faster, no deadlock. But openbsd comes along with lame > pthreads, usermode at that, so we use user threads, and wait(hang) > could deadlock.. > > > There is an interface in m3core to handle this stuff, but if > you bootstrap from an old build, it isn't there. > > > Mitigating factor as I understand that we don't use threads agressively, > so the deadlock isn't actually likely. > "we" meaning code that launches processes. > > > I understand that ideally you don't care if you are using userthreads or kernelthreads. > But the abstraction historically was incomplete. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:16:24 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Huh? Cryptic comment. > > > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > > > Modified files: > > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > > > Log message: > > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:03:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:03:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,, , , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, , ,,<4B7035B2.4030806@lcwb.coop>, ,,, , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , , , , , <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> Message-ID: One might imagine that: VAR a,b:Target.Int; TInt.EQ(a, b) implies TWord.Extract(a, 10, 8) = TWord.Extract(b, 10, 8) (for various values of 10 and 8). but it doesn't. a could be a one byte zero, b a two byte zero, they are EQ, but Extract offset 10 will fail on a. I believe the right way to say this is "referential integrity is broken". EQ should imply equivalent in all observable ways, but it doesn't. Because two numbers with different size can be EQ, but different size leads to other varying behavior. I'm not 100% certain of any of this, but at least 50%. And then, I realize, given a Long.T and a Word.T, you can't directly compare them. You have to go through VAL, which makes them the same size. So there's a missing analog sort of. Target.Int is more loosely typed than its analogs Long.T and Word.T. Target.Int allows mixing arithmetic on different sized operands, for better and worse. In one hand TWord.Extract should just act like the value is infinitely zero extended. On the other, as you point out, that's not what its callers really expect. It's probably a useful semantic, but in some other context. And in that imaginary context, TWord.Insert might grow the data to fit. And likewise TInt.Add/Subtract would grow the value, not overflow.. I realize, this is not the context we care about, we just need something for the compiler. (Though I'm not even sure what for, esp. why all the operations, other than for the constant folding in the NT386 backend, which makes good use of it all.) - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:47:13 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 10 Feb 2010, at 11:35, Jay K wrote: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:05:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:05:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> References: <20100210112056.6B5332474001@birch.elegosoft.com>, , <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> Message-ID: I understand but I have a variety of systems and a variety of installs lying around. I usually make do with whatever I have. It is untidy, but only slightly. For some definition of "only slightly". I keep hoping we can say 5.8 release is the new base, abandon all others, but we don't have it yet. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:53:39 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:08:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:08:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, , <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Message-ID: BITS 16, I know, but I like BITS 8. Using integer directly is viable and efficient, but I doubt worthwhile in this context. If they must be abstracted, I think a comment next to them giving their actual values would be good. I was tempted to change all the bitsize(x) and bitsize(x) - 1 expressions to 8 and 7. So much little layering here and there, can really slow down one's reading comprehension.. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:44:23 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 11 09:42:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:42:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211084251.9F81A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:42:51 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: encode constant shifts by 1 in two bytes instead of three; though the right approach is actually to do an add to self, we'll get to that as part of a broader pass following the optimization guidelines, like decomposing multiplication as adds/shifts, division by constant to multiplication by reciprocal, etc. From jkrell at elego.de Thu Feb 11 09:59:03 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:59:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211085903.17EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:59:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add comment for previous change, though I still expect to change it to an add From jkrell at elego.de Thu Feb 11 11:50:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:50:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105058.3F3B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:50:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c hand.c Log message: enable testing the insert/extract functions on non-Win32, establish what the other low/highbits table is, so we can eliminate it From jkrell at elego.de Thu Feb 11 11:51:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:51:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105134.C9EF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:51:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: cleanup From jkrell at elego.de Thu Feb 11 13:12:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:12:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211121251.456312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:12:51 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable test p227 some longint/integer stuff, might not quite work or on all platforms but is very close if not From jkrell at elego.de Thu Feb 11 13:20:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:20:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122022.935972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:20:22 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: restore Tony's version 1.10 from April 2008 that depends on a 64bit longint, now that NT386 has it From jkrell at elego.de Thu Feb 11 13:24:33 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:24:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122433.A6F3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:24:33 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: reduce diff against 64bit version by making unsigned_long_int = Word.T 'restated' instead of equating to unsigned_int which is also Word.T; really we should look into removing any such thing called Ctypes.unsigned_long Ctypes.long_int due to it NOT being the same size in all 64bit C environments, it is therefore useless; pointer sized integer is INTEGER or Word.T or size_t or ptrdiff_t, NOT long, long int, unsigned long (see Win64) From jkrell at elego.de Thu Feb 11 13:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122945.814F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:29:45 Modified files: cm3/m3-sys/m3tests/src/e0/e029/: stdout.build Log message: update output From jkrell at elego.de Thu Feb 11 13:32:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:32:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211123212.6EAEA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:32:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current NT386 output; we'll see how it compares to others From jkrell at elego.de Thu Feb 11 13:45:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:45:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124513.24F902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:45:12 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: we can now provide UINT32_MAX, though its type isn't perhaps what is wanted (LONGINT instead of INTEGER or Word.T) From jkrell at elego.de Thu Feb 11 13:47:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:47:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124755.D14382474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:47:55 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: line up the columns From jkrell at elego.de Thu Feb 11 13:52:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:52:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125204.840CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:52:04 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: comments From jkrell at elego.de Thu Feb 11 13:59:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125900.17A472474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:00 Modified files: cm3/m3-libs/m3core/src/C/ALPHA_OSF/: Csetjmp.i3 Log message: replace long with INTEGER From jkrell at elego.de Thu Feb 11 13:59:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125930.00A772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:29 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstddef.i3 Log message: replace long with INTEGER, unsigned_long with Word.T From jkrell at elego.de Thu Feb 11 14:04:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:04:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130453.133D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:04:53 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: allow for 64bit integers now, comment out the cas/casp stuff which I'll shortly change to the new atomic interface From jkrell at elego.de Thu Feb 11 14:07:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:07:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130740.08B7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:07:40 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: space after comma From jkrell at elego.de Thu Feb 11 14:45:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:45:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134529.530432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:45:29 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information for assertion failures: hits when trying atomics -- popping addr into int64, actually there's an indirection and it should be ok From jkrell at elego.de Thu Feb 11 14:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134642.0A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:46:41 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'size' => 'srcSize' or 'destSize' for clarity From jkrell at elego.de Thu Feb 11 14:48:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:48:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134828.1AA8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:48:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move common repeated code out to common path From jkrell at elego.de Thu Feb 11 15:00:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:00:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211140056.891E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:00:56 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: start filling in combinatorial code (maybe I should use generics?); some stuff is commented out because it causes backend assertion failures because the backend currently doesn't even manage the virtual stack correctly for atomics yet From jkrell at elego.de Thu Feb 11 15:59:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:59:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211145952.102AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:59:52 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Log message: make fence work it is a little sleazy any xchg that references memory is serializing the simplest would be push eax xchg [esp+4], eax pop eax however the push/pop are usually a waste The approach here is to have a fence local variable, allocate a register, and xchg fence, reg (a global would also do, but that'd cause artifical contention) however the tricky/sleazy part is that our code generator is so good that it'll want to enregister fence, and xchg reg1, reg2 is not serializing. Many of my attempts did that. The pattern here seems to do the trick reliably. I think in particular because of the "overwritesdest" boolean. Test case has multiple fences in a row, and they still all go to memory. The other sleazy part is how I've filled in the table for shld, shrd, xchg. I need to understand this better, and need to be certain the bogus entries won't be used. From jkrell at elego.de Thu Feb 11 16:15:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:15:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211151505.4F0112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:15:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add the usual debugging output and uncomment store_ordered, at least for int32 (not really possible for int64, not sure about smaller); implementation is just fence; store; fence; the generated code is a bit fishy in its efficiency and correctness, will dig more and possibly email.. From jkrell at elego.de Thu Feb 11 16:20:46 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:20:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211152046.2FF352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:20:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix store_ordered to store indirect instead of direct, looks better now, though still many extra instructions From jkrell at elego.de Thu Feb 11 16:38:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:38:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153834.75B5C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:38:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: load_ordered is fence; load_indirect; fence -- I'm worried the optimizer will inhibit duplicate ordered loads/stores though, we'll have to be watchful From jkrell at elego.de Thu Feb 11 16:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153943.399C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: combine load/store tests -- hopefully compiler won't remember enough -- I need to change it to use locals, whose address might be passed across threads, then I'll know better, as we don't optimize away stores to globals, I guess From jkrell at elego.de Thu Feb 11 16:43:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:43:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211154329.8921B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:43:29 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: augment test code some From jkrell at elego.de Fri Feb 12 11:02:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:02:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100246.F2B3C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:02:46 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: actually write the lock prefix, not just in the debug output From jkrell at elego.de Fri Feb 12 11:04:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:04:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100427.186BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:04:27 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100535.4D04A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:05:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: enable the atomics code I had, some fixes there, I think CG.i3 is broken for compare_exchange though, still need to look into exchange and fetch_and_op more, see if they are working From jkrell at elego.de Fri Feb 12 11:06:18 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100618.521352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:18 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:06:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100659.1AB152474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:59 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: remove some newlines, suppress longint code for now From jkrell at elego.de Fri Feb 12 11:45:54 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:45:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212104555.1E36B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:45:54 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: fix compare_exchange by hand-building the modrm part of the instruction Still, it would be better if compare_exchange took a Var parameter in the function call instead of on the stack. Witness the code: 0000018E: 8D3538000000 LEA ESI gv.2[_MM_Main]+56 00000194: 8D3D98000000 LEA EDI gv.2[_MM_Main]+152 0000019A: 8BC7 MOV EAX EDI 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG ESI EBX should really be more like: 00000194: 8D3D98000000 MOV EAX gv.2[_MM_Main]+152 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG gv.2[_MM_Main]+56 EBX which should be easy to achieve if compare_exchange took its parameters in the function call instead of on the stack. 3 instructions instead of 5! From jkrell at elego.de Fri Feb 12 12:11:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:11:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111116.0790C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:11:15 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: work in progress: atomics, note that Visual C++ interlockedor/and/xor are cmpxchg loops, probably wrong approach taken here currently, the code doesn't disasm as intended and I need to check if the intended operations exist From jkrell at elego.de Fri Feb 12 12:19:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:19:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111926.E75D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:19:26 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: atomics: better, important to not generate escape byte for most operations, still looks like the indirection problem compxchg had, if not other problems (such as returning the before vs. after value which I haven't checked on) From jkrell at elego.de Fri Feb 12 13:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124315.E87CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:43:15 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: use inc/dec for atomic add/sub of 1 or -1 before: lea esi,[_MM_Main+38h] mov ebx, 1 lock inc dword ptr [esi], ebx mov dword ptr [_MM_Main+9Ch],esi after: lea esi,[_MM_Main+38h] lock inc dword ptr [esi] mov dword ptr [_MM_Main+9Ch],esi ideal: lock inc dword ptr [_MM_Main+38h] aha but I think I know why, will try for ideal I thought this was only going to save one byte: add foo,1 vs. inc foo but we were loading 1 into a register as well (we could have gotten to add foo,1, but no point now) the unop changes not actually used here no unop is atomic, inc/dec are implemented separately I tried using the table based stuff but it is confusing diff: Index: Codex86.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.i3,v retrieving revision 1.18 diff -u -r1.18 Codex86.i3 --- Codex86.i3 11 Feb 2010 14:59:51 -0000 1.18 +++ Codex86.i3 12 Feb 2010 12:41:14 -0000 @@ -60,8 +60,9 @@ lock_compare_exchange (READONLY dest, src: Operand); pushOp (READONLY src: Operand); popOp (READONLY dest: Operand); - decOp (READONLY op: Operand); - unOp (op: Op; READONLY dest: Operand); + decOp (READONLY op: Operand; locked := FALSE); + incOp (READONLY op: Operand; locked := FALSE); + unOp (op: Op; READONLY dest: Operand; locked := FALSE); mulOp (READONLY src: Operand); imulOp (READONLY dest, src: Operand); imulImm (READONLY dest, src: Operand; imm, imsize: INTEGER); Index: Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.55 diff -u -r1.55 Codex86.m3 --- Codex86.m3 12 Feb 2010 11:19:26 -0000 1.55 +++ Codex86.m3 12 Feb 2010 12:41:14 -0000 @@ -92,6 +92,7 @@ pushOp := pushOp; popOp := popOp; decOp := decOp; + incOp := incOp; unOp := unOp; mulOp := mulOp; imulOp := imulOp; @@ -1019,26 +1020,49 @@ END; END popOp; -PROCEDURE decOp (t: T; READONLY op: Operand) = + +PROCEDURE incOrDecOp (t: T; READONLY op: Operand; locked: BOOLEAN; incOrDec: [0..1]) = VAR ins: Instruction; + name := ARRAY [0..1] OF TEXT{"INC", "DEC"}[incOrDec]; BEGIN - Mn(t, "DEC"); MnOp(t, op); + ins.lock := locked; + Mn(t, name); MnOp(t, op); + <* ASSERT op.loc = OLoc.mem OR op.loc = OLoc.register *> - IF op.loc = OLoc.register THEN - ins.opcode := 16_48 + op.reg[0]; + + IF locked THEN + ins.mrmpres := TRUE; + ins.disp := 0; + ins.dsize := 0; + ins.modrm := 8 * incOrDec + op.reg[0]; + ins.opcode := 16_FF; + writecode(t, ins); + ELSIF op.loc = OLoc.register THEN + ins.opcode := 16_40 + 8 * incOrDec + op.reg[0]; writecode(t, ins); ELSE <* ASSERT op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 4 *> - build_modrm(t, op, t.opcode[1], ins); + build_modrm(t, op, t.opcode[incOrDec], ins); ins.opcode := 16_FF; writecode(t, ins); log_global_var(t, op.mvar, -4); END + END incOrDecOp; + +PROCEDURE incOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 0); + END incOp; + +PROCEDURE decOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 1); END decOp; -PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR ins: Instruction; BEGIN + ins.lock := locked; ins.opcode := opcode[op].imm32; IF dest.loc = OLoc.mem THEN get_op_size(dest.mvar.mvar_type, ins); @@ -1057,11 +1081,14 @@ END END unOp1; -PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR destA: ARRAY OperandPart OF Operand; destSize := SplitOperand(dest, destA); BEGIN + (* future: we could use cmpxchg loop *) + <* ASSERT (destSize = 1) OR (NOT locked) *> + IF destSize = 2 AND (op IN SET OF Op{Op.oNEG, Op.oNOT}) THEN CASE op OF | Op.oNOT => @@ -1079,7 +1106,7 @@ <* ASSERT NOT Is64(destA[destSize - 1].optype) *> FOR i := 0 TO destSize - 1 DO - unOp1(t, op, destA[i]); + unOp1(t, op, destA[i], locked); END; END; END unOp; Index: M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.110 diff -u -r1.110 M3x86.m3 --- M3x86.m3 12 Feb 2010 11:11:15 -0000 1.110 +++ M3x86.m3 12 Feb 2010 12:41:15 -0000 @@ -3004,7 +3004,8 @@ u.vstack.newdest(u.cg.reg[EDI]); ELSE - WITH stack0 = u.vstack.pos(0, "zero"), stop0 = u.vstack.op(stack0) DO + WITH stack0 = u.vstack.pos(0, "zero"), + stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, @@ -4297,15 +4298,16 @@ CONST AtomicOpToOp = ARRAY AtomicOp OF Op { Op.oADD, Op.oSUB, Op.oOR, Op.oAND, Op.oXOR }; CONST AtomicOpName = ARRAY AtomicOp OF TEXT { "add", "sub", "or", "and", "xor" }; -PROCEDURE fetch_and_op (x: U; op: AtomicOp; t: MType; z: ZType; +PROCEDURE fetch_and_op (x: U; atomic_op: AtomicOp; t: MType; z: ZType; <*UNUSED*>order: MemoryOrder) = (* tmp := Mem [s1.A].t; Mem [s1.A].t := tmp op s0.u; s1.u := tmp op s0.u; pop *) + VAR op := AtomicOpToOp[atomic_op]; BEGIN IF x.debug THEN x.wr.Cmd ("fetch_and_op"); - x.wr.OutT (AtomicOpName[op]); + x.wr.OutT (AtomicOpName[atomic_op]); x.wr.TName (t); x.wr.TName (z); x.wr.NL (); @@ -4318,7 +4320,35 @@ RETURN; END; - EVAL x.vstack.dobin(AtomicOpToOp[op], (*symmetric*) op # AtomicOp.Sub, (*overwritesdest*) TRUE, t, locked := TRUE); + (* optimize add 1 => inc, add -1 => dec, sub 1 => dec, sub -1 => inc + * to save a byte encoding the immediate value. + * NOTE: We should do this for reg where t.reguse[reg].last_imm = 1 or -1 also. + *) + + WITH stack0 = x.vstack.pos(0, "fetch_and_op"), + stack1 = x.vstack.pos(1, "fetch_and_op"), + stop0 = x.vstack.op(stack0) DO + IF op IN SET OF Op{Op.oADD, Op.oSUB} THEN + IF stop0.loc = OLoc.imm THEN + WITH imm = stop0.imm DO + IF (TInt.EQ(imm, TInt.One) OR TInt.EQ(imm, TInt.MOne)) THEN + x.vstack.unlock(); + x.vstack.find(stack1, Force.anyreg); + IF (op = Op.oADD) = TInt.EQ(imm, TInt.One) THEN + x.cg.incOp(x.vstack.op(stack1), locked := TRUE); + ELSE + x.cg.decOp(x.vstack.op(stack1), locked := TRUE); + END; + x.vstack.newdest(x.vstack.op(stack1)); + x.vstack.discard(1); + RETURN; + END; + END; + END; + END; + END; + + EVAL x.vstack.dobin(op, (*symmetric*) (*op # AtomicOp.Sub*) FALSE, (*overwritesdest*) TRUE, t, locked := TRUE); END fetch_and_op; From jkrell at elego.de Fri Feb 12 13:45:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:45:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124559.AB8B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:45:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments From jkrell at elego.de Fri Feb 12 13:50:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:50:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212125040.6D9B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:50:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: don't force into a register, but, alas, too late, it already is, unnecessarily, really could use passing a var here instead of pushing a load_address From jkrell at elego.de Fri Feb 12 14:17:44 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:17:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212131744.60EAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:17:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Stackx86.m3 Log message: a little more atomic work hack around the wrong level of indirection we now have: _Main__Test_AtomicInteger_FetchAnd: 000001BA: 55 push ebp 000001BB: 8B EC mov ebp,esp 000001BD: 81 EC 00 00 00 00 sub esp,0 000001C3: 53 push ebx 000001C4: 56 push esi 000001C5: 57 push edi 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 000001D2: F0 21 1E lock and dword ptr [esi],ebx 000001D5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001DB: 5F pop edi 000001DC: 5E pop esi 000001DD: 5B pop ebx 000001DE: C9 leave 000001DF: C3 ret _Main__Test_AtomicInteger_FetchDec: 000001E0: 55 push ebp 000001E1: 8B EC mov ebp,esp 000001E3: 81 EC 00 00 00 00 sub esp,0 000001E9: 53 push ebx 000001EA: 56 push esi 000001EB: 57 push edi 000001EC: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001F2: F0 FF 0E lock dec dword ptr [esi] 000001F5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001FB: 5F pop edi 000001FC: 5E pop esi 000001FD: 5B pop ebx 000001FE: C9 leave 000001FF: C3 ret notice that: - the lea esi is not needed - the mov foo, esi is *wrong* and wrecks the result From jkrell at elego.de Fri Feb 12 14:36:19 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:36:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212133622.B64D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:36:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: nevermind, this is all wrong except for store, load, fence, exchange, and compare_exchange The atomic interface really does *not* expose a bunch of functionality on x86. x86 generally stores the result in memory. We cannot then return the result because we'd have to reread memory. Therefore all these functions will require cmpxchg loops. Probably just write wrapper functions for the C compiler intrinsics.. From jkrell at elego.de Fri Feb 12 14:43:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:43:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212134317.A83ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:43:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: remove all the passing around of "locked" since the lock prefix isn't going to be useful except for compare_exchange and lock_compare_exchange (and not even for exchange actually, it doesn't need it) we will be able to do some of add/sub with xadd probably but or/xor/and will just use cmpxchg loops, probably functions From hosking at cs.purdue.edu Fri Feb 12 16:26:04 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 12 Feb 2010 10:26:04 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100212133622.B64D92474001@birch.elegosoft.com> References: <20100212133622.B64D92474001@birch.elegosoft.com> Message-ID: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. On 12 Feb 2010, at 14:36, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/12 14:36:19 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > nevermind, this is all wrong except for store, load, fence, exchange, > and compare_exchange > The atomic interface really does *not* expose a bunch of > functionality on x86. x86 generally stores the result in memory. > We cannot then return the result because we'd have to reread memory. > Therefore all these functions will require cmpxchg loops. > Probably just write wrapper functions for the C compiler intrinsics.. From jay.krell at cornell.edu Fri Feb 12 18:10:47 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 12 Feb 2010 17:10:47 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> References: <20100212133622.B64D92474001@birch.elegosoft.com>, <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> Message-ID: Value could change in the meantime. I'll implement fetch_and_op with cmpxchg loops soon. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 12 Feb 2010 10:26:04 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. > > On 12 Feb 2010, at 14:36, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/12 14:36:19 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > nevermind, this is all wrong except for store, load, fence, exchange, > > and compare_exchange > > The atomic interface really does *not* expose a bunch of > > functionality on x86. x86 generally stores the result in memory. > > We cannot then return the result because we'd have to reread memory. > > Therefore all these functions will require cmpxchg loops. > > Probably just write wrapper functions for the C compiler intrinsics.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wagner at elego.de Sat Feb 13 11:59:24 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 11:59:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213105924.47CFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 11:59:24 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: we need to run upgrade from scratch From wagner at elego.de Sat Feb 13 17:02:11 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 17:02:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213160211.B739F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 17:02:11 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: don't ship anything too early From jkrell at elego.de Sun Feb 14 08:23:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:23:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214072326.B75172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:23:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: atomic fetch_op work in progress almost works, but the levels of indirection are wrong: _Main__Test_AtomicInteger_FetchAnd: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax,esi needs indirection, doesn't need to be use esi but that is ok 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [ebx],esi parameters reversed, odd, given that compare_exchange works 000001DC: 75 F6 jne 000001D4 000001DE: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi ... should be more like: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax, [_MM_Main+38h] or DWORD PTR [esi] ** 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [esi],ebx OR lock cmpxchg dword ptr [_MM_Main+98h],ebx 000001DC: 75 F6 jne 000001D4 ... From jkrell at elego.de Sun Feb 14 08:40:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:40:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214074053.0CCCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:40:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: very slight restructure to make it simpler, given that in at least two places order seems to get reversed, though they are only related to 32bit operations so this won't likely clear things up...Modula-3 seems to lack a 'next' or 'continue' statement, so I have to reindent a bunch where in C I avoid indentation whereever I can (no 'with', use goto for error handling; heck 'with' always confuses me, I don't know which part of it is 'reevaluated' vs. 'captured' -- does it introduce pointers, or cached copies, or just shortand for long expressions? All three are useful and with can only be done.. From jkrell at elego.de Sun Feb 14 09:33:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:33:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083355.B85172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:33:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: clarify comment, after checking documentation From jkrell at elego.de Sun Feb 14 09:35:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083509.EE9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:09 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 09:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083546.CEE592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix comment From jkrell at elego.de Sun Feb 14 09:38:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:38:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083855.A512E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:38:54 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 10:49:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:49:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214094907.25CC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:49:06 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix parameter order and indirect in atomic fetch_op; the last store is actually ok, still one wrong indirection to fix From jkrell at elego.de Sun Feb 14 10:59:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:59:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214095950.0B5BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:59:50 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup: one statement per line From jkrell at elego.de Sun Feb 14 11:44:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:44:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104417.DCF392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:44:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup formating, remove general lock prefix support (only used once, not worth it) From jkrell at elego.de Sun Feb 14 11:45:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:45:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104536.446A72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:45:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: 'o' => 'offset' From jkrell at elego.de Sun Feb 14 11:57:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:57:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105732.415672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:57:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: when loading from register + offset, and offset is 0, use different flags in the instruction so we don't have to waste a byte on the index; more to do here, but this case is known to occur From jkrell at elego.de Sun Feb 14 11:58:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:58:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105818.85EAC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:58:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add a comment From jkrell at elego.de Sun Feb 14 11:59:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:59:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105945.E37FA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:59:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: one statement per line From jkrell at elego.de Sun Feb 14 12:01:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:01:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110142.771C02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:01:42 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "sibpres" => "sib_present" "sib" is the x86 "scale index byte" or such, very often refernced in x86 literature, probably ok to leave cryptic asis From jkrell at elego.de Sun Feb 14 12:03:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:03:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110311.E964B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:03:11 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "mrmpres" => "mrm_present" "mrm" is short for "mod/rm" or such, which is often referenced in x86 literatue so probably ok to leave cryptic From jkrell at elego.de Sun Feb 14 12:06:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:06:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110633.F13C82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:06:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more formatting repair: THEN goes at end of line, ELSE takes its entire line From jkrell at elego.de Sun Feb 14 12:35:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:35:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214113548.46E1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:35:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: shorten other cases for offset=0 From jkrell at elego.de Sun Feb 14 12:42:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:42:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214114206.7F3B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:42:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Sun Feb 14 13:02:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:02:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214120221.50CFC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:02:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix indirection in atomic fetch_and_op just my ignorance using movOp instead of load_ind code is like: _Main__Test_AtomicInteger_FetchOr: 00000250: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] ; atomic variable 00000256: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] ; value to or with 0000025C: 8B 06 mov eax,dword ptr [esi] ; fetch old value 0000025E: 8B D8 mov ebx,eax ; move old value to tmp (this is needed) 00000260: 0B DA or ebx,edx ; compute new value 00000262: F0 0F B1 1E lock cmpxchg dword ptr [esi],ebx ; try to swap 00000266: 75 F6 jne 0000025E ; old value is in eax (always eax; or edx:eax pair for 64bit operations, not yet implemented) ; new value is in, in this case, ebx still could be better, could be: mov edx,dword ptr [_MM_Main+98h] mov eax,[_MM_Main+38h] retry: mov ebx,eax or ebx,edx lock cmpxchg [_MM_Main+38h],ebx jne retry ; old value is in eax ; new value is in, in this case, ebx six instructions instead of seven three registers (eax, ebx, edx) instead of four (eax, ebx, edx, esi) (problem is that we get load_address on the variable first, and we go ahead and enregister that address unnecessarily) And even so: if six instructions is considered too large, we can use a function instead. As well, add, sub, we can do more efficiently with xadd. (still need to check what libatomic does here) also we can probably optimize or(-1) => store_ordered(-1) or(0) => do nothing and(-1) => do nothing and(0) => store_ordered(0) probably they are rare/nonexistant From jkrell at elego.de Sun Feb 14 13:30:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:30:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123045.0EDF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:30:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: fix level of indirection in atomic swap Like compareExchange, it suffers from unnecessary enregistration of the address of the atomic variable: 0000034A: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 00000350: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 00000356: F0 87 1E lock xchg ebx,dword ptr [esi] which should be more like: mov ebx,dword ptr [_MM_Main+98h] lock xchg ebx,[_MM_Main+38h] two instructions instead of three, one register instead of two Though Visual C++ seems to do similar: ; 2 : long __fastcall F1(long b) { return _InterlockedExchange(&a, b); } 00000 8b c1 mov eax, ecx 00002 b9 00 00 00 00 mov ecx, OFFSET _a 00007 87 01 xchg DWORD PTR [ecx], eax 00009 c3 ret 0 notice that it uses a smaller mov to generate the address, because, you know, the instruction needs relocation anyway, you might as well have the relocation include the +38; This is probably something we should look into improving across the board in m3back. From jkrell at elego.de Sun Feb 14 13:36:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:36:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123626.6E3C22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:36:26 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: stderr.pgm stdout.build Log message: commit current output; needs work, but an ok start (it just compiles and runs, some atomic integer stuff; the printouts are just leftover from cas/casp stuff, the results of atomic aren't yet verified/printed, I just look at the disasm, and only integer is tested so far, not any other type) From jkrell at elego.de Sun Feb 14 13:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124522.ADD402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:45:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: slight update, fix newlines, only more nonportable stuff, but output should change slightly, hm? From jkrell at elego.de Sun Feb 14 13:46:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:46:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124606.739AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:46:06 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p227 atomics, doesn't test much yet, just compiles, runs, no output From jkrell at elego.de Sun Feb 14 14:18:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:18:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214131856.A81402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:18:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: add back underlying inc support, so we can soon optimize add/sub by +1/-1 (including atomic case) to be inc/dec From jkrell at elego.de Sun Feb 14 14:23:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:23:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214132342.3625E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:23:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove more a bit of the generalized lock support that ended up not used From jkrell at elego.de Sun Feb 14 14:38:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:38:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214133804.A7B872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:38:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: verify comment about procedure FixReturnValue and wordsmith it appropriately (half the comment appears to have gone obsolete/incorrect circa Visual C++ 5.0 but let's just stay compatible with older -- the only difference is for calling functions that return 16bit return types) From jkrell at elego.de Sun Feb 14 14:45:27 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134527.704EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:27 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Sun Feb 14 14:45:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134544.165C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 06:00:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:00:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050037.DB9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:00:37 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c Added files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 m3makefile Log message: test for sign/zero extension of the return values of functions that return types smaller than 32bits. I'm about to change the code here: the AMD manual recommends specific sequences that are shorter or equal in length to what we use, but in 3 of the 4 cases what we use doesn't match the recommendation From hosking at elego.de Mon Feb 15 06:07:07 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 15 Feb 2010 6:07:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050707.87E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/15 06:07:07 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Cleaner fix for LONGINT static initialization. From jkrell at elego.de Mon Feb 15 06:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050900.3057A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly, I think I found a bug From jkrell at elego.de Mon Feb 15 06:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050948.28DF32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:09:48 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly From jkrell at elego.de Mon Feb 15 06:18:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:18:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215051818.EA8AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:18:18 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test coverage to converting positive values too From jkrell at elego.de Mon Feb 15 06:44:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:44:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215054452.C6A512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:44:51 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: some refinements, esp. to give some contenxt to diffs From jkrell at elego.de Mon Feb 15 06:51:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:51:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215055136.E791E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:51:36 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 07:03:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:03:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215060353.57CED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:03:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: add line numbers From jkrell at elego.de Mon Feb 15 07:14:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:14:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215061433.DEF602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:14:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case; there is a bug here, different output on NT386 vs. LINUXLIBC6, not yet sure which is correct From jkrell at elego.de Mon Feb 15 07:24:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:24:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062435.991372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:24:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more From jkrell at elego.de Mon Feb 15 07:26:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:26:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062634.512542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:26:34 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more, there is a crash in here.. From jkrell at elego.de Mon Feb 15 07:37:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:37:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063735.EFDE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:37:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix mistake in dec when I put in the inc code; this broke division From jkrell at elego.de Mon Feb 15 07:38:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:38:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063825.DF4B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:38:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove two newlines From jkrell at elego.de Mon Feb 15 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064124.D73422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:41:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: move and modify assert (maybe we can make it tighter?) From jkrell at elego.de Mon Feb 15 07:42:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:42:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064244.A2D462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:42:42 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: flush more often (at newlines), for debugability From jkrell at elego.de Mon Feb 15 07:55:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:55:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215065531.B786D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:55:31 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 08:39:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:39:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215073958.C32CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:39:58 Added files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 m3makefile Log message: new smaller test that fails on NT386, non-const int64 division by 1 From jkrell at elego.de Mon Feb 15 08:40:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:40:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215074045.663582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:40:45 Modified files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 Log message: reduce, still fails From jkrell at elego.de Mon Feb 15 09:01:26 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:01:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215080127.EC77D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:01:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix div parameter order, and presumably mod From jkrell at elego.de Mon Feb 15 09:32:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:32:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083209.84A102474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:32:09 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 09:38:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:38:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083837.C1C312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:38:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: update output From jkrell at elego.de Mon Feb 15 09:59:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:59:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215085901.B20C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:59:01 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: add newlines to output, remove 'bug?' comment: uint8 and uint16 are full range in 8 and 16 bits, but uint32 is not, that isn't possible without going to 64bit representation From jkrell at elego.de Mon Feb 15 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090043.F3D7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:00:43 Added files: cm3/m3-sys/m3tests/src/p2/p228/: stdout.pgm Log message: add expected output From jkrell at elego.de Mon Feb 15 10:06:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:06:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090608.6D3C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:06:08 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p228 sign/zero extend return values of functions returning types smaller than 32bits; enable p229 minimal 64bit divide test, that was failing (still need mod, and more) From jkrell at elego.de Mon Feb 15 10:25:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:25:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215092508.1AE792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:25:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: remove unused functions: get_addsize must_extend aligned From hosking at cs.purdue.edu Mon Feb 15 16:17:12 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 15 Feb 2010 10:17:12 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100215083209.84A102474001@birch.elegosoft.com> References: <20100215083209.84A102474001@birch.elegosoft.com> Message-ID: <05565123-28DB-4C46-B2B2-AE087FB1DCB6@cs.purdue.edu> Good catch! Thanks Jay. On 15 Feb 2010, at 09:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/15 09:32:09 > > Modified files: > cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c > > Log message: > fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 18:44:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:44:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174416.15E552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:44:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174522.E3A852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:45:22 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174857.E37212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:48:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 18:56:19 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:56:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175621.70FF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:56:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Mon Feb 15 18:58:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:58:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175821.92A7A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:58:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Wed Feb 17 05:06:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:06:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040644.0A0402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:06:43 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: avoid returning out of a deep nested loop to workaround apparently problem in older releases such as 5.4.0 (if using current config files) From jkrell at elego.de Wed Feb 17 05:08:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:08:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040849.6D5B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:08:49 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040923.601552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:09:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:10:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:10:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041030.7BB172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:10:30 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: remove newline from middle of short comment From jkrell at elego.de Wed Feb 17 05:17:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:17:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041757.7F2A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:17:57 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial merge with head to support older cm3 (more to do); also reduce intent in this deeply indented functions to 2 spaces from 4 spaces From jkrell at elego.de Wed Feb 17 05:20:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:20:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042039.892BE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:20:39 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial, very partial undo From jkrell at elego.de Wed Feb 17 05:26:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:26:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042656.1560B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:26:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: slight variation on the fix for building with older cm3 From jkrell at elego.de Wed Feb 17 05:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043311.5CB372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:33:11 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace and a little cleanup of repetitive code From jkrell at elego.de Wed Feb 17 05:35:06 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:35:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043506.A9F962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:35:06 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: whitespace From jkrell at elego.de Wed Feb 17 05:41:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:41:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044121.848AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:41:21 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: mostly merge with head From jkrell at elego.de Wed Feb 17 05:42:35 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:42:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044236.22B4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:42:35 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: mostly merge with release From jkrell at elego.de Wed Feb 17 06:03:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:03:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050355.C74942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:03:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: AMD64_SOLARIS Darwin.common HPUX.common Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Solaris.common Unix.common cm3cfg.common Log message: remove whitspace from ends of lines From jkrell at elego.de Wed Feb 17 06:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050616.C20BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:06:16 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 AMD64_SOLARIS Darwin.common HPUX.common I386_SOLARIS Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Unix.common cm3cfg.common Log message: remove whitespace from ends of lines From jkrell at elego.de Wed Feb 17 06:12:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:12:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051255.5D0CA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:12:54 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Darwin.common NT386 NT386.common NT386GNU NT386MINGNU Solaris.common cm3.cfg cm3cfg.common Log message: consistent support/workaround for MxConfig always define all of CR, EOL, M3_PROFILING, SL, in that order From jkrell at elego.de Wed Feb 17 06:16:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:16:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051607.A784F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:16:07 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:17:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:17:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051742.10BE32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:17:41 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:20:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:20:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217052002.6D5732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:20:01 Modified files: cm3/m3-sys/cminstall/src/config/: Tag: release_branch_cm3_5_8 ALPHA_OSF FreeBSD3 FreeBSD4 HPPA IBMR2 IRIX5 LINUXELF LINUXLIBC6 NetBSD2_i386 PPC_LINUX SOLgnu SOLsun SPARC Log message: remove whitespace from ends of lines (dead files) From jkrell at elego.de Wed Feb 17 06:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217054439.649B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:44:38 Added files: cm3/m3-sys/m3tests/src/p2/p228/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile stdout.pgm cm3/m3-sys/m3tests/src/p2/p229/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: new files from head (branching incompatible with sequential numbers so it behooves us to at least keep the directory listing in sync) From jkrell at elego.de Wed Feb 17 07:25:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:25:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217062500.EE3F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:25:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll stuff for Interix now that I found I don't need it (more stuff here to try removing when I get back to it) From jkrell at elego.de Wed Feb 17 07:31:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:31:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063149.1FF4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:31:48 Removed files: cm3/m3-win/ntdll/: .cvsignore cm3/m3-win/ntdll/src/: m3makefile ntdll.c cm3/m3-win/w32api/: CONTRIBUTIONS Makefile.in README.w32api TODO aclocal.m4 config.guess config.sub configure configure.in install-sh cm3/m3-win/w32api/include/: accctrl.h aclapi.h aclui.h adsprop.h afxres.h amaudio.h amvideo.h audevcod.h aviriff.h aygshell.h basetsd.h basetyps.h bdatypes.h cderr.h cguid.h cmnquery.h comcat.h commctrl.h commdlg.h control.h cpl.h cplext.h custcntl.h dbt.h dde.h ddeml.h devguid.h dhcpcsdk.h dlgs.h docobj.h dsadmin.h dsclient.h dsgetdc.h dshow.h dsquery.h dsrole.h dvdevcod.h dvdmedia.h edevdefs.h errorrep.h errors.h evcode.h exdisp.h exdispid.h fltdefs.h httpext.h icm.h idispids.h il21dec.h imagehlp.h imm.h initguid.h intshcut.h ipexport.h iphlpapi.h ipifcons.h ipinfoid.h iprtrmib.h iptypes.h ipxconst.h ipxrtdef.h ipxtfflt.h isguids.h ks.h ksmedia.h largeint.h lm.h lmaccess.h lmalert.h lmapibuf.h lmat.h lmaudit.h lmbrowsr.h lmchdev.h lmconfig.h lmcons.h lmerr.h lmerrlog.h lmmsg.h lmremutl.h lmrepl.h lmserver.h lmshare.h lmsname.h lmstats.h lmsvc.h lmuse.h lmuseflg.h lmwksta.h lzexpand.h mapi.h mciavi.h mcx.h mgm.h mgmtapi.h mlang.h mmreg.h mmsystem.h mpegtype.h mprapi.h mq.h msacm.h mshtml.h mswsock.h nb30.h nddeapi.h nspapi.h ntdef.h ntdll.h ntdsapi.h ntdsbcli.h ntldap.h ntsecapi.h ntsecpkg.h oaidl.h objbase.h objfwd.h objidl.h objsafe.h objsel.h ocidl.h odbcinst.h ole.h ole2.h ole2ver.h oleacc.h oleauto.h olectl.h olectlid.h oledlg.h oleidl.h pbt.h poppack.h powrprof.h prsht.h psapi.h pshpack1.h pshpack2.h pshpack4.h pshpack8.h qedit.h rapi.h ras.h rasdlg.h raserror.h rassapi.h reason.h regstr.h richedit.h richole.h routprot.h rpc.h rpcdce.h rpcdce2.h rpcdcep.h rpcndr.h rpcnsi.h rpcnsip.h rpcnterr.h rpcproxy.h rtutils.h schannel.h schnlsp.h scrnsave.h sddl.h secext.h security.h servprov.h setupapi.h shellapi.h shldisp.h shlguid.h shlobj.h shlwapi.h snmp.h specstrings.h sql.h sqlext.h sqltypes.h sqlucode.h sspi.h stm.h strmif.h subauth.h svcguid.h tlhelp32.h tmschema.h unknwn.h userenv.h usp10.h uxtheme.h vfw.h vidcap.h vmr9.h vptype.h w32api.h winable.h winbase.h winber.h wincon.h wincrypt.h windef.h windns.h windows.h windowsx.h winerror.h wingdi.h wininet.h winioctl.h winldap.h winnetwk.h winnls.h winnt.h winperf.h winreg.h winresrc.h winsnmp.h winsock.h winsock2.h winspool.h winsvc.h winuser.h winver.h ws2spi.h ws2tcpip.h wsahelp.h wsipx.h wsnetbs.h wtsapi32.h wtypes.h xprtdefs.h zmouse.h cm3/m3-win/w32api/include/ddk/: atm.h batclass.h cfg.h cfgmgr32.h d4drvif.h d4iface.h ddkmapi.h hidclass.h hidpi.h hidsdi.h hidusage.h kbdmou.h mcd.h miniport.h minitape.h mountdev.h mountmgr.h ndis.h ndisguid.h ndistapi.h ndiswan.h netevent.h netpnp.h newdev.h ntapi.h ntdd8042.h ntddbeep.h ntddcdrm.h ntddcdvd.h ntddchgr.h ntdddisk.h ntddk.h ntddkbd.h ntddmou.h ntddndis.h ntddpar.h ntddpcm.h ntddscsi.h ntddser.h ntddstor.h ntddtape.h ntddtdi.h ntddvdeo.h ntddvol.h ntifs.h ntpoapi.h ntstatus.h parallel.h pfhook.h poclass.h scsi.h scsiscan.h scsiwmi.h smbus.h srb.h storport.h tdi.h tdiinfo.h tdikrnl.h tdistat.h tvout.h upssvc.h usb.h usb100.h usbcamdi.h usbdi.h usbioctl.h usbiodef.h usbscan.h usbuser.h video.h videoagp.h win2k.h winddi.h winddk.h winnt4.h winxp.h ws2san.h xfilter.h cm3/m3-win/w32api/lib/: Makefile.in ntdll.def Log message: remove ntdll/w32api stuff w32api might be useful to reduce dependency on C compiler (ie: compiler and linker and C runtime, but not win32 headers/libraries; ie some of the express versions) From jkrell at elego.de Wed Feb 17 07:36:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:36:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063618.E1F2B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:36:18 Modified files: cm3/scripts/python/: pylib.py Log message: remove most ntdll/w32api stuff (need to look into the rest another time) From jkrell at elego.de Wed Feb 17 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064124.D9C052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:41:24 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: bring over "AdjustShared" from head Specifically what this does is when using older toolsets, it turns building of anything "shared" into "not shared". This way these config files can deal less with the vagaries of older toolsets. The point being, when mixing these config files with older tools, only to handle building cm3. "old toolset" is defined as "not defining install_symbolic_link" Perhaps we should have something like cm3 -DBOOT or cm3 -DNO_SHARED to better encapsulate this. Note that this is placed in such a way that it doesn't affect all targets. But probably it should. Also this disabled building "shared" on Interix, pending more investigation. (This is what head does.) From jkrell at elego.de Wed Feb 17 07:47:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:47:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064729.1328B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:47:28 Modified files: cm3/scripts/: README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh cm3/scripts/python/: do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: upgrade.cmd Log message: remove m3staloneback from various lists leave it only in tool/std It is not needed in front/core/boot etc. From jkrell at elego.de Wed Feb 17 07:53:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:53:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065306.2DA532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:53:05 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd upgrade.cmd Log message: m3staloneback not needed in many places -- just tool/std -- it isn't any special part of front/back/boot/core -- it isn't actually used anywhere, it also doesn't need to be filtered out of non-Win32 platforms, since it should build and work everywhere (just, again, we don't use it) From jkrell at elego.de Wed Feb 17 07:58:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:58:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065815.5BDD92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:58:14 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: libdump, fix_nl also not needed in upgrade/cross stuff add m3staloneback back to 'core' group, because in fact 'core' is never used, useless, no need to mess with it (should just remove it, pylib.py should be updated to use the other data files..) From jkrell at elego.de Wed Feb 17 08:22:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:22:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072229.61EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:22:28 Modified files: cm3/scripts/python/: pylib.py cm3/scripts/win/: pkginfo.cmd Log message: fix_nl, libdump not so important, and don't need filtering From jkrell at elego.de Wed Feb 17 08:23:50 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:23:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072351.10EF42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:23:50 Modified files: cm3/scripts/: boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh Log message: adjust filters: fix_nl, libdump ought to be, and may already be, very portable From jkrell at elego.de Wed Feb 17 08:25:51 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:25:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072551.343612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:25:51 Removed files: cm3/scripts/python/: do-cm3-comm.py do-cm3-core.py do-cm3-gui.py do-cm3-base.py Log message: remove useless stuff From jkrell at elego.de Wed Feb 17 08:26:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:26:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072649.D2C9C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:26:49 Removed files: cm3/scripts/python/: do-cm3-caltech-parser.py do-cm3-front.py Log message: remove more useless From jkrell at elego.de Wed Feb 17 08:30:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:30:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073058.49A002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:30:57 Modified files: cm3/scripts/python/: pylib.py Log message: remove 'core' and 'base' groups, they aren't useful From jkrell at elego.de Wed Feb 17 08:32:04 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:32:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073207.854852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:32:04 Modified files: cm3/scripts/python/: pylib.py Log message: comments From jkrell at elego.de Wed Feb 17 08:34:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:34:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073455.39C712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:34:55 Modified files: cm3/scripts/: backup-pkgs.sh Log message: fix_nl, libdump not so important From jkrell at elego.de Wed Feb 17 08:35:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:35:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073531.7E0F82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:35:31 Modified files: cm3/scripts/python/: upgrade.py Log message: ok to build mklib in first pass, its dependency on m3core has been reduced From jkrell at elego.de Wed Feb 17 08:39:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:39:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073956.10AAD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:39:55 Modified files: cm3/scripts/python/: make-dist.py pylib.py Log message: ok to build mklib early, no need to list m3objfile twice From jkrell at elego.de Wed Feb 17 08:47:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:47:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074726.86A542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:47:25 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: remove dependency on m3core/WinNT in order to work with older Unix m3core From jkrell at elego.de Wed Feb 17 08:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074858.0DFDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:48:57 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: cleanup From jkrell at elego.de Wed Feb 17 08:58:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:58:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217075801.CA9A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:58:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll/interix stuff, I thought I already had From jkrell at elego.de Wed Feb 17 09:16:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:16:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217081623.522202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:16:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove ConvertLibsToStandalone, it is in cm3cfg.common now From jkrell at elego.de Wed Feb 17 09:42:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:42:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217084202.347572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:42:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 09:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085152.287D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:51:52 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and partial merge with head (mainly whitespace, also stuff under ifdef) From jkrell at elego.de Wed Feb 17 09:53:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:53:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085301.72C8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:53:01 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and reorder 'a and b and c' to 'a and c and b' or such to put faster parts earlier From jkrell at elego.de Wed Feb 17 09:54:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:54:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085457.EBC092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:54:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: a little more test coverage, forgot the output file From jkrell at elego.de Wed Feb 17 11:40:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:40:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104014.16E3E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:40:14 Modified files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 m3makefile RTIO.i3 Added files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 RTIOc.c Log message: some longint int support from head From jkrell at elego.de Wed Feb 17 11:46:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:46:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104614.4A1642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:46:14 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: Tag: release_branch_cm3_5_8 parse.c Log message: from head: fix longint div and presumably mod From jkrell at elego.de Wed Feb 17 12:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217111834.4EECB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:18:34 Modified files: cm3/m3-sys/libdump/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: from head: reduce dependency on newer m3core From jkrell at elego.de Wed Feb 17 12:25:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:25:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217112544.C37E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:25:44 Modified files: cm3/m3-libs/libm3/src/os/WIN32/: FSWin32.m3 FileWin32.m3 Log message: don't truncate file sizes to 32bits From jkrell at elego.de Wed Feb 17 12:43:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:43:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217114354.C6B212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:43:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 12:54:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:54:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217115443.E7E722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:54:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 13:17:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:17:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217121752.C30AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:17:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing: in particular I want to verify that 32bit div/mod doesn't generate a function call, when we alter m3cg From jkrell at elego.de Wed Feb 17 13:25:46 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:25:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217122547.038012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:25:46 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: we don't need m3_div, m3_divL, m3_mod, m3_modL We can "just" use gcc's support "directly". Granted, on many targets, that will generate calls to __divdi3, __udivdi3, __moddi3, __umoddi3, but heck, our hand.c code generated such calls as well, and for platforms for which gcc is not the compiler/linker, we have libgcc.c. This *might* be a deoptimization on some platforms, e.g. SOLsun. That is, if we are going to call a function, better to call their helpers instead of our libgcc stand-ins. However it is likely an optimization on all 64bit platforms all gcc platforms all 32bit operations leaving the deoptimization only on 32bit non-gcc platforms when using longint (Note that m3_divL, m3_modL still used by NT386; m3_div, m3_mod never were) From jkrell at elego.de Wed Feb 17 13:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217124556.0D9AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 13:55:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:55:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217125525.5CF8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:55:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: remove 32bit helpers: m3_div_old m3_div m3_mod_old m3_mod TestDiv32 leaving, at least, 64bit helpers for m3back: m3_div64 (Win32 only, else static) m3_mod64 (Win32 only, else static) From hosking at elego.de Wed Feb 17 22:40:49 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 17 Feb 2010 22:40:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217214049.A3D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/17 22:40:49 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: Add UNUSED_SIGN macro. From hosking at elego.de Thu Feb 18 03:33:15 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 3:33:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218023315.67F322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 03:33:15 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinRd.m3 M3CG_Rd.m3 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg cm3/m3-sys/m3front/src/builtinInfo/: InfoThisLine.m3 cm3/m3-sys/m3front/src/builtinOps/: BitSize.m3 Dec.m3 Number.m3 cm3/m3-sys/m3front/src/builtinWord/: And.mg Divide.mg Extract.mg GE.mg GT.mg Insert.mg LE.mg LT.mg Minus.mg Mod.mg Module.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddExpr.m3 AddressExpr.m3 ArrayExpr.m3 Expr.m3 IntegerExpr.m3 ModExpr.m3 ReelExpr.m3 SetExpr.m3 SubtractExpr.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Scanner.m3 TipeDesc.m3 cm3/m3-sys/m3front/src/stmts/: CaseStmt.m3 cm3/m3-sys/m3front/src/types/: ArrayType.m3 EnumType.m3 OpenArrayType.m3 SubrangeType.m3 Type.m3 cm3/m3-sys/m3tools/src/: M3Builtin.m3 M3Const.m3 M3Lexer.m3 M3Type.m3 Log message: Drastic simplification of TInt/TWord. These no longer simulate INTEGER arithmetic directly, but simply provide support for arithmetic up to the precision of any target. As a result, users of these interfaces must explicitly ensure that their results do not exceed the bounds of their target integer precision. One side-effect has been fixes to some remaining bugs in range-checking for CARDINAL/LONGCARD. Index: m3middle/src/M3CG_BinRd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_BinRd.m3,v retrieving revision 1.9 diff -c -r1.9 M3CG_BinRd.m3 *** m3middle/src/M3CG_BinRd.m3 11 Jan 2010 22:04:48 -0000 1.9 --- m3middle/src/M3CG_BinRd.m3 18 Feb 2010 02:30:47 -0000 *************** *** 407,426 **** | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, NUMBER (val.x), val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), NUMBER (byte.x), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN ! TWord.Subtract (TInt.Zero, val, val); ! END; RETURN val; END Scan_Tint; --- 407,424 ---- | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN TWord.Subtract (TInt.Zero, val, val); END; RETURN val; END Scan_Tint; Index: m3middle/src/M3CG_Rd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_Rd.m3,v retrieving revision 1.7 diff -c -r1.7 M3CG_Rd.m3 *** m3middle/src/M3CG_Rd.m3 30 Jan 2010 21:28:34 -0000 1.7 --- m3middle/src/M3CG_Rd.m3 18 Feb 2010 02:30:48 -0000 *************** *** 364,377 **** result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, NUMBER (result.x), result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), NUMBER (result.x), result) THEN ! RETURN result; ! END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), NUMBER (tmp.x), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; --- 364,375 ---- result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), result) THEN RETURN result END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; Index: m3middle/src/TInt.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.i3,v retrieving revision 1.25 diff -c -r1.25 TInt.i3 *** m3middle/src/TInt.i3 8 Feb 2010 16:42:41 -0000 1.25 --- m3middle/src/TInt.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,74 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! signed integer operations. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new target value, otherwise they return FALSE. *) ! FROM Target IMPORT Int, IBytes; CONST ! Zero = Int{NUMBER (IBytes), IBytes{ 0,0,..}}; ! One = Int{NUMBER (IBytes), IBytes{ 1,0,..}}; ! Two = Int{NUMBER (IBytes), IBytes{ 2,0,..}}; ! Three = Int{NUMBER (IBytes), IBytes{ 3,0,..}}; ! Four = Int{NUMBER (IBytes), IBytes{ 4,0,..}}; ! Eight = Int{NUMBER (IBytes), IBytes{ 8,0,..}}; ! Ten = Int{NUMBER (IBytes), IBytes{10,0,..}}; ! ThirtyOne = Int{NUMBER (IBytes), IBytes{31,0,..}}; ! ThirtyTwo = Int{NUMBER (IBytes), IBytes{32,0,..}}; ! SixtyThree= Int{NUMBER (IBytes), IBytes{63,0,..}}; ! SixtyFour = Int{NUMBER (IBytes), IBytes{64,0,..}}; ! F3FF = Int{NUMBER (IBytes), IBytes{16_FF,16_F3,0,..}}; ! x0400 = Int{NUMBER (IBytes), IBytes{0,4,0,..}}; ! x0800 = Int{NUMBER (IBytes), IBytes{0,8,0,..}}; ! x0F00 = Int{NUMBER (IBytes), IBytes{0,16_F,0,..}}; ! ! (* 'M' for Minus (negative) *) ! ! MOne = Int{NUMBER (IBytes), IBytes{16_FF,..}}; ! MThirtyOne = Int{NUMBER (IBytes), IBytes{16_E1,16_FF,..}}; ! MSixtyThree= Int{NUMBER (IBytes), IBytes{16_C1,16_FF,..}}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) - PROCEDURE IntI (READONLY x: Int; n: CARDINAL; VAR i: Int): BOOLEAN; - (* converts a target integer 'x' to a target integer 'i' *) - PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; n: CARDINAL; ! VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns a if a >= 0, -a if a < 0, or overflow *) - PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns '-a' unless there's an overflow *) - PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) --- 10,48 ---- (* Modula-3 target description ! This interface provides simulations of signed integer operations, ! at the maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new value, otherwise they return FALSE. *) ! FROM Target IMPORT Int; ! ! CONST Size = BITSIZE(Int); CONST ! Zero = Int{ 0, 0,..}; ! One = Int{ 1, 0,..}; ! MOne = Int{16_FF,..}; ! PROCEDURE FromInt (x: INTEGER; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) *************** *** 81,101 **** PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* returns 'a = b' *) - PROCEDURE NE (READONLY a, b: Int): BOOLEAN; - (* returns 'a # b' *) - PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* returns 'a < b' *) - PROCEDURE GT (READONLY a, b: Int): BOOLEAN; - (* returns 'a > b' *) - PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* returns 'a <= b' *) - PROCEDURE GE (READONLY a, b: Int): BOOLEAN; - (* returns 'a >= b' *) - PROCEDURE ToText (READONLY i: Int): TEXT; (* converts 'i' to a printable string. *) --- 55,66 ---- *************** *** 103,111 **** (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): INTEGER; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns -1 if 'buf' is too short. *) END TInt. --- 68,79 ---- (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): CARDINAL; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns 0 if 'buf' is too short. *) ! ! PROCEDURE Chop (VAR i: Int; n: CARDINAL); ! (* Extract the low-order 'n' bytes of 'i', sign extended. *) END TInt. Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.22 diff -c -r1.22 TInt.m3 *** m3middle/src/TInt.m3 10 Feb 2010 13:09:59 -0000 1.22 --- m3middle/src/TInt.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,15 **** MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; --- 9,15 ---- MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; *************** *** 17,109 **** And = Word.And; CONST ! Mask = 16_FF; ! SignMask = 16_80; ! Base = 16_100; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR r: Int): BOOLEAN = BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := And (x, Mask); x := x DIV Base; END; ! RETURN (n > 0) AND (x = 0 OR x = -1); END FromInt; ! TYPE Sign = {Bad, Neg, Pos}; ! ! PROCEDURE CheckSign (READONLY r: Int; n: CARDINAL): Sign = BEGIN ! <*ASSERT n # 0*> ! IF And (r.x[r.n-1], SignMask) = 0 THEN ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) # 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # 0 THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Pos; ! ELSE ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) = 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # Mask THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Neg; END; - END CheckSign; - PROCEDURE IntI (READONLY r: Int; n: CARDINAL; VAR x: Int): BOOLEAN = - VAR sign := CheckSign (r, n); j := 0; result := TRUE; - BEGIN - CASE sign OF - | Sign.Bad => result := FALSE; - | Sign.Pos => j := 0; - | Sign.Neg => j := Mask; - END; - x.n := n; - FOR i := 0 TO r.n-1 DO x.x[i] := r.x[i] END; - FOR i := r.n TO n-1 DO x.x[i] := j END; - RETURN result; - END IntI; - - PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = - VAR sign := CheckSign (r, BITSIZE (INTEGER) DIV BITSIZE (IByte)); - result := TRUE; - BEGIN (* ensure the result has the right sign extension *) ! CASE sign OF ! | Sign.Bad => result := FALSE; ! | Sign.Pos => x := 0; ! | Sign.Neg => x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := r.n-1 TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r.x[i]); END; ! RETURN result; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; n: CARDINAL; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; IF (NUMBER (x) = 1) THEN ! r.x[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r.x[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ! digit.x[0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; --- 17,74 ---- And = Word.And; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! SignMask = LShift (1, BITSIZE (IByte) - 1); ! Base = Mask + 1; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; + Ten = Int{10,0,..}; ! PROCEDURE FromInt (x: INTEGER; VAR r: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := And (x, Mask); x := x DIV Base; END; ! RETURN (x = 0 OR x = -1); END FromInt; ! PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = ! CONST Extras = BITSIZE (INTEGER) DIV BITSIZE (IByte); ! VAR j := 0; sign_chunk := MIN (Extras - 1, LAST(Int)); BEGIN ! (* check that any extra bits are the same as the sign bit *) ! IF And (r [sign_chunk], SignMask) # 0 THEN j := Mask; END; ! FOR i := Extras TO LAST(Int) DO ! IF r [i] # j THEN RETURN FALSE; END; END; (* ensure the result has the right sign extension *) ! IF j = 0 ! THEN x := 0; ! ELSE x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := LAST(Int) TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r[i]); END; ! RETURN TRUE; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! r := Zero; IF (NUMBER (x) = 1) THEN ! r[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Zero; FOR i := FIRST (x) TO LAST (x) DO ! digit [0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; *************** *** 113,206 **** PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - RETURN Subtract(Zero, a, r); - END Negate; - - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - IF GE(a, Zero) THEN - r := a; - RETURN TRUE; - END; - RETURN Negate(a, r); - END Abs; - PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! n := MIN (a.n, b.n); k, carry: INTEGER; q: Int; ! p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO k := i + j; ! carry := Word.Times (a.x[i], b.x[j]); WHILE carry # 0 DO ! carry := carry + p[k]; ! p[k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! r.n := n; FOR i := 0 TO n-1 DO r.x[i] := p[i]; END; ! q.n := n; FOR i := 0 TO n-1 DO q.x[i] := p[i+n]; END; (* compute the top half *) ! IF And (a.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! CASE CheckSign (r, n) OF ! | Sign.Bad => <*ASSERT FALSE*> ! | Sign.Pos => carry := 0; ! | Sign.Neg => carry := Mask; ! END; ! FOR i := 0 TO n-1 DO ! IF q.x[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; --- 78,145 ---- PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR carry := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a [i] + b [i] + carry; ! r [i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR borrow := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! k, carry: INTEGER; ! q: Int; ! p := ARRAY [0.. 2 * NUMBER(Int) - 1] OF IByte {0, ..}; BEGIN ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO k := i + j; ! carry := Word.Times (a [i], b [j]); WHILE carry # 0 DO ! carry := carry + p [k]; ! p [k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! FOR i := 0 TO LAST(Int) DO r[i] := p[i]; END; ! FOR i := 0 TO LAST(Int) DO q[i] := p[i+NUMBER(Int)]; END; (* compute the top half *) ! IF And (a [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! carry := 0; ! IF And (r [LAST(Int)], SignMask) # 0 THEN carry := Mask; END; ! FOR i := 0 TO LAST(Int) DO ! IF q[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; *************** *** 224,250 **** VAR num := a; den := b; ! num_neg: BOOLEAN; ! den_neg: BOOLEAN; ! n := MIN (a.n, b.n); ! a_sign := CheckSign (a, n); ! b_sign := CheckSign (b, n); ! min: Int; BEGIN - IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN - RETURN FALSE - END; - IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := a_sign = Sign.Neg; ! den_neg := b_sign = Sign.Neg; ! (* check for the only possible overflow: FIRST DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; --- 163,182 ---- VAR num := a; den := b; ! num_neg : BOOLEAN; ! den_neg : BOOLEAN; ! min : Int; BEGIN IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := And (a [LAST(Int)], SignMask) # 0; ! den_neg := And (b [LAST(Int)], SignMask) # 0; ! (* check for the only possible overflow: FIRST(Int) DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; *************** *** 296,327 **** *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN ! RETURN FALSE; ! END; ! FOR i := 0 TO n-1 DO ! IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := CheckSign (a, a.n); ! b_sign := CheckSign (b, b.n); ! n := MIN (a.n, b.n); ! BEGIN ! <*ASSERT a_sign # Sign.Bad*> ! <*ASSERT b_sign # Sign.Bad*> ! IF (a_sign # b_sign) THEN RETURN (a_sign = Sign.Neg); END; ! ! IF CheckSign (a, n) = Sign.Bad THEN RETURN a_sign = Sign.Neg END; ! IF CheckSign (b, n) = Sign.Bad THEN RETURN b_sign = Sign.Pos END; ! ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; --- 228,249 ---- *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! IF a[i] # b[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! BEGIN ! IF (a_sign # b_sign) THEN RETURN (a_sign # 0); END; ! ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; *************** *** 333,355 **** RETURN EQ (a, b) OR LT (a, b); END LE; - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN NOT EQ (a, b); - END NE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT (b, a); - END GT; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; --- 255,262 ---- RETURN EQ (a, b) OR LT (a, b); END LE; PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result: ARRAY [0..BITSIZE (Int)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; *************** *** 360,369 **** minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; rr := r; ! quo, rem, min: Int; ! n := r.n; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; --- 267,276 ---- minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..Size] OF CHAR; rr := r; ! quo, rem: Int; ! min : Int; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; *************** *** 372,381 **** ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r.x[n-1], SignMask) # 0 THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; --- 279,288 ---- ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r [LAST(Int)], SignMask) # 0 THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST(Int) a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; *************** *** 386,397 **** (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem.x [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST *) IF (bump) THEN result [nDigits] := '0'; j := 0; --- 293,304 ---- (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST (Int) *) IF (bump) THEN result [nDigits] := '0'; j := 0; *************** *** 399,405 **** i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; --- 306,312 ---- i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; *************** *** 416,422 **** (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO --- 323,329 ---- (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO *************** *** 426,447 **** RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): INTEGER = ! VAR n := r.n; j := 0; k := n; BEGIN (* strip the sign extension *) ! IF And (r.x[n-1], SignMask) # 0 THEN j := Mask END; ! FOR i := n-1 TO 0 BY -1 DO ! IF r.x[i] # j THEN EXIT END; ! DEC (k); ! END; ! <* ASSERT (k = 0) = (EQ(r, Zero) OR EQ(r, MOne)) *> ! INC(k, ORD(k = 0)); (* increment if 0 *) ! IF k > NUMBER (buf) THEN RETURN -1 END; (* unpack the bytes *) ! FOR i := 0 TO k-1 DO buf[i] := r.x[i] END; ! RETURN k; END ToBytes; BEGIN END TInt. --- 333,365 ---- RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): CARDINAL = ! VAR j := NUMBER(Int); BEGIN (* strip the sign extension *) ! DEC (j); ! IF (r[j] = 0) THEN ! WHILE (j > 0) AND (r[j] = 0) AND (r[j-1] < 16_80) DO DEC (j); END; ! ELSIF (r[j] = 16_ff) THEN ! WHILE (j > 0) AND (r[j] = 16_ff) AND (r[j-1] >= 16_80) DO DEC (j); END; ! END; ! INC (j); ! ! IF j > NUMBER (buf) THEN RETURN 0 END; ! (* unpack the bytes *) ! FOR i := 0 TO j-1 DO buf[i] := r[i] END; ! ! RETURN j; END ToBytes; + PROCEDURE Chop (VAR r: Int; n: CARDINAL) = + BEGIN + IF And (r [n-1], SignMask) = 0 + THEN FOR i := n TO LAST(Int) DO r [i] := 0 END; + ELSE FOR i := n TO LAST(Int) DO r [i] := Mask END; + END; + END Chop; + BEGIN END TInt. Index: m3middle/src/TWord.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.i3,v retrieving revision 1.8 diff -c -r1.8 TWord.i3 *** m3middle/src/TWord.i3 24 Jan 2010 12:29:14 -0000 1.8 --- m3middle/src/TWord.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,17 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! unsigned integer operations. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, --- 10,17 ---- (* Modula-3 target description ! This interface provides simulations of unsigned integer operations, at the ! maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, *************** *** 20,26 **** FROM Target IMPORT Int; ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) --- 20,28 ---- FROM Target IMPORT Int; ! CONST Size = BITSIZE(Int); ! ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) *************** *** 43,54 **** PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* a < b *) ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* a <= b *) ! PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* a = b *) ! PROCEDURE NE (READONLY a, b: Int): BOOLEAN; (* a # b *) ! PROCEDURE GE (READONLY a, b: Int): BOOLEAN; (* a >= b *) ! PROCEDURE GT (READONLY a, b: Int): BOOLEAN; (* a > b *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) --- 45,55 ---- PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LT (a, b)' *) ! ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LE (a, b)' *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) *************** *** 62,83 **** PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (x, n)' *) ! PROCEDURE LeftShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.LeftShift (x, n)' *) ! PROCEDURE RightShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.RightShift (x, n)' *) ! PROCEDURE Rotate (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Rotate (x, n)' *) ! PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (x, i, n)' *) ! PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (x, y, i, n)' *) END TWord. --- 63,84 ---- PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (a, b)' *) ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.LeftShift (a, b)' *) ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.RightShift (a, b)' *) ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int); ! (* returns 'Word.Rotate (a, b)' *) ! PROCEDURE Extract (READONLY a: Int; b, c: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (a, b, c)' *) ! PROCEDURE Insert (READONLY a, b: Int; c, d: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (a, b, c, d)' *) END TWord. Index: m3middle/src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.15 diff -c -r1.15 TWord.m3 *** m3middle/src/TWord.m3 10 Feb 2010 16:33:10 -0000 1.15 --- m3middle/src/TWord.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,32 **** MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = 16_FF; ! Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; ! VAR r: Int): BOOLEAN = ! VAR rr: IBytes; digit: INTEGER; ch: CHAR; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); --- 9,30 ---- MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! Base = Mask + 1; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; VAR r: Int): BOOLEAN = ! VAR rr: Int; digit: INTEGER; ch: CHAR; BEGIN ! r := TInt.Zero; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); *************** *** 36,49 **** END; (* rr := r * base *) ! rr := IBytes {0,..}; ! FOR i := 0 TO n-1 DO ! VAR carry := Word.Times (r.x[i], base); BEGIN ! FOR j := i TO n-1 DO IF carry = 0 THEN EXIT END; ! INC (carry, rr[j]); ! rr[j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 34,47 ---- END; (* rr := r * base *) ! rr := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! VAR carry := Word.Times (r[i], base); BEGIN ! FOR j := i TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! INC (carry, rr [j]); ! rr [j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 53,61 **** (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO n-1 DO ! INC (carry, rr[i]); ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 51,59 ---- (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO LAST(Int) DO ! INC (carry, rr [i]); ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 66,106 **** END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO ! carry := Word.Times (a.x[i], b.x[j]); ! FOR k := i + j TO n-1 DO IF carry = 0 THEN EXIT END; ! carry := carry + r.x[k]; ! r.x[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; --- 64,99 ---- END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a[i] + b[i] + carry; ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; BEGIN ! r := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO ! carry := Word.Times (a[i], b[j]); ! FOR k := i + j TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! carry := carry + r[k]; ! r[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; *************** *** 136,168 **** quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den: ARRAY [0..NUMBER (IBytes)+1] OF INTEGER; ! n := MIN (x.n, y.n); BEGIN - <*ASSERT n # 0*> (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO n-1 DO ! num[i] := x.x[i]; IF num[i] # 0 THEN max_num := i END; ! den[i] := y.x[i]; IF den[i] # 0 THEN max_den := i END; ! END; ! FOR i := n TO LAST (num) DO ! num[i] := 0; ! den[i] := 0; END; ! q := Int{n}; ! r := Int{n}; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q.x [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r.x[0] := carry; RETURN; END; --- 129,155 ---- quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den := ARRAY [0..NUMBER (Int)+1] OF INTEGER {0,..}; BEGIN (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO LAST(Int) DO ! num[i] := x[i]; IF num[i] # 0 THEN max_num := i; END; ! den[i] := y[i]; IF den[i] # 0 THEN max_den := i; END; END; ! q := TInt.Zero; ! r := TInt.Zero; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r[0] := carry; RETURN; END; *************** *** 237,243 **** END; (* store the quotient digit. *) ! q.x [i - 1] := quo_est; END; (* finally, compute the remainder *) --- 224,230 ---- END; (* store the quotient digit. *) ! q [i - 1] := quo_est; END; (* finally, compute the remainder *) *************** *** 246,420 **** END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; - PROCEDURE xEQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); - BEGIN - <*ASSERT n # 0*> - FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN - RETURN FALSE; - END; - END; - FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; - FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN FALSE END END; - RETURN TRUE; - END xEQ; - - PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR x := xEQ(a, b); - BEGIN - <* ASSERT x = xEQ(b, a) *> - <* ASSERT x = (LE(a, b) AND LE(b, a)) *> - RETURN x; - END EQ; - - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - VAR x := NOT xEQ(a, b); - BEGIN - <* ASSERT x = (NOT xEQ(b, a)) *> - <* ASSERT x = (LT(a, b) OR LT(b, a)) *> - RETURN x; - END NE; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT(b, a); - END GT; - PROCEDURE And (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (a.x[i], b.x[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Or (a.x[i], b.x[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Xor (a.x[i], b.x[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = - VAR n := a.n; BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (Word.Not (a.x[i]), Mask); END; END Not; ! PROCEDURE LeftShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := n-1 TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a.x[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a.x[z-1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! IF z <= n-1 THEN x1 := RShift (a.x[z], i); END; ! IF z+1 <= n-1 THEN x2 := LShift (a.x[z+1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END RightShift; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF b > 0 THEN (* left shift *) ! LeftShift(a, b, r); ! ELSE (* right shift *) ! RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: IBytes; ! n := a.n; size := n * BITSIZE (IByte); BEGIN - <*ASSERT n # 0*> b := b MOD size; IF b = 0 THEN --- 233,338 ---- END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; PROCEDURE And (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (a [i], b[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Or (a [i], b[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Xor (a [i], b[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (Word.Not (a [i]), Mask); END; END Not; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF ABS (b) >= Size THEN ! r := TInt.Zero; ! ELSIF b > 0 ! THEN LeftShift(a, b, r); ! ELSE RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := LAST(Int) TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a[z-1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO LAST(Int) DO z := k + w; x1 := 0; x2 := 0; ! IF z <= LAST(Int) THEN x1 := RShift (a[z], i); END; ! IF z+1 <= LAST(Int) THEN x2 := LShift (a[z+1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END RightShift; ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: Int; ! size := n * BITSIZE (IByte); BEGIN b := b MOD size; IF b = 0 THEN *************** *** 426,436 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a.x[z MOD n], i); ! x2 := RShift (a.x[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); --- 344,354 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a[z MOD n], i); ! x2 := RShift (a[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); *************** *** 438,485 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a.x[z MOD n], i); ! x2 := LShift (a.x[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r.x[w] := Word.And (r.x[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST (IBytes) DO r.x[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i + n, yy); ! LeftShift (yy, n, r); ! LeftShift (y, size - n, yy); ! RightShift (yy, size - n, yyy); Or (r, yyy, r); ! LeftShift (r, i, yyyy); r := yyyy; ! LeftShift (x, size - i, yy); ! RightShift (yy, size - i, yyy); Or (r, yyy, r); RETURN TRUE; --- 356,401 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a[z MOD n], i); ! x2 := LShift (a[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r[w] := Word.And (r[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST(Int) DO r[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -(i + n), yy); ! Shift (yy, n, r); ! Shift (y, Size - n, yy); ! Shift (yy, -(Size - n), yyy); Or (r, yyy, r); ! Shift (r, i, yyyy); r := yyyy; ! Shift (x, Size - i, yy); ! Shift (yy, -(Size - i), yyy); Or (r, yyy, r); RETURN TRUE; Index: m3middle/src/Target.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.i3,v retrieving revision 1.49 diff -c -r1.49 Target.i3 *** m3middle/src/Target.i3 8 Feb 2010 16:00:54 -0000 1.49 --- m3middle/src/Target.i3 18 Feb 2010 02:30:49 -0000 *************** *** 191,210 **** (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target INTEGER (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) RECORD ! n: CARDINAL; (* only bytes [0..n-1] contain valid bits *) ! x := IBytes{0,..}; (* default is Zero *) ! END; ! IBytes = ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; - PROCEDURE TargetIntToDiagnosticText(a: Int): TEXT; - TYPE Int_type = RECORD cg_type : CGType; (* representation *) --- 191,204 ---- (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target integer (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; TYPE Int_type = RECORD cg_type : CGType; (* representation *) Index: m3middle/src/Target.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.m3,v retrieving revision 1.85 diff -c -r1.85 Target.m3 *** m3middle/src/Target.m3 8 Feb 2010 07:17:14 -0000 1.85 --- m3middle/src/Target.m3 18 Feb 2010 02:30:49 -0000 *************** *** 8,33 **** MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils, Fmt; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; - 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; - PROCEDURE Init64 () = BEGIN Integer := Int64; --- 8,18 ---- MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; PROCEDURE Init64 () = BEGIN Integer := Int64; *************** *** 82,131 **** Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{NUMBER(IBytes), IBytes{16_80,FF,..}}; ! Int8.max := Int{NUMBER(IBytes), IBytes{16_7f,00,..}}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{NUMBER(IBytes), IBytes{00,16_80,FF,..}}; ! Int16.max := Int{NUMBER(IBytes), IBytes{FF,16_7f,00,..}}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{NUMBER(IBytes), IBytes{00,00,00,16_80,FF,..}}; ! Int32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,16_7f,00,..}}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,16_80}}; ! Int64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,16_7f}}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{NUMBER(IBytes), IBytes{00,00,..}}; ! Word8.max := Int{NUMBER(IBytes), IBytes{FF,00,..}}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{NUMBER(IBytes), IBytes{00,00,00,..}}; ! Word16.max := Int{NUMBER(IBytes), IBytes{FF,FF,00,..}}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,..}}; ! Word32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,00,..}}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,00}}; ! Word64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,FF}}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; --- 67,116 ---- Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{16_80,FF,..}; ! Int8.max := Int{16_7f,00,..}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{00,16_80,FF,..}; ! Int16.max := Int{FF,16_7f,00,..}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{00,00,00,16_80,FF,..}; ! Int32.max := Int{FF,FF,FF,16_7f,00,..}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{00,00,00,00,00,00,00,16_80}; ! Int64.max := Int{FF,FF,FF,FF,FF,FF,FF,16_7f}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{00,00,..}; ! Word8.max := Int{FF,00,..}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{00,00,00,..}; ! Word16.max := Int{FF,FF,00,..}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{00,00,00,00,00,..}; ! Word32.max := Int{FF,FF,FF,FF,00,..}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{00,00,00,00,00,00,00,00}; ! Word64.max := Int{FF,FF,FF,FF,FF,FF,FF,FF}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; *************** *** 137,144 **** Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0}; ! Void.max := Int{0}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; --- 122,129 ---- Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0,..}; ! Void.max := Int{0,..}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; Index: m3back/src/Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.79 diff -c -r1.79 Codex86.m3 *** m3back/src/Codex86.m3 15 Feb 2010 17:48:57 -0000 1.79 --- m3back/src/Codex86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 9,15 **** MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord; FROM TargetMap IMPORT CG_Bytes; --- 9,15 ---- MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord, Text; FROM TargetMap IMPORT CG_Bytes; *************** *** 18,24 **** FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize, TZero; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; --- 18,24 ---- FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; *************** *** 252,258 **** op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TZero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; --- 252,258 ---- op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TInt.Zero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; *************** *** 379,392 **** PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; ! IF TInt.GE(imm, Target.Int8.min) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; --- 379,395 ---- PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; ! IF TInt.LE(Target.Int8.min, imm) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; *************** *** 465,473 **** t.set_label(compare_label); | Op.oSHL => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); --- 468,476 ---- t.set_label(compare_label); | Op.oSHL => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); *************** *** 482,490 **** END | Op.oSHR => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); --- 485,493 ---- END | Op.oSHR => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); *************** *** 513,518 **** --- 516,522 ---- PROCEDURE binOp1WithShiftCount (t: T; op: Op; READONLY dest, src: Operand; READONLY shiftCount: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT NOT Is64(src.optype) *> *************** *** 549,559 **** <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.GE(shiftCount.imm, Target.Int8.min) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; ELSE --- 553,564 ---- <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.LE(Target.Int8.min, shiftCount.imm) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(shiftCount.imm, buf)))); END; ins.imsize := 1; ELSE *************** *** 908,916 **** PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> --- 913,924 ---- PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> *************** *** 921,927 **** ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TZero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; --- 929,935 ---- ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TInt.Zero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; *************** *** 934,940 **** PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, BYTESIZE(imm), immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); --- 942,948 ---- PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); *************** *** 942,954 **** PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 950,966 ---- PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("pushOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1073,1079 **** unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TZero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> --- 1085,1091 ---- unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TInt.Zero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> *************** *** 1104,1109 **** --- 1116,1122 ---- PROCEDURE imulOp (t: T; READONLY dest, src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register *> <* ASSERT src.loc # OLoc.mem OR CG_Bytes[src.mvar.mvar_type] = 4 *> *************** *** 1111,1118 **** IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("imulOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 1124,1134 ---- IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("imulOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1195,1201 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) --- 1211,1217 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) *************** *** 1221,1227 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) --- 1237,1243 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) *************** *** 1479,1492 **** PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) AND (NOT TWord.LE(val.imm, Target.Word32.max)) THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(val.imm)); END; ins.imsize := CG_Bytes[type]; END; --- 1495,1512 ---- PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) ! AND (NOT TWord.LE(val.imm, Target.Word32.max)) ! THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(val.imm, buf)))); END; ins.imsize := CG_Bytes[type]; END; *************** *** 2324,2330 **** 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); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; --- 2344,2350 ---- WHILE f_lit # NIL DO FOR i := 0 TO f_lit.flit_size - 1 DO ! EVAL TInt.FromInt(f_lit.arr[i], tint); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; *************** *** 2332,2338 **** END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TZero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; --- 2352,2358 ---- END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TInt.Zero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; Index: m3back/src/M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.126 diff -c -r1.126 M3x86.m3 *** m3back/src/M3x86.m3 15 Feb 2010 17:58:21 -0000 1.126 --- m3back/src/M3x86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 1105,1117 **** pad_init(u, o); len := TInt.ToBytes(value, bytes); - IF NOT (len <= NUMBER(bytes) AND len <= CG_Bytes[t] AND len > 0) THEN - u.Err("init_int: len:" & Fmt.Int(len) & " type:" & Target.TypeNames[t] & " value:" & Target.TargetIntToDiagnosticText(value)); - END; <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TZero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; --- 1105,1114 ---- pad_init(u, o); len := TInt.ToBytes(value, bytes); <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TInt.Zero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; *************** *** 1506,1512 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; --- 1503,1509 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; *************** *** 1520,1526 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; --- 1517,1523 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; *************** *** 1802,1808 **** END; u.vstack.unlock(); ! u.vstack.pushimmT(TZero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = --- 1799,1805 ---- END; u.vstack.unlock(); ! u.vstack.pushimmT(TInt.Zero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = *************** *** 2166,2172 **** pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TZero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; --- 2163,2169 ---- pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TInt.Zero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; *************** *** 2323,2336 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR TInt.NE(u.vstack.op(stack1).imm, TZero) THEN (* shift non-constant *) --- 2320,2333 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero) THEN (* shift non-constant *) *************** *** 2385,2391 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); --- 2382,2388 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); *************** *** 2395,2401 **** (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (TInt.NE(u.vstack.op(stack1).imm, TZero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; --- 2392,2398 ---- (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; *************** *** 2452,2458 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2449,2456 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2505,2511 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2503,2510 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2749,2757 **** u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in copy_n"); END; --- 2748,2756 ---- u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in copy_n"); END; *************** *** 2806,2815 **** IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN --- 2805,2814 ---- IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN *************** *** 2940,2948 **** u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in zero_n"); END; --- 2939,2947 ---- u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in zero_n"); END; *************** *** 2953,2959 **** start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TZero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); --- 2952,2958 ---- start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TInt.Zero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); *************** *** 3013,3019 **** stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, stop0, i * size, faketype[size]); END END --- 3012,3018 ---- stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TInt.Zero, optype := t }, stop0, i * size, faketype[size]); END END *************** *** 3155,3168 **** u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TZero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TZero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); --- 3154,3167 ---- u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TInt.Zero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); *************** *** 3194,3200 **** END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.GE(u.vstack.lower(u.vstack.reg(stack0)), i) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); --- 3193,3199 ---- END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.LE(i, u.vstack.lower(u.vstack.reg(stack0))) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); *************** *** 3232,3238 **** u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.GT(u.vstack.lower(u.vstack.reg(stack0)), i) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); --- 3231,3237 ---- u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.LT(i, u.vstack.lower(u.vstack.reg(stack0))) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); *************** *** 3279,3287 **** reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.GE(lo, a) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TZero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); --- 3278,3286 ---- reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.LE(a, lo) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TInt.Zero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); *************** *** 3457,3463 **** u.wr.NL (); END; ! IF NOT TInt.FromInt(i, Target.Integer.bytes, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; --- 3456,3462 ---- u.wr.NL (); END; ! IF NOT TInt.FromInt(i, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; *************** *** 3642,3650 **** IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Four); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Eight); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE --- 3641,3649 ---- IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{4,0,..}); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{8,0,..}); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE *************** *** 3694,3706 **** WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, Target.Integer.bytes, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.GT(ts, TInt.ThirtyTwo) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); --- 3693,3705 ---- WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.LT(Target.Int{32,0,..}, ts) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); *************** *** 3880,3886 **** IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); --- 3879,3885 ---- IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); *************** *** 3939,3945 **** (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; --- 3938,3944 ---- (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; *************** *** 4027,4033 **** u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TZero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], --- 4026,4032 ---- u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TInt.Zero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], *************** *** 4047,4053 **** IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TZero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); --- 4046,4052 ---- IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TInt.Zero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); *************** *** 4060,4066 **** PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TZero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); --- 4059,4065 ---- PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TInt.Zero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); Index: m3back/src/M3x86Rep.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86Rep.i3,v retrieving revision 1.28 diff -c -r1.28 M3x86Rep.i3 *** m3back/src/M3x86Rep.i3 14 Feb 2010 08:35:08 -0000 1.28 --- m3back/src/M3x86Rep.i3 18 Feb 2010 02:30:50 -0000 *************** *** 146,161 **** PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST TZero = TInt.Zero; ! CONST UnsignedType = ARRAY IType OF IType { Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { TInt.ThirtyOne, TInt.ThirtyOne, ! TInt.SixtyThree, TInt.SixtyThree }; ! ! CONST MinimumShift = ARRAY IType OF Target.Int { TInt.MThirtyOne, TInt.MThirtyOne, ! TInt.MSixtyThree, TInt.MSixtyThree }; CONST BitCountMask = MaximumShift; --- 146,162 ---- PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST UnsignedType = ARRAY IType OF IType { ! Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; ! CONST MinimumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; CONST BitCountMask = MaximumShift; Index: m3back/src/Stackx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Stackx86.m3,v retrieving revision 1.93 diff -c -r1.93 Stackx86.m3 *** m3back/src/Stackx86.m3 14 Feb 2010 13:23:42 -0000 1.93 --- m3back/src/Stackx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 16,22 **** FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize, TZero; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; --- 16,22 ---- FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; *************** *** 101,107 **** Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TZero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; --- 101,107 ---- Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TInt.Zero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; *************** *** 780,786 **** PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, Target.Integer.bytes, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); --- 780,786 ---- PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); *************** *** 974,983 **** WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, Target.Integer.bytes, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, Target.Integer.bytes, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN --- 974,983 ---- WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN *************** *** 1234,1240 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1234,1240 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1294,1300 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1294,1300 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1323,1329 **** IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.GT(imm, Target.Int8.max) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE --- 1323,1329 ---- IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.LT(Target.Int8.max, imm) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE *************** *** 1347,1353 **** WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Negate(stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; --- 1347,1353 ---- WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; *************** *** 1367,1380 **** WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Abs(stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TZero); lab := t.cg.reserve_labels(1, TRUE); --- 1367,1382 ---- WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF TInt.LT (stop0.imm, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); ! END; END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); lab := t.cg.reserve_labels(1, TRUE); *************** *** 1426,1452 **** (* shift non-constant by a constant *) ! IF TInt.NE(stop0.imm, TZero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, MaximumShift[type]) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.GT(stop0.imm, TZero) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; --- 1428,1454 ---- (* shift non-constant by a constant *) ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.LT(MaximumShift[type], stop0.imm) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.LT(TInt.Zero, stop0.imm) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; *************** *** 1461,1467 **** END ELSE ! IF ((stop1.loc # OLoc.imm) OR (TInt.NE(stop1.imm, TZero))) THEN (* shift by a non-constant *) --- 1463,1469 ---- END ELSE ! IF ((stop1.loc # OLoc.imm) OR (NOT TInt.EQ(stop1.imm, TInt.Zero))) THEN (* shift by a non-constant *) *************** *** 1476,1482 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); --- 1478,1484 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); *************** *** 1484,1490 **** t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); --- 1486,1492 ---- t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); *************** *** 1494,1500 **** t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); --- 1496,1502 ---- t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); *************** *** 1528,1536 **** IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, stop1.imm); ELSE ! IF TInt.NE(stop0.imm, TZero) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1530,1539 ---- IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, ! Target.Integer.bytes, stop1.imm); ELSE ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1538,1548 **** find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, TZero) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); --- 1541,1551 ---- find(t, stack1, Force.anytemp); ! IF TInt.LT(TInt.Zero, stop0.imm) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); *************** *** 1554,1560 **** END ELSE ! IF ((stop0.loc # OLoc.imm) OR (TInt.NE(stop0.imm, TZero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1557,1563 ---- END ELSE ! IF ((stop0.loc # OLoc.imm) OR (NOT TInt.EQ(stop0.imm, TInt.Zero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1567,1573 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); --- 1570,1576 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); *************** *** 1705,1715 **** find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(TInt.ThirtyTwo, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; --- 1708,1718 ---- find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(Target.Int{32,0,..}, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; *************** *** 1759,1765 **** IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF TInt.NE(tint, TZero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; --- 1762,1768 ---- IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF NOT TInt.EQ(tint, TInt.Zero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; *************** *** 1770,1783 **** IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); --- 1773,1786 ---- IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); *************** *** 1790,1796 **** END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); --- 1793,1799 ---- END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); *************** *** 1858,1864 **** t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF TInt.NE(stop1.imm, TZero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END --- 1861,1867 ---- t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF NOT TInt.EQ(stop1.imm, TInt.Zero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END *************** *** 1997,2003 **** END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); --- 2000,2006 ---- END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); *************** *** 2008,2014 **** TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF TWord.NE(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE --- 2011,2017 ---- TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF NOT TInt.EQ(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE *************** *** 2021,2032 **** TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; --- 2024,2035 ---- TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; *************** *** 2209,2215 **** find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN --- 2212,2218 ---- find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN *************** *** 2244,2250 **** END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, Target.Integer.bytes, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); --- 2247,2253 ---- END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); *************** *** 2383,2391 **** t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], TInt.F3FF); ! IF TInt.NE(t.rmode[mode], TZero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; --- 2386,2394 ---- t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], Target.Int{16_FF,16_F3,0,..}); ! IF NOT TInt.EQ(t.rmode[mode], TInt.Zero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; *************** *** 2540,2546 **** END; t.rmode := ARRAY FlToInt OF Target.Int ! { TZero, TInt.x0400, TInt.x0800, TInt.x0F00 }; t.lowset_table := NIL; t.highset_table := NIL; END init; --- 2543,2552 ---- END; t.rmode := ARRAY FlToInt OF Target.Int ! { Target.Int{0,0,0,..}, ! Target.Int{0,4,0,..}, ! Target.Int{0,8,0,..}, ! Target.Int{0,16_F,0,..}}; t.lowset_table := NIL; t.highset_table := NIL; END init; *************** *** 2633,2639 **** IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TZero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN --- 2639,2645 ---- IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TInt.Zero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN Index: m3back/src/Wrx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Wrx86.m3,v retrieving revision 1.6 diff -c -r1.6 Wrx86.m3 *** m3back/src/Wrx86.m3 15 Feb 2010 17:45:22 -0000 1.6 --- m3back/src/Wrx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 153,164 **** PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; - len := TargetInt.ToChars (i, buf); BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, len)); ! OutC (t, ' '); ! OutT (t, Target.TargetIntToDiagnosticText(i)); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = --- 153,161 ---- PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, TargetInt.ToChars (i, buf))); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = Index: m3front/src/builtinAtomic/AtomicModule.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinAtomic/AtomicModule.mg,v retrieving revision 1.2 diff -c -r1.2 AtomicModule.mg *** m3front/src/builtinAtomic/AtomicModule.mg 4 Feb 2010 02:11:30 -0000 1.2 --- m3front/src/builtinAtomic/AtomicModule.mg 18 Feb 2010 02:30:51 -0000 *************** *** 10,20 **** Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, TInt; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); --- 10,26 ---- Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, Target; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = + CONST + Zero = Target.Int{0,0,..}; + One = Target.Int{1,0,..}; + Two = Target.Int{2,0,..}; + Three = Target.Int{3,0,..}; + Four = Target.Int{4,0,..}; VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); *************** *** 40,55 **** elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), TInt.Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), TInt.One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), TInt.Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), TInt.Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), TInt.Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, TInt.Four); IsLockFree.Initialize (); Store.Initialize (); --- 46,61 ---- elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, Four); IsLockFree.Initialize (); Store.Initialize (); Index: m3front/src/builtinInfo/InfoThisLine.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinInfo/InfoThisLine.m3,v retrieving revision 1.4 diff -c -r1.4 InfoThisLine.m3 *** m3front/src/builtinInfo/InfoThisLine.m3 18 Sep 2007 20:25:21 -0000 1.4 --- m3front/src/builtinInfo/InfoThisLine.m3 18 Feb 2010 02:30:51 -0000 *************** *** 28,34 **** BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, Target.Integer.bytes, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; --- 28,34 ---- BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; Index: m3front/src/builtinOps/BitSize.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/BitSize.m3,v retrieving revision 1.3 diff -c -r1.3 BitSize.m3 *** m3front/src/builtinOps/BitSize.m3 18 Sep 2007 20:25:35 -0000 1.3 --- m3front/src/builtinOps/BitSize.m3 18 Feb 2010 02:30:51 -0000 *************** *** 111,121 **** IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, Target.Integer.bytes, size) ! AND TInt.FromInt (unit, Target.Integer.bytes, a) ! AND TInt.FromInt (unit - 1, Target.Integer.bytes, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; --- 111,123 ---- IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, size) ! AND TInt.FromInt (unit, a) ! AND TInt.FromInt (unit - 1, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) + AND NOT TInt.LT (d, Target.Integer.min) + AND NOT TInt.LT (Target.Integer.max, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; Index: m3front/src/builtinOps/Dec.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Dec.m3,v retrieving revision 1.12 diff -c -r1.12 Dec.m3 *** m3front/src/builtinOps/Dec.m3 10 Jan 2010 10:46:35 -0000 1.12 --- m3front/src/builtinOps/Dec.m3 18 Feb 2010 02:30:51 -0000 *************** *** 71,77 **** dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); --- 71,77 ---- dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! tmin, tmax, bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); *************** *** 79,100 **** THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSIF tlhs = LInt.T ! THEN dec := IntegerExpr.New (LInt.T, TInt.One); Expr.Prep (dec); ! ELSE dec := IntegerExpr.New (Int.T, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF tlhs = LInt.T THEN ! IF TInt.LT (Target.Longint.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Longint.max) THEN INC (check, 2) END; ! ELSE ! IF TInt.LT (Target.Integer.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Integer.max) THEN INC (check, 2) END; ! END; END; Expr.CompileLValue (lhs, traced := FALSE); --- 79,94 ---- THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; + EVAL Type.GetBounds (tlhs, tmin, tmax); IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSE dec := IntegerExpr.New (tlhs, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF TInt.LT (tmin, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, tmax) THEN INC (check, 2) END; END; Expr.CompileLValue (lhs, traced := FALSE); Index: m3front/src/builtinOps/Number.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Number.m3,v retrieving revision 1.4 diff -c -r1.4 Number.m3 *** m3front/src/builtinOps/Number.m3 18 Sep 2007 20:25:36 -0000 1.4 --- m3front/src/builtinOps/Number.m3 18 Feb 2010 02:30:51 -0000 *************** *** 64,70 **** e := ce.args[0]; t, index, element: Type.T; min, max, tmp, num: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN IF NOT TypeExpr.Split (e, t) THEN t := Expr.TypeOf (e) END; IF ArrayType.Split (t, index, element) THEN t := index END; --- 64,69 ---- *************** *** 77,83 **** IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); --- 76,83 ---- IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); *************** *** 90,96 **** PROCEDURE Fold (ce: CallExpr.T): Expr.T = VAR min, max, tmp, num: Target.Int; t, index, elem: Type.T; e: Expr.T; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN e := ce.args[0]; IF NOT TypeExpr.Split (e, t) THEN --- 90,95 ---- *************** *** 102,108 **** IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; --- 101,109 ---- IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (num, Target.Integer.max) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; *************** *** 114,120 **** IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; --- 115,122 ---- IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; Index: m3front/src/builtinWord/And.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/And.mg,v retrieving revision 1.1 diff -c -r1.1 And.mg *** m3front/src/builtinWord/And.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/And.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,17 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.And (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Divide.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Divide.mg,v retrieving revision 1.1 diff -c -r1.1 Divide.mg *** m3front/src/builtinWord/Divide.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Divide.mg 18 Feb 2010 02:30:51 -0000 *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Extract.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Extract.mg,v retrieving revision 1.1 diff -c -r1.1 Extract.mg *** m3front/src/builtinWord/Extract.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Extract.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 32,67 **** IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Integer_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Integer_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Integer_types[rep].size - i2, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Integer_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Integer_types[rep].size - i1, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) --- 32,65 ---- IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Word_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Word_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Word_types[rep].size - i2, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Word_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Word_types[rep].size - i1, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) *************** *** 72,79 **** CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); --- 70,76 ---- CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); *************** *** 85,91 **** CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; --- 82,88 ---- CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; *************** *** 95,115 **** BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) AND (0 <= i) AND (i <= Integer_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.ToInt (e1, i1)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 92,114 ---- BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) ! AND (0 <= i) AND (i <= Word_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! IF (e0 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT GetBitIndex (ce.args[1], i1) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR i1 + i2 > Word_types[rep].size ! OR NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; *************** *** 117,123 **** VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Integer_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; --- 116,122 ---- VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Word_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; Index: m3front/src/builtinWord/GE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GE.mg,v retrieving revision 1.1 diff -c -r1.1 GE.mg *** m3front/src/builtinWord/GE.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/GT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GT.mg,v retrieving revision 1.1 diff -c -r1.1 GT.mg *** m3front/src/builtinWord/GT.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Insert.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Insert.mg,v retrieving revision 1.1 diff -c -r1.1 Insert.mg *** m3front/src/builtinWord/Insert.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Insert.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 30,37 **** CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); --- 30,36 ---- CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); *************** *** 45,70 **** CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Integer_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2, e3: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; ! t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! e3 := Expr.ConstValue (ce.args[3]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.Split (e1, w1, t)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! (e3 = NIL) OR (NOT IntegerExpr.ToInt (e3, i3)) OR ! NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 44,77 ---- CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Word_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; + PROCEDURE GetBitIndex (e: Expr.T; VAR i: INTEGER): BOOLEAN = + BEGIN + e := Expr.ConstValue (e); + IF (e = NIL) THEN RETURN FALSE END; + RETURN IntegerExpr.ToInt (e, i) + AND (0 <= i) AND (i <= Word_types[rep].size); + END GetBitIndex; + PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! IF (e0 = NIL) OR (e1 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT IntegerExpr.Split (e1, w1, t) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR NOT GetBitIndex (ce.args[3], i3) ! OR i2 + i3 > Word_types[rep].size ! OR NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; Index: m3front/src/builtinWord/LE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LE.mg,v retrieving revision 1.1 diff -c -r1.1 LE.mg *** m3front/src/builtinWord/LE.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/LT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LT.mg,v retrieving revision 1.1 diff -c -r1.1 LT.mg *** m3front/src/builtinWord/LT.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Minus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Minus.mg,v retrieving revision 1.1 diff -c -r1.1 Minus.mg *** m3front/src/builtinWord/Minus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Minus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Subtract (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Mod.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Mod.mg,v retrieving revision 1.1 diff -c -r1.1 Mod.mg *** m3front/src/builtinWord/Mod.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Mod.mg 18 Feb 2010 02:30:51 -0000 *************** *** 32,37 **** --- 32,38 ---- VAR w0, w1, result: Target.Int; BEGIN IF GetArgs (ce.args, w0, w1) AND TWord.Mod (w0, w1, result) THEN + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = --- 43,57 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = *************** *** 56,61 **** --- 64,70 ---- ELSE min := TInt.Zero; TWord.Subtract (max_b, TInt.One, max); + TInt.Chop (max, Word_types[rep].bytes); END; END GetBounds; Index: m3front/src/builtinWord/Module.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Module.mg,v retrieving revision 1.1 diff -c -r1.1 Module.mg *** m3front/src/builtinWord/Module.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Module.mg 18 Feb 2010 02:30:51 -0000 *************** *** 15,22 **** PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); ! <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN --- 15,21 ---- PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN *************** *** 30,37 **** PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, Target.Integer.bytes, size); ! <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order --- 29,35 ---- PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, size); <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order Index: m3front/src/builtinWord/Not.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Not.mg,v retrieving revision 1.1 diff -c -r1.1 Not.mg *** m3front/src/builtinWord/Not.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Not.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; --- 5,11 ---- GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; *************** *** 31,36 **** --- 31,37 ---- e := Expr.ConstValue (ce.args[0]); IF (e # NIL) AND IntegerExpr.Split (e, w, t) THEN TWord.Not (w, result); + TInt.Chop (result, Integer_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Or.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Or.mg,v retrieving revision 1.1 diff -c -r1.1 Or.mg *** m3front/src/builtinWord/Or.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Or.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Or (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Plus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Plus.mg,v retrieving revision 1.1 diff -c -r1.1 Plus.mg *** m3front/src/builtinWord/Plus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Plus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 4,10 **** GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 4,10 ---- GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord, TInt; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Add (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Rotate.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Rotate.mg,v retrieving revision 1.1 diff -c -r1.1 Rotate.mg *** m3front/src/builtinWord/Rotate.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Rotate.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max : Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, -i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Shift.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Shift.mg,v retrieving revision 1.1 diff -c -r1.1 Shift.mg *** m3front/src/builtinWord/Shift.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Shift.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max: Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, -i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Times.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Times.mg,v retrieving revision 1.1 diff -c -r1.1 Times.mg *** m3front/src/builtinWord/Times.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Times.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Multiply (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 41,48 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Xor.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Xor.mg,v retrieving revision 1.1 diff -c -r1.1 Xor.mg *** m3front/src/builtinWord/Xor.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Xor.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Xor (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/exprs/AddExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddExpr.m3,v retrieving revision 1.4 diff -c -r1.4 AddExpr.m3 *** m3front/src/exprs/AddExpr.m3 10 Jan 2010 05:12:05 -0000 1.4 --- m3front/src/exprs/AddExpr.m3 18 Feb 2010 02:30:51 -0000 *************** *** 172,178 **** EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) AND TInt.Add (max_a, max_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 172,181 ---- EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Add (max_a, max_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/exprs/AddressExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddressExpr.m3,v retrieving revision 1.8 diff -c -r1.8 AddressExpr.m3 *** m3front/src/exprs/AddressExpr.m3 8 Feb 2010 12:03:30 -0000 1.8 --- m3front/src/exprs/AddressExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 39,45 **** PROCEDURE New (READONLY value: Target.Int): Expr.T = VAR p: P; BEGIN - IF TWord.LT (Target.Address.max, value) THEN RETURN NIL END; p := NEW (P); ExprRep.Init (p); p.value := value; --- 39,44 ---- *************** *** 66,72 **** IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => TWord.Add (p.value, i, j); c := New (j); RETURN c # NIL; ELSE RETURN FALSE; END; END Add; --- 65,75 ---- IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Add (p.value, i, j); ! TInt.Chop (j, Target.Address.bytes); ! c := New (j); ! RETURN TRUE; ELSE RETURN FALSE; END; END Add; *************** *** 82,102 **** IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => TWord.Subtract (i, p.value, k); c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN c # NIL; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN --- 85,111 ---- IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); + TInt.Chop (k, Target.Address.bytes); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Subtract (i, p.value, k); ! TInt.Chop (k, Target.Address.bytes); ! c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN TRUE; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; + TWord.And (x, Target.Address.max, x); + TWord.And (y, Target.Address.max, y); IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN Index: m3front/src/exprs/ArrayExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ArrayExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ArrayExpr.m3 *** m3front/src/exprs/ArrayExpr.m3 18 Sep 2007 20:25:54 -0000 1.6 --- m3front/src/exprs/ArrayExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 103,117 **** END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); --- 103,116 ---- END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); *************** *** 125,140 **** BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE RETURN FALSE; END; END GetBounds; --- 124,140 ---- BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => ! IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE ! RETURN FALSE; END; END GetBounds; *************** *** 214,220 **** END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), Target.Integer.bytes, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); --- 214,222 ---- END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), nn) ! AND NOT TInt.LT (nn, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); *************** *** 335,341 **** EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, Target.Integer.bytes, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. --- 337,343 ---- EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. Index: m3front/src/exprs/Expr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/Expr.m3,v retrieving revision 1.8 diff -c -r1.8 Expr.m3 *** m3front/src/exprs/Expr.m3 25 Sep 2009 02:42:12 -0000 1.8 --- m3front/src/exprs/Expr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 98,104 **** GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; --- 98,104 ---- GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; Index: m3front/src/exprs/IntegerExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/IntegerExpr.m3,v retrieving revision 1.9 diff -c -r1.9 IntegerExpr.m3 *** m3front/src/exprs/IntegerExpr.m3 8 Feb 2010 13:02:20 -0000 1.9 --- m3front/src/exprs/IntegerExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 38,58 **** VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; v: Target.Int; t := type = LInt.T; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF type = Int.T THEN ! IF NOT TInt.IntI (value, Target.Integer.bytes, v) THEN RETURN NIL END; ! ELSIF type = LInt.T THEN ! IF NOT TInt.IntI (value, Target.Longint.bytes, v) THEN RETURN NIL END; ! ELSE RETURN NIL END; p := NEW (P); ExprRep.Init (p); ! p.value := v; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) --- 38,59 ---- VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; t := Type.IsSubtype (type, LInt.T); ! min, max: Target.Int; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF NOT Type.GetBounds (type, min, max) ! OR TInt.LT (value, min) ! OR TInt.LT (max, value) THEN ! <*ASSERT FALSE*> ! END; p := NEW (P); ExprRep.Init (p); ! p.value := value; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) *************** *** 94,127 **** END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 95,134 ---- END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 129,140 **** RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 136,149 ---- RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 142,190 **** RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; ! END; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF TInt.LE (TInt.Zero, p.value) THEN ! c := a; RETURN TRUE; ! END; ! IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; END; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.ToInt (p.value, i) THEN ! RETURN FALSE; ! END; ! RETURN TRUE; ! ELSE RETURN FALSE; ! END; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): --- 151,194 ---- RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! RETURN TRUE; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF TInt.LT (x, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! ELSE ! c := a; END; + RETURN TRUE; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = + VAR x: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.ToInt (x, i) THEN RETURN FALSE END; ! RETURN TRUE; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): Index: m3front/src/exprs/ModExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ModExpr.m3,v retrieving revision 1.5 diff -c -r1.5 ModExpr.m3 *** m3front/src/exprs/ModExpr.m3 4 May 2008 11:03:46 -0000 1.5 --- m3front/src/exprs/ModExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 181,202 **** END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR min_b, max_b: Target.Int; ! OneI := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; ! OneL := Target.Int{Target.Longint.bytes, Target.IBytes{1,0,..}}; ! One := ARRAY[Class.cINT..Class.cLINT] OF Target.Int { OneI, OneL }; ! MaxI := Target.Integer.max; ! MaxL := Target.Longint.max; ! Max := ARRAY [Class.cINT..Class.cLINT] OF Target.Int { MaxI, MaxL }; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, One[p.class], max) THEN ! max := Max[p.class]; END; END; ELSE --- 181,198 ---- END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR tmin, tmax, min_b, max_b: Target.Int; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN + EVAL Type.GetBounds (p.type, tmin, tmax); Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, TInt.One, max) ! OR TInt.LT (max, tmin) OR TInt.LT (tmax, max) THEN ! max := tmax; END; END; ELSE Index: m3front/src/exprs/ReelExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ReelExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ReelExpr.m3 *** m3front/src/exprs/ReelExpr.m3 8 Feb 2010 12:03:31 -0000 1.6 --- m3front/src/exprs/ReelExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 9,15 **** MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Int, LInt, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT --- 9,15 ---- MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT *************** *** 172,222 **** END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = --- 172,218 ---- END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = Index: m3front/src/exprs/SetExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SetExpr.m3,v retrieving revision 1.6 diff -c -r1.6 SetExpr.m3 *** m3front/src/exprs/SetExpr.m3 2 Jan 2010 21:31:48 -0000 1.6 --- m3front/src/exprs/SetExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 10,16 **** IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module; TYPE Node = REF RECORD --- 10,16 ---- IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module, Text; TYPE Node = REF RECORD *************** *** 564,579 **** END; END Compile; - PROCEDURE TargetIntToDiagnosticText(name: TEXT; a: Target.Int): TEXT = - VAR t := ""; - b: INTEGER; - BEGIN - IF NOT TInt.ToInt(a, b) THEN - t := "**"; - END; - RETURN t & name & ":" & Target.TargetIntToDiagnosticText(a); - END TargetIntToDiagnosticText; - PROCEDURE CompileBig (p: P; VAR info: Type.Info): CG.Var = VAR range : Type.T; --- 564,569 ---- *************** *** 590,603 **** n : Node; b : BOOLEAN; tmp : Target.Int; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 580,594 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 659,666 **** PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = BEGIN ! CG.Load_integer (Target.Integer.cg_type, value); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; --- 650,659 ---- PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = + VAR tmp := value; BEGIN ! TInt.Chop (tmp, Target.Integer.bytes); ! CG.Load_integer (Target.Integer.cg_type, tmp); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; *************** *** 689,694 **** --- 682,688 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN Type.Compile (p.tipe); nWords := info.size DIV Grain; *************** *** 699,707 **** EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 693,701 ---- EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 793,800 **** IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; curWord := w1; curMask := TInt.Zero; --- 787,796 ---- IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; curWord := w1; curMask := TInt.Zero; *************** *** 802,812 **** IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! full, is_const); END; curWord := w2; curMask := right [b2]; --- 798,811 ---- IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO + tmp := full; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! tmp, is_const); END; curWord := w2; curMask := right [b2]; *************** *** 819,837 **** (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; END GenLiteral; PROCEDURE Init () = - VAR Zero := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (Zero, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); TWord.Shift (full, i, left [i]); END; END Init; --- 818,840 ---- (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; END GenLiteral; PROCEDURE Init () = BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (TInt.Zero, full); ! TWord.And (full, Target.Word.max, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); + TWord.And (right[i], Target.Word.max, right[i]); TWord.Shift (full, i, left [i]); + TWord.And (left[i], Target.Word.max, left[i]); END; END Init; Index: m3front/src/exprs/SubtractExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SubtractExpr.m3,v retrieving revision 1.5 diff -c -r1.5 SubtractExpr.m3 *** m3front/src/exprs/SubtractExpr.m3 10 Jan 2010 05:12:18 -0000 1.5 --- m3front/src/exprs/SubtractExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 62,68 **** VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN --- 62,68 ---- VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) AND EnumType.Is (ta) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN *************** *** 189,195 **** ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN --- 189,197 ---- ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) ! AND NOT TInt.LT (x3, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN *************** *** 205,211 **** Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND TInt.Subtract (max_a, min_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 207,215 ---- Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Subtract (max_a, min_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/misc/CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.35 diff -c -r1.35 CG.m3 *** m3front/src/misc/CG.m3 15 Feb 2010 05:07:07 -0000 1.35 --- m3front/src/misc/CG.m3 18 Feb 2010 02:30:53 -0000 *************** *** 940,946 **** (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; --- 940,946 ---- (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := TWord.Size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; *************** *** 984,1001 **** PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; v, tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; - EVAL TInt.IntI (value, Target.Longint.bytes, v); AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) --- 984,1000 ---- PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := TWord.Size - (o - init_pc) - s; END; IF (o = init_pc) *************** *** 1003,1010 **** AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, v, itype); ! ELSIF TWord.Insert (init_bits, v, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); --- 1002,1009 ---- AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, value, itype); ! ELSIF TWord.Insert (init_bits, value, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); *************** *** 1013,1021 **** END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; --- 1012,1023 ---- END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; *************** *** 1807,1815 **** END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; --- 1809,1820 ---- END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; *************** *** 2760,2768 **** END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; --- 2765,2776 ---- END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; Index: m3front/src/misc/Scanner.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/Scanner.m3,v retrieving revision 1.7 diff -c -r1.7 Scanner.m3 *** m3front/src/misc/Scanner.m3 4 May 2008 11:03:47 -0000 1.7 --- m3front/src/misc/Scanner.m3 18 Feb 2010 02:30:53 -0000 *************** *** 509,515 **** IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), Target.Integer.bytes, val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN --- 509,515 ---- IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN *************** *** 524,542 **** END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Long.bytes, val)) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Word.bytes, val)) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; cur.token := TK.tINTEGERCONST; cur.int := val; END; --- 524,546 ---- END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) ! OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, val)) ! OR TWord.LT (Target.Long.max, val) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Longint.bytes); cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) ! OR NOT TWord.New (SUBARRAY (buf, 0, len), base, val) ! OR TWord.LT (Target.Word.max, val) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Integer.bytes); cur.token := TK.tINTEGERCONST; cur.int := val; END; *************** *** 551,558 **** (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 555,563 ---- (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 617,632 **** (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Longint.bytes, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 622,639 ---- (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Longint.min) ! OR TInt.LT (Target.Longint.max, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 675,681 **** THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, Target.Integer.bytes, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; --- 682,688 ---- THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; Index: m3front/src/misc/TipeDesc.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/TipeDesc.m3,v retrieving revision 1.5 diff -c -r1.5 TipeDesc.m3 *** m3front/src/misc/TipeDesc.m3 1 Apr 2008 00:02:58 -0000 1.5 --- m3front/src/misc/TipeDesc.m3 18 Feb 2010 02:30:53 -0000 *************** *** 145,155 **** PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.IBytes)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN TWord.Subtract (TInt.Zero, ii, i); END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); --- 145,158 ---- PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.Int)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN ! TWord.Subtract (TInt.Zero, ii, i); ! TInt.Chop (i, Target.Integer.bytes); ! END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); Index: m3front/src/stmts/CaseStmt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/stmts/CaseStmt.m3,v retrieving revision 1.4 diff -c -r1.4 CaseStmt.m3 *** m3front/src/stmts/CaseStmt.m3 4 May 2008 11:03:48 -0000 1.4 --- m3front/src/stmts/CaseStmt.m3 18 Feb 2010 02:30:53 -0000 *************** *** 247,253 **** PROCEDURE CompleteTree (t: Tree; min, max: Target.Int): BOOLEAN = VAR x, y: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN WHILE (t # NIL) DO IF TInt.LT (t.max, min) OR TInt.LT (max, t.min) THEN --- 247,252 ---- *************** *** 256,273 **** IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, One, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, One, max) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, One, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, One, min) THEN RETURN TRUE; END; t := t.greater; --- 255,280 ---- IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, TInt.One, max) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, TInt.One, min) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.greater; *************** *** 458,464 **** next: Target.Int; oc, xc: Stmt.Outcomes; l_bodies, l_else, l_end: INTEGER; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN p.tree := CollapseTree (p.tree); l_bodies := CG.Next_label (p.nCases); --- 465,470 ---- *************** *** 485,491 **** CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, One, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; --- 491,499 ---- CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, TInt.One, next) ! OR TInt.LT (next, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; Index: m3front/src/types/ArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/ArrayType.m3,v retrieving revision 1.5 diff -c -r1.5 ArrayType.m3 *** m3front/src/types/ArrayType.m3 4 May 2008 11:03:48 -0000 1.5 --- m3front/src/types/ArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 309,315 **** VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, Target.Integer.bytes, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); --- 309,315 ---- VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); Index: m3front/src/types/EnumType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/EnumType.m3,v retrieving revision 1.7 diff -c -r1.7 EnumType.m3 *** m3front/src/types/EnumType.m3 4 May 2008 11:03:49 -0000 1.7 --- m3front/src/types/EnumType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 44,50 **** n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); --- 44,50 ---- n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); *************** *** 70,76 **** BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); --- 70,76 ---- BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); *************** *** 121,127 **** PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO --- 121,129 ---- PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, max) ! OR TInt.LT (max, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO *************** *** 158,164 **** p.info.hash := hash; END Check; - PROCEDURE CheckAlign (p: P; offset: INTEGER): BOOLEAN = VAR sz := TargetMap.Word_types [p.rep].size; --- 160,165 ---- *************** *** 172,178 **** RETURN (offset + sz) <= (z0 + Target.Integer.size); END CheckAlign; - PROCEDURE Compiler (p: P) = VAR v := Scope.ToList (p.scope); BEGIN --- 173,178 ---- *************** *** 222,230 **** VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN ! RETURN 1; ! END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; --- 222,228 ---- VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, max) THEN RETURN 1 END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; Index: m3front/src/types/OpenArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/OpenArrayType.m3,v retrieving revision 1.4 diff -c -r1.4 OpenArrayType.m3 *** m3front/src/types/OpenArrayType.m3 18 Sep 2007 20:26:11 -0000 1.4 --- m3front/src/types/OpenArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 209,217 **** PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), ! Target.Integer.bytes, m) ! AND TInt.FromInt (20, Target.Integer.bytes, n) (* guess 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; --- 209,216 ---- PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), m) ! AND TInt.FromInt (20, n) (* guess that there are 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; Index: m3front/src/types/SubrangeType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/SubrangeType.m3,v retrieving revision 1.7 diff -c -r1.7 SubrangeType.m3 *** m3front/src/types/SubrangeType.m3 15 Jan 2010 21:50:12 -0000 1.7 --- m3front/src/types/SubrangeType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 78,91 **** PROCEDURE SetRep (p: P) = BEGIN - IF Type.IsSubtype (p.baseType, LInt.T) - THEN p.rep := Target.Longint.cg_type; - ELSE p.rep := Target.Integer.cg_type; - END; - IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; RETURN; END; --- 78,90 ---- PROCEDURE SetRep (p: P) = BEGIN IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; + IF Type.IsSubtype (p.baseType, LInt.T) + THEN p.rep := Target.Longint.cg_type; + ELSE p.rep := Target.Integer.cg_type; + END; RETURN; END; *************** *** 102,109 **** (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) ! AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; --- 101,107 ---- (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; *************** *** 277,283 **** END BitWidth; VAR (*CONST*) ! power : ARRAY [0..BITSIZE (Target.Int)] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = --- 275,281 ---- END BitWidth; VAR (*CONST*) ! power : ARRAY [0..TInt.Size] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = *************** *** 306,312 **** rep_max := Target.Integer.max; END; ! IF zeroed AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; --- 304,311 ---- rep_max := Target.Integer.max; END; ! IF zeroed ! AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; *************** *** 340,347 **** VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) ! OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN --- 339,345 ---- VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN Index: m3front/src/types/Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/Type.m3,v retrieving revision 1.8 diff -c -r1.8 Type.m3 *** m3front/src/types/Type.m3 4 May 2008 11:03:49 -0000 1.8 --- m3front/src/types/Type.m3 18 Feb 2010 02:30:53 -0000 *************** *** 392,399 **** IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, max); ! <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; --- 392,398 ---- IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), max); <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; *************** *** 411,417 **** END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND TInt.LE (max, Target.Integer.max) THEN RETURN max; END; Error.Msg ("type has too many elements"); --- 410,417 ---- END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND NOT TInt.LT (max, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, max) THEN RETURN max; END; Error.Msg ("type has too many elements"); *************** *** 425,432 **** b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, min); ! <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; --- 425,431 ---- b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), min); <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; Index: m3tools/src/M3Builtin.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Builtin.m3,v retrieving revision 1.5 diff -c -r1.5 M3Builtin.m3 *** m3tools/src/M3Builtin.m3 18 Sep 2007 20:26:30 -0000 1.5 --- m3tools/src/M3Builtin.m3 18 Feb 2010 02:30:54 -0000 *************** *** 111,117 **** val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, Target.Integer.bytes, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); --- 111,117 ---- val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); Index: m3tools/src/M3Const.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Const.m3,v retrieving revision 1.6 diff -c -r1.6 M3Const.m3 *** m3tools/src/M3Const.m3 16 Jan 2010 02:29:10 -0000 1.6 --- m3tools/src/M3Const.m3 18 Feb 2010 02:30:54 -0000 *************** *** 861,868 **** Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) ! AND TInt.FromInt (b.info, Target.Integer.bytes, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); --- 861,867 ---- Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) AND TInt.FromInt (b.info, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); *************** *** 1161,1167 **** BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, Target.Integer.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalInt; --- 1160,1166 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalInt; *************** *** 1171,1177 **** BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, Target.Longint.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; --- 1170,1176 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; Index: m3tools/src/M3Lexer.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Lexer.m3,v retrieving revision 1.4 diff -c -r1.4 M3Lexer.m3 *** m3tools/src/M3Lexer.m3 18 Sep 2007 20:26:30 -0000 1.4 --- m3tools/src/M3Lexer.m3 18 Feb 2010 02:30:54 -0000 *************** *** 89,96 **** SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t, Target.Integer.bytes); ! | TK_Long_const => FixInt (t, Target.Longint.bytes); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); --- 89,96 ---- SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t); ! | TK_Long_const => FixInt (t); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); *************** *** 108,114 **** t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T; bytes: CARDINAL) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO --- 108,114 ---- t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO *************** *** 120,135 **** END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), bytes, t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), bytes, t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, bytes, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; --- 120,135 ---- END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; Index: m3tools/src/M3Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Type.m3,v retrieving revision 1.6 diff -c -r1.6 M3Type.m3 *** m3tools/src/M3Type.m3 16 Jan 2010 02:29:11 -0000 1.6 --- m3tools/src/M3Type.m3 18 Feb 2010 02:30:54 -0000 *************** *** 45,55 **** PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; - One := Target.Int{Target.Integer.bytes, TInt.One.x}; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, max) THEN RETURN max; END; RETURN Target.Integer.max; --- 45,54 ---- PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, max) THEN RETURN max; END; RETURN Target.Integer.max; *************** *** 248,254 **** PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, Target.Integer.bytes, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); --- 247,253 ---- PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); *************** *** 289,296 **** VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, Target.Integer.size, max); ! <*ASSERT b*> RETURN TRUE; END EnumBounds; --- 288,294 ---- VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, max); <*ASSERT b*> RETURN TRUE; END EnumBounds; From hosking at elego.de Thu Feb 18 04:01:14 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 4:01:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218030114.E3D712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 04:01:14 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Avoid warning for 64-bit INTEGER. From jkrell at elego.de Thu Feb 18 08:30:35 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 8:30:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218073035.2628C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 08:30:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: more information when this assertion fails, as it now does: == package C:\dev2\cm3.2\m3-libs\m3core == +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 new source -> compiling RTHooks.i3 "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 *** *** runtime error: *** <*ASSERT*> failed. *** file "..\src\M3x86.m3", line 1114 *** Stack trace: FP PC Procedure --------- --------- ------------------------------- 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 confusion here about signed vs. unsigned integers; the signed number 158 requires 2 bytes but the unsigned number 158 only requirs 1 byte From jay.krell at cornell.edu Thu Feb 18 09:09:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100218073035.2628C2474001@birch.elegosoft.com> References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 09:54:16 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 9:54:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218085416.592572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 09:54:16 Added files: cm3/m3-sys/m3back/src/: TWordOld.i3 TWordOld.m3 TIntOld.i3 TIntOld.m3 Log message: initial copies of previous versions, we'll have to adapt to put them into place, and then gradually maybe turn them into the new versions, keeping things working as we go; I'm not too keen on debugging things otherwise right now From jkrell at elego.de Thu Feb 18 10:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 10:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218090709.D28FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 10:07:09 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsWord => TypeIsUnsignedInt IsInt => TypeIsSignedInt Is64 => TypeIs64 From jay.krell at cornell.edu Thu Feb 18 11:05:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 10:05:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: Another problem now is that 64bit rotate of constants doesn't get the type size correct. Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? - Jay From: jay.krell at cornell.edu To: jkrell at elego.de; m3commit at elegosoft.com Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: Re: [M3commit] CVS Update: cm3 Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 12:31:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:31:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113110.D1F722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:31:10 Added files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Removed files: cm3/m3-sys/m3back/src/: TIntOld.m3 TIntOld.i3 TWordOld.i3 TWordOld.m3 Log message: rename these files; they derive directly from m3middle/TInt, TWord From jkrell at elego.de Thu Feb 18 12:38:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:38:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113822.D8B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:38:22 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 Log message: go back a few versions: cvs -z3 upd -r 1.126 M3x86.m3 cvs -z3 upd -r 1.93 Stackx86.m3 cvs -z3 upd -r 1.79 Codex86.m3 cvs -z3 upd -r 1.28 M3x86Rep.i3 cvs -z3 upd -r 1.6 Wrx86.m3 This does not build, but the previous didn't work anyway. The history will be easier to see here when I commit something that builds and works (I already have it). From jkrell at elego.de Thu Feb 18 12:41:37 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:41:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218114137.81CF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:41:37 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: rename the interface/end from TInt/TWord to M3BackInt/M3BackWord (yes, I realize it sounds like 'backward') From jkrell at elego.de Thu Feb 18 14:05:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:05:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130500.4C0A52474001@birch.elegosoft.com> 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") From jkrell at elego.de Thu Feb 18 14:08:24 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:08:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130824.62F942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:08:24 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: assert earlier From jkrell at elego.de Thu Feb 18 14:12:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:12:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131234.32E2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:12:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix dumb out of order initialization, should fix the problem building showheap From jkrell at elego.de Thu Feb 18 14:13:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:13:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131314.E78672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:13:14 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: remove procuedures New and IntI that we don't use From jkrell at elego.de Thu Feb 18 15:09:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:09:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218140956.2E5F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:09:56 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Log message: fix converting Target.Int to M3Back.Int, test p227 much better now but still a problem with 1 MODUL 1 (wierd considering that 1 MODL 1 works); all this was working but still recovering from TInt changes From jkrell at elego.de Thu Feb 18 15:20:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:20:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218142048.257322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:20:48 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo in test case, duh From hosking at cs.purdue.edu Thu Feb 18 18:07:57 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:07:57 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). On 18 Feb 2010, at 05:05, Jay K wrote: > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > - Jay > > > From: jay.krell at cornell.edu > To: jkrell at elego.de; m3commit at elegosoft.com > Date: Thu, 18 Feb 2010 08:09:30 +0000 > Subject: Re: [M3commit] CVS Update: cm3 > > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > From hosking at cs.purdue.edu Thu Feb 18 18:02:18 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:02:18 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: It probably makes sense for me to repair this in the front-end. Let me look into it. On 18 Feb 2010, at 03:09, Jay K wrote: > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Thu Feb 18 22:08:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 21:08:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: You had changed TWord.Rotate() uses to assume Target.Integer.bytes. x: M3x86Rep.Operand; TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) What probably would have worked is more like: TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. Precision affects the intermediate results. That's the only possible problem that stood out to me on a quick read. Whatever it all was though, the compiler no longer worked, basically not at all, even if I removed the assertions about integers fitting in their claimed types. I wasn't too keen on debugging that right now but I should before much longer. I'd rather not keep a separate copy of TInt/TWord.. - Jay > From: hosking at cs.purdue.edu > Date: Thu, 18 Feb 2010 12:07:57 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > - Jay > > > > > > From: jay.krell at cornell.edu > > To: jkrell at elego.de; m3commit at elegosoft.com > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Tony there are multiple related problems here. > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > e.g. in InitTypecell. > > And maybe similar for 16/32/64, I don't know. > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > I'll see what I can do. > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > - Jay > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > To: m3commit at elegosoft.com > > > From: jkrell at elego.de > > > Subject: [M3commit] CVS Update: cm3 > > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > Log message: > > > more information when this assertion fails, as it now does: > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > new source -> compiling RTHooks.i3 > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > *** > > > *** runtime error: > > > *** <*ASSERT*> failed. > > > *** file "..\src\M3x86.m3", line 1114 > > > *** > > > > > > Stack trace: > > > FP PC Procedure > > > --------- --------- ------------------------------- > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > confusion here about signed vs. unsigned integers; > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > only requirs 1 byte > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 18 23:11:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 17:11:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: <357F3AF3-577B-4346-875F-613135F023E7@cs.purdue.edu> Rotate now has an extra parameter to indicate the bytes rotated. You do need to use TInt.Chop to treat the result as having the correct size. (See how folding is done in m3front/src/builtinWord operations.) Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 18 Feb 2010, at 16:08, Jay K wrote: > You had changed TWord.Rotate() uses to assume Target.Integer.bytes. > x: M3x86Rep.Operand; > TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) > What probably would have worked is more like: > TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) > > > Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. > Precision affects the intermediate results. > > > That's the only possible problem that stood out to me on a quick read. > Whatever it all was though, the compiler no longer worked, basically not at all, > even if I removed the assertions about integers fitting in their claimed types. > I wasn't too keen on debugging that right now but I should before much longer. > I'd rather not keep a separate copy of TInt/TWord.. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Thu, 18 Feb 2010 12:07:57 -0500 > > To: jay.krell at cornell.edu > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > > > - Jay > > > > > > > > > From: jay.krell at cornell.edu > > > To: jkrell at elego.de; m3commit at elegosoft.com > > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > Tony there are multiple related problems here. > > > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > > e.g. in InitTypecell. > > > And maybe similar for 16/32/64, I don't know. > > > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > > > I'll see what I can do. > > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > > > - Jay > > > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > > To: m3commit at elegosoft.com > > > > From: jkrell at elego.de > > > > Subject: [M3commit] CVS Update: cm3 > > > > > > > > CVSROOT: /usr/cvs > > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > > > Modified files: > > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > > > Log message: > > > > more information when this assertion fails, as it now does: > > > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > > > new source -> compiling RTHooks.i3 > > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > > > *** > > > > *** runtime error: > > > > *** <*ASSERT*> failed. > > > > *** file "..\src\M3x86.m3", line 1114 > > > > *** > > > > > > > > Stack trace: > > > > FP PC Procedure > > > > --------- --------- ------------------------------- > > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > > > confusion here about signed vs. unsigned integers; > > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > > only requirs 1 byte > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 12:28:32 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 12:28:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219112832.B05CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 12:28:32 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: Expand test coverage to more sizes of sets. Something is really odd here. A set of >32 elements is being correctly handled as a set of two integers, for purposes of comparison, but I don't see where the code to do that is. A set of one integer, I see that. The code is correct, but I don't know where it is coming from. From jay.krell at cornell.edu Fri Feb 19 13:17:17 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 19 Feb 2010 12:17:17 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100219112832.B05CD2474001@birch.elegosoft.com> References: <20100219112832.B05CD2474001@birch.elegosoft.com> Message-ID: > Something is really odd here. Finally found it. There is a general notion of "solid" types. For which equality comparison can be an inlined word by word comparison. See EqualExpr.m3 / Max_unroll. - Jay > Date: Fri, 19 Feb 2010 12:28:32 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/19 12:28:32 > > Modified files: > cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 > > Log message: > Expand test coverage to more sizes of sets. > Something is really odd here. > A set of >32 elements is being correctly handled > as a set of two integers, for purposes of comparison, > but I don't see where the code to do that is. > A set of one integer, I see that. > The code is correct, but I don't know where it is coming from. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 14:13:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:13:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219131345.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:13:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current output From jkrell at elego.de Fri Feb 19 14:28:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:28:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132855.959C72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:28:55 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: replace set_ne (not equal) and seq_eq (equal) with !memcmp or !!memcmp From jkrell at elego.de Fri Feb 19 14:29:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:29:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132955.B63AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:29:55 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: eliminate set_eq and set_ne From jkrell at elego.de Sun Feb 21 10:52:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 10:52:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221095250.D74B82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 10:52:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: UNUSED_INTEGER is a long not an int From jkrell at elego.de Sun Feb 21 12:25:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 12:25:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221112506.112E32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 12:25:06 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: restore losting cleanup: THEN goes at end of line and go beyond that: factor common code into a function (original authors seemed very keen on manual inlining, which is kind of nice, but leads to a lot of duplicate code; we should strongly consider adding inlining in m3back) simple guard against a form of overflow that I have trouble believing is possible, but the guard is super cheap From jkrell at elego.de Sun Feb 21 14:56:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 14:56:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221135624.71EEF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 14:56:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.m3 M3BackInt.i3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 02:42:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 2:42:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222014204.55A562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 02:42:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I somehow missed this file as part of: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 03:25:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 3:25:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222022522.BFCD32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 03:25:22 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: gut M3BackWord such that TWord does most of the work; each function is basically zero extend, call TWord, Chop; Insert/Extract have more stringent size limit; still more to do in M3BackInt From jkrell at elego.de Mon Feb 22 09:59:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 9:59:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222085938.C29A22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 09:59:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 Log message: temporary version that does all the world old way and new way and asserts they match, including making copies because aliasing does exist (in this very file, look at the uses of subtract in divide) From jkrell at elego.de Mon Feb 22 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222090043.937532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 10:00:43 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: comment, formating (don't bury major semantics in VAR) From jkrell at elego.de Mon Feb 22 11:25:55 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:25:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102555.EA0EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:25:55 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version, something is wrong and I should do the version where everything is done both ways and checked From jkrell at elego.de Mon Feb 22 11:27:17 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102717.5A3482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:17 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: remove another IMPORT Foo AS Bar renaming From jkrell at elego.de Mon Feb 22 11:27:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102759.71ECF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:59 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: remove unused procedure New From jkrell at elego.de Mon Feb 22 13:43:52 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 13:43:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222124352.AD5252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 13:43:52 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: temporary version that does everything old and new and asserts they match; beware of aliasing, when you do things twice, the inputs tend to get clobbered From jkrell at elego.de Mon Feb 22 14:01:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:01:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222130125.BC64D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:01:25 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: go back to only doing things once this time with a different Chop function though, not sure that matters From jkrell at elego.de Mon Feb 22 14:24:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:24:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222132450.D4FCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:24:50 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "ToTargetInt" => "ZeroExtend" remove unused: LShift, RShift, Word, IByte, IBytes From jkrell at elego.de Mon Feb 22 14:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135721.A49DC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "Chop" => "UnsignedTruncate" From jkrell at elego.de Mon Feb 22 14:57:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135751.996A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:51 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove most of the code -- delegating to TInt Add Subtract Multiply Div Mod (DivMod) -- which I understood least well EQ LT the following significant functions remain and might merit further attention: SignExtend ZeroExtend SignedTruncate UnsignedTruncate ToBytes ToBytes I haven't looked into much. It could be that TInt.ToBytes can work. But possible problems already reported. TInt.Chop might be useful, but I'm sure we are missing some functionality in terms of signed vs. unsigned. Two functions are needed for widening and two for narrowing. As well, ToChars should have signed and unsigned variations, though we only use it for debug code and we aren't sensitive to incorrect printing of large positive numbers. Something is also still fishy with ToInt and/or FromInt. Whenever I convert them, I hit problems (assertion failures in RTCollector/RTAllocator) I haven't tried the double work + assert approach to them. They look so simple.. From jkrell at elego.de Mon Feb 22 22:16:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:16:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222211635.665C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:16:35 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: temporary version that does double work + assert in ToInt and FromInt From jkrell at elego.de Mon Feb 22 22:21:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:21:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212102.750822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:21:02 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Wrx86.m3 Log message: TargetIntToDiagnosticText => ToDiagnosticText TIntToDiagnosticText => TargetIntToDiagnosticText From jkrell at elego.de Mon Feb 22 22:23:10 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:23:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212310.DC54C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:23:10 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: use FIRST and LAST instead of 0 and 7 From jkrell at elego.de Mon Feb 22 22:34:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:34:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222213402.9534E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:34:02 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: fix typo From jkrell at elego.de Mon Feb 22 23:54:32 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:54:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225432.E87372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:54:32 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: in TInt.ToInt, pack the bytes even if there is overflow; caller can pay attention to the overflow or not From jkrell at elego.de Mon Feb 22 23:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225722.056AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:01:02 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:01:02 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100222225722.056AE2474001@birch.elegosoft.com> References: <20100222225722.056AE2474001@birch.elegosoft.com> Message-ID: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:03:03 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:03:03 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com> <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Message-ID: P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 02:30:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 01:30:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: I'm still a bit leary of Chop and ToBytes. I *suspect* we need a bit more in TWord to make this all hold together. Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > From hosking at cs.purdue.edu Tue Feb 23 03:10:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 21:10:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> On 22 Feb 2010, at 20:30, Jay K wrote: > I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. > I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 20:03:03 -0500 >> To: hosking at cs.purdue.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> >> >> P.S. The assumption is that results from operations that overflow should be discarded. >> >> >> Antony Hosking | Associate Professor | Computer Science | Purdue University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> >> >> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >> >> Jay, If you want that behavior, just do: >> >> TInt.Chop(x, BYTESIZE(INTEGER), x); >> TInt.ToInt(x, i) >> >> On 22 Feb 2010, at 23:57, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >> >> From jay.krell at cornell.edu Tue Feb 23 03:30:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 02:30:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > >> I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > >> I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > >> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >> >> >> I don't entirely ignore ToInt's boolean. >> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >> >> >> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >> >> >> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >> >> >> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >> >> >> And then rewriting hand.c in Modula-3. >> >> >> And then other stuff. >> >> >> ..Jay >> >> >> ________________________________ >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>> To: hosking at cs.purdue.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> >>> >>> P.S. The assumption is that results from operations that overflow should be discarded. >>> >>> >>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>> 305 N. University Street | West Lafayette | IN 47907 | USA >>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>> >>> >>> >>> >>> >>> >>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>> >>> Jay, If you want that behavior, just do: >>> >>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>> TInt.ToInt(x, i) >>> >>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>> >>> CVSROOT: /usr/cvs >>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>> >>> Modified files: >>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>> >>> Log message: >>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>> >>> > From jkrell at elego.de Tue Feb 23 12:11:38 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:11:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223111138.C3F5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:11:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: remove TargetIntToDiagnosticText, no callers outside of M3BackInt.m3 From jkrell at elego.de Tue Feb 23 12:54:04 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:54:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223115404.4A5E02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:54:04 Added files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 m3makefile stdout.pgm Log message: add test case for set_singleton This might be endian and/or word size specific. But heck, I can at least compare NT386, LINUXLIBC6, I386_DARWIN. And maybe adjust the infrastructure to cope with it. From jkrell at elego.de Tue Feb 23 13:04:17 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 13:04:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223120417.D92412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 13:04:17 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: add to test case From jkrell at elego.de Tue Feb 23 14:00:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 14:00:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223130057.614652474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 14:00:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: ulong => size_t in the interest of Win64, the only platform for which these are different, and size_t is probably the intent From hosking at cs.purdue.edu Tue Feb 23 14:35:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 08:35:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 21:10:10 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> On 22 Feb 2010, at 20:30, Jay K wrote: >> >>> I'm still a bit leary of Chop and ToBytes. >> >> Chop is just the same as a C cast. >> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >> >> ToBytes simply returns the significant bytes. >> >>> I *suspect* we need a bit more in TWord to make this all hold together. >> >> I don't see the need. I think this speaks to confusion on your part... >> >>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>> >>> >>> I don't entirely ignore ToInt's boolean. >>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>> >>> >>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>> >>> >>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>> >>> >>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>> >>> >>> And then rewriting hand.c in Modula-3. >>> >>> >>> And then other stuff. >>> >>> >>> ..Jay >>> >>> >>> ________________________________ >>>> From: hosking at cs.purdue.edu >>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>> To: hosking at cs.purdue.edu >>>> CC: m3commit at elegosoft.com >>>> Subject: Re: [M3commit] CVS Update: cm3 >>>> >>>> >>>> >>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>> >>>> >>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>> >>>> >>>> >>>> >>>> >>>> >>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>> >>>> Jay, If you want that behavior, just do: >>>> >>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>> TInt.ToInt(x, i) >>>> >>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>> >>>> CVSROOT: /usr/cvs >>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>> >>>> Modified files: >>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>> >>>> Log message: >>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>> >>>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150535.710962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:05:35 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: more testing From jkrell at elego.de Tue Feb 23 16:06:37 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:06:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150637.B7D3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:06:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3x86.m3 Log message: another not very useful function in hand.c bites the dust, at least under #ifdef use bts instruction instead of calling set_singleton bts's notion of how to index bits happens to line up with set_singleton (assuming test p230 is complete enough) bts isn't fast, but surely this is better overall due to drastically fewer instructions note that set_singleton test cases tend to generate very large code zeroing stuff I was not able to get coverage of several addressing modes, so they are left issuing errors and asserts. That is, among: bts mem, reg bts reg, imm8 bts reg, reg possibly bts mem, imm8 I was only able to get bts reg, reg to hit. Still to ponder gcc backend? I had hoped to get this done in the frontend but became stumped. ? It's just a shift and and, should be achievable portably. ? From jkrell at elego.de Tue Feb 23 16:11:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:11:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223151139.450FB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:11:39 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_singleton from NT386 maybe we can remove it from others too? From jay.krell at cornell.edu Tue Feb 23 16:27:06 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 15:27:06 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: I'd rather move along to other things.. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 08:35:39 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223155153.166A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:51:52 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: implementation of direct thread suspend/resume for interix been sitting on it and almost deleted it direct suspend/resume can be achieve by writing certain control codes to the correct files in /procfs the context of a suspended thread can be gotten by reading a file However I'd like to at least avoid opening the files repeatedly. Here we open them in thread create. I don't remember why Interix can't use the portable code. It doesn't have SA_SIGINFO but that doesn't prove it. It is empirically showable that the context is on the stack. So maybe we just have a single parameter signal handler and a null context? From hosking at cs.purdue.edu Tue Feb 23 18:39:49 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 12:39:49 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > >> >> ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? >> I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. >> >> >> - Jay >> >> >> ---------------------------------------- >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 21:10:10 -0500 >>> To: jay.krell at cornell.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> On 22 Feb 2010, at 20:30, Jay K wrote: >>> >>>> I'm still a bit leary of Chop and ToBytes. >>> >>> Chop is just the same as a C cast. >>> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >>> >>> ToBytes simply returns the significant bytes. >>> >>>> I *suspect* we need a bit more in TWord to make this all hold together. >>> >>> I don't see the need. I think this speaks to confusion on your part... >>> >>>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>>> >>>> >>>> I don't entirely ignore ToInt's boolean. >>>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>>> >>>> >>>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>>> >>>> >>>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>>> >>>> >>>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>>> >>>> >>>> And then rewriting hand.c in Modula-3. >>>> >>>> >>>> And then other stuff. >>>> >>>> >>>> ..Jay >>>> >>>> >>>> ________________________________ >>>>> From: hosking at cs.purdue.edu >>>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>>> To: hosking at cs.purdue.edu >>>>> CC: m3commit at elegosoft.com >>>>> Subject: Re: [M3commit] CVS Update: cm3 >>>>> >>>>> >>>>> >>>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>>> >>>>> >>>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>>> >>>>> Jay, If you want that behavior, just do: >>>>> >>>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>>> TInt.ToInt(x, i) >>>>> >>>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>>> >>>>> CVSROOT: /usr/cvs >>>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>>> >>>>> Modified files: >>>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>>> >>>>> Log message: >>>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>>> >>>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 19:15:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 18:15:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Tue Feb 23 20:00:07 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 14:00:07 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: > So we need TWord.ToBytes? > > - Jay > > From: hosking at cs.purdue.edu > Date: Tue, 23 Feb 2010 12:39:49 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com; jay.krell at cornell.edu > Subject: Re: [M3commit] CVS Update: cm3 > > Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. > These TInt functions should be interpreted as having C arithmetic semantics. > > On 23 Feb 2010, at 08:35, Tony Hosking wrote: > > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > > I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > > I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 24 00:08:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 23:08:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , ,,, ,,, , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , , , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, , <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu>, , Message-ID: I'll have to show you where the values are coming from. I don't know offhand. Could be from m3back, or m3front, I don't know. This stuff largely is runnable/testable from arbitrary hosts. cd scripts/python ./do-cm3-std.py realclean NT386 ./do-cm3-std.py buildship NT386 to get the data we are interested in, would want to change this code e.g.: C:\dev2\cm3.2\m3-sys\m3back\src\Codex86.m3(386): IF (NOT M3BackInt.ToInt(imm, ins.imm)) AND (NOT M3BackWord.LE(imm, M3BackInt.Word32.max)) THEN Note that most of the uses of ToInt in m3back don't do that, e.g.: IF shiftCount.loc = OLoc.imm THEN IF NOT M3BackInt.ToInt(shiftCount.imm, ins.imm) THEN t.Err("binOp: unable to convert immediate to INTEGER:" & M3BackInt.ToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; And at least one of these examples is so far unreachable -- the one in bitTestAndSet that I added yesterday. But some are not, I didn't go here randomly. bitTestAndSet seems unusual but ok in that many x86 instructions can take a one byte signed immediate value, but bitTestAndSet seems to take a one byte unsigned immediate value. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 14:00:07 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 24 00:26:36 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 0:26:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223232636.612802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 00:26:35 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: 1UL => ((size_t)1) again with Win64 in mind From jkrell at elego.de Wed Feb 24 08:56:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 8:56:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224075620.035032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 08:56:15 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case to cover constants From jkrell at elego.de Wed Feb 24 09:05:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 9:05:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224080554.A1B902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 09:05:54 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case From jkrell at elego.de Wed Feb 24 12:33:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:33:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224113329.3FC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:33:28 Modified files: cm3/m3-ui/bicycle/src/: m3makefile cm3/m3-ui/cmvbt/src/: m3makefile cm3/m3-ui/codeview/src/: m3makefile cm3/m3-ui/formsedit/src/: m3makefile cm3/m3-ui/formsvbt/src/: m3makefile cm3/m3-ui/formsview/src/: m3makefile cm3/m3-ui/images/src/: m3makefile cm3/m3-ui/juno-2/juno-app/src/: m3makefile cm3/m3-ui/mg/src/: m3makefile cm3/m3-ui/mgkit/src/: m3makefile cm3/m3-ui/ui/test/Argus/src/: m3makefile cm3/m3-ui/ui/test/BadBricks/src/: m3makefile cm3/m3-ui/ui/test/ButtonTest/src/: m3makefile cm3/m3-ui/ui/test/Cards/src/: m3makefile cm3/m3-ui/ui/test/ColorMonster/src/: m3makefile cm3/m3-ui/ui/test/Draw/src/: m3makefile cm3/m3-ui/ui/test/EyesVBT/src/: m3makefile cm3/m3-ui/ui/test/Hello/src/: m3makefile cm3/m3-ui/ui/test/Monster/src/: m3makefile cm3/m3-ui/ui/test/Sketch2/src/: m3makefile cm3/m3-ui/ui/test/StarAnim/src/: m3makefile cm3/m3-ui/ui/test/Track/src/: m3makefile cm3/m3-ui/ui/test/TypeInTest/src/: m3makefile cm3/m3-ui/ui-tests/pixmapcomtest/src/: m3makefile cm3/m3-ui/ui-tests/test25/src/: m3makefile cm3/m3-ui/ui-tests/texturecomtest/src/: m3makefile cm3/m3-ui/vbtkit/src/: m3makefile cm3/m3-ui/videovbt/src/: m3makefile cm3/m3-ui/webvbt/src/: m3makefile cm3/m3-ui/webvbt/src/hyperpage/src/: m3makefile cm3/m3-ui/zeus/src/: m3makefile Log message: HasGui => HasTrestle I suspect this won't matter shortly, I think I know what is wrong with X on Interix, just need to configure it as not having the shared memory extension.. From jkrell at elego.de Wed Feb 24 12:57:09 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:57:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224115709.67B632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:57:09 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test -- this gets more addressing modes From jkrell at elego.de Wed Feb 24 13:23:29 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:23:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122329.71DBF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:23:29 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: extend test From jkrell at elego.de Wed Feb 24 13:28:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:28:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122800.E307A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:28:00 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: another little helper function bites the dust, at least for NT386 replace size_t __stdcall set_member(size_t elt, size_t* set) { register size_t word = elt / SET_GRAIN; register size_t bit = elt % SET_GRAIN; return (set[word] & (((size_t)1) << bit)) != 0; } with bt instruction which does it all, and leaves the result in the carry flag (some gymnastics then to get the carry flag) before: 0000003C: 56 push esi 0000003D: 53 push ebx 0000003E: FF 15 30 00 00 00 call dword ptr [T$111+30h] Shouldn't this be a direct call, save a byte? 00000044: 89 45 F4 mov dword ptr [ebp-0Ch],eax 11 bytes, 4 instructions (plus the function!) after, attempt #1 0000003C: 0F A3 1E bt dword ptr [esi],ebx 0000003F: 0F 92 45 F0 setb byte ptr [ebp-10h] 00000043: 33 D2 xor edx,edx 00000045: 8A 55 F0 mov dl,byte ptr [ebp-10h] 00000048: 89 55 F4 mov dword ptr [ebp-0Ch],edx 15 bytes, 5 instructions so many to extract the carry! Probably a win, but larger. Attempt #2: Let's try a different approach to capturing the result: 000000D1: 0F A3 1E bt dword ptr [esi],ebx 000000D4: 1B D2 sbb edx,edx 000000D6: F7 DA neg edx 000000D8: 89 55 F8 mov dword ptr [ebp-8],edx 10 bytes, 4 instructions (though I think the old approach could get by with 10, using a direct call) We can probably replace setcc other places similarly (see below). I had tried: xor eax, eax adc eax, 0 That didn't work. I suspect xor clobbered the carry. We could make that work by reserving and clearing the register earlier. However it is 11 bytes instead of 1 and this sbb, neg is how Visual C++ compiles: int F(unsigned a, unsigned b) { return a < b; } (further note: > is < but reversed, <= is < but inc instead of neg, and, importantly == and != are xor, op, sete regL, should be a nice win over our current strategy, if we can reserve/xor the register ahead of op) Note that now we get the various addressing modes (where set_singleton did not), however I couldn't get them to work, probably not encoding them with the right amount of indirection, so I force reg/reg addressing. Not ideal but probably still much better. Note that set_member is pretty heavily used, though none of these changes affects set that fit in 32 bits. We really should try to improve gcc backend? From jkrell at elego.de Wed Feb 24 13:30:19 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:30:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224123019.7CBDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:30:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_member on NT386, see m3back changes, m3back generates x86 bt (bit test) instruction instead From jkrell at elego.de Thu Feb 25 08:15:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:15:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225071542.1EA6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:15:42 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: replace cat with fs_contents From jkrell at elego.de Thu Feb 25 08:29:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:29:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225072914.6F3F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:29:14 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: on non-posix, look for \cygwin\bin\date.exe \cygwin\bin\bc.exe \cygwin\bin\awk.exe \cygwin\bin\cat.exe and use them if they exist Still, this won't let date even work on Solaris. Notice how pkgmap.sh just builds its own from one line of portable C. Awk I think we can remove just by using wc -l instead of wc? cat multiple files could be concating fs_contents? wc via split with newlines as the delimiter? bc we can just use "0" if it isn't there or maybe actually write an expression evaluator? more to do here later.. From jkrell at elego.de Thu Feb 25 08:47:21 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:47:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225074721.9D9462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:47:21 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: Remove unncessary use of awk, cat, wc, replacing with fairly portable quake. There is some issue here regarding splitting on \r or \n or both. Date and bc remain. From jkrell at elego.de Thu Feb 25 09:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225083142.8EF262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:31:39 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: Go back a version, I think I showed these changes aren't needed, since the context is on the stack in Interix, just not exposed. From jkrell at elego.de Thu Feb 25 09:40:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:40:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084038.8ABE72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:40:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: when splitting 8 byte constants into two 4 byte constants, do chop them into 4 bytes, this fixes the ToInt overflow problem, so that we get e.g. 4:0 0 0 80 instead of 8:0 0 0 80 0 0 0 0 From jkrell at elego.de Thu Feb 25 09:48:23 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:48:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084823.A37792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:48:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: undo previous, there is a problem From jkrell at elego.de Thu Feb 25 10:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091055.B3B8D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:10:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.m3 Log message: fix to not need result when TInt.ToInt overflows -- chop at 4 bytes in M3BackInt.ToInt From jkrell at elego.de Thu Feb 25 10:12:36 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:12:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091236.8196D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:12:36 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt From jkrell at elego.de Thu Feb 25 10:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091702.A79892474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:17:02 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 Log message: scientific names instead of goofy names char => UINT8 u_short => UINT16 short => INT16 long => INT32 From jkrell at elego.de Thu Feb 25 11:07:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:07:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100729.E4C8A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:07:29 Modified files: cm3/m3-sys/m3objfile/src/: MasmObjFile.m3 NTObjFile.m3 Log message: spaces around binary operators: len-1 => len - 1 cnt-1 => cnt - 1 etc. (except not on ^. or "->") From jkrell at elego.de Thu Feb 25 11:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100948.460292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:09:48 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: THEN usually at end of line, ELSE usually on its own line From jkrell at elego.de Thu Feb 25 11:10:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:10:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101052.EEE1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:10:52 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: Grow objfile buffer from 2K to 64K. If anyone thinks this is too piggy, I'm ok with anything: 2K, 4K, 512, etc. From jkrell at elego.de Thu Feb 25 11:19:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:19:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101938.4581B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:19:38 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 From jkrell at elego.de Thu Feb 25 11:30:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:30:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103040.EC33C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:30:40 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 CHAR => UINT8 (requires a loophole array of uint8 to array of char) UINT8 != CHAR UINT8 = BITS 8 FOR [0..255] From jkrell at elego.de Thu Feb 25 11:32:01 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:32:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103202.735AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:32:01 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: OutP => OutPathChar; DO on its own line, THEN at end of line From jkrell at elego.de Thu Feb 25 11:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103311.61C422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:33:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: DO at end of line (meant to say that in previous) From jkrell at elego.de Thu Feb 25 11:40:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:40:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104043.6E18A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:40:43 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 MasmObjFile.m3 Log message: upcase hex (ff => FF) From jkrell at elego.de Thu Feb 25 11:42:08 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:42:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104208.3A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:42:08 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: spaces around binary minus and plus From jkrell at elego.de Thu Feb 25 11:46:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:46:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104652.DBBD42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:46:51 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: sometimes put two spaces after Out8/N to line up with Out16, Out32 there is some value to the names OutC/S/I but I think 8/16/32 is more sensible implement Out16/32 as small loops over Out8 From jkrell at elego.de Thu Feb 25 11:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105312.17B1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:53:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix newlines From jkrell at elego.de Thu Feb 25 11:56:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:56:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105606.052012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:56:05 Modified files: cm3/m3-sys/m3objfile/src/: M3ObjFile.i3 NTObjFile.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Log message: Change m3objfile appendBytes from taking ARRAY of 0..255 to array of bits 8 for 0..255 (aka UINT8) pass the bytes of a Target.Int directly to appendBytes thereby removing our own M3BackInt.ToBytes function, and not even calling TInt.ToBytes violating the abstraction boundary, granted (which Tony declared to be a little fuzzy) From jkrell at elego.de Thu Feb 25 14:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225130640.5FF452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:06:40 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Removed files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: eliminate M3BackWord drastically reduce M3BackInt to just: FromInt ToInt FromTargetInt ToDiagnosticText which can probably all go into TInt as something like FromIntAndChop ChopAndToInt CopyAndChop ToTextVerbose or somesuch, or caller synthesize add TInt.NE, GT, GE, Abs, Negate TWord.GE, GT which make for a smoother transition for m3back, even if the caller can inline them change TInt.EQ and NE to use structural (infix) comparison move the constants all to TInt to reduce abstraction boundary violations: Three, Four, Eight ThirtyOne, ThirtyTwo, SixtyThree, F3FF x0400, x0800, x0F00, MaxU8 -- changed to Target.Word8.max MThirtyOne, MSixtyThree perhaps not the best choice. At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. Some of the others are encodings for x87 status flags for example. Converting from strings is another not bad idea. The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int where the bytes are passed directly to m3objfile.AppendBytes This should perhaps be revisited. Granted, inconsistency with regard to where I violate the boundary. I have to look into ToBytes again. From jay.krell at cornell.edu Thu Feb 25 14:08:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:08:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Thu Feb 25 14:09:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:09:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From wagner at elegosoft.com Thu Feb 25 14:25:40 2010 From: wagner at elegosoft.com (Olaf Wagner) Date: Thu, 25 Feb 2010 14:25:40 +0100 Subject: [M3commit] CM3 CVS commit hooks on birch, was: Re: CVS Update: cm3 In-Reply-To: References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: <20100225142540.ji0dypxy8kco4oco@mail.elegosoft.com> Quoting Jay K : > Given the current setup..I still think worthwhile to send diffs > (just not in check comments..), attached. Can we easily (without much efforts) add udiffs to the commit mails sent by the Perl scripts triggered by CVS commits from the cm3 repository? Of course only for text files. If somebody could have a quick look and let us know that would be appreciated. Olaf > - Jay > >> Date: Thu, 25 Feb 2010 14:06:40 +0000 >> To: m3commit at elegosoft.com >> From: jkrell at elego.de >> Subject: [M3commit] CVS Update: cm3 >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 14:06:40 >> >> Modified files: >> cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 >> M3BackInt.m3 M3x86.m3 M3x86Rep.i3 >> Stackx86.i3 Stackx86.m3 Wrx86.i3 >> Wrx86.m3 m3makefile >> cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 >> Removed files: >> cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 >> >> Log message: >> eliminate M3BackWord >> >> drastically reduce M3BackInt to just: >> FromInt >> ToInt >> FromTargetInt >> ToDiagnosticText >> which can probably all go into TInt as something like >> FromIntAndChop >> ChopAndToInt >> CopyAndChop >> ToTextVerbose >> or somesuch, or caller synthesize >> >> add TInt.NE, GT, GE, Abs, Negate >> TWord.GE, GT >> >> which make for a smoother transition for m3back, even if the caller >> can inline them >> >> change TInt.EQ and NE to use structural (infix) comparison >> >> move the constants all to TInt to reduce abstraction boundary violations: >> Three, Four, Eight >> ThirtyOne, ThirtyTwo, >> SixtyThree, >> F3FF >> x0400, x0800, x0F00, >> MaxU8 -- changed to Target.Word8.max >> MThirtyOne, MSixtyThree >> >> perhaps not the best choice. >> At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. >> Some of the others are encodings for x87 status flags for example. >> Converting from strings is another not bad idea. >> >> The only abstraction boundary violation remaining now is the >> avoidance of ToBytes in init_int >> where the bytes are passed directly to m3objfile.AppendBytes >> This should perhaps be revisited. >> Granted, inconsistency with regard to where I violate the boundary. >> I have to look into ToBytes again. > -- Olaf Wagner -- elego Software Solutions GmbH Gustav-Meyer-Allee 25 / Geb?ude 12, 13355 Berlin, Germany phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95 http://www.elegosoft.com | Gesch?ftsf?hrer: Olaf Wagner | Sitz: Berlin Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194 From jkrell at elego.de Thu Feb 25 14:32:25 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:32:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225133225.255292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:32:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix typos in comments From jkrell at elego.de Thu Feb 25 14:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134539.B61462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:39 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:45:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134557.D58222474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:57 Modified files: cm3/scripts/python/: make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:47:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:47:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134713.7CFA72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:47:12 Modified files: cm3/scripts/python/: pylib.py Log message: merge function MakeDebianPackage from release to head (I'll probably get these comments wrong sometimes though!) From jkrell at elego.de Thu Feb 25 14:50:54 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:50:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135054.94D522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:50:54 Modified files: cm3/scripts/python/: make-deb.py Log message: copy make-deb.py from release to head head made "min" and "std" packages release just makes one -- much simpler to test, and talk about, albeit contributes to bloat when people can't install bits/pieces There are other aspects changed here, like how to specify the input, but it is really just a few lines either way. (current version is 15 lines, previous was 19) From jkrell at elego.de Thu Feb 25 14:55:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:55:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135510.A4D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:55:10 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-core.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:56:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:56:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135611.6A2F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:56:11 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-with-m3.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:57:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:57:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135753.505202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:57:53 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 copy-bootarchives.sh Log message: unimportant reconciliation with head (very very tempting to just delete the file..nobody uses this cross build stuff; I have done many cross builds, and not using this stuff..and these *.sh variations build more than needed..) From jkrell at elego.de Thu Feb 25 14:59:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:59:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135942.F108D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:59:42 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 do-cm3-all.sh Log message: unimportant reconciliation with head (getting a little more interesting, but it is only whitespace and 'all' works for 'realclean' but not generally for 'buildship', 'std' is the useful one) From jkrell at elego.de Thu Feb 25 15:00:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:00:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140030.4E6372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:00:28 Modified files: cm3/scripts/: find-packages.sh Log message: remove a space, match release From jkrell at elego.de Thu Feb 25 15:02:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:02:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140222.BC2E12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:02:22 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 pack-crossbuild.sh Log message: unimportant reconciliation with head (can we just delete all the old cross/boot/core stuff?) From jkrell at elego.de Thu Feb 25 15:05:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:05:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140540.C92612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:05:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: some minor reconciliation with head From jkrell at elego.de Thu Feb 25 15:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140644.771F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:06:42 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 upgrade.py Log message: some minor reconciliation with head From hosking at cs.purdue.edu Thu Feb 25 18:22:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 12:22:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225091236.8196D2474001@birch.elegosoft.com> References: <20100225091236.8196D2474001@birch.elegosoft.com> Message-ID: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> WTF!!!!!! What are you messing with Tint for? I just cleaned it up. Jay, this is getting very annoying. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 10:12, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 10:12:36 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.m3 > > Log message: > go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 25 20:49:06 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 14:49:06 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> References: <20100225091236.8196D2474001@birch.elegosoft.com> <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> Message-ID: <1D5CAE14-317E-4759-9351-DE963FF781EC@cs.purdue.edu> Jay, my apologies. My response was inappropriate and misplaced. I should have looked more closely at the details of your commits before complaining... It seems you have just added back some of the constants you use, and some of the additional comparisons you use. Again, my apologies. -- Tony Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 12:22, Tony Hosking wrote: > WTF!!!!!! > > What are you messing with Tint for? I just cleaned it up. > Jay, this is getting very annoying. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 25 Feb 2010, at 10:12, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 10:12:36 >> >> Modified files: >> cm3/m3-sys/m3middle/src/: TInt.m3 >> >> Log message: >> go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 12:02:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:02:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110233.645722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:02:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version on these files, two versions on Codex86.m3 bringing back overflow checking for every compile time integer operation cvs -z3 upd -r1.28 Codex86.i3 cvs -z3 upd -r1.89 Codex86.m3 cvs -z3 upd -r1.13 M3BackInt.i3 cvs -z3 upd -r1.15 M3BackInt.m3 cvs -z3 upd -r1.140 M3x86.m3 cvs -z3 upd -r1.34 M3x86Rep.i3 cvs -z3 upd -r1.18 Stackx86.i3 cvs -z3 upd -r1.98 Stackx86.m3 cvs -z3 upd -r1.4 Wrx86.i3 cvs -z3 upd -r1.12 Wrx86.m3 cvs -z3 upd -r1.4 m3makefile cvs -z3 upd -r1.6 M3BackWord.i3 cvs -z3 upd -r1.14 M3BackWord.m3 From jkrell at elego.de Fri Feb 26 12:05:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:05:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110517.C94DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:05:17 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: 'BITESIZE(IByte) * NUMBER(IBytes)' => 'BITSIZE(Int)' From jkrell at elego.de Fri Feb 26 12:08:56 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:08:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110856.552C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:08:56 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add MaxU8 (Yes I know there is Target.Word8.max) From jkrell at elego.de Fri Feb 26 12:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110959.63F8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:09:59 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse the constants from TInt (but wrapping them with an explicit precision From jkrell at elego.de Fri Feb 26 12:11:05 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:11:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111105.CEC0E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:11:05 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse more constants from TInt (but wrapping them with an explicit precision); IBytes => Target.Int; remove IByte From jkrell at elego.de Fri Feb 26 12:14:58 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:14:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111458.91C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:14:58 Added files: cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 Log message: initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 13:30:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:30:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226123048.CDFDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:30:48 Added files: cm3/m3-sys/m3middle/src/: TIntN.m3 Log message: initial copy of m3back/src/M3BackInt.m3 From jkrell at elego.de Fri Feb 26 13:48:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:48:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226124834.9AB1D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:48:34 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: introduce type Target.IntN which is Int plus a precision just like the old Target.Int (previously M3BackInt.Int) make TIntN and TWordN support it they are just thin wrappers over TInt, TWord previously named M3BackInt, M3BackWord add small amount of support to TInt: SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate These could, if desired, go into their only users: TIntN, TWordN. (with the understanding that that Target.Int is "revealed" to them.) add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged This is "just" additions. (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) (A little unsatisfactory that N is bytes instead of bits.) (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) While at it, in TIntN, rename things slightly: FromInt => FromHostInteger ToInt => ToHostInteger "Int" is "Target.Int" "HostInteger" is "INTEGER" again, TInt/TWord/m3front/m3middle not much affected. One fishy/uncertain thing in all of this, something to test out, is cross builds that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we really need INTEGER to be 4 bytes throughout m3back? (I know that mklib has little endian dependency.) From jay.krell at cornell.edu Fri Feb 26 13:50:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 12:50:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: diff attached > Date: Fri, 26 Feb 2010 13:48:34 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Fri Feb 26 14:12:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131202.EC20C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:02 Modified files: cm3/m3-sys/cm3/src/: version.quake Log message: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:12:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131259.569732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:59 Modified files: cm3/m3-sys/cm3/src/: Tag: release_branch_cm3_5_8 version.quake Log message: from head: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:17:38 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:17:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131740.37D642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:17:38 Modified files: cm3/scripts/: sysinfo.sh Log message: put back echo that I removed in version 1.89 Nov 26 2009, it seems critical for correctness, and the purported reason for removing it has been worked around elsewise, and I'm somewhat suspicious of the stated reason; suspicious of my original changes here too -- the issue is what does cm3 call itself. I think people complained about the inability to build cm3 as easily as other things, or that doing so made it identify itself as some sort of 'unknown' version. Another fix would be to checkin version.quake over here in scripts next to version, or such, not requiring anything to transform it over in m3-sys/cm3/src/m3makefile, maybe I can get Olaf to look at this..it's not very interesting (and I only like interesting things.. :) ) anyway, not critical; the point here is really to make head and release identical From jkrell at elego.de Fri Feb 26 14:26:41 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:26:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132644.F23E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:26:41 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:29:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:29:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132933.C3B5D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:29:33 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133548.3AFF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:35:46 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:39:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:39:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133930.CBA3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:39:30 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: make m3cc first; shipping is separate, so not sure why this matters (and if we did buildship, m3cc should probably be last, but it wasn't last before anyway) From jkrell at elego.de Fri Feb 26 14:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134027.C5F1B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:40:27 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: formating only From jkrell at elego.de Fri Feb 26 14:44:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:44:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134412.EFEDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:44:12 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: always install mklib (i.e. for cross builds that target NT386, though we need go fix endian/alignment bugs in it) From jkrell at elego.de Fri Feb 26 14:51:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:51:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135129.18C0A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:51:26 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: put back support for old config files (really? Maybe we should just remove it from release); 'fix' the stub config for the sake of hobbled quake readers such as cm3ide (ust earlier build time TARGET to write the file instead of later build time HOST) From jkrell at elego.de Fri Feb 26 14:53:37 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:53:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135337.C17C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:53:37 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: complete merge/copy of this file with release From jkrell at elego.de Fri Feb 26 15:01:08 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:01:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140109.63AAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:01:08 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release (we can just copy?) From jkrell at elego.de Fri Feb 26 15:03:09 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:03:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140309.808672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:03:09 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release: formating and echoing From hosking at cs.purdue.edu Fri Feb 26 16:10:42 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:10:42 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226110856.552C32474001@birch.elegosoft.com> References: <20100226110856.552C32474001@birch.elegosoft.com> Message-ID: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> On 26 Feb 2010, at 12:08, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:08:56 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 > > Log message: > add MaxU8 (Yes I know there is Target.Word8.max) So, why? From hosking at cs.purdue.edu Fri Feb 26 16:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226111458.91C632474001@birch.elegosoft.com> References: <20100226111458.91C632474001@birch.elegosoft.com> Message-ID: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> These don't belong here! Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. On 26 Feb 2010, at 12:14, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:14:58 > > Added files: > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > Log message: > initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 20:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226192146.05C3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:21:45 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 cm3/m3-sys/m3middle/src/: TInt.i3 TIntN.i3 Log message: replace MaxU8 with Target.Word8.maxN that I didn't think of until later fix diagnostic in non-occuring internal diagnostic (the stack overflow messages in the backend, which are 'just' a form of assertion) ('fetch_and_op' => 'exchange') From jay.krell at cornell.edu Fri Feb 26 20:22:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:22:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Fri Feb 26 20:35:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:35:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> References: <20100226111458.91C632474001@birch.elegosoft.com>, <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> Message-ID: Tony, I don't think this complicated TInt/TWord. Whatever I did add to them, we could move. I didn't change their existing code. I just added like four functions to TInt. >>> I want compile time arithmetic that does overflow checks to a specified precision. I actually suspect precision should be given in bits, or perhaps via a CGType, but that is a smaller matter. Currently precision is specified in bytes. It is a small layering over TInt/TWord, but one I'd rather not foist on their clients, since it, as far as I can tell, requires "doubling" the function calls. If every single function is always paired with another, or multiple other, that seems ripe for wrapping up in their own functions. Doesn't it? And then, it turns out, carrying along a precision seems reasonable too, so there is a new type. I understand it'd be more efficient to inline in the caller but I don't like that approach, of having good abstraction boundaries, and then manually partially inlining across them. At the very least therefore, I'd want to add, say: M3x86Rep.Add, Sub, Multiply, Shift that are all one liners over TInt/TWord. Those one liners I have simply put in TIntN/TWordN. Which is just perhaps a nicer factoring. Very hypothetically, other backends could use them. In reality there's only two, without much danger of their being more. I think the best we could hope for is I can "extend" m3back, but it'd still just be m3back and the code could still go there if you really want. By adding four small functions to TInt I avoid TIntN/TWordN knowing the representation. However, by virtue of their living in m3middle, I also made it ok for them to know the representation. As well, as you said, it is only partly opaque. All that is to say, there are many almost identical options here. The code could go in m3back if you really want. Or the functions I added to TInt could go in TIntN/TWordN. Or I could even, in a stretch, not have the overflow checking -- it historically wasn't there. But I think having it is an improvement. I still do blatantly violate the abstraction boundary here: PROCEDURE init_int (u: U; o: ByteOffset; READONLY value: Target.Int; t: Type) = BEGIN ... u.obj.appendBytes(u.init_varstore.seg, SUBARRAY(value, 0, CG_Bytes[t])); appendBytes (s: Seg; READONLY bytes: ARRAY OF UINT8); That is really imho the main outstanding problem in this area. I should try using ToBytes. And if I just ignore its return value, should work. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:14:34 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > These don't belong here! > > Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. > > On 26 Feb 2010, at 12:14, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:14:58 > > > > Added files: > > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > > > Log message: > > initial copies from m3back/M3BackInt, M3BackWord > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 20:40:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:40:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226194040.F12FC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:40:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: cleanup, at least until some future time that we generate more debug info, which is sorely lacking From jay.krell at cornell.edu Fri Feb 26 21:39:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 20:39:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Oops, not a different type, but a constant instead of a variable. Anyway, it is gone. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Fri, 26 Feb 2010 19:22:27 +0000 Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 27 01:43:08 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:43:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004309.8C2492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:43:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3middle/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate. From hosking at elego.de Sat Feb 27 01:49:47 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:49:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004948.3278B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:49:47 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate m3middle (TInt and TWord). Add back deprecated TIntN and TWordN until someone has time to fix m3back. It currently manifests significant confusion regarding target integer types. There is sufficient type information around for this confusion to be repaired. I just don't have the time for this. From hosking at cs.purdue.edu Sat Feb 27 01:51:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 19:51:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: <7E4207F1-C6FD-4421-8A4A-6C08DF566E35@cs.purdue.edu> I've just spent most of the day decontaminating m3middle and putting TIntN and TWordN back into m3back as deprecated modules. m3back needs to be fixed to get rid of these. I don't have time to mess with this stuff and I am peeved that I wasted a whole day on this. On 26 Feb 2010, at 13:48, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) From jkrell at elego.de Sat Feb 27 13:02:59 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:02:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120259.761E92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:02:59 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix one whitespace From jkrell at elego.de Sat Feb 27 13:09:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:09:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120945.000952474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:09:44 Modified files: cm3/m3-demo/calculator/src/: m3makefile cm3/m3-demo/cube/src/: m3makefile cm3/m3-demo/fisheye/src/: m3makefile cm3/m3-demo/mentor/src/: m3makefile cm3/m3-demo/sharedboard/boardclient/src/: m3makefile Log message: 'HasGui' => 'HasTrestle'; fix newlines From jkrell at elego.de Sat Feb 27 13:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121206.3A1B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:12:06 Modified files: cm3/m3-obliq/obliqbinanim/src/: m3makefile cm3/m3-obliq/obliqbinui/src/: m3makefile cm3/m3-obliq/obliqsrvui/src/: m3makefile cm3/m3-obliq/visualobliq/src/: m3makefile cm3/m3-obliq/voquery/src/: m3makefile cm3/m3-obliq/vorun/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:14:40 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:14:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121440.EB5A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:14:40 Modified files: cm3/m3-tools/rehearsecode/src/: m3makefile cm3/m3-tools/replayheap/src/: m3makefile cm3/m3-tools/showheap/src/: m3makefile cm3/m3-tools/shownew/src/: m3makefile cm3/m3-tools/showthread/src/: m3makefile cm3/m3-www/deckscape/src/: m3makefile cm3/m3-www/webscape/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:16:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:16:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121611.ADCAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:16:11 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix so it compiles, and pass correct parameters (debug code only) From jkrell at elego.de Sat Feb 27 13:20:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:20:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227122009.380132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:20:09 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: put back Chop() so that m3front compiles From jkrell at elego.de Sat Feb 27 13:35:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:35:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227123517.5741C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:35:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: go back to the versions that work since some files are absent here, this does *not* actually compile, but the history will be more sensible this way Codex86.i3 1.31 Codex86.m3 1.93 M3x86.m3 1.145 M3x86Pre.i3 1.37 Stackx86.i3 1.21 Stackx86.m3 1.102 Wrx86.m3 1.15 Wrx86.i3 1.7 NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) fixes to let it build shall be made very soon From jay.krell at cornell.edu Sat Feb 27 13:36:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 12:36:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227123517.5741C2474001@birch.elegosoft.com> References: <20100227123517.5741C2474001@birch.elegosoft.com> Message-ID: attached - Jay > Date: Sat, 27 Feb 2010 13:35:17 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 13:35:17 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > go back to the versions that work > since some files are absent here, this does *not* actually compile, > but the history will be more sensible this way > > Codex86.i3 1.31 > Codex86.m3 1.93 > M3x86.m3 1.145 > M3x86Pre.i3 1.37 > Stackx86.i3 1.21 > Stackx86.m3 1.102 > Wrx86.m3 1.15 > Wrx86.i3 1.7 > > NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) > > fixes to let it build shall be made very soon > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Sat Feb 27 14:55:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 14:55:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227135518.93B1F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 14:55:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Wrx86.i3 Wrx86.m3 Log message: make it work again possible new issue noticed: range checking on longint, or rather longint subranges and longcard: code might assume the values are already in integer range, and only range check for values not known to be within integer range, or something like that, I need to read this code more.. From jay.krell at cornell.edu Sat Feb 27 14:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 13:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Sat Feb 27 15:01:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 14:01:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: attached > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From hosking at elego.de Sat Feb 27 17:15:06 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:15:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161506.2B9482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:15:06 Modified files: cm3/m3-sys/m3front/src/builtinWord/: And.mg Extract.mg Insert.mg Minus.mg Mod.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 SetExpr.m3 cm3/m3-sys/m3front/src/misc/: Scanner.m3 TipeDesc.m3 Log message: Forgot to commit Chop => Extend! From hosking at elego.de Sat Feb 27 17:16:43 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:16:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161643.D72132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:16:43 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: Chop Chop. :-) It is the same as Extend. From jkrell at elego.de Sat Feb 27 20:54:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:54:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195408.910F72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:54:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsInt => TypeIsSigned IsWord => TypeIsUnsigned Is64 => TypeIs64 TIntN.T{n := NUMBER(Target.Int), x := ...} => TIntN.T{x := ...} n's default is NUMBER(Target.Int) uint_type.size => typeBitSize (new local) Modula-3 hides pointers vs. values from me, which normally I think is syntacic inconvenience in C, "." vs. "->", I should just be able to always say ".", but maybe there is a pointer after all adjust comments to be less scary when they are about efficiency and not correctness e.g. a few 64bit operations involving constants generate function calls when they could/should be implemented inline interesting point from a code size point of view though, is that we could inline "everything", and a caller who doesn't like the bloat could generally wrap up the operations in a function, if they notice, though we have some obligation to be efficient for people that don't bother looking (specifically, we don't inline some things that Visual C++ does, e.g. rotate64, and we do outline some things same as Visual C++ that processor manual suggests inlining e.g. 64bit shifts) GetOperandSize => OperandGetSize I know the first one reads more like an English sentence, but the second "scales" better I think, more mechanical and higher odds of success to always say TypeOperation than to find a nice English sentence From jkrell at elego.de Sat Feb 27 20:58:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:58:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195833.B32C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:58:33 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: the number '32' is suspicious to the reader who knows 64 bit integers are supported, add assert not is64 to indicate that shouldn't get here (at least until we implement that obvious optimization) From jkrell at elego.de Sat Feb 27 21:17:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:17:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227201716.B67FF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:17:16 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: looking for more "32", fix likely problems in insert/extract of 64bit numbers, esp. with bit offsets/sizes beyond 32 need to add more tests! From jkrell at elego.de Sat Feb 27 21:55:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:55:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205506.49D9F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:55:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't like the phrase 'in words' in a comment, because it sounds like an English usage for 'in summary', so try to clarify by saying 'in 'words' or 'registers'; I'm also not entirely happey that I've introduced yet another unit of measure, bad enough that we have both bits and bytes, maybe we can reduce this From jkrell at elego.de Sat Feb 27 21:58:20 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:58:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205820.5D4FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:58:20 Modified files: cm3/m3-sys/m3back/src/: TIntN.i3 TWordN.i3 Log message: comment out some unused constants: torn between providing the obvious simple clear more complete interface, vs. strictly what is used; this leaves unused probably in TInt/TWord as well, but again, reasonable to also leave them all in From jkrell at elego.de Sat Feb 27 22:03:02 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 22:03:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227210302.986F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 22:03:02 Modified files: cm3/m3-sys/m3back/src/: TWordN.i3 TWordN.m3 Log message: No need for DivMod here, we just call through to TInt/TWord. From wagner at elego.de Sun Feb 28 00:11:00 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:11:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227231101.259432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:11:00 Modified files: cm3/scripts/: make-src-dist-all.sh make-src-dist-sys.sh pkginfo.txt Added files: cm3/scripts/: all-deps get-all-deps.sh cm3/scripts/regression/: hudson_build_system.sh hudson_pkg_tests.sh cm3/scripts/win/: cvs.c Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:22:01 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:22:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227232201.BADFF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:22:01 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:30:54 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:30:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233054.3428C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:30:54 Modified files: cm3/scripts/regression/: defs.sh Log message: partial merge of changes from the 5.8 release branch From jkrell at elego.de Sun Feb 28 00:35:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:35:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233528.369AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:35:28 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: print all labels in the -debug output From jkrell at elego.de Sun Feb 28 00:52:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:52:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227235238.AF45E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:52:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: mostly resolve the double shift source vs. dest problem the underlying helper function sometimes reverses dest and src, in the interest of getting reg, mem These helper functions need cleanup and unification. build_modrm, load_like_helper, etc. abtract out some assumptions of 32bit sizes to be type-based so that we might inline some shift/insert/extract no actual bug here, only 32bit types get here currently, the rest generate function calls From jay.krell at cornell.edu Sun Feb 28 00:58:34 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 23:58:34 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227235238.AF45E2474001@birch.elegosoft.com> References: <20100227235238.AF45E2474001@birch.elegosoft.com> Message-ID: > mostly resolve the double shift source vs. dest problem Clarification, I don't know of any bug here, just that - the code looked wrong but acted right - the debug output was probably wrong and definitely a little bit missing (I'm sure nobody ever runs cm3 -debug and looks at NT386/foo.molog, but I've been doing that a lot lately, it is similar to cm3cg -y, but shows the generated code as well, interleaved). The actual generated code seemed ok, based on stuff in m3-sys/m3tests. "mostly resolve" as in, the code reads more sensibly now, though there is too much code duplication, build_modrm isn't as useful as it should be.. Also "double shift" doesn't mean "extra shift", but "double precision shift" -- 64bit shift. x86 has the instructions shld and shrd, shift left double, shift right double. You shift a register "into" another a register, instead of shifting in zeros or sign bits. - Jay > Date: Sun, 28 Feb 2010 00:52:38 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/28 00:52:37 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.m3 > > Log message: > mostly resolve the double shift source vs. dest problem > the underlying helper function sometimes reverses dest and src, in the > interest of getting reg, mem > These helper functions need cleanup and unification. > build_modrm, load_like_helper, etc. > > abtract out some assumptions of 32bit sizes to be type-based > so that we might inline some shift/insert/extract > no actual bug here, only 32bit types get here currently, the > rest generate function calls > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 28 01:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 1:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228003254.C2D702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 01:32:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: inline 64bit shifts by a constant, or at least more instances (e.g. shifting a non-const by a const?) Oh, actually left_shift and right_shift already did this, this now affects "signed shift", which I just don't see much utility in really... including: before: < start_call_direct p.71[_m3_shift64 at 12] 0 Word.64 < load_stack_param Word.32 0 < 00004803: 68FFFFFFFF PUSH $-1 < load_stack_param Word.64 0 < 00004808: 8B5DF8 MOV EBX tv.71[_a] < 0000480B: 8B55FC MOV EDX tv.71[_a]+4 < 0000480E: 52 PUSH EDX < 0000480F: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004810: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004803: 8B5DF8 MOV EBX tv.71[_a] > 00004806: 8B55FC MOV EDX tv.71[_a]+4 > 00004809: 0FACD301 SHRD EBX EDX $1 > 0000480D: D1EA SHR EDX $1 (though this really should use other addressing modes and that'd probably save an instruction) and then tricks like, shifting by more than 32: before: < 00004CA7: 6828000000 PUSH $40 < load_stack_param Word.64 0 < 00004CAC: 8B5DF8 MOV EBX tv.71[_a] < 00004CAF: 8B55FC MOV EDX tv.71[_a]+4 < 00004CB2: 52 PUSH EDX < 00004CB3: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004CB4: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004B50: 8B5DF8 MOV EBX tv.71[_a] > 00004B53: 8B55FC MOV EDX tv.71[_a]+4 > 00004B56: 8BD3 MOV EDX EBX > 00004B58: C1E208 SHL EDX $8 > 00004B5B: 33DB XOR EBX EBX move low to high, zero low, shift high by count - 32 though this too could be a lot better, at the very least, move edx ebx could be replaced just with a "virtual move" that reassigns the registers I'm strongly considering inlining all shifts and rotates, though I couldn't get it to work yet. This is a step. also notice this is less than one line changed, just to let the code run that was already there From jkrell at elego.de Sun Feb 28 09:41:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 9:41:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228084123.101D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 09:41:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add command line switch: -include-less-portable-output which triggers program to print all the output, including word size and/or endian-dependent output None of the output is "fully target dependent", there aren't n different less portable outputs, just 2 or 4 It might be nice to have finer control: -include-endian-specific-output -include-wordsize-specific-output that way we could, e.g. compare PPC_LINUX output with I386_LINUX, etc. instead of forcing PPC_LINUX to only be comparable to e.g. SPARC32_LINUX However I think this is a reasonable compromise. If a test truly *only* has endian-specifity or word-size specifity, that will be allowed for ('infrastructure' coming soon, just a few lines of code in m3makefile), but if a test has any of both, then so far my thinking is all or nothing (otherwise the logic to pick output file will be trickier) From jkrell at elego.de Sun Feb 28 10:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091206.D8F5A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:12:06 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Main.m3 Log message: remove line numbers, leave it as an option developer can uncomment to aid debugging From jkrell at elego.de Sun Feb 28 10:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091834.588532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:18:34 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm-little_endian32 Log message: add little endian 32bit output (we'll want at least big_endian32 (PPC, SPARC) and little_endian64 (AMD64); big endian 64 are currently not quite there but close (SPARC64, PPC64, MIPS64) From jkrell at elego.de Sun Feb 28 10:48:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:48:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228094801.912362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:48:01 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: two improvements - zero sized file compare equal to missing files so we don't have to checkin all the little stdout.build, stderr.build files - allow for stuff like stdout.pgm-littleendian32,etc and running a test without and without -include-less-portable-output flag when the flag is omitted, comparison is done to stdout.pgm etc. when the flag is included, a somewhat target specific file is probed for Having "fully target specific" stdout.pgm-NT386 would prevent automatic comparison across targets, ok but not great, and is not allowed here you can have stdout.pgm32 stdout.pgm64 stdout.pgm-little_endian32 stdout.pgm-little_endian64 stdout.pgm-little_endian stdout.pgm-big_endian32 stdout.pgm-big_endian64 stdout.pgm-big_endian pick 2 or 4 of them (though again, big_endian64 is not well represented, and littleendian64 is only one architecture) TARGET_ENDIAN must be defined in the config files All the checked in ones have it. Really cm3 should set this, but things aren't run in the right order. Maybe later (much). p227 uses this to get additional coverage, but some others should use it too -- so that we don't probe for all tests, only the ones that need it, and maybe these test can get the -include-less-portable-output flag That is, we already have some word size specific tests, and so our default is to probe for all tests. This new feature runs specified tests with and without probing. mixed_portability_test() is the name of the new one, though I'm open to other names rename pb_test to build_flags_test rename pr_test to p_run_flags_test This will allow proceeding with less worry, more testing, changing the NT386 insert/extract operations, for example, and gcc backend set_singleton/member, since we can get more testing coverage, don't have to be limited by full portability (though there is still a shortage of some variants, e.g. no working big endian 64bit and only one working little endian 64bit (AMD64) hopefully we can fill these gaps before much longer with MIPS64, SPARC64, PPC64, IA64) What is the difference between "cmp_file" and "compare_file". Someone should do source analysis, flag synonyms in the same context, and error, make the programmer use longer names... go ahead and combine run_test and run_test2, there aren't so many uses of each that it is so disruptive From jkrell at elego.de Sun Feb 28 11:09:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:09:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228100953.B33862474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:09:53 Modified files: cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: partial merge with release: mklib is portable enough, doesn't need a filter (it can compile/link on all platforms, even with old m3core, though it might not work esp. on big endian hosts) From jkrell at elego.de Sun Feb 28 11:11:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:11:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101114.696F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:11:14 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: partial merge with head: add mklib From jkrell at elego.de Sun Feb 28 11:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101331.723192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:13:31 Modified files: cm3/scripts/win/: pkginfo.cmd Log message: partial merge with release: m3staloneback doesn't need a filter, it is very portable, even if it isn't important and nobody ever uses it (it is command line access I believe to code linked into cm3) From hosking at elego.de Mon Feb 1 07:18:34 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 1 Feb 2010 7:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201061835.0A5662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/01 07:18:34 Modified files: cm3/doc/reference/: syntax.html Log message: Correction: include "~" in OtherChar. From jkrell at elego.de Mon Feb 1 12:45:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:45:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201114521.3DAD82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:45:20 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup to std, variable to add -debug to switches (I use this while working on longint/int64 for nt386) From jkrell at elego.de Mon Feb 1 12:58:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 12:58:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201115840.1CCB62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 12:58:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 13:00:07 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 13:00:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201120007.4C5F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 13:00:07 Modified files: cm3/scripts/python/: pylib.py Log message: add cvsup From jkrell at elego.de Mon Feb 1 14:25:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:25:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132503.EC58D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:25:03 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: fix Abs for positive input From jkrell at elego.de Mon Feb 1 14:28:46 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:28:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201132846.450302474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:28:46 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Log message: copy TInt, TWord from head; in particular because I was hitting an assertion failure in TInt line 42 building cvsup; taking everything is overkill and maybe won't even fix it, but should be ok From jkrell at elego.de Mon Feb 1 14:33:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:33:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133338.172582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:33:37 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 RsyncFile.m3 TokScan.m3 UnixMisc.m3 m3makefile cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: release_branch_cm3_5_8 DevT.m3 Log message: copy from head From jkrell at elego.de Mon Feb 1 14:37:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:37:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201133737.F1E252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:37:37 Modified files: cm3/m3-tools/cvsup/suptcp/src/common/: Tag: release_branch_cm3_5_8 SupErrnoC.c Log message: copy from head: #define _REENTRANT on Interix, I think this code is dead anyway From jay.krell at cornell.edu Mon Feb 1 14:34:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 13:34:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201133338.172582474001@birch.elegosoft.com> References: <20100201133338.172582474001@birch.elegosoft.com> Message-ID: diff attached > Date: Mon, 1 Feb 2010 14:33:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 14:33:37 > > Modified files: > cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 > RsyncFile.m3 TokScan.m3 > UnixMisc.m3 m3makefile > cm3/m3-tools/cvsup/suplib/src/dev_t_posix/: Tag: > release_branch_cm3_5_8 > DevT.m3 > > Log message: > copy from head > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Mon Feb 1 14:45:03 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:45:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134504.ADB032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:45:03 Modified files: cm3/doc/help/cm3/m3build/: exports.html Log message: copy from release (change from August 21 2009) From jkrell at elego.de Mon Feb 1 14:47:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:47:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134737.7AAA52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:47:36 Modified files: cm3/m3-comm/tcp/src/POSIX/: Tag: release_branch_cm3_5_8 HerrnoC.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 14:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 14:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201134846.37AB02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 14:48:45 Modified files: cm3/m3-lectern/lecternclient/src/POSIX/: Tag: release_branch_cm3_5_8 LecternClient.c Log message: copy from head: #define _REENTRANT on Interix From jkrell at elego.de Mon Feb 1 15:05:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:05:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201140537.5DC1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:05:37 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 Target.m3 Log message: bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) From jkrell at elego.de Mon Feb 1 15:19:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:19:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201141907.65F192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:19:06 Modified files: cm3/m3-sys/m3gdb/gdb/gdb/: Tag: release_branch_cm3_5_8 m3-util.c Log message: copy from head: crude but effective platform sniffing -- if it contains '64' or 'ALPHA' it is 64bit, if it contains 'NT386' it is NT386 (what about I386_NT?), if it contains '32' it is not 64bit ('other') From jkrell at elego.de Mon Feb 1 15:21:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:21:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142125.596AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:21:24 Modified files: cm3/m3-ui/anim3D/src/win-opengl/: Tag: release_branch_cm3_5_8 Win_OpenGL_Base.m3 Log message: copy from head: fix asserts to be #False instead of =True, since any non-zero value is considered success, not just 1 From jkrell at elego.de Mon Feb 1 15:23:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:23:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201142354.032332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:23:53 Modified files: cm3/www/uploaded-archives/: Tag: release_branch_cm3_5_8 targets.txt Log message: copy from head: add AMD64_NETBSD and AMD64_OPENBSD From jkrell at elego.de Mon Feb 1 15:34:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:34:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201143447.492802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:34:47 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$, it makes for noisy diffs one newline at ends of files is enough, some had two, remove one one had zero, add one From jkrell at elego.de Mon Feb 1 15:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144130.5C6672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:41:30 Modified files: cm3/scripts/: README archive-pkg.sh backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh create-skel.sh do-cm3-all.sh do-cm3-base.sh do-cm3-caltech-parser.sh do-cm3-coll.sh do-cm3-comm.sh do-cm3-core.sh do-cm3-front.sh do-cm3-gui.sh do-cm3-min.sh do-cm3-std.sh do-pkg.sh find-packages.sh find-src-dirs.sh install-cm3-compiler.sh list-pkg-dirs.sh make-bin-dist-min.sh make-dist.sh make-doc-dist.sh make-script-dist.sh make-src-dist-all.sh make-src-dist-gnu.sh make-src-dist-snapshots.sh make-src-dist-std.sh make-src-dist-sys.sh make-src-files-update.sh make-src-update.sh pack-crossbuild.sh pkgcmds.sh pkginfo.sh pkgmap.sh sysinfo-new.sh sysinfo.sh upgrade-5.3.sh upgrade.sh cm3/scripts/python/: boot1.py chext.py do-cm3-all.py do-cm3-base.py do-cm3-caltech-parser.py do-cm3-comm.py do-cm3-core.py do-cm3-front.py do-cm3-gui.py do-cm3-min.py do-cm3-std.py do-pkg.py install-back.py install-cm3-compiler.py install-config.py install-front.py make-deb.py make-dist.py make-msi.py upgrade.py cm3/scripts/regression/: loop.py cm3/scripts/win/: clearenv.cmd do-cm3-all.cmd do-cm3-base.cmd do-cm3-core.cmd do-cm3-front.cmd do-cm3-min.cmd do-cm3-std.cmd do-pkg.cmd find-packages.cmd install-cm3-compiler.cmd make-dist.cmd pkgcmds.cmd pkggnu_clean.cmd pkginfo.cmd pkgmap.cmd sysinfo.cmd upgrade.cmd Log message: remove $Id$ ensure files end in one newline, not two, not zero From jkrell at elego.de Mon Feb 1 15:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 15:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201144315.0A3D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 15:43:15 Modified files: cm3/m3-sys/mklib/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: copy minor changes from head: BYTE to UINT8, <*UNALIGNED*> TO (*UNALIGNED*) (nonexistant pragma to comment, BYTESIZE would be wrong here due to padding/alignment and isn't used From jay.krell at cornell.edu Mon Feb 1 15:47:54 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 1 Feb 2010 14:47:54 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201140537.5DC1C2474001@birch.elegosoft.com> References: <20100201140537.5DC1C2474001@birch.elegosoft.com> Message-ID: actually I accidentally had a bunch of head files in my release tree, oops good that I caught it - Jay > Date: Mon, 1 Feb 2010 15:05:37 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 15:05:37 > > Modified files: > cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.i3 > Target.m3 > > Log message: > bring over TargetIntToDiagnosticText from head just so I can avoid avoiding to bring over anything that uses it (like I maybe did already) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 1 16:06:05 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:06:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201150606.1DF522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:06:05 Modified files: cm3/m3-sys/m3middle/src/: Tag: release_branch_cm3_5_8 Target.m3 Log message: import Fmt From jkrell at elego.de Mon Feb 1 16:10:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:10:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151036.A85AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:10:36 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix warnings: remove unused consts (they were used with -defaultlib:libc that I removed) From jkrell at elego.de Mon Feb 1 16:11:47 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:11:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151147.8DC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:11:47 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 NTObjFile.m3 Log message: copy from head: remove -defaultlib:libc, add appendBytes that I think I might need, fold common code (albeit using unsafe, can we have it both ways? eliminate redundancy and keep safety?) From jkrell at elego.de Mon Feb 1 16:18:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:18:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151828.F2D992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:18:28 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: provide HasTrestle to replace HasGui From jkrell at elego.de Mon Feb 1 16:19:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:19:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201151953.571D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:19:53 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: wrap HasTrestle, HasOpenGL in ifndef so that others can override From jkrell at elego.de Mon Feb 1 16:21:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:21:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201152134.D2EBC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:21:34 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace only, and only one of them at that From jkrell at elego.de Mon Feb 1 16:33:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 16:33:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201153309.E23092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 16:33:09 Modified files: cm3/m3-tools/cvsup/suplib/src/: Tag: release_branch_cm3_5_8 FileAttr.m3 RCSFile.m3 Log message: copy from head, I though I already had: fixes related to filesize=LONGINT From jkrell at elego.de Mon Feb 1 17:11:23 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 17:11:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201161124.032D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 17:11:23 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadInterix.c ThreadPThreadC.c m3makefile Log message: interix support (partial) From jkrell at elego.de Mon Feb 1 18:34:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 18:34:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201173421.6851C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 18:34:21 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: initial guesses for insert64 and extract64 (need to check if sign extension is ever requested, and of course we could optimize by providing two functions since sign extension is a constant early enough From jkrell at elego.de Mon Feb 1 20:17:28 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:17:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201191728.A55F42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. From jkrell at elego.de Mon Feb 1 20:31:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 1 Feb 2010 20:31:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100201193142.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:31:42 Modified files: cm3/m3-sys/m3objfile/src/: Tag: release_branch_cm3_5_8 M3ObjFile.i3 Log message: I thought I commited this file already, oops. From jkrell at elego.de Tue Feb 2 09:21:31 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 2 Feb 2010 9:21:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100202082131.D18042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/02 09:21:31 Modified files: cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Log message: changfe parameter name from 'two' to 'to' From hosking at cs.purdue.edu Tue Feb 2 18:19:16 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 2 Feb 2010 12:19:16 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100201191728.A55F42474001@birch.elegosoft.com> References: <20100201191728.A55F42474001@birch.elegosoft.com> Message-ID: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 3 06:22:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 05:22:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 3 06:52:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 00:52:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu> Message-ID: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 3 06:53:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 6:53:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203055330.B58412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 06:53:30 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: The prior fix was broken. The problem lies elsewhere. From hosking at elego.de Wed Feb 3 07:26:21 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 7:26:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203062622.299E42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 07:26:21 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:31:30 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:31:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083130.5199E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:31:30 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: A cleaner fix for e029. From hosking at elego.de Wed Feb 3 09:33:44 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 3 Feb 2010 9:33:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203083344.BA7002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/03 09:33:44 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: A cleaner fix for e029. From jay.krell at cornell.edu Wed Feb 3 12:43:50 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 11:43:50 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: That is legal? What does it mean? What can you do it with t? I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. - Jay From: hosking at cs.purdue.edu Date: Wed, 3 Feb 2010 00:52:34 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Clearly the source code is not legal. It's just that your change breaks legal code: VAR t: NULL; which should emit a warning but nothing else. The problem lies elsewhere... On 3 Feb 2010, at 00:22, Jay K wrote: The backend should be able to cope with almost anything, I guess. But is the source code really legal? Shouldn't the front end error? The front end should error on some things, obviously. Notice that all of the "internal errors" in this scenario are from the front end. Just the assertion failure is not. The front end doesn't handle its own stack correctly here, the errors come from its CG.m3 module that wraps the backend. If this code is truly illegal and has no valid meaning, I think this is an ok change. The NT386 backend I guess should be hardened against front end bugs though. - Jay From: hosking at cs.purdue.edu Date: Tue, 2 Feb 2010 12:19:16 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That's the wrong approach. A warning is not an error. The backend should be able to cope with it... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 1 Feb 2010, at 20:17, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/01 20:17:28 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: test case e0\e029: MODULE Main; TYPE Rec = RECORD a: INTEGER END; VAR r := Rec; (* warning: variable has type NULL *) BEGIN INC(r.a) END Main. followed by internal errors and an assertion failure in m3back Change warning to error, and then it never gets to the internal errors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 14:50:56 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:50:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135057.949332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:50:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 M3x86.m3 Log message: 'two' => 'to' From jkrell at elego.de Wed Feb 3 14:53:45 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:53:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135345.9E9692474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:53:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce OperandPart = [0..1], OperandSize = [1..2], in support of int64/longint and the notion of multi-register operands (though unfortunately zero extending an INTEGER is going to eat a register for the zero instead of being split between register and immediate, but maybe we should sign extend anyway) From jkrell at elego.de Wed Feb 3 14:56:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:56:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135622.018912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:56:21 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Log message: some use of OperandPart, OperandSize From jkrell at elego.de Wed Feb 3 14:57:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 14:57:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203135724.8FD0F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 14:57:24 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: use M3x86Rep.RegName instead of local nearly exact copy (debug output only) From jkrell at elego.de Wed Feb 3 15:00:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:00:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140048.103BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:00:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust some assertions From jkrell at elego.de Wed Feb 3 15:01:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:01:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140132.A83D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:01:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust error message From jkrell at elego.de Wed Feb 3 15:02:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:02:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140218.763622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:02:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: adjust formating From jkrell at elego.de Wed Feb 3 15:04:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:04:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140457.E6DC32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:04:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add more asserts and diagnostics From jkrell at elego.de Wed Feb 3 15:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203140616.4CFC12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:06:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix set_label debug output From jkrell at elego.de Wed Feb 3 15:26:53 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:26:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203142655.534F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:26:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: add operandPart parameters in many places possibly we could do this less via the data (to be) stored in reguse From jkrell at elego.de Wed Feb 3 15:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143140.0468B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:31:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add GetTypeSize and GetOperandSize: besides bits and bytes, a new unit of measure is 'words' or 'registers', maybe unfortunate but I've been weighing a while and it seems useful From jkrell at elego.de Wed Feb 3 15:37:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:37:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143723.7A4032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:37:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt pushnew1 for multi-part operands (int64/longint) From jkrell at elego.de Wed Feb 3 15:39:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:39:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203143918.766C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:39:18 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'src_mvar' in procedure push From hosking at cs.purdue.edu Wed Feb 3 15:40:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 3 Feb 2010 09:40:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: On 3 Feb 2010, at 06:43, Jay K wrote: > That is legal? What does it mean? What can you do it with t? It's a variable of type NULL. It can only hold the NIL reference. Agreed, it is not particularly useful. The warning is there to distinguish: VAR t: NULL which a programmer presumably intended to write, from VAR t:= complicated expression of type NULL (perhaps hidden through various type renaming) which the programmer possibly did not intend to write. > I compiled all of cm3 (at least what isn't filtered out on NT386) and it didn't break anything. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 3 Feb 2010 00:52:34 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Clearly the source code is not legal. It's just that your change breaks legal code: > > VAR t: NULL; > > which should emit a warning but nothing else. > > The problem lies elsewhere... > > > On 3 Feb 2010, at 00:22, Jay K wrote: > > The backend should be able to cope with almost anything, I guess. > But is the source code really legal? > Shouldn't the front end error? > The front end should error on some things, obviously. > > Notice that all of the "internal errors" in this scenario are from > the front end. Just the assertion failure is not. > > > The front end doesn't handle its own stack correctly > here, the errors come from its CG.m3 module that wraps > the backend. > > If this code is truly illegal and has no valid meaning, I think this is an ok change. > The NT386 backend I guess should be hardened against front end bugs though. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Tue, 2 Feb 2010 12:19:16 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > That's the wrong approach. A warning is not an error. The backend should be able to cope with it... > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 1 Feb 2010, at 20:17, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/01 20:17:28 > > Modified files: > cm3/m3-sys/m3front/src/values/: Variable.m3 > > Log message: > test case e0\e029: > > MODULE Main; > TYPE Rec = RECORD a: INTEGER END; > VAR r := Rec; (* warning: variable has type NULL *) > BEGIN > INC(r.a) > END Main. > > followed by internal errors and an assertion failure in m3back > > Change warning to error, and then it never gets to the internal errors. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 15:44:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 15:44:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203144420.8934D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 15:44:20 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adaptions for push and pop for multipart operands (int64/longint) From jkrell at elego.de Wed Feb 3 16:45:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 16:45:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203154530.D35B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 16:45:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: end_init is seemingly the last call, so need to flush the debug output there (really I'm not sure it is the last, but I know its output is often truncated and near the end and flushing fixes that, could be we should flush for every function); also adapt 'Is64' => more abstract 'GetTypeSize' From jkrell at elego.de Wed Feb 3 17:23:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 17:23:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203162301.6E2D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 17:23:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86Rep.i3 Log message: move the register constants to M3x86 to show and preserve their correspondence with RegName From jkrell at elego.de Wed Feb 3 18:47:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:47:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174748.5F33E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:47:48 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: check_hi/lo/range/index/eq From jkrell at elego.de Wed Feb 3 18:48:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 18:48:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203174841.4DE7B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 18:48:41 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Log message: remove old versions change not-yet-used functions to __stdcall From rodney_bates at lcwb.coop Wed Feb 3 20:13:48 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Wed, 03 Feb 2010 13:13:48 -0600 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: References: <20100201191728.A55F42474001@birch.elegosoft.com>, , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> Message-ID: <4B69CAEC.7080308@lcwb.coop> Tony Hosking wrote: > On 3 Feb 2010, at 06:43, Jay K wrote: > >> That is legal? What does it mean? What can you do it with t? > > It's a variable of type NULL. It can only hold the NIL reference. > Agreed, it is not particularly useful. > > The warning is there to distinguish: > > VAR t: NULL > > which a programmer presumably intended to write, from > > VAR t:= complicated expression of type NULL (perhaps hidden through > various type renaming) > > which the programmer possibly did not intend to write. IMO, the appropriate thing for the front end to do is not to set the type of r to NULL, which is a perfectly valid Modula-3 type, but rather to an internal value named TypeUnknownBecauseOfAPriorError. Then make all warning/error checks silently succeed when applied to such unknown types, or anything else unknown in his way. > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and >> it didn't break anything. >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Wed, 3 Feb 2010 00:52:34 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> Clearly the source code is not legal. It's just that your change >> breaks legal code: >> >> VAR t: NULL; >> >> which should emit a warning but nothing else. >> >> The problem lies elsewhere... >> >> >> On 3 Feb 2010, at 00:22, Jay K wrote: >> >> The backend should be able to cope with almost anything, I guess. >> But is the source code really legal? >> Shouldn't the front end error? >> The front end should error on some things, obviously. >> >> Notice that all of the "internal errors" in this scenario are from >> the front end. Just the assertion failure is not. >> >> >> The front end doesn't handle its own stack correctly >> here, the errors come from its CG.m3 module that wraps >> the backend. >> >> If this code is truly illegal and has no valid meaning, I think >> this is an ok change. >> The NT386 backend I guess should be hardened against front end >> bugs though. >> >> >> - Jay >> >> >> ------------------------------------------------------------------------ >> From: hosking at cs.purdue.edu >> Date: Tue, 2 Feb 2010 12:19:16 -0500 >> To: jkrell at elego.de >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> That's the wrong approach. A warning is not an error. The >> backend should be able to cope with it... >> >> Antony Hosking | Associate Professor | Computer Science | Purdue >> University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> On 1 Feb 2010, at 20:17, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/01 20:17:28 >> >> Modified files: >> cm3/m3-sys/m3front/src/values/: Variable.m3 >> >> Log message: >> test case e0\e029: >> >> MODULE Main; >> TYPE Rec = RECORD a: INTEGER END; >> VAR r := Rec; (* warning: variable has type NULL *) >> BEGIN >> INC(r.a) >> END Main. >> >> followed by internal errors and an assertion failure in m3back >> >> Change warning to error, and then it never gets to the >> internal errors. >> >> >> >> >> > From jay.krell at cornell.edu Wed Feb 3 21:11:44 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 3 Feb 2010 20:11:44 +0000 Subject: [M3commit] CVS Update: cm3 (Warning, type is NULL) In-Reply-To: <4B69CAEC.7080308@lcwb.coop> References: <20100201191728.A55F42474001@birch.elegosoft.com>, , , <2E99159B-4577-4288-9CD3-E84D27A58A78@cs.purdue.edu>, , , , <279DA41E-ED3F-49AA-B375-0A33F1D9EF7A@cs.purdue.edu> , , <4B69CAEC.7080308@lcwb.coop> Message-ID: > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. The compiler does apparently do stuff like that in general. Tony put in use of "ErrType.T". - Jay > Date: Wed, 3 Feb 2010 13:13:48 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 (Warning, type is NULL) > > > > Tony Hosking wrote: > > On 3 Feb 2010, at 06:43, Jay K wrote: > > > >> That is legal? What does it mean? What can you do it with t? > > > > It's a variable of type NULL. It can only hold the NIL reference. > > Agreed, it is not particularly useful. > > > > The warning is there to distinguish: > > > > VAR t: NULL > > > > which a programmer presumably intended to write, from > > > > VAR t:= complicated expression of type NULL (perhaps hidden through > > various type renaming) > > > > which the programmer possibly did not intend to write. > > IMO, the appropriate thing for the front end to do is not to set the > type of r to NULL, which is a perfectly valid Modula-3 type, but > rather to an internal value named TypeUnknownBecauseOfAPriorError. > Then make all warning/error checks silently succeed when applied to > such unknown types, or anything else unknown in his way. > > > > >> I compiled all of cm3 (at least what isn't filtered out on NT386) and > >> it didn't break anything. > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Wed, 3 Feb 2010 00:52:34 -0500 > >> To: jay.krell at cornell.edu > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> Clearly the source code is not legal. It's just that your change > >> breaks legal code: > >> > >> VAR t: NULL; > >> > >> which should emit a warning but nothing else. > >> > >> The problem lies elsewhere... > >> > >> > >> On 3 Feb 2010, at 00:22, Jay K wrote: > >> > >> The backend should be able to cope with almost anything, I guess. > >> But is the source code really legal? > >> Shouldn't the front end error? > >> The front end should error on some things, obviously. > >> > >> Notice that all of the "internal errors" in this scenario are from > >> the front end. Just the assertion failure is not. > >> > >> > >> The front end doesn't handle its own stack correctly > >> here, the errors come from its CG.m3 module that wraps > >> the backend. > >> > >> If this code is truly illegal and has no valid meaning, I think > >> this is an ok change. > >> The NT386 backend I guess should be hardened against front end > >> bugs though. > >> > >> > >> - Jay > >> > >> > >> ------------------------------------------------------------------------ > >> From: hosking at cs.purdue.edu > >> Date: Tue, 2 Feb 2010 12:19:16 -0500 > >> To: jkrell at elego.de > >> CC: m3commit at elegosoft.com > >> Subject: Re: [M3commit] CVS Update: cm3 > >> > >> That's the wrong approach. A warning is not an error. The > >> backend should be able to cope with it... > >> > >> Antony Hosking | Associate Professor | Computer Science | Purdue > >> University > >> 305 N. University Street | West Lafayette | IN 47907 | USA > >> Office +1 765 494 6001 | Mobile +1 765 427 5484 > >> > >> > >> > >> > >> On 1 Feb 2010, at 20:17, Jay Krell wrote: > >> > >> CVSROOT: /usr/cvs > >> Changes by: jkrell at birch. 10/02/01 20:17:28 > >> > >> Modified files: > >> cm3/m3-sys/m3front/src/values/: Variable.m3 > >> > >> Log message: > >> test case e0\e029: > >> > >> MODULE Main; > >> TYPE Rec = RECORD a: INTEGER END; > >> VAR r := Rec; (* warning: variable has type NULL *) > >> BEGIN > >> INC(r.a) > >> END Main. > >> > >> followed by internal errors and an assertion failure in m3back > >> > >> Change warning to error, and then it never gets to the > >> internal errors. > >> > >> > >> > >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 3 21:29:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:29:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203202908.83E2C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:29:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: return boolean instead From jkrell at elego.de Wed Feb 3 21:30:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:30:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203026.4F9672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:30:26 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: add eq, ne, lt, le, gt, ge, maybe we can avoid using these From jkrell at elego.de Wed Feb 3 21:31:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:31:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203201.4B3EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:31:59 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and unsigned lt,le,gt,ge From jkrell at elego.de Wed Feb 3 21:33:03 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 3 Feb 2010 21:33:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100203203303.DC3D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/03 21:33:03 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: and then all the check functions except range should be redundant From hosking at elego.de Thu Feb 4 03:02:57 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:02:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020257.DCA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:02:57 Modified files: cm3/m3-sys/m3front/src/values/: Variable.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:03:10 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:03:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020310.B64AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:03:10 Modified files: cm3/m3-sys/m3front/src/exprs/: NamedExpr.m3 Log message: Seems that a NIL type for an expression is OK elsewhere (cf BITSIZE). So, just check for it here. From hosking at elego.de Thu Feb 4 03:04:00 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020400.9C6422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:00 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinWr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:04:16 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:04:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020416.506312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:04:16 Modified files: cm3/m3-sys/m3middle/src/: M3CG_Wr.m3 Log message: Oops. Typo. From hosking at elego.de Thu Feb 4 03:08:47 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:08:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204020847.DF62A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:08:47 Removed files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXOr.mg Log message: Fixing capitalization. From hosking at elego.de Thu Feb 4 03:11:30 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 3:11:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204021130.A70942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 03:11:30 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg CompareSwap.mg FetchDec.mg FetchInc.mg Load.mg cm3/m3-sys/m3front/src/misc/: CG.i3 CG.m3 Added files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchXor.mg Log message: Push through remaining atomics support. It will compile things now. But still needs testing... From jkrell at elego.de Thu Feb 4 07:21:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 4 Feb 2010 7:21:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204062104.93D0C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/04 07:21:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: some cosmetic ahead of other changes From hosking at elego.de Thu Feb 4 21:00:46 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 4 Feb 2010 21:00:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100204200046.D566A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/04 21:00:46 Modified files: cm3/m3-sys/m3front/src/builtinWord/: m3makefile word.tmpl Added files: cm3/m3-sys/m3front/src/builtinWord/: And.ig And.mg Divide.ig Divide.mg Extract.ig Extract.mg GE.ig GE.mg GT.ig GT.mg Insert.ig Insert.mg LE.ig LE.mg LT.ig LT.mg Minus.ig Minus.mg Mod.ig Mod.mg Module.ig Module.mg Not.ig Not.mg Or.ig Or.mg Plus.ig Plus.mg Rotate.ig Rotate.mg Shift.ig Shift.mg Times.ig Times.mg Xor.ig Xor.mg Removed files: cm3/m3-sys/m3front/src/builtinWord/: GenAnd.ig GenAnd.mg GenDivide.ig GenDivide.mg GenExtract.ig GenExtract.mg GenGE.ig GenGE.mg GenGT.ig GenGT.mg GenInsert.ig GenInsert.mg GenLE.ig GenLE.mg GenLT.ig GenLT.mg GenMinus.ig GenMinus.mg GenMod.ig GenMod.mg GenModule.ig GenModule.mg GenNot.ig GenNot.mg GenOr.ig GenOr.mg GenPlus.ig GenPlus.mg GenRotate.ig GenRotate.mg GenShift.ig GenShift.mg GenTimes.ig GenTimes.mg GenXor.ig GenXor.mg Log message: A more sensible naming scheme. From jkrell at elego.de Fri Feb 5 07:48:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:48:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205064852.D686A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:48:51 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: work in progress: adapt procedure find for int64/longint From jkrell at elego.de Fri Feb 5 07:56:03 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:56:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065605.2A5B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:56:03 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swapreg for int64/longint From jkrell at elego.de Fri Feb 5 07:59:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 7:59:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205065936.68D2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 07:59:36 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure unlock for int64/longint From jkrell at elego.de Fri Feb 5 08:01:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:01:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205070148.820922474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:01:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure set_reg, loadreg, loadphantom for int64/longint From jkrell at elego.de Fri Feb 5 08:43:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 8:43:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205074345.C96B72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 08:43:45 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure newdest for int64/longint From jkrell at elego.de Fri Feb 5 09:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 9:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205084023.0AA7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 09:40:22 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure sweep for int64/longint From jkrell at elego.de Fri Feb 5 10:05:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:05:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205090505.0613F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:05:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'mvar' to 'dest_mvar' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205091053.77C032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:10:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: rename 'stack0' to 'src_stack0' in procedure pop1 From jkrell at elego.de Fri Feb 5 10:20:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:20:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092012.D88AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:20:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:24:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:24:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092442.DEA2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:24:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: further adapt procedure pop for int64/longint From jkrell at elego.de Fri Feb 5 10:29:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:29:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205092953.6EBC22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:29:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix previous to compile and a little more adjustment for int64/longint From jkrell at elego.de Fri Feb 5 10:41:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:41:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094130.C12BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:41:30 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure swawp for int64/longint From jkrell at elego.de Fri Feb 5 10:48:42 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 10:48:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205094842.55B522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 10:48:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. From jkrell at elego.de Fri Feb 5 11:12:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 11:12:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205101214.0DA182474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 11:12:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: in doloophole, use the locals that I added and add asserts From jkrell at elego.de Fri Feb 5 12:40:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:40:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114026.DA1762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:40:26 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'Is64' => 'GetTypeSize', so to speak (not a direct replacement, but close) From jkrell at elego.de Fri Feb 5 12:42:01 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:42:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114201.D31962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:42:01 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: add an assert (related to int64/longint) From jkrell at elego.de Fri Feb 5 12:45:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:45:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114503.0D0032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:45:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: make findbin less confusing but equivalent, more like the historical version From jkrell at elego.de Fri Feb 5 12:49:28 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 12:49:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205114930.64E5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 12:49:28 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 M3x86.m3 Log message: flush the debug output at every newline (none of this is in the default path, you have to say cm3 -debug; it is very useful stuff though); otherwise the debug output would be truncated in the case of assertion failures, etc. From jkrell at elego.de Fri Feb 5 13:02:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:02:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205120234.B2F462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:02:34 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: oops on the flush: flush, don't recurse infinite From jkrell at elego.de Fri Feb 5 13:33:57 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:33:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205123358.040BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:33:57 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt procedure discard fori nt64/longint From jkrell at elego.de Fri Feb 5 13:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124027.743592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:40:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: add NonVolatileRegisters, VolatileRegisters, AllRegisters they are const but the first two at least could become variables if/when we adapt to other platforms (depending on their calling conventions) not sure we'll get around to optimizing based on the distinction though, this backend always preserves all nonvolatile registers in every prologue/epilogue I believe, no matter which a function uses From jkrell at elego.de Fri Feb 5 13:43:21 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:43:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124321.534DF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:43:21 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: remove ESP and EBP from the register sets because they are 'special' (right, sorry, not a technical term..) From jkrell at elego.de Fri Feb 5 13:45:47 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 13:45:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205124547.B58212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 13:45:47 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comments only From jkrell at elego.de Fri Feb 5 14:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131055.AECF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:10:55 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Codex86.m3 Log message: adapt load_indirect and store_indirect for int64/longint the structure here is oddly asymmetric load_indirect implementation is mostly in m3x86.m3 and adaption there store_indirect implementation is mostly in stackx86.m3 but I put adaption in codex86.m3, probably could be in stack though also inline_copy seems to do wierd things here..so the adaption is very conservative..maybe a sign it really belong in stackx86.m3 From jkrell at elego.de Fri Feb 5 14:15:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:15:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131515.2EB912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:15:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't know why in_proc_call is limited to 2; it seems fairly harmless to raise it (it'll waste memory on the fixed size arrays) so raise it to 10; enforce the limit with a subrange instead of an assert (that is better Modula-3 style, right?); we should try to construct some 'complex' code to see if we can get the value over 2 or even 10 From jkrell at elego.de Fri Feb 5 14:16:51 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:16:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205131651.0E6502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:16:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: again 'Is64' => 'GetTypeSize', again somewhat apples/oranges, but the diff makes sense From jkrell at elego.de Fri Feb 5 14:34:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:34:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205133412.582522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:34:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: bring in all the code for add/sub/mult/check_hi/div/mod/check_lo/etc. the main known missing pieces at this point are: - check the return value of check_hi/lo/eq/range/index, generate call to reportfault currently I'm just discarding the return values - get the parameter orders all correct, I've been less than guessing - see about eliminating some of the functions; e.g. add/sub/and/or/xor/compares are the most inlinable, not much else is (mul/div/mod/shift/rotate/insert/extract) - also give the constant folding a chance instead of just always calling; that givces even mul/div/mod/shift/rotate/insert/extract a good chance, and the front end does use e.g. extract for division by powers of two or such; this really is easy, it amounts to just moving all this code "a few lines down", like into stackx86.m3 after it checks for the constant/immediate cases (note that most operations are binary, so there imm op imm, and non-imm op imm, and some of them are commutive e.g. plus, mult and some are not e.g. divide and shift) - implement compares (the "check" ones are here, the functions are in hand2.c, but I forgot to handle the normal cases) - see about loophole/val zero extending vs. sign extending (currently always zero extends which I'm sure is wrong, unless the frontend deals with it) - of course flipping the switch in Target.m3, which I've done frequently; consider a command line option for this for now - probably move hand2.c to hand.c so it is statically linked, which also saves an instruction per call (and lets off of the compatibility hook mostly, though the static linking was really put in due to the data, so the other options are only statically link the data, none of the functions, or, really, in fact, eliminate the data, it looks easily eliminatable) - exit_proc looks a little suspicious/fragile; it needs to be certain to get the high part in edx, the low part in eax, currently' it doesn't appear so deterministic; that will be easy - I can't get the C compiler to generate an unsigned multiply, so maybe signed is all we need, not two functions - consider a more portable rotate implementation, currently is Visual C++ specific; could use #ifdef, really, not difficult.. just shift in direction and or.. - test insert/extract in particular; they are a bit gnarly None of these are particularly difficult and many of them are not important, but some are very important. From jkrell at elego.de Fri Feb 5 14:40:22 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:40:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205134022.4867E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:40:22 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: drop the four operations which are the most trivially implemented by just two instructions without any regard for carry, borrow, etc. (ignoring load/store): and, or, xor, not notice they weren't used anyway (not in this case is flipping all the bits, xor -1, not the the logical value, I'm pretty sure) From jkrell at elego.de Fri Feb 5 14:52:31 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:52:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135232.4AA642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:52:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: rename 'l' to 'label' (they could have at least used 'L'..) From jkrell at elego.de Fri Feb 5 14:56:23 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 14:56:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205135623.BB45B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 14:56:23 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: add a label parameter to dobin This will be used shortly for compare. Slightly experiment, but I expect it to work well. i.e. cmp hi1, hi2 jne label cmp lo1, lo2 label: I think will easily implement all the comparisons. If I'm being simple-minded, the label should be useful for the correct form. From jkrell at elego.de Fri Feb 5 15:05:43 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:05:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205140543.C8DB42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:05:43 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: strawman inline implementation of 64bit comparisons (should use this for check_hi/lo/eq/index also!) From jkrell at elego.de Fri Feb 5 15:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205142945.79B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:29:45 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce type Operand1 that resembles the old version of Operand; this isn't backsliding on the approach being used, but it'll probably let us clean things up a bit: the arrays can be of this type and the functions that only ever operate on words can use this, in particular, if nothing else, we can change many remaining uses of reg[0] (as opposed to reg[i]) to just reg; and we might use host integers here, might (consider however if this backend is adapted to 64bit, with 32bit host, and 64bit immediate parameters, without using LONGINT -- it might pay to avoid host INTEGER long term) From jkrell at elego.de Fri Feb 5 15:30:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:30:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143027.26D342474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:30:27 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment only From jkrell at elego.de Fri Feb 5 15:31:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:31:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143113.2AC6F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:31:12 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: minor edits to Operand1, which isn't in use yet, and won't be for now, it's not important From jkrell at elego.de Fri Feb 5 15:33:24 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 15:33:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205143324.D8EA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 15:33:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: whitespace only From jkrell at elego.de Fri Feb 5 16:10:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151040.E2C592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:40 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:10:53 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:10:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151053.C34502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:10:53 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: forgot a file: fix 64bit compare and fill int 64bit add, sub, or, not, xor, and From jkrell at elego.de Fri Feb 5 16:13:04 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:13:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205151304.2C4B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:13:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove function based 64bit add and subtract From jkrell at elego.de Fri Feb 5 16:24:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:24:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152402.E3F2E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:24:02 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: NOT is a unary operation, doesn't belong in dobin From jkrell at elego.de Fri Feb 5 16:25:07 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 16:25:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205152507.BADE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 16:25:07 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: implement 64bit NOT and NEG (something fishy here -- why dobin but unOp? probably should move the dobin code into binOp From jkrell at elego.de Fri Feb 5 17:04:14 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:04:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160414.59D932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:04:14 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: push dobin work down to binOp (for xor/and/or/not it should have already worked) inline all the 64bit check_lo/hi/eq/index via binOp handling oCMP From jkrell at elego.de Fri Feb 5 17:06:36 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:06:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205160636.4E0742474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:06:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: abs64 and neg64 now handled inline, remove function stuff From jkrell at elego.de Fri Feb 5 17:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161450.C11932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:14:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: handle 64bit min and max inline (basically just comparisons) From jkrell at elego.de Fri Feb 5 17:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 5 Feb 2010 17:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205161702.EC31E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/05 17:17:02 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: remove min, max, add, sub, and, or, xor, compares, check_range, abs, not, neg From hosking at elego.de Fri Feb 5 17:38:23 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163823.2ED242474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:23 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchInc.mg FetchDec.mg Log message: Need to loophole INTEGER incr/decr as necessary to Rep.T (i.e., for LONGINT and ADDRESS). Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:38:41 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:38:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205163841.58B602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:38:41 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchOr.mg FetchXor.mg Log message: Generate a run-time error for the AtomicRefany module (so we can reuse the same generic code), while giving a compile-time error for other clients. From hosking at elego.de Fri Feb 5 17:53:35 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 17:53:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205165336.1200C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 17:53:35 Modified files: cm3/m3-sys/m3front/src/builtinAtomic/: FetchAnd.mg FetchDec.mg FetchInc.mg FetchOr.mg FetchXor.mg Log message: Allow unsafe operations in AtomicAddress module (so we don't need to explicitly declare it unsafe). Other clients will still get a compile-time error unless they are also unsafe. From hosking at elego.de Fri Feb 5 18:09:51 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 18:09:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205170951.9BA262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 18:09:51 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.ig atomic.tmpl m3makefile Added files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: Addressable implementations of the atomic builtins. From hosking at elego.de Fri Feb 5 19:09:50 2010 From: hosking at elego.de (Antony Hosking) Date: Fri, 5 Feb 2010 19:09:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100205180950.A09842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/05 19:09:50 Modified files: cm3/m3-libs/libm3/src/os/Common/: File.i3 Log message: Use LONGCARD for size (used to be CARDINAL). From jkrell at elego.de Sat Feb 6 11:17:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:17:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101718.90DE62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:17:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: immOp, binOp can allocate the compare_label themselves -- that's less code and it handles cases I had missed From jkrell at elego.de Sat Feb 6 11:18:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:18:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206101838.1E2572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:18:38 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: 'l' => 'label' From jkrell at elego.de Sat Feb 6 11:25:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:25:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206102556.BD6782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:25:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the 64bit shifts/rotates to fold constants more to do here, both to handle more constant cases and to call the C compiler helpers directly instead of our wrappers for them (a little tricky given their custom calling conventions) From jkrell at elego.de Sat Feb 6 11:37:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 11:37:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206103732.634732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 11:37:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c m3makefile Removed files: cm3/m3-libs/m3core/src/Csupport/Common/: hand2.c Log message: move NT386 64bit helpers back to static linking also saving an extra copy of div/mod still work to do here -- should use the C compiler helpers directly for e.g. 64bit shifts From jkrell at elego.de Sat Feb 6 12:52:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:52:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115253.D39D62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:52:53 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move the checking code out of unlock into separate functions; it has proven useful placing calls elsewhere to see where things go wrong From jkrell at elego.de Sat Feb 6 12:54:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 12:54:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206115441.B5B292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 12:54:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: don't issue an error when converting Target.Word32.max to a host INTEGER overflows (this takes advantage of TInt.ToInt doing the conversion even if it overflows) From jkrell at elego.de Sat Feb 6 13:00:03 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:00:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120004.332A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:00:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more generally, don't error for anything less or equal to Target.Word32.max From jkrell at elego.de Sat Feb 6 13:02:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:02:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120251.298712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:02:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix indent on one line From jkrell at elego.de Sat Feb 6 13:05:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:05:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120526.F10852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:05:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the unlock calls in call_64, they don't match the patterns elsewhere From jkrell at elego.de Sat Feb 6 13:06:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:06:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206120612.366792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:06:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove the various 64bit compare functions, as we inline them now From jkrell at elego.de Sat Feb 6 13:38:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123812.D373D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:12 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:38:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:38:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206123821.E420B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:38:21 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move Register and TZero to shared M3x86Rep.i3 for upcoming change, introduce RegUse for same From jkrell at elego.de Sat Feb 6 13:59:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 13:59:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206125956.D1E772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 13:59:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 M3x86Rep.i3 M3x86.m3 Codex86.m3 Log message: go back a version, I'll do something else From jkrell at elego.de Sat Feb 6 15:01:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:01:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140104.E7CAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:01:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: replace 64bit shift left and right with the C compiler helpers _allshr, _allshl, ullshr From jkrell at elego.de Sat Feb 6 15:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140232.3AA732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:02:32 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove shift_left64 and shift_right64 (notice I had failed to implement signed shift right, but that is fixed now) From jkrell at elego.de Sat Feb 6 15:05:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:05:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140557.B643A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:05:57 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: hm, looks like shift_right is always supposed to be unsigned? From jkrell at elego.de Sat Feb 6 15:06:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:06:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206140656.3BA132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:06:56 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments only, about custom calling convention of 64bit shift From jkrell at elego.de Sat Feb 6 15:19:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:19:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206141921.B864A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:19:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: call compiler helper directly for 64bit multiplication, there is just one for signed and unsigned From jkrell at elego.de Sat Feb 6 15:24:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:24:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142455.71E3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:24:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove whitespace from ends of lines From jkrell at elego.de Sat Feb 6 15:29:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 15:29:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206142958.C295F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 15:29:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove m3_umul64 in favor of _allmul that it would call anyway From jkrell at elego.de Sat Feb 6 17:04:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:04:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206160428.454982474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:04:28 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: '_uallshr' => '_aullshr' From jkrell at elego.de Sat Feb 6 17:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161331.B63AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:13:31 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: go ahead and move TZero to M3x86Rep.i3 From jkrell at elego.de Sat Feb 6 17:15:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:15:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161528.B51842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:15:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: adapt get_temp properly for int64/longint; this will be important very shortly, fixing the register preservation around int64 function calls From jkrell at elego.de Sat Feb 6 17:16:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:16:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161612.D2CF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:16:12 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: comment and whitespace in get_temp From jkrell at elego.de Sat Feb 6 17:19:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161941.A2F392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:41 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 17:19:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 17:19:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206161956.9FE012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 17:19:56 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Log message: forgot files: save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From jkrell at elego.de Sat Feb 6 18:01:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:01:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170155.528372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:01:50 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect: the need for the offset is obvious; the need to do both dealloc_reg before either set_reg I don't understand, it seems like it should be ok either way From jkrell at elego.de Sat Feb 6 18:03:05 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:03:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206170305.AEA8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:03:05 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information in the event of an assertion failure From rodney_bates at lcwb.coop Sat Feb 6 18:12:46 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:12:46 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100205094842.55B522474001@birch.elegosoft.com> References: <20100205094842.55B522474001@birch.elegosoft.com> Message-ID: <4B6DA30E.10004@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/05 10:48:42 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the two types to have the same size (or arranges it thus, for conversion to an open array). But then doloophole could conceivable be called in the compiler for some additional purpose besides translating source code LOOPHOLE. From jay.krell at cornell.edu Sat Feb 6 18:17:41 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 6 Feb 2010 17:17:41 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: > But then doloophole could conceivably be called in the compiler > for some additional purpose besides translating source code LOOPHOLE. It is. As the comment says -- VAL calls doloophole. In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. - Jay > Date: Sat, 6 Feb 2010 11:12:46 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > Modified files: > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > Log message: > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sat Feb 6 18:18:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:18:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206171854.2EDBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:18:54 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Stackx86.i3 M3x86.m3 Log message: load_indirect needs to set the resulting operand type, at least so my own assertions succed, and we get a little further.. From rodney_bates at lcwb.coop Sat Feb 6 18:25:02 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Sat, 06 Feb 2010 11:25:02 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206140557.B643A2474001@birch.elegosoft.com> References: <20100206140557.B643A2474001@birch.elegosoft.com> Message-ID: <4B6DA5EE.7000909@lcwb.coop> Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 15:05:57 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > hm, looks like shift_right is always supposed to be unsigned? > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) shifts zeros into vacated bits, in either direction. I have sometimes wanted a signed right shift, but realized eventually that DIV by 2^n will do it. But if n is variable, that takes another runtime operation. From jkrell at elego.de Sat Feb 6 18:30:51 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 6 Feb 2010 18:30:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206173051.4E5362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/06 18:30:51 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: swapping differently sized things is legal, it occurs on line 189 of M3CBackEnd_C.m3; remove my assertion to the contrary, and we get the further (to line 1037 of same and another assertion failure) From hosking at cs.purdue.edu Sat Feb 6 19:15:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:15:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100206161941.A2F392474001@birch.elegosoft.com> References: <20100206161941.A2F392474001@birch.elegosoft.com> Message-ID: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. On 6 Feb 2010, at 17:19, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/06 17:19:41 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? From hosking at cs.purdue.edu Sat Feb 6 19:23:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:23:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA30E.10004@lcwb.coop> References: <20100205094842.55B522474001@birch.elegosoft.com> <4B6DA30E.10004@lcwb.coop> Message-ID: <2852DEFD-F700-4103-98B2-94EFFA5DE0A2@cs.purdue.edu> I did overload use of m3cg_loophole for conversion to/from INTEGER/LONGINT. For those, we should sign-extend. The gcc-based backend handles that trivially. On 6 Feb 2010, at 12:12, Rodney M. Bates wrote: > > > Jay Krell wrote: >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/05 10:48:42 >> Modified files: >> cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: >> adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > two types to have the same size (or arranges it thus, for conversion to an open array). > > But then doloophole could conceivable be called in the compiler for some additional purpose > besides translating source code LOOPHOLE. From hosking at cs.purdue.edu Sat Feb 6 19:27:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sat, 6 Feb 2010 13:27:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100205094842.55B522474001@birch.elegosoft.com>, <4B6DA30E.10004@lcwb.coop> Message-ID: <9C5DCFCC-3974-4F8C-946C-AC17C9822D03@cs.purdue.edu> VAL is the only place that needs to handle the conversion On 6 Feb 2010, at 12:17, Jay K wrote: > > But then doloophole could conceivably be called in the compiler > > for some additional purpose besides translating source code LOOPHOLE. > > It is. As the comment says -- VAL calls doloophole. > In fact every single array substract calls doloophole, usually to convert Int32 to In32..seems pointless.. I probably could avoid that in most cases. It's only there for arrays whose index type is a subrange of LONGINT. > > - Jay > > > Date: Sat, 6 Feb 2010 11:12:46 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay Krell wrote: > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/05 10:48:42 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: Stackx86.m3 > > > > > > Log message: > > > adapt procedure doloophole for int64/longint though probably we should sign extend sometimes? VAL calls loophole. > > > > > > > > If doloophole is used only to compile LOOPHOLE, this is irrelevant, as the language requires the > > two types to have the same size (or arranges it thus, for conversion to an open array). > > > > But then doloophole could conceivable be called in the compiler for some additional purpose > > besides translating source code LOOPHOLE. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 6 19:47:45 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 6 Feb 2010 19:47:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100206184745.8241B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/06 19:47:45 Modified files: cm3/m3-sys/m3front/src/exprs/: SubscriptExpr.m3 Log message: Clean up LInt-based (i.e., arrays indexed by LONGINT subranges) indexing. Avoid CG.Loophole where not needed. From jay.krell at cornell.edu Sun Feb 7 07:56:39 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 06:56:39 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> References: <20100206161941.A2F392474001@birch.elegosoft.com>, <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu> Message-ID: The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:06:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:06:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207070605.CC6602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:06:04 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: another place where I failed to offset the high part of the load; something still wrong here though, we still get assertion failure at line 1036 of M3CBackEnd_C.m3 From jay.krell at cornell.edu Sun Feb 7 08:33:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Sun, 7 Feb 2010 07:33:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100206161941.A2F392474001@birch.elegosoft.com>, , <74F1736D-2A3B-4DFC-B92B-973A605579ED@cs.purdue.edu>, Message-ID: Hm. I guess it would be more like: push 1 push 3 mov ecx, [esp+4] mov eax, [esp+8] add eax, ecx mov [esp+4], eax add esp,4 mov eax, [esp + 4] mov foo, eax add esp,4 and function calling isn't so hard. imagine the function int add(int a, int b). It'd go: push/eval a push/eval b mov eax, [esp + 4] push eax mov eax, [esp + 8] push eax call add add esp,16 That is, you would: 1) not "discard" from the "virtual stack" (merged with the machine stack) until after the call, cleaning up both it and the machine stack (for __cdecl) 2) As you build up the parameters, you'd maintain an offset to adjust virtual stack references by However, I still think you'd have to change all this for 32bit types as well, somewhat of a "rewrite" of the NT386 backend. (Not that I haven't changed it a bunch now to deal with types that don't fit in a single register.) You can't just do it for 64bit types. I think. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Sun, 7 Feb 2010 06:56:39 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 The generated code is simple. The "problem" is that the "virtual stack" is used for constant folding too. Surely it is faster, much smaller, to say: mov foo, 3 than push 1 push 2 pop eax pop ecx add eax, ecx mov foo, eax tempting though. Really, a lot of what the NT386 backend does is target-independent and could be moved either to the frontend or an in-between "cg" layer that is always present. It also presents a problem for calling functions. You can't trivially combine the stacks and still call functions. Evaluation of the parameters and actually passing them on the stack gets confused. At least in my head. Maybe it isn't so hard. - Jay > From: hosking at cs.purdue.edu > Date: Sat, 6 Feb 2010 13:15:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-) > > So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it. > > > On 6 Feb 2010, at 17:19, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 17:19:41 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 7 08:58:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 8:58:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207075812.B4D1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 08:58:12 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix load_indirect to not free the register holding the upper part of an address (or whatever register number is sitting there, it is junk) From jkrell at elego.de Sun Feb 7 09:18:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:18:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207081856.8CDD62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:18:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: some cleanup now that things seem good From jkrell at elego.de Sun Feb 7 09:31:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:31:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083142.C6E782474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:31:41 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: go back a version From jkrell at elego.de Sun Feb 7 09:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083254.A2E8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:32:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: introduce CONST RegistersForByteOperations, should give a little cleanup From jkrell at elego.de Sun Feb 7 09:36:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:36:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207083601.AEE822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:36:01 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: use RegistersForByteOperations From jkrell at elego.de Sun Feb 7 09:43:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:43:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084316.7F0EB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:43:16 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use C compiler helpers directly for unsigned div/mod From jkrell at elego.de Sun Feb 7 09:46:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:46:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207084657.F33D52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:46:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove unsigned div/mod, add comment about 'missing' functions From jkrell at elego.de Sun Feb 7 09:55:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 9:55:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207085519.EC7BA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 09:55:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: tweak set_range_new From jkrell at elego.de Sun Feb 7 10:00:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:00:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090025.3C35F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:00:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: add m3test_insert32 and m3test_extract32 so I can test the 64bit versions, by comparing the 32bit results of C and Modula-3 From jkrell at elego.de Sun Feb 7 10:01:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:01:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207090129.BA66E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:01:29 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: small tweak to M3_INSERT From jkrell at elego.de Sun Feb 7 10:27:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:27:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207092745.B97D12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:27:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: some test code for insert and extract From jkrell at elego.de Sun Feb 7 10:43:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:43:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094357.8A7852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:43:57 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: add PutLong and PutLongHex From jkrell at elego.de Sun Feb 7 10:44:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:44:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094433.B3F972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:44:33 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 Log message: use upper case for hex From jkrell at elego.de Sun Feb 7 10:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 10:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207094633.8F5CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 10:46:28 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: split the notin of the compiler (msvc or gcc) and platform (win32 or not) with respect how uint64/int64 are defined, vs. using %I64X vs. %llX; also actually save and commit the uppercase change From jkrell at elego.de Sun Feb 7 12:12:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:12:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207111225.C92942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:12:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: use 32bit values for bit offsets and shift counts, m3back will need adjusting (it already does to get the parameter orders correct anyway) From jkrell at elego.de Sun Feb 7 12:48:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 12:48:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207114846.5D8D72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 12:48:46 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386.common Log message: adjust the code that decides to statically link the files with data; I'm not sure there was a problem here or if it was something else, but this seems a little simpler From jkrell at elego.de Sun Feb 7 13:12:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:12:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121239.1D3F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:12:38 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIOc.c Log message: fix newlines From jkrell at elego.de Sun Feb 7 13:13:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:13:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121324.606142474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:13:24 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: leading 0x to match PutHex From jkrell at elego.de Sun Feb 7 13:15:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121504.7EE842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:04 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: adjust test code to non-windows %I64x vs. %llx From jkrell at elego.de Sun Feb 7 13:15:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:15:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121558.F3FD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:15:58 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: leading 0x to match RTIO.PutHex/PutLongHex that the parallel Modula-3 test code will use, and we're hoping they match From jkrell at elego.de Sun Feb 7 13:16:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:16:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207121633.729052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:16:33 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: more leading 0x on hex From jkrell at elego.de Sun Feb 7 13:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122145.D00562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:21:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test far more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:22:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:22:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122245.124E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:22:45 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: test more values, it is plenty fast From jkrell at elego.de Sun Feb 7 13:26:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:26:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122642.279A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:26:42 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: put the test code under #ifdef M3CORE_TEST_HAND instead of #if 0, that is probably ok, and test still more values From jkrell at elego.de Sun Feb 7 13:27:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:27:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122708.4E3732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:27:08 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: back to safer #if 0 From jkrell at elego.de Sun Feb 7 13:28:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:28:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122801.CE16E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:28:01 Added files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: copy hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:29:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:29:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207122934.551EE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:29:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: #include hand.c From jkrell at elego.de Sun Feb 7 13:30:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:30:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123028.E40C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:30:28 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove the test code (now in test_hand.c) From jkrell at elego.de Sun Feb 7 13:32:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:32:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207123214.555332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:32:14 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: move the 32bit insert/extract functions from hand.c to test_hand.c From jkrell at elego.de Sun Feb 7 13:44:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:44:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124450.096482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:44:50 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: add an option to merge stdout and stderr, because I use RTIO From jkrell at elego.de Sun Feb 7 13:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124642.37F702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:46:41 Added files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 m3makefile Log message: some test code for int64/longint, more to do (and it found a bug: inability to initialize longint variable (probably only with large values)) From jkrell at elego.de Sun Feb 7 13:48:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:48:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207124831.44D052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:48:31 Modified files: cm3/m3-sys/m3tests/src/: Test.common Log message: don't normalize stderr.pgm if merging stdout and stderr From jkrell at elego.de Sun Feb 7 13:54:19 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:54:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125419.52BBA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:54:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 13:55:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 13:55:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207125529.7A17F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 13:55:29 Modified files: cm3/m3-libs/m3core/src/runtime/common/: RTIO.i3 RTIOc.c Log message: back to lowercase hex to patch RTIO.PutHex From jkrell at elego.de Sun Feb 7 14:03:57 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:03:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207130357.1F1AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:03:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust and make terser; really the point now is to see if longints can be initialized on other platforms, not sure the bug is in m3back or not From jkrell at elego.de Sun Feb 7 14:32:35 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:32:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133235.197CE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:32:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: demonstrate some longint stuff working, though sign extension from negative integers doesn't From jkrell at elego.de Sun Feb 7 14:36:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:36:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207133639.E75352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:36:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix the parameter orders and sizes to some/many/all of the 64bit helper functions From jkrell at elego.de Sun Feb 7 14:49:29 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 14:49:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207134929.E4F332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 14:49:29 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: LINUXLIBC6 Log message: -march=i586 required for atomics to compile, probably needed on all other 32bit architectures as well, but maybe/probably we can adjust m3cc/m3makefile finally From jkrell at elego.de Sun Feb 7 15:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207140709.7A0E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:07:09 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix shifting (to not assert when it tries to allocate registers for the custom calling convention) and fix a newline; still a problem getting 64bit return values in the correct order From jkrell at elego.de Sun Feb 7 15:13:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:13:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141358.7FA4D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:13:58 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: remove Codex86. from in front of register names -- flatten the namespace From jkrell at elego.de Sun Feb 7 15:16:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:16:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141636.64D842474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:16:36 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: get the return value in the registers correctly for 64bit call_indirect, and slight reformat the same code in call_direct From jkrell at elego.de Sun Feb 7 15:18:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:18:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207141848.291262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:18:48 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove a newline, this one keeps bugging me From jkrell at elego.de Sun Feb 7 15:51:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:51:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145138.904542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:51:37 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: remove another newline From jkrell at elego.de Sun Feb 7 15:55:58 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 15:55:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207145558.260072474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 15:55:58 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: be sure 64bit return values are high in edx, low in eax From jkrell at elego.de Sun Feb 7 16:01:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:01:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150127.DF3F92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:01:24 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: oops: fix the wierdo shift whose direction is based on sign as opposed to the explicit left and right shift that are optimized with a custom calling convention to the C compiler helper function while at it, length some names: do_shift_64 => do_custom_calling_convention_shift_64 do_rotate_64 => do_rotate_or_shift_64 (actually was correct before but now has another use) From jkrell at elego.de Sun Feb 7 16:02:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:02:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207150232.B9F282474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:02:32 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: and bang: longint is now 64bits on NT386 From jkrell at elego.de Sun Feb 7 16:20:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:20:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152023.4AA622474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:20:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix 32bit signed vs. unsigned multiplication, back to what it was instead of accidentally reversed, I'm not sure if it matters, given that the C compiler only generates one of the two instructions From jkrell at elego.de Sun Feb 7 16:21:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152101.EA88C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:01 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: reformat previous From jkrell at elego.de Sun Feb 7 16:21:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:21:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152139.1864D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:21:39 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: slightly more reformat previous From jkrell at elego.de Sun Feb 7 16:28:39 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:28:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207152839.8D4872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:28:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add some tests of abs, min, max, neg; not all of which work! :( From jkrell at elego.de Sun Feb 7 16:38:00 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:38:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207153800.9CB0D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:38:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: assert that the constant and non-constant versions match -- this confirms there are some bugs, to be looked into shortly From jkrell at elego.de Sun Feb 7 16:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 16:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207154557.581352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 16:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: show that comparing negative numbers to 0 is a problem From jkrell at elego.de Sun Feb 7 17:05:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:05:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207160547.5FDB92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:05:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix some of the problems in compares: Int32 is not the only signed type now, Int64 is there (these patterns repeat in a few places, look for 'unscond' and/or 'revcond') From jkrell at elego.de Sun Feb 7 17:11:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:11:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161136.4AABC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:11:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix problem with negate, I had read the C compiler output carelessly when learning how to do this From jkrell at elego.de Sun Feb 7 17:16:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:16:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161614.5CBD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:16:13 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: crude but adequate fix for absolute value of int64; probably I hadn't read the code here carefully the first time, to notice that it isn't alway implemented via comparing to zero and negating..the other branch seems like it should work though? From jkrell at elego.de Sun Feb 7 17:18:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:18:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161822.F250E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:18:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:19:37 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:19:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207161937.79D532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:19:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: rotate is more interesting with larger rotations From jkrell at elego.de Sun Feb 7 17:26:12 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:26:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207162613.23BA92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:26:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: use easier to eyeball values From jkrell at elego.de Sun Feb 7 17:34:13 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 17:34:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207163413.579732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 17:34:13 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: terser but no less clear From jkrell at elego.de Sun Feb 7 19:59:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 19:59:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207185921.A6B202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 19:59:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: neuter atomics for now, they are hitting assertion failures in m3back From jkrell at elego.de Sun Feb 7 20:04:23 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 7 Feb 2010 20:04:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100207190423.7821F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/07 20:04:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: further neuter atomics for now From jay.krell at cornell.edu Mon Feb 8 01:13:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:13:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B6DA5EE.7000909@lcwb.coop> References: <20100206140557.B643A2474001@birch.elegosoft.com>, <4B6DA5EE.7000909@lcwb.coop> Message-ID: It is trivial to add clear/direct SignedRightShift if there is any interest. And heck, I find the "direction specified by sign" shift just wierd. It makes little sense to me. Never should have been there imho. - Jay > Date: Sat, 6 Feb 2010 11:25:02 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay Krell wrote: > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/06 15:05:57 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > hm, looks like shift_right is always supposed to be unsigned? > > > > > Yup. Word.eroShift (which Word.RightShift is also defined in terms of) > shifts zeros into vacated bits, in either direction. > > I have sometimes wanted a signed right shift, but realized > eventually that DIV by 2^n will do it. But if n is variable, > that takes another runtime operation. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 01:18:13 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 1:18:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208001813.C07662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 01:18:13 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Fix bug for constant initialization of LONGINT static data: MODULE Main; VAR a := 1L; BEGIN END Main. From jay.krell at cornell.edu Mon Feb 8 01:49:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 00:49:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208001813.C07662474001@birch.elegosoft.com> References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 01:57:17 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Sun, 7 Feb 2010 19:57:17 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com> Message-ID: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:05:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:05:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com> , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu> Message-ID: I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:09:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:09:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, Message-ID: Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 02:12:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 2:12:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208011233.4E4D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 02:12:33 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: go back a version From jay.krell at cornell.edu Mon Feb 8 02:27:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:27:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , Message-ID: Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:40:46 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:40:46 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, ,,,,, , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , Message-ID: This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 02:47:59 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 01:47:59 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, , , , , , , , Message-ID: hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:15:00 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:15:00 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , ,,, , ,,,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>,,, ,,,,, , , , , , , , Message-ID: I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 03:32:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 02:32:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , ,,,,, , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , ,,,,, , , , , , , , Message-ID: Tony, it is pretty distressing how much code in CG.m3 is identical except for replacing Target.Integer with Target.Longint, when they can be stored into a variable up front and then use common code. I'll work on that. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 02:15:00 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I wonder if we need TInt8, TInt16, TInt32, TInt64, TInt, TLong TWord8, TWord16, TWord32, TWord64, TWord, TLongWord that accurately implement ints/words of the exact specified size, with TInt/TWord/TLong/TLongWord depending on the target. I wouldn't mind trying to remove this word "Word". And replace it with UInt or such. TInt, TUInt, TLong, TULong? TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? TInt, TUnsignedInt, TLong, TUnsignedLong? TInt.Zero is just always 8 bytes. The size is I believe meant to be fairly opaque to the user. This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:47:59 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 hm. Bug perhaps in TWord: PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; Shift (x, -i, r); and maybe: PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; size := x.n * BITSIZE (IByte); BEGIN IF i + n > size THEN RETURN FALSE; END; I propose that TWord.Extract interpret all values as infinitely extended with zeros. Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). And Insert widen infinitely to fit whatever is being inserted? Will it break stuff? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:40:46 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 This really puzzles me, that using TInt.Zero makes it fail. I do see a subtle difference, n of TInt.Zero is always 8, but the CG.m3 code uses 4 for for 32bit. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:27:30 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Oddly, just using TInt.Zero apparently breaks it all. Assertion failures all over ThreadWin32.m3. I'll dig a *little*. Well, er, maybe just try your change without the TInt.Zero part? - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:09:42 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Same thing on Linux/x86. i.e. it breaks everything. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 01:05:58 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'll look a bit. I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Sun, 7 Feb 2010 19:57:17 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu Rats! I'll look into it. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 19:49, Jay K wrote: new source -> compiling RTHooks.m3 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to convert or initialize bit field value?? n_bytes=4 size=32 "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to - Jay > Date: Mon, 8 Feb 2010 01:18:13 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 01:18:13 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Fix bug for constant initialization of LONGINT static data: > > MODULE Main; > VAR a := 1L; > BEGIN > END Main. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 05:07:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:07:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208040757.D2D8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:07:57 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure store_indirect From jkrell at elego.de Mon Feb 8 05:14:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:14:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208041424.3924E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:14:24 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: fold some common code in procedure Add_offset From jkrell at elego.de Mon Feb 8 05:39:12 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:39:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208043912.D9A272474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:39:12 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load From jkrell at elego.de Mon Feb 8 05:41:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 5:41:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208044151.B4C772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 05:41:51 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: eliminate gross duplication of code for int vs. longint in procedure Load_indirect From jkrell at elego.de Mon Feb 8 07:20:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 7:20:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208062058.580E52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 07:20:58 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: repair and more similar cleanup; still a lot to do, look how load, store, load_direct, store_direct repeat a lot of code.. From jkrell at elego.de Mon Feb 8 08:08:00 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:08:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208070800.980A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:08:00 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: a little better on NT: let the fc calls work; still requires bc and date in the path, and link must not be Cygwin's From jkrell at elego.de Mon Feb 8 08:17:14 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 8:17:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208071714.C1C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 08:17:14 Modified files: cm3/m3-sys/m3middle/src/: Target.m3 Log message: allow unaligned load/stores on all x86/AMD64 targets; cleanup a bit From hosking at cs.purdue.edu Mon Feb 8 08:39:26 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:26 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: Nah, not necessary. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 7 Feb 2010, at 21:15, Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:47:59 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > hm. Bug perhaps in TWord: > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > Shift (x, -i, r); > > > and maybe: > > > PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR yy, yyy, yyyy: Int; > size := x.n * BITSIZE (IByte); > BEGIN > IF i + n > size THEN RETURN FALSE; END; > > > I propose that TWord.Extract interpret all values as infinitely extended with zeros. > Er, well, except that it makes me a bit scared too (esp. I'm currently without my good editor to really search/read the code). > And Insert widen infinitely to fit whatever is being inserted? > > > Will it break stuff? > > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:40:46 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > This really puzzles me, that using TInt.Zero makes it fail. > I do see a subtle difference, n of TInt.Zero is always 8, > but the CG.m3 code uses 4 for for 32bit. > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:27:30 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Oddly, just using TInt.Zero apparently breaks it all. > Assertion failures all over ThreadWin32.m3. > I'll dig a *little*. > Well, er, maybe just try your change without the TInt.Zero part? > > - Jay > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:09:42 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Same thing on Linux/x86. > i.e. it breaks everything. > > - Jay > > > From: jay.krell at cornell.edu > To: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 01:05:58 +0000 > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'll look a bit. > I'll double check the starting point, and try on Linux. This was on NT386, which has another problem initializing things larger than integer. > > - Jay > > > Subject: Re: [M3commit] CVS Update: cm3 > From: hosking at cs.purdue.edu > Date: Sun, 7 Feb 2010 19:57:17 -0500 > CC: m3commit at elegosoft.com > To: jay.krell at cornell.edu > > Rats! I'll look into it. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 7 Feb 2010, at 19:49, Jay K wrote: > > new source -> compiling RTHooks.m3 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > convert or initialize bit field value?? n_bytes=4 size=32 > "..\src\runtime\common\RTHooks.m3", line 18: ** INTERNAL CG ERROR *** unable to > > > - Jay > > > > Date: Mon, 8 Feb 2010 01:18:13 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 01:18:13 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Fix bug for constant initialization of LONGINT static data: > > > > MODULE Main; > > VAR a := 1L; > > BEGIN > > END Main. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 08:39:53 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 02:39:53 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208040757.D2D8C2474001@birch.elegosoft.com> References: <20100208040757.D2D8C2474001@birch.elegosoft.com> Message-ID: <2EC2E14F-6D83-4002-9474-933062F0268F@cs.purdue.edu> Jay, back off. I'm trying to fix things. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 05:07, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 05:07:57 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > eliminate gross duplication of code for int vs. longint in procedure store_indirect -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 09:21:50 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:21:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208082150.192DA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:21:50 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Repair damage from improper merge of Integer/Longint cases for loads/stores. From hosking at elego.de Mon Feb 8 09:33:20 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 9:33:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208083320.38BD02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 09:33:20 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Insert and Extract can use explicit shift directions. From hosking at elego.de Mon Feb 8 11:03:19 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 11:03:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208100319.E23C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 11:03:19 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Some more cleanup. Still needs fixing for LONGINT static constants. From hosking at elego.de Mon Feb 8 12:21:51 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 12:21:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208112151.F2A1C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 12:21:51 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Get rid of TInt.IntI. Not necessary. From hosking at elego.de Mon Feb 8 13:03:31 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 13:03:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208120331.C78762474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 13:03:31 Modified files: cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 IntegerExpr.m3 ReelExpr.m3 Log message: Check for out-of-range values in constructor when folding. From jkrell at elego.de Mon Feb 8 14:02:20 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:02:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208130222.40B752474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:02:20 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 Log message: Bring back IntI, to fix: "..\src\float\Common\DragonInt.m3", line 114: value is not constant SigBits = Word.RightShift (Word.Not (0), Reserved); "..\src\time\WIN32\TimeWin32.m3", line 19: value is not constant I = Word.Plus(LAST(INTEGER), 1); The pain that is CVS: cvs -z3 upd -j 1.21 -j 1.20 TInt.i3 cvs -z3 upd -j 1.18 -j 1.17 TInt.m3 cvs -z3 upd -j 1.7 -j 1.6 IntegerExpr.m3 From jay.krell at cornell.edu Mon Feb 8 14:03:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:03:42 +0000 Subject: [M3commit] TInt.IntI In-Reply-To: <20100208112151.F2A1C2474001@birch.elegosoft.com> References: <20100208112151.F2A1C2474001@birch.elegosoft.com> Message-ID: This seemed to break things so I put it back. - Jay > Date: Mon, 8 Feb 2010 12:21:51 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 12:21:51 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 > cm3/m3-sys/m3front/src/exprs/: IntegerExpr.m3 > > Log message: > Get rid of TInt.IntI. Not necessary. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:10:06 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:10:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208131006.8876B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:10:06 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: using TInt.Zero still seems to cause tremendous problems, so put back Target.Int{Target.Integer.bytes, Target.IBytes{0,..}} just a little bit From jay.krell at cornell.edu Mon Feb 8 14:13:13 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 13:13:13 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208100319.E23C42474001@birch.elegosoft.com> References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 14:37:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:37:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208133701.558F12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:37:01 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: split up m3_extract64(value, m, n, sign_extend) into m3_extract64(value, m, n) /* no sign extend */ and m3_extract_and_sign_extend64(value, m, n, sign_extend) still need to move this code to do constant folding From jkrell at elego.de Mon Feb 8 14:46:11 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:46:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208134612.1E20F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:46:11 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c cm3/m3-sys/m3back/src/: M3x86.m3 Log message: Change the helpers all from __cdecl to __stdcall. It is smaller and therefore faster/better. granted: if you could only have one calling convention, it would have to be __cdecl, for its compatibility with printf However __stdcall is heavily used. This does break the ABI but I think that is ok. From jkrell at elego.de Mon Feb 8 14:55:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 14:55:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208135522.AD6D32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 14:55:22 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: comments about why set_ne and set_eq are left in the NT386 platform even though they aren't used by it From jkrell at elego.de Mon Feb 8 15:05:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:05:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140550.79E992474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:05:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_load From jkrell at elego.de Mon Feb 8 15:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208140640.93B2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:06:40 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: don't repeat the identical if twice in m3_store From jkrell at elego.de Mon Feb 8 15:10:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:10:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141034.E40832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:10:34 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: edit the comment to be clearer in m3cg_declare_segment From jkrell at elego.de Mon Feb 8 15:12:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:12:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208141204.A73B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:12:04 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: go back a version, to previous comment From jkrell at elego.de Mon Feb 8 15:25:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:25:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142534.6E9942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:25:34 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyThree, to be used shortly From jkrell at elego.de Mon Feb 8 15:26:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:26:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208142618.A51A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:26:18 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: move SixtyThree down a line From jkrell at elego.de Mon Feb 8 15:51:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 15:51:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208145131.EEBC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 15:51:31 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: fixing shift/rotate/insert/extract to all fold constants: pass type from m3x86 to stackx86, since often the stack code is what checks if we have constants (I propose we move this work to the frontend..) From jkrell at elego.de Mon Feb 8 16:04:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:04:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208150425.617492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:04:25 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: work in progress: stack.shift/rotate/insert/extract now all return a boolean indicating if they did the work or not, so m3x86.shift/rotate/insert/extract can decide to generate a call or not This is really an artifact of the inconsistent splitting between stack and m3x86. Notice how sometimes the similar code is one, sometimes the other. Not the worst thing though. From jkrell at elego.de Mon Feb 8 16:32:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:32:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208153248.9ECAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:32:48 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: add CGTypeToIntType From jkrell at elego.de Mon Feb 8 16:47:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:47:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154709.48D732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:47:08 Modified files: cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 Log message: limit CGTypeToIntType to IType, even just unsigned would probably suffice From jkrell at elego.de Mon Feb 8 16:48:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 16:48:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208154846.0E0162474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 16:48:45 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 Log message: add ToUnsignedType to map from int32,word32,int64,word64 to word32,word32,word64,word64 From hosking at cs.purdue.edu Mon Feb 8 16:49:20 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:49:20 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208100319.E23C42474001@birch.elegosoft.com> Message-ID: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: > Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. > The RTIO was there for a reason that was still valid a day ago. > There is a test case that hits assertion failures. I'll see if that is still the case. > > - Jay > > > > Date: Mon, 8 Feb 2010 11:03:19 +0000 > > To: m3commit@ > > From: hosking@ > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 11:03:19 > > > > Modified files: > > cm3/m3-sys/m3front/src/misc/: CG.m3 > > > > Log message: > > Some more cleanup. > > Still needs fixing for LONGINT static constants. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 16:57:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 10:57:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208153248.9ECAE2474001@birch.elegosoft.com> References: <20100208153248.9ECAE2474001@birch.elegosoft.com> Message-ID: <664E362F-C2C5-4C0B-9B4A-509546E4C856@cs.purdue.edu> What do you need this mapping for? It is not needed anywhere in the front-end. If you really need something like this in your specialised backend can you please put it there. I see no need to add this unless they are really needed upstream in the front-end (as opposed to downstream in your backend). I will revert. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 16:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/08 16:32:48 > > Modified files: > cm3/m3-sys/m3middle/src/: TargetMap.i3 TargetMap.m3 > > Log message: > add CGTypeToIntType -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Mon Feb 8 17:00:54 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 8 Feb 2010 17:00:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208160054.9D38A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/08 17:00:54 Modified files: cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 Log message: Revert muddying of m3middle interfaces. These are engineered in support of the front-end. They should not be perturbed for down-stream back-end needs. From rodney_bates at lcwb.coop Mon Feb 8 17:02:58 2010 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Mon, 08 Feb 2010 10:02:58 -0600 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , Message-ID: <4B7035B2.4030806@lcwb.coop> Jay K wrote: > I wonder if we need > TInt8, TInt16, TInt32, TInt64, TInt, TLong > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > that accurately implement ints/words of the exact specified size, > with TInt/TWord/TLong/TLongWord depending on the target. > I wouldn't mind trying to remove this word "Word". > And replace it with UInt or such. > TInt, TUInt, TLong, TULong? > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > TInt, TUnsignedInt, TLong, TUnsignedLong? > > TInt.Zero is just always 8 bytes. > The size is I believe meant to be fairly opaque to the user. > This is the first I've noticed it being visible, such that TInt.EQ is > true for values with "quite different" behavior. I would have "thunk" > (thought without much thought) that anything TInt.EQ is more equivalent > than they actually are. > Hmm. I recall in a discussion a while back that the arithmetic on target ints was not coded to handle operands with mixed values of n. Could this have something to do with this? > > - Jay > > > From jay.krell at cornell.edu Mon Feb 8 17:13:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:13:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> References: <20100208100319.E23C42474001@birch.elegosoft.com>, , <82F2895E-51F5-4749-ACE3-DFB906446FF9@cs.purdue.edu> Message-ID: Major problems at runtime. Basically nothing works. I think, basically, initializing lots of stuff gets broken. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 10:49:20 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Where do you see the problems? At compile-time or run-time? I was able to compile without trouble. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 08:13, Jay K wrote: Part of this, again related to TInt.Zero, seemed to case *major* problems so I just *partly* undid it. The RTIO was there for a reason that was still valid a day ago. There is a test case that hits assertion failures. I'll see if that is still the case. - Jay > Date: Mon, 8 Feb 2010 11:03:19 +0000 > To: m3commit@ > From: hosking@ > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 11:03:19 > > Modified files: > cm3/m3-sys/m3front/src/misc/: CG.m3 > > Log message: > Some more cleanup. > Still needs fixing for LONGINT static constants. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <068EFB68-5F49-4F6B-8228-49E005E855CC@cs.purdue.edu> I am working on these issues right now. Stay tuned... It will be much cleaner than what Jay proposes. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:02, Rodney M. Bates wrote: > > > Jay K wrote: >> I wonder if we need >> TInt8, TInt16, TInt32, TInt64, TInt, TLong >> TWord8, TWord16, TWord32, TWord64, TWord, TLongWord >> that accurately implement ints/words of the exact specified size, >> with TInt/TWord/TLong/TLongWord depending on the target. >> I wouldn't mind trying to remove this word "Word". >> And replace it with UInt or such. >> TInt, TUInt, TLong, TULong? >> TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? >> TInt, TUnsignedInt, TLong, TUnsignedLong? >> TInt.Zero is just always 8 bytes. >> The size is I believe meant to be fairly opaque to the user. >> This is the first I've noticed it being visible, such that TInt.EQ is true for values with "quite different" behavior. I would have "thunk" (thought without much thought) that anything TInt.EQ is more equivalent than they actually are. >> > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > >> - Jay >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:15:36 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100208160054.9D38A2474001@birch.elegosoft.com> References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:18:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:18:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <4B7035B2.4030806@lcwb.coop> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , ,,, , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Mon Feb 8 17:31:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Mon, 8 Feb 2010 16:31:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com>, Message-ID: I'm also not sure the line between frontend and backend is so clear. They are immediately adjacent of course and do surprisingly similar things. You know, the front end does a lot of bit twiddling. I think a lot of what is in m3back belongs elsewhere, either in m3front or a nonexistant middle layer. It does a lot of target-independent optimization and bit twiddling. I guess ultimately the design is m3back would have M3sparc.m3, M3ppc.m3, M3alpha.m3, M3amd64.m3 ( possibly part of m3x86.m3), M3mips.m3, etc., and the existing x86 stuff would gradually get refactored so they'd share a lot of code. But ok, I've copied the stuff to m3back. - Jay From: jay.krell at cornell.edu To: hosking at elego.de; m3commit at elegosoft.com Date: Mon, 8 Feb 2010 16:15:36 +0000 Subject: Re: [M3commit] CVS Update: cm3 In the one case, there is a dependency on the ordering of the enumeration. It seems to me that anything that depends on the order of an enumeration belongs very near the definition of the enumeration. Stuff like this: SignedType = ARRAY CGType OF BOOLEAN { FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) TRUE, TRUE, TRUE, (* Reel .. XReel *) FALSE, FALSE, FALSE (* Addr .. Void *) }; CONST ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF [CGType.Word32..CGType.Word64] { CGType.Word32, CGType.Word32, CGType.Word64, CGType.Word64 }; I'm likely going to duplicate this exact stuff. - Jay > Date: Mon, 8 Feb 2010 17:00:54 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/08 17:00:54 > > Modified files: > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > Log message: > Revert muddying of m3middle interfaces. These are engineered in support > of the front-end. They should not be perturbed for down-stream back-end needs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 17:42:44 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 17:42:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208164247.244F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 17:42:44 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add SixtyFour and MSixtyThree, likely used in support of constant folding of 64bit shifts in m3back From hosking at cs.purdue.edu Mon Feb 8 17:36:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:36:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop> Message-ID: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Mon Feb 8 17:35:51 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 8 Feb 2010 11:35:51 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208160054.9D38A2474001@birch.elegosoft.com> Message-ID: <48542AD1-2AF4-468D-B1A0-38368DA466A6@cs.purdue.edu> I would simply populate an array from TargetMap.Integer_types. cf StackType in CG.m3. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:15, Jay K wrote: > In the one case, there is a dependency on the ordering of the enumeration. > It seems to me that anything that depends on the order of an enumeration > belongs very near the definition of the enumeration. > > Stuff like this: > > SignedType = ARRAY CGType OF BOOLEAN { > FALSE, TRUE, FALSE, TRUE, (* Word8 .. Int16 *) > FALSE, TRUE, FALSE, TRUE, (* Word32 .. Int64 *) > TRUE, TRUE, TRUE, (* Reel .. XReel *) > FALSE, FALSE, FALSE (* Addr .. Void *) > }; > > CONST > ToUnsignedType = ARRAY [CGType.Word32..CGType.Int64] OF > [CGType.Word32..CGType.Word64] { > CGType.Word32, CGType.Word32, > CGType.Word64, CGType.Word64 }; > > I'm likely going to duplicate this exact stuff. > > - Jay > > > Date: Mon, 8 Feb 2010 17:00:54 +0000 > > To: m3commit at elegosoft.com > > From: hosking at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: hosking at birch. 10/02/08 17:00:54 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: Target.i3 TargetMap.i3 TargetMap.m3 > > > > Log message: > > Revert muddying of m3middle interfaces. These are engineered in support > > of the front-end. They should not be perturbed for down-stream back-end needs. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Mon Feb 8 18:08:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:08:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208170838.D415E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:08:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: whitespace From jkrell at elego.de Mon Feb 8 18:29:30 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 8 Feb 2010 18:29:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100208172930.D16582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/08 18:29:30 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: work in progress optimizing shift/rotate/insert/extract involving constants From jkrell at elego.de Tue Feb 9 07:56:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 7:56:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209065657.7543F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 07:56:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Stackx86.m3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms From jkrell at elego.de Tue Feb 9 08:19:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 8:19:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209071935.B842E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 08:19:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Log message: rename SAL to SHL, it seems to be the more common name for these synonyms; add rows for SHLD and SHRD, still trying to figure how how they should read, confusing stuff From jkrell at elego.de Tue Feb 9 10:42:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 10:42:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209094257.5FE552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 10:42:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: better formating From jkrell at elego.de Tue Feb 9 18:31:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:31:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173100.4C1032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:31:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209173943.26DBE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:43:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:43:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174324.4FA4A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:43:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209174540.519482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:45:39 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:50:25 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:50:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175025.EC6452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:50:25 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage; looks like bug found right shifting longint by count greater than 31 or so From jkrell at elego.de Tue Feb 9 18:52:03 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:52:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175205.516AF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:52:03 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 18:58:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 18:58:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209175805.E0D322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 18:58:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: TInt.ThirtyOne => MaximumShift[t] fix shift/rotate longint by constant between 32 and 63 inclusive From jkrell at elego.de Tue Feb 9 19:07:30 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:07:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209180730.766C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:07:30 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: work in progress adding more test coverage From jkrell at elego.de Tue Feb 9 19:40:23 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:40:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184023.376E22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:40:23 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: combinatorics'r'us (more test converage, and a little less tedium) From jkrell at elego.de Tue Feb 9 19:48:33 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:48:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209184833.1D6822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:48:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a few more loops to reduce tedious code From jkrell at elego.de Tue Feb 9 19:55:05 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:55:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185505.88C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:55:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases, still missing all of rotate From jkrell at elego.de Tue Feb 9 19:56:00 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 19:56:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209185600.AD7592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 19:56:00 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: whitespace From jkrell at elego.de Tue Feb 9 20:29:49 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:29:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209192949.5F98E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:29:49 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:27 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195827.8AF912474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:27 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add asserts to compare runtime and compiletime values From jkrell at elego.de Tue Feb 9 20:58:55 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 20:58:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209195855.5A1022474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 20:58:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 21:26:56 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:26:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209202656.DA9512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:26:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.m3 Log message: inline 64bit shifts by a constant (and shifts of 64bit constant by constant) (and optimize away shift/rotate of constant 0) some of this seems backwards, and is commented as such, but the test case and disassembly show it to be correct, need to study that more still to handle 64bit rotate by constant.. From jkrell at elego.de Tue Feb 9 21:58:45 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 21:58:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209205845.A44ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 21:58:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases: value besides just 1 From jkrell at elego.de Tue Feb 9 22:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210616.272DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:16 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: more test cases From jkrell at elego.de Tue Feb 9 22:06:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:06:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210652.B88932474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:06:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix printout From jkrell at elego.de Tue Feb 9 22:08:19 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210819.AC0332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:19 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: comment about a bit of a 'trick' employed here From jkrell at elego.de Tue Feb 9 22:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209210859.1783E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: adjust comment From jkrell at elego.de Tue Feb 9 22:10:54 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:10:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211054.275112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:10:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: newline From jkrell at elego.de Tue Feb 9 22:14:50 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 9 Feb 2010 22:14:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100209211450.645042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/09 22:14:50 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: line up columns; add coment From jay.krell at cornell.edu Wed Feb 10 10:47:02 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 09:47:02 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 10:57:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:57:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095720.B5CCA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:57:20 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: enable longer run From jkrell at elego.de Wed Feb 10 10:59:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 10:59:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210095954.092662474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 10:59:54 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: allow 32bit specific output, don't make 64bit look like the bad guy, they are peers From jkrell at elego.de Wed Feb 10 11:03:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:03:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210100316.923A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:03:15 Added files: cm3/m3-sys/m3tests/src/p2/p226/: Tag: release_branch_cm3_5_8 stderr.build stderr.pgm stdout.build stdout.pgm Main.m3 m3makefile cm3/m3-sys/m3tests/src/p2/p227/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: stake a claim on these test case numbers in release branch, in case new tests do come along in this brach -- sequential numbering is not compatible with branching and we've gotten into trouble here before..not likely to enable these tests in this branch From jkrell at elego.de Wed Feb 10 11:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104438.196C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:45:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:45:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104508.ACC4E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:45:08 Added files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:49:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:49:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210104924.2E4CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:49:23 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:51:40 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:51:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105140.B719C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:51:40 Modified files: cm3/m3-libs/sysutils/src/: FSUtils.i3 System.i3 cm3/m3-libs/sysutils/src/POSIX/: SystemPosixC.c Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:53:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:53:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105329.6A5A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:53:28 Modified files: cm3/m3-libs/sysutils/src/: System.i3 Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ From jkrell at elego.de Wed Feb 10 11:54:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:54:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105448.A3E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:54:48 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_pm3.m3 SystemPosix.m3 Log message: and remove unused imports From jkrell at elego.de Wed Feb 10 11:55:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:55:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105520.22F4C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:55:20 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 Log message: remove unused import From jkrell at elego.de Wed Feb 10 11:58:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 11:58:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210105832.87B5B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:58:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:00:32 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:00:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110032.EF1522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:00:32 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: fix module name From jkrell at elego.de Wed Feb 10 12:03:27 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:03:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210110328.EADF12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:03:27 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnixC.c Log message: remove unneeded #include From jkrell at elego.de Wed Feb 10 12:12:17 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:12:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210111217.08E7F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:12:17 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: checkin output from LINUXLIBC6 as probably correct, will compare against AMD64_DARWIN and NT386 From jkrell at elego.de Wed Feb 10 12:20:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:20:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210112056.6B5332474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:20:55 Modified files: cm3/m3-libs/sysutils/src/POSIX/: m3makefile Log message: I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From jkrell at elego.de Wed Feb 10 12:58:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 12:58:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210115812.269A12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) From jkrell at elego.de Wed Feb 10 13:00:20 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:00:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120020.921A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:00:20 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: This test does various bit twiddling with INTEGER. e.g. Word.Insert, Word.Extract duplicate all of it to use Long as well Note that I didn't extend it to use bigger/wider values that would get better coverage of what Long can do that Word cannot, I just left it using the same test values as for Word From jkrell at elego.de Wed Feb 10 13:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120642.687CF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:06:42 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: change code to avoid overflow From jkrell at elego.de Wed Feb 10 13:07:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:07:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210120731.3F8492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:07:31 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: oops, go back to not allowing overflow From jkrell at elego.de Wed Feb 10 13:10:37 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:10:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210121037.27B642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:10:37 Modified files: cm3/m3-sys/m3tests/src/p1/p137/: Main.m3 Log message: extend test just *slightly* From jkrell at elego.de Wed Feb 10 13:58:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 13:58:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210125854.E3FFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 13:58:54 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 cm3/m3-sys/m3back/src/: M3x86.m3 Log message: use the new m3objfile appendBytes(array of [0..255]) instead of m3objfile append(integer) so that we have a chance of initializing longints, when the frontend is fixed in TInt.m3, fix ToBytes to return 1 byte for zero and -1 instead of zero bytes -- it should never return 0 bytes From jkrell at elego.de Wed Feb 10 14:03:08 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:03:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130308.6A59F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:03:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: strengthen assert: the intermediate result must be 0 for r=0 or r=-1; deobfuscate Mask, SignMask, Base: just set them to FF, 80, 100, instead of roundabout ways of saying the exact same thing From jkrell at elego.de Wed Feb 10 14:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210130959.71D4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:09:59 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.21 diff -u -r1.21 TInt.m3 --- m3middle/src/TInt.m3 10 Feb 2010 13:03:07 -0000 1.21 +++ m3middle/src/TInt.m3 10 Feb 2010 13:09:01 -0000 @@ -116,8 +116,9 @@ VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO carry := a.x[i] + b.x[i] + carry; @@ -133,8 +134,9 @@ VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; r.n := n; FOR i := 0 TO n-1 DO borrow := a.x[i] - b.x[i] - borrow; @@ -167,8 +169,9 @@ p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; FOR i := 0 TO n-1 DO FOR j := 0 TO n-1 DO k := i + j; @@ -228,8 +231,9 @@ b_sign := CheckSign (b, n); min: Int; BEGIN - IF a_sign = Sign.Bad THEN RETURN FALSE END; - IF b_sign = Sign.Bad THEN RETURN FALSE END; + IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN + RETURN FALSE + END; IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; @@ -294,8 +298,9 @@ PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = VAR n := MIN (a.n, b.n); BEGIN - IF CheckSign (a, n) = Sign.Bad THEN RETURN FALSE END; - IF CheckSign (b, n) = Sign.Bad THEN RETURN FALSE END; + IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN + RETURN FALSE; + END; FOR i := 0 TO n-1 DO IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; From jkrell at elego.de Wed Feb 10 14:46:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:46:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210134630.BE5032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:46:28 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: Just remove the size check in Extract. It appears it will just naturally treat the value as zero extended, which is reasonable and allows the rest to work. This lets Tony's fix for initializing Longint work. To be reapplied shortly. Deobfuscate Mask and Base here as well, like in TInt. Cleanup my TWord.xEQ function (still could use further cleanup, clearly, once confidence is total) Index: src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.10 diff -u -r1.10 TWord.m3 --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 @@ -16,8 +16,8 @@ LShift = Word.LeftShift; CONST - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); - Base = Mask + 1; + Mask = 16_FF; + Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) @@ -278,8 +278,8 @@ BEGIN <*ASSERT n # 0*> FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN RETURN FALSE; - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; + IF a.x[i] # b.x[i] THEN + RETURN FALSE; END; END; FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; @@ -449,10 +449,7 @@ PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN - IF i + n > size THEN RETURN FALSE; END; - RightShift (x, i, r); w := n DIV BITSIZE (IByte); From jkrell at elego.de Wed Feb 10 14:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 14:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210135311.BFF6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 14:53:11 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: reapply Tony's fix for longint initialization compare with http://dcvs.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-sys/m3front/src/misc/CG.m3.diff?r1=1.21;r2=1.22 seemingly identical except in the mean time "n_bits" renamed to "excess" It works now that TWord.Extract has no size limit and just assumes zero extension. Index: CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.31 diff -u -r1.31 CG.m3 --- CG.m3 8 Feb 2010 13:10:06 -0000 1.31 +++ CG.m3 10 Feb 2010 13:51:58 -0000 @@ -107,6 +107,9 @@ PROCEDURE Init () = BEGIN + + <* ASSERT TInt.Zero.n = Target.Longint.bytes *> + Max_alignment := Target.Alignments [LAST (Target.Alignments)]; FOR t := FIRST (Type) TO LAST (Type) DO StackType[t] := t; END; @@ -143,7 +146,7 @@ fields[TRUE] := NIL; in_init := FALSE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; free_temps := NIL; busy_temps := NIL; free_values := NIL; @@ -797,7 +800,7 @@ cg.begin_init (v); in_init := TRUE; init_pc := 0; - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; END Begin_init; PROCEDURE End_init (v: Var) = @@ -940,10 +943,10 @@ (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; - excess := Target.Integer.size - size; + excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); - init_bits := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; + init_bits := TInt.Zero; ELSIF Target.Little_endian AND TWord.Extract (init_bits, 0, size, tmp) AND TWord.Extract (init_bits, size, excess, new_bits) THEN @@ -970,7 +973,7 @@ FOR i := LAST (TargetMap.Integer_types) TO FIRST (TargetMap.Integer_types) BY -1 DO WITH z = TargetMap.Integer_types[i] DO - IF (z.bytes <= n_bytes) AND (z.size <= Target.Integer.size) + IF (z.bytes <= n_bytes) AND (offset MOD z.align = 0) THEN t := z.cg_type; RETURN TRUE; @@ -994,7 +997,7 @@ AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; - ELSE bit_offset := Target.Integer.size - (o - init_pc) - s; + ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) From jkrell at elego.de Wed Feb 10 15:06:26 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:06:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140626.98A902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:06:26 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: darnit, something is broken, go back a version From jkrell at elego.de Wed Feb 10 15:09:33 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:09:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210140935.04DD72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:09:33 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: go back to m3objfile append(integer) instead of appendBytes(array of bytes) From jkrell at elego.de Wed Feb 10 15:23:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:23:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210142357.D51C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:23:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo (lots of deliberat copy/paste here) From jkrell at elego.de Wed Feb 10 15:54:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:54:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145402.ACDCB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:54:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: classify various parts as portable or not; portable = same output for 32bit and 64bit, for non portable, print 'notportable' so they file can be diffed; we might somehow allow for portable and specific though? From jkrell at elego.de Wed Feb 10 15:57:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 15:57:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210145744.7A3642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 15:57:44 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: bounce to the AMD64_DARWIN output; most of the diff is changing to 'notportable' but there are definitely discrepancies between AMD64_DARWIN and LINUXLIBC6 that we need to investigate very soon, along with comparing to other platforms esp. NT386 and isolating the initialization issue (that could be related to these diffs) From jkrell at elego.de Wed Feb 10 16:11:59 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:11:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151159.38F482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:11:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: let's try this again, there was maybe something wierd on my machine, retesting.. go back a version: append(host integer) => appendBytes(array up to 8 bytes) We'll need this for initializing LONGINT, since they don't fit in host INTEGER From jkrell at elego.de Wed Feb 10 16:13:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:13:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151330.912062474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:13:30 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) From jkrell at elego.de Wed Feb 10 16:19:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 16:19:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210151907.1F3C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 16:19:07 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: again, maybe was wierdness on my machine, or it was the m3front change: remove the size check from TWord.Extract, tested by running upgrade.py twice, and the code is fairly clear, it works From hosking at cs.purdue.edu Wed Feb 10 16:14:37 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:14:37 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210104438.196C42474001@birch.elegosoft.com> References: <20100210104438.196C42474001@birch.elegosoft.com> Message-ID: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:16:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:16:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210112056.6B5332474001@birch.elegosoft.com> References: <20100210112056.6B5332474001@birch.elegosoft.com> Message-ID: Huh? Cryptic comment. On 10 Feb 2010, at 12:20, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:20:55 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > Log message: > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD From hosking at cs.purdue.edu Wed Feb 10 16:18:24 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:18:24 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210115812.269A12474001@birch.elegosoft.com> References: <20100210115812.269A12474001@birch.elegosoft.com> Message-ID: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 12:58:11 > > Modified files: > cm3/m3-sys/m3back/src/: Stackx86.m3 > > Log message: > allow negating FIRST(INTEGER) even though it overflows > allows this test case to compile: > C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 > --- building in NT386 --- > > new source -> compiling Main.m3 > "..\Main.m3", line 35: doneg: Negate overflowed > 1 error encountered > compilation failed => not building program "pgm.exe" > Fatal Error: package build failed > > tempting to make TInt.Add/Subtract return the value > even if overflow, but for now, no. > This fix assumes two's complement, that is, > it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 16:25:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:25:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210151330.912062474001@birch.elegosoft.com> References: <20100210151330.912062474001@birch.elegosoft.com> Message-ID: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> On 10 Feb 2010, at 16:13, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 16:13:30 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! From hosking at cs.purdue.edu Wed Feb 10 16:23:08 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:23:08 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210134630.BE5032474001@birch.elegosoft.com> References: <20100210134630.BE5032474001@birch.elegosoft.com> Message-ID: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> What does xEQ do exactly? PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. On 10 Feb 2010, at 14:46, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 14:46:28 > > Modified files: > cm3/m3-sys/m3middle/src/: TWord.m3 > > Log message: > Just remove the size check in Extract. > It appears it will just naturally treat the value as zero extended, which > is reasonable and allows the rest to work. > > This lets Tony's fix for initializing Longint work. > To be reapplied shortly. > > Deobfuscate Mask and Base here as well, like in TInt. > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > once confidence is total) > > Index: src/TWord.m3 > =================================================================== > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > retrieving revision 1.10 > diff -u -r1.10 TWord.m3 > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > @@ -16,8 +16,8 @@ > LShift = Word.LeftShift; > > CONST > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > - Base = Mask + 1; > + Mask = 16_FF; > + Base = 16_100; > > (*------------------------------------------- unsigned integer operations ---*) > > @@ -278,8 +278,8 @@ > BEGIN > <*ASSERT n # 0*> > FOR i := n-1 TO 0 BY -1 DO > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > + IF a.x[i] # b.x[i] THEN > + RETURN FALSE; > END; > END; > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > @@ -449,10 +449,7 @@ > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > VAR w, b: INTEGER; > - size := x.n * BITSIZE (IByte); > BEGIN > - IF i + n > size THEN RETURN FALSE; END; > - > RightShift (x, i, r); > > w := n DIV BITSIZE (IByte); From hosking at cs.purdue.edu Wed Feb 10 16:32:29 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:32:29 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 16:35:23 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 16:35:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210153523.710832474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 16:35:23 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert to including the overflow checks here. More changes coming. From hosking at cs.purdue.edu Wed Feb 10 16:13:31 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 10:13:31 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> Message-ID: I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210160924.031B92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:09:23 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: granted I'm guessing a bit, but this seems to allow for longint initialization, and doesn't break initialization of everything else; the rationale, other than a load of guessing and taking hints from Tony's change, is to flush the initialization at integer boundaries, whether we hit them or go past them, though I'm not really all that familiar with this code..the change is pretty darn small and safe seeming.. From jkrell at elego.de Wed Feb 10 17:13:13 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:13:13 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161313.3F9042474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:13:13 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: 1) mark more cases as non portable, that I missed before, because e.g. 0xABCD0000 < 10 depends on word size 2) go ahead and use longint intialization, of individual variables and of an array; this also reveals a bug in the test code where I was leaving one element of the array uninitialized, (see, I got all the way to the end, but I had missed [2] by accident) that could definitely account for some of the descrepancies, good news! From jkrell at elego.de Wed Feb 10 17:17:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:17:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210161705.6D2BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:17:05 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: mark a few more cases as not portable (I'm being a little sloppy here but ok) From jay.krell at cornell.edu Wed Feb 10 17:22:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:22:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:26:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:26:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , ,,, , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , ,,, , , , ,,, , , ,,, , ,,, , , , , , , <4B7035B2.4030806@lcwb.coop>, , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu> , Message-ID: I did a mechanical transform from Word to TWord. Nearly all of the constant folding was there, but only for 32bit operations (the only ones that existed). I've "merely" been giving parity to the 64bit variants. If anything, so far I have added checks. Granted, there might be some missing. My experience though is that they are in there, somewhere, probably via the frontend calling check_hi/lo. You know, I write code like Word.Shift(a, 123), I get a compile time warning and a runtime error. The large shift count is what comes to mind. I can test the extract/insert n + i stuff. I'm going to test with TWord.Extract put back. It ended up not used by my fix. Sorry about that. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:32:29 -0500 CC: m3commit at elegosoft.com To: jay.krell at cornell.edu I'm worried what it does for use of TWord.Extract with constant folding. The semantics of Word.Extract mandate a checked run-time error for n+i>Word.Size. We want to get that behaviour by not constant folding when the error might occur, so that the programmer gets the appropriate run-time error. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:31:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:31:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> References: <20100210115812.269A12474001@birch.elegosoft.com>, <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu> Message-ID: I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 17:33:10 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 17:33:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210163310.DC9C12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 17:33:10 Modified files: cm3/m3-sys/m3middle/src/: TWord.m3 Log message: put size check back in Extract, my longint initialization fix didn't require it after all; fix a newline it appears as well From jay.krell at cornell.edu Wed Feb 10 17:35:48 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:35:48 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , ,,, , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, ,,, , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:37:23 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:37:23 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:43:52 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:43:52 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, Message-ID: (I also doubt the efficiency gained by IWord/ILongCard based implementations is worth the slight extra mental effort to understand. This code is already beyond a lot of people, keeping it bytes, with clear values, helps just a teeny tiny little bit to read it. I still haven't studied how divide works for example. A comment indicating the actual values I'd say is an ok compromise, I had it in there briefly. I realize people might be tempted to press this into work where performance matters, at which point a larger base becomes more interesting. (I assume the "arithmetic" package looks similar.)) - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:22:56 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:47:28 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:47:28 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; PROCEDURE FloatI (READONLY iI: Int; p: Precision; VAR f: Float): BOOLEAN = VAR i: INTEGER; BEGIN BEGIN IF NOT TInt.ToInt (iI, i) THEN RETURN FALSE; END; f.pre := p; Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:48:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:48:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100210153523.710832474001@birch.elegosoft.com> References: <20100210153523.710832474001@birch.elegosoft.com> Message-ID: whoops didn't realize that had pasted in, I didn't see anything. Shouldn't the code keep the data in Target.Int instead of converting to host integer? - Jay > Date: Wed, 10 Feb 2010 16:35:23 +0000 > To: m3commit at elegosoft.com > From: hosking at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: hosking at birch. 10/02/10 16:35:23 > > Modified files: > cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 > > Log message: > Revert to including the overflow checks here. More changes coming. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:52:07 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:52:07 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 17:55:05 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 16:55:05 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: > be warned that your m3back code might break when I check things in. I have nothing outstanding on my machine. Please compile what is checked in, thanks. I do have a little more in mind, maybe. It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. We still have one or two word size cross issues. I looked into inlining rotates, the C compiler generates pretty big code though. - Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:00:53 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:00:53 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:06:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:06:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: I don't either but I'd just assume workaround it and move on. I get tired of fighting dependencies, I understand the code well enough, I just copy it around and give it the local module/interface name and move on.. Normally I don't like such duplication, but I know the code, and I just needed to get the system back up and running so I could compare longint test cases across multiple systems. There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:14:37 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Why? I don't understand how this can occur... Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:44, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 11:44:38 Modified files: cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 SystemPosix.m3 SystemPosixC.c m3makefile Log message: /* copied from m3core/src/unix/Common to fix bootstrapping error: /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' */ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:14:45 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:14:45 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210115812.269A12474001@birch.elegosoft.com>, , <6FC4ECB4-DFB7-4F6A-A855-7A9F76B17ECA@cs.purdue.edu>, Message-ID: Word.Insert and Word.Extract with large constants fail appropriately, via check_hi. I just checked. Long.Insert/Extract similar. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Wed, 10 Feb 2010 16:37:23 +0000 Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc. I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de Date: Wed, 10 Feb 2010 16:31:28 +0000 CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I don't really allow Add/Subtract to overflow. In fact I didn't make that change. I removed the overflow in the test case. My work is actually finding code that depends on silent overflow. My usage follows historical usage. Even the change I did have, not sure it is still there, returned the correct "false". But after possible garbage produced (or the wraparound value)) Realize that all my tint/tword code used to use word. There were no checks. Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt: IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; It really is around some type ambiguity. Is the value signed or unsigned? Maybe we need TWord.ToWord(Word.T)? I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:18:24 -0500 To: jkrell at elego.de CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 12:58, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 12:58:11 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: allow negating FIRST(INTEGER) even though it overflows allows this test case to compile: C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3 --- building in NT386 --- new source -> compiling Main.m3 "..\Main.m3", line 35: doneg: Negate overflowed 1 error encountered compilation failed => not building program "pgm.exe" Fatal Error: package build failed tempting to make TInt.Add/Subtract return the value even if overflow, but for now, no. This fix assumes two's complement, that is, it assumes FIRST(INTEGER) = -FIRST(INTEGER) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Wed Feb 10 18:29:19 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 10 Feb 2010 18:29:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210172919.BBBCD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/10 18:29:19 Modified files: cm3/m3-sys/m3middle/src/: TFloat.i3 TFloat.m3 Log message: Revert From hosking at cs.purdue.edu Wed Feb 10 18:44:23 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:44:23 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210151330.912062474001@birch.elegosoft.com>, <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu> Message-ID: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: > You really anticipate it every changing? > Ever having machines that can't address bytes? > I know they used to exist, but it has been several decades. > The world's vast swaths of C, C++, Java, C# won't port easily to them. > If I understood you, you argued that it is clearly IByte, so I should > feel free to make up my own constants outside of TInt.i3/TWord.i3. > Though so far I haven't. > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:25:31 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:47:13 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:47:13 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , , , , , , , , , , , <5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <4B7035B2.4030806@lcwb.coop>, , , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , Message-ID: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> On 10 Feb 2010, at 11:35, Jay K wrote: > I was just trying to get longint initialization to work. > It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. > It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. > Maybe that is desirable. > > - Jay > > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:13:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you are trying to do or why. Can you provide further explanation? > > On 10 Feb 2010, at 04:47, Jay K wrote: > > Shall I go ahead and let Extract act as if the data is infinitely zero extended? > That seems easy to do. I don't know if it will fix the problems, or cause other problems. > It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. > > > - Jay > > > From: hosking at cs.purdue.edu > Date: Mon, 8 Feb 2010 11:36:31 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Yes, that is what I am now trying to clean up. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 8 Feb 2010, at 11:18, Jay K wrote: > > Rodney I *think* generally mixed sizes are supported in TWord, TInt. > Though I don't necessarily understand all of the code. > There was a problem recently fixed, granted. > One problem here though is that you can't TWord.Extract beyond the size. > So the varying sizes of "zero" behave differently. > You might imagine it's zeros as far out as needed, but it doesn't work that way currently. > > - Jay > > > Date: Mon, 8 Feb 2010 10:02:58 -0600 > > From: rodney_bates at lcwb.coop > > To: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > > > Jay K wrote: > > > I wonder if we need > > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > > > that accurately implement ints/words of the exact specified size, > > > with TInt/TWord/TLong/TLongWord depending on the target. > > > I wouldn't mind trying to remove this word "Word". > > > And replace it with UInt or such. > > > TInt, TUInt, TLong, TULong? > > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > > > TInt.Zero is just always 8 bytes. > > > The size is I believe meant to be fairly opaque to the user. > > > This is the first I've noticed it being visible, such that TInt.EQ is > > > true for values with "quite different" behavior. I would have "thunk" > > > (thought without much thought) that anything TInt.EQ is more equivalent > > > than they actually are. > > > > > > > Hmm. I recall in a discussion a while back that the arithmetic on > > target ints was not coded to handle operands with mixed values of > > n. Could this have something to do with this? > > > > > > > > - Jay > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 10 18:50:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 10 Feb 2010 18:50:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100210175014.DD8C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/10 18:50:14 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Stackx86.m3 Log message: correctly convert Int32 to Int64 using CDQ instruction: convert double to quad; it's inefficient because CDQ only operates on EDX:EAX pair we already correctly convert Word32 to Word64 via allocating and zeroing another register truncation conversions we throw out the upper registers (after wastefully forcing the value into registers) still to consider: range checks and unsigned<=>signed conversion There are many error cases here. Perhaps the frontend already deals with it? From hosking at cs.purdue.edu Wed Feb 10 18:49:56 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:56 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: OK, I'll work it through to m3back. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:55, Jay K wrote: > > be warned that your m3back code might break when I check things in. > > I have nothing outstanding on my machine. > Please compile what is checked in, thanks. > I do have a little more in mind, maybe. > It's also quite easy to run and at least get .objs out or not. scripts/python/do-cm3-std.py NT386. > We still have one or two word size cross issues. > I looked into inlining rotates, the C compiler generates pretty big code though. > > > - Jay > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:54:47 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:54:47 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210104438.196C42474001@birch.elegosoft.com>, <7D6C8743-2354-4B7D-97B0-2F3D89618A0C@cs.purdue.edu> Message-ID: But it makes an untidy mess! On 10 Feb 2010, at 12:06, Jay K wrote: > I don't either but I'd just assume workaround it and move on. > I get tired of fighting dependencies, I understand the code well enough, > I just copy it around and give it the local module/interface name and move on.. > Normally I don't like such duplication, but I know the code, and I just needed > to get the system back up and running so I could compare longint test cases > across multiple systems. > > There was other wierdnes on the machine and rm -rf /cm3/pkg/sysutils seemed to help. > > - Jay > > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:14:37 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Why? I don't understand how this can occur... > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 10 Feb 2010, at 11:44, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/10 11:44:38 > > Modified files: > cm3/m3-libs/sysutils/src/POSIX/: FSUnix_cm3.m3 FSUnix_pm3.m3 > SystemPosix.m3 SystemPosixC.c > m3makefile > > Log message: > /* copied from m3core/src/unix/Common to fix bootstrapping error: > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINVAL' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__X_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__R_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__W_OK' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__ECHILD' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Uerror__EINTR' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__access' > /cm3/pkg/sysutils/LINUXLIBC6/libsysutils.so: undefined reference to `Unix__gethostname' > */ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 18:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 17:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> , <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> Message-ID: I don't think they are the same. TInt.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => true, they are both -1 TWord.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => false, they are 255 and 65535. But maybe I'm confused. I should just test the above but not now. I guess..it'd help if n was a constant, always 8. Then TInt.EQ would work, and the CheckSign business would be gone/simpler. Except then, we'd know, all other beings equal, initialization would be horribly broken. I don't fully understand that, but we need a 4 byte value. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:49:32 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: xEQ should be EQ but I wasn't confident I wrote it correctly. So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. It should be fairly clear from the code. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:23:08 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > What does xEQ do exactly? > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > Just remove the size check in Extract. > > It appears it will just naturally treat the value as zero extended, which > > is reasonable and allows the rest to work. > > > > This lets Tony's fix for initializing Longint work. > > To be reapplied shortly. > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > once confidence is total) > > > > Index: src/TWord.m3 > > =================================================================== > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > retrieving revision 1.10 > > diff -u -r1.10 TWord.m3 > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > @@ -16,8 +16,8 @@ > > LShift = Word.LeftShift; > > > > CONST > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > - Base = Mask + 1; > > + Mask = 16_FF; > > + Base = 16_100; > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > @@ -278,8 +278,8 @@ > > BEGIN > > <*ASSERT n # 0*> > > FOR i := n-1 TO 0 BY -1 DO > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > + IF a.x[i] # b.x[i] THEN > > + RETURN FALSE; > > END; > > END; > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > @@ -449,10 +449,7 @@ > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > VAR w, b: INTEGER; > > - size := x.n * BITSIZE (IByte); > > BEGIN > > - IF i + n > size THEN RETURN FALSE; END; > > - > > RightShift (x, i, r); > > > > w := n DIV BITSIZE (IByte); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:49:32 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:49:32 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210134630.BE5032474001@birch.elegosoft.com>, <7244B52A-4279-4D7C-849C-9721574756D3@cs.purdue.edu> Message-ID: <8536159F-8215-40D1-92AB-7DA46B1B7B75@cs.purdue.edu> But why do you need it. Just use TInt.EQ. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 10 Feb 2010, at 11:52, Jay K wrote: > xEQ should be EQ but I wasn't confident I wrote it correctly. > So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them. > Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern. > It should be fairly clear from the code. > > - Jay > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:23:08 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > What does xEQ do exactly? > > > > PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in. > > > > On 10 Feb 2010, at 14:46, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 14:46:28 > > > > > > Modified files: > > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > > > Log message: > > > Just remove the size check in Extract. > > > It appears it will just naturally treat the value as zero extended, which > > > is reasonable and allows the rest to work. > > > > > > This lets Tony's fix for initializing Longint work. > > > To be reapplied shortly. > > > > > > Deobfuscate Mask and Base here as well, like in TInt. > > > > > > Cleanup my TWord.xEQ function (still could use further cleanup, clearly, > > > once confidence is total) > > > > > > Index: src/TWord.m3 > > > =================================================================== > > > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v > > > retrieving revision 1.10 > > > diff -u -r1.10 TWord.m3 > > > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10 > > > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000 > > > @@ -16,8 +16,8 @@ > > > LShift = Word.LeftShift; > > > > > > CONST > > > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); > > > - Base = Mask + 1; > > > + Mask = 16_FF; > > > + Base = 16_100; > > > > > > (*------------------------------------------- unsigned integer operations ---*) > > > > > > @@ -278,8 +278,8 @@ > > > BEGIN > > > <*ASSERT n # 0*> > > > FOR i := n-1 TO 0 BY -1 DO > > > - IF a.x[i] # b.x[i] THEN RETURN FALSE; > > > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE; > > > + IF a.x[i] # b.x[i] THEN > > > + RETURN FALSE; > > > END; > > > END; > > > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; > > > @@ -449,10 +449,7 @@ > > > > > > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = > > > VAR w, b: INTEGER; > > > - size := x.n * BITSIZE (IByte); > > > BEGIN > > > - IF i + n > size THEN RETURN FALSE; END; > > > - > > > RightShift (x, i, r); > > > > > > w := n DIV BITSIZE (IByte); > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Wed Feb 10 18:53:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Wed, 10 Feb 2010 12:53:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100210112056.6B5332474001@birch.elegosoft.com>, Message-ID: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: > sysutils has somewhat of a need to know if it is using user threads. > We've been over this multiple times through the years. > Never seems to be 100% resolved, but a solid 99%. > > > It runs a process and waits. > Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. > It was identified by people as a major performance problem. > Because the process exits fairly quickly but you have to wait for the sleep to finish. > Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. > By and by, most platforms got kernel threads. Changing it to be wait(hang) > became good, faster, no deadlock. But openbsd comes along with lame > pthreads, usermode at that, so we use user threads, and wait(hang) > could deadlock.. > > > There is an interface in m3core to handle this stuff, but if > you bootstrap from an old build, it isn't there. > > > Mitigating factor as I understand that we don't use threads agressively, > so the deadlock isn't actually likely. > "we" meaning code that launches processes. > > > I understand that ideally you don't care if you are using userthreads or kernelthreads. > But the abstraction historically was incomplete. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Wed, 10 Feb 2010 10:16:24 -0500 > > To: jkrell at elego.de > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Huh? Cryptic comment. > > > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > > > Modified files: > > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > > > Log message: > > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:03:04 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:03:04 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> References: <20100208001813.C07662474001@birch.elegosoft.com>, , , , , , , ,,, , , , , , , , ,,<5F307B24-922E-460B-ADAB-5EAC6993E6FB@cs.purdue.edu>, , , , , , ,,, , , , , , , ,,, , , , , ,,, , , , ,,, , , ,,, , ,,, , ,,<4B7035B2.4030806@lcwb.coop>, ,,, , , <92FC52BE-354A-4C16-ACAC-50A6825CBD8E@cs.purdue.edu>, , , , , , <453B17E3-9F00-45EA-ACD2-50C9285EC18E@cs.purdue.edu> Message-ID: One might imagine that: VAR a,b:Target.Int; TInt.EQ(a, b) implies TWord.Extract(a, 10, 8) = TWord.Extract(b, 10, 8) (for various values of 10 and 8). but it doesn't. a could be a one byte zero, b a two byte zero, they are EQ, but Extract offset 10 will fail on a. I believe the right way to say this is "referential integrity is broken". EQ should imply equivalent in all observable ways, but it doesn't. Because two numbers with different size can be EQ, but different size leads to other varying behavior. I'm not 100% certain of any of this, but at least 50%. And then, I realize, given a Long.T and a Word.T, you can't directly compare them. You have to go through VAL, which makes them the same size. So there's a missing analog sort of. Target.Int is more loosely typed than its analogs Long.T and Word.T. Target.Int allows mixing arithmetic on different sized operands, for better and worse. In one hand TWord.Extract should just act like the value is infinitely zero extended. On the other, as you point out, that's not what its callers really expect. It's probably a useful semantic, but in some other context. And in that imaginary context, TWord.Insert might grow the data to fit. And likewise TInt.Add/Subtract would grow the value, not overflow.. I realize, this is not the context we care about, we just need something for the compiler. (Though I'm not even sure what for, esp. why all the operations, other than for the constant folding in the NT386 backend, which makes good use of it all.) - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:47:13 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 10 Feb 2010, at 11:35, Jay K wrote: I was just trying to get longint initialization to work. It seemed some of its problems might have been related to the fact that you Extract more high order zeros from TInt.Zero than Target.Int{Target.Integer.bytes}. But in the end (just now) I left TWord.Extract alone. It remains true that EQ(TInt.Zero) has multiple representations and they don't act alike. I don't understand what you mean by this statement. Maybe that is desirable. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 10:13:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I'm not sure what you are trying to do or why. Can you provide further explanation? On 10 Feb 2010, at 04:47, Jay K wrote: Shall I go ahead and let Extract act as if the data is infinitely zero extended? That seems easy to do. I don't know if it will fix the problems, or cause other problems. It is easy to try. The danger is if it causes subtle undetected-at-first-and-for-a-while problems. - Jay From: hosking at cs.purdue.edu Date: Mon, 8 Feb 2010 11:36:31 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Yes, that is what I am now trying to clean up. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 8 Feb 2010, at 11:18, Jay K wrote: Rodney I *think* generally mixed sizes are supported in TWord, TInt. Though I don't necessarily understand all of the code. There was a problem recently fixed, granted. One problem here though is that you can't TWord.Extract beyond the size. So the varying sizes of "zero" behave differently. You might imagine it's zeros as far out as needed, but it doesn't work that way currently. - Jay > Date: Mon, 8 Feb 2010 10:02:58 -0600 > From: rodney_bates at lcwb.coop > To: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > Jay K wrote: > > I wonder if we need > > TInt8, TInt16, TInt32, TInt64, TInt, TLong > > TWord8, TWord16, TWord32, TWord64, TWord, TLongWord > > > > that accurately implement ints/words of the exact specified size, > > with TInt/TWord/TLong/TLongWord depending on the target. > > I wouldn't mind trying to remove this word "Word". > > And replace it with UInt or such. > > TInt, TUInt, TLong, TULong? > > TSignedInt, TUnsignedInt, TSignedLong, TUnsignedLong? > > TInt, TUnsignedInt, TLong, TUnsignedLong? > > > > TInt.Zero is just always 8 bytes. > > The size is I believe meant to be fairly opaque to the user. > > This is the first I've noticed it being visible, such that TInt.EQ is > > true for values with "quite different" behavior. I would have "thunk" > > (thought without much thought) that anything TInt.EQ is more equivalent > > than they actually are. > > > > Hmm. I recall in a discussion a while back that the arithmetic on > target ints was not coded to handle operands with mixed values of > n. Could this have something to do with this? > > > > > - Jay > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:05:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:05:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> References: <20100210112056.6B5332474001@birch.elegosoft.com>, , <27DF0B57-4C09-41BC-8841-7CD2A887CA86@cs.purdue.edu> Message-ID: I understand but I have a variety of systems and a variety of installs lying around. I usually make do with whatever I have. It is untidy, but only slightly. For some definition of "only slightly". I keep hoping we can say 5.8 release is the new base, abandon all others, but we don't have it yet. - Jay Subject: Re: [M3commit] CVS Update: cm3 From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:53:39 -0500 CC: jkrell at elego.de; m3commit at elegosoft.com To: jay.krell at cornell.edu We've been over this before. The run-time libraries (including sysutils) can be assumed to bootstrap from a *new* compiler, which has itself been compiled against the *old* libraries. Then, you can build a *new new* compiler linked against the *new* libraries. Let's not make the libraries have braindead code when it is not necessary. They should be kept clean going forward! On 10 Feb 2010, at 12:00, Jay K wrote: sysutils has somewhat of a need to know if it is using user threads. We've been over this multiple times through the years. Never seems to be 100% resolved, but a solid 99%. It runs a process and waits. Historically in sysutils and m3core this was sleep/wait(nohang) in a loop. It was identified by people as a major performance problem. Because the process exits fairly quickly but you have to wait for the sleep to finish. Sleep being Modula-3 Thread.Sleep I guess -- call into the user thread scheduler. By and by, most platforms got kernel threads. Changing it to be wait(hang) became good, faster, no deadlock. But openbsd comes along with lame pthreads, usermode at that, so we use user threads, and wait(hang) could deadlock.. There is an interface in m3core to handle this stuff, but if you bootstrap from an old build, it isn't there. Mitigating factor as I understand that we don't use threads agressively, so the deadlock isn't actually likely. "we" meaning code that launches processes. I understand that ideally you don't care if you are using userthreads or kernelthreads. But the abstraction historically was incomplete. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:16:24 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > Huh? Cryptic comment. > > On 10 Feb 2010, at 12:20, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 12:20:55 > > > > Modified files: > > cm3/m3-libs/sysutils/src/POSIX/: m3makefile > > > > Log message: > > I had this change around: expose if we are using user threads, i.e. if we are OpenBSD > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 10 19:08:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Wed, 10 Feb 2010 18:08:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> References: <20100210151330.912062474001@birch.elegosoft.com>, , <1DB246D9-B86B-4940-8310-BC4794490593@cs.purdue.edu>, , <0046C4EB-22A3-43B3-911F-100C96D1BB87@cs.purdue.edu> Message-ID: BITS 16, I know, but I like BITS 8. Using integer directly is viable and efficient, but I doubt worthwhile in this context. If they must be abstracted, I think a comment next to them giving their actual values would be good. I was tempted to change all the bitsize(x) and bitsize(x) - 1 expressions to 8 and 7. So much little layering here and there, can really slow down one's reading comprehension.. - Jay From: hosking at cs.purdue.edu Date: Wed, 10 Feb 2010 12:44:23 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 Changes coming that should make life easier... (HIstorically, the representation was BITS 16 FOR [0..16_FFFF] instead of the current BITS 8 FOR [0..16_FF]) On 10 Feb 2010, at 11:22, Jay K wrote: You really anticipate it every changing? Ever having machines that can't address bytes? I know they used to exist, but it has been several decades. The world's vast swaths of C, C++, Java, C# won't port easily to them. If I understood you, you argued that it is clearly IByte, so I should feel free to make up my own constants outside of TInt.i3/TWord.i3. Though so far I haven't. - Jay > From: hosking at cs.purdue.edu > Date: Wed, 10 Feb 2010 10:25:31 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 10 Feb 2010, at 16:13, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/10 16:13:30 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TWord.m3 > > > > Log message: > > just cleanup a little: make Mask and Base clear and not obfuscated, don't do the same compare twice in a row in xEQ (which should be plain EQ when I'm confident in its correctness, currently what EQ does is compute like three values and verify they all match) > > Mask and Base are computed like that so it is easy to change the underlying representation of Target.Int. We might not have IByte, but instead have IWord! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 11 09:42:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:42:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211084251.9F81A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:42:51 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: encode constant shifts by 1 in two bytes instead of three; though the right approach is actually to do an add to self, we'll get to that as part of a broader pass following the optimization guidelines, like decomposing multiplication as adds/shifts, division by constant to multiplication by reciprocal, etc. From jkrell at elego.de Thu Feb 11 09:59:03 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 9:59:03 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211085903.17EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 09:59:03 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add comment for previous change, though I still expect to change it to an add From jkrell at elego.de Thu Feb 11 11:50:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:50:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105058.3F3B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:50:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c hand.c Log message: enable testing the insert/extract functions on non-Win32, establish what the other low/highbits table is, so we can eliminate it From jkrell at elego.de Thu Feb 11 11:51:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 11:51:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211105134.C9EF82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 11:51:34 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: test_hand.c Log message: cleanup From jkrell at elego.de Thu Feb 11 13:12:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:12:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211121251.456312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:12:51 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable test p227 some longint/integer stuff, might not quite work or on all platforms but is very close if not From jkrell at elego.de Thu Feb 11 13:20:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:20:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122022.935972474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:20:22 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: restore Tony's version 1.10 from April 2008 that depends on a 64bit longint, now that NT386 has it From jkrell at elego.de Thu Feb 11 13:24:33 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:24:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122433.A6F3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:24:33 Modified files: cm3/m3-libs/m3core/src/C/32BITS/: BasicCtypes.i3 Log message: reduce diff against 64bit version by making unsigned_long_int = Word.T 'restated' instead of equating to unsigned_int which is also Word.T; really we should look into removing any such thing called Ctypes.unsigned_long Ctypes.long_int due to it NOT being the same size in all 64bit C environments, it is therefore useless; pointer sized integer is INTEGER or Word.T or size_t or ptrdiff_t, NOT long, long int, unsigned long (see Win64) From jkrell at elego.de Thu Feb 11 13:29:45 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:29:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211122945.814F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:29:45 Modified files: cm3/m3-sys/m3tests/src/e0/e029/: stdout.build Log message: update output From jkrell at elego.de Thu Feb 11 13:32:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:32:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211123212.6EAEA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:32:12 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current NT386 output; we'll see how it compares to others From jkrell at elego.de Thu Feb 11 13:45:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:45:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124513.24F902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:45:12 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: we can now provide UINT32_MAX, though its type isn't perhaps what is wanted (LONGINT instead of INTEGER or Word.T) From jkrell at elego.de Thu Feb 11 13:47:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:47:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211124755.D14382474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:47:55 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: line up the columns From jkrell at elego.de Thu Feb 11 13:52:04 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:52:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125204.840CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:52:04 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstdint.i3 Log message: comments From jkrell at elego.de Thu Feb 11 13:59:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125900.17A472474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:00 Modified files: cm3/m3-libs/m3core/src/C/ALPHA_OSF/: Csetjmp.i3 Log message: replace long with INTEGER From jkrell at elego.de Thu Feb 11 13:59:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 13:59:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211125930.00A772474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 13:59:29 Modified files: cm3/m3-libs/m3core/src/C/Common/: Cstddef.i3 Log message: replace long with INTEGER, unsigned_long with Word.T From jkrell at elego.de Thu Feb 11 14:04:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:04:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130453.133D22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:04:53 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: allow for 64bit integers now, comment out the cas/casp stuff which I'll shortly change to the new atomic interface From jkrell at elego.de Thu Feb 11 14:07:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:07:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211130740.08B7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:07:40 Modified files: cm3/m3-libs/m3core/src/atomic/: Atomic.mg Log message: space after comma From jkrell at elego.de Thu Feb 11 14:45:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:45:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134529.530432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:45:29 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: more information for assertion failures: hits when trying atomics -- popping addr into int64, actually there's an indirection and it should be ok From jkrell at elego.de Thu Feb 11 14:46:41 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:46:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134642.0A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:46:41 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: 'size' => 'srcSize' or 'destSize' for clarity From jkrell at elego.de Thu Feb 11 14:48:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 14:48:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211134828.1AA8F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 14:48:28 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: move common repeated code out to common path From jkrell at elego.de Thu Feb 11 15:00:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:00:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211140056.891E62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:00:56 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: start filling in combinatorial code (maybe I should use generics?); some stuff is commented out because it causes backend assertion failures because the backend currently doesn't even manage the virtual stack correctly for atomics yet From jkrell at elego.de Thu Feb 11 15:59:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 15:59:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211145952.102AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 15:59:52 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 Log message: make fence work it is a little sleazy any xchg that references memory is serializing the simplest would be push eax xchg [esp+4], eax pop eax however the push/pop are usually a waste The approach here is to have a fence local variable, allocate a register, and xchg fence, reg (a global would also do, but that'd cause artifical contention) however the tricky/sleazy part is that our code generator is so good that it'll want to enregister fence, and xchg reg1, reg2 is not serializing. Many of my attempts did that. The pattern here seems to do the trick reliably. I think in particular because of the "overwritesdest" boolean. Test case has multiple fences in a row, and they still all go to memory. The other sleazy part is how I've filled in the table for shld, shrd, xchg. I need to understand this better, and need to be certain the bogus entries won't be used. From jkrell at elego.de Thu Feb 11 16:15:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:15:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211151505.4F0112474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:15:05 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: add the usual debugging output and uncomment store_ordered, at least for int32 (not really possible for int64, not sure about smaller); implementation is just fence; store; fence; the generated code is a bit fishy in its efficiency and correctness, will dig more and possibly email.. From jkrell at elego.de Thu Feb 11 16:20:46 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:20:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211152046.2FF352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:20:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix store_ordered to store indirect instead of direct, looks better now, though still many extra instructions From jkrell at elego.de Thu Feb 11 16:38:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:38:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153834.75B5C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:38:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: load_ordered is fence; load_indirect; fence -- I'm worried the optimizer will inhibit duplicate ordered loads/stores though, we'll have to be watchful From jkrell at elego.de Thu Feb 11 16:39:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:39:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211153943.399C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:39:43 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: combine load/store tests -- hopefully compiler won't remember enough -- I need to change it to use locals, whose address might be passed across threads, then I'll know better, as we don't optimize away stores to globals, I guess From jkrell at elego.de Thu Feb 11 16:43:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 11 Feb 2010 16:43:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100211154329.8921B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/11 16:43:29 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: augment test code some From jkrell at elego.de Fri Feb 12 11:02:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:02:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100246.F2B3C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:02:46 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: actually write the lock prefix, not just in the debug output From jkrell at elego.de Fri Feb 12 11:04:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:04:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100427.186BC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:04:27 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100535.4D04A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:05:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: enable the atomics code I had, some fixes there, I think CG.i3 is broken for compare_exchange though, still need to look into exchange and fetch_and_op more, see if they are working From jkrell at elego.de Fri Feb 12 11:06:18 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100618.521352474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:18 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: fix newlines From jkrell at elego.de Fri Feb 12 11:06:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:06:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212100659.1AB152474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:06:59 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: Main.m3 Log message: remove some newlines, suppress longint code for now From jkrell at elego.de Fri Feb 12 11:45:54 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 11:45:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212104555.1E36B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 11:45:54 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: fix compare_exchange by hand-building the modrm part of the instruction Still, it would be better if compare_exchange took a Var parameter in the function call instead of on the stack. Witness the code: 0000018E: 8D3538000000 LEA ESI gv.2[_MM_Main]+56 00000194: 8D3D98000000 LEA EDI gv.2[_MM_Main]+152 0000019A: 8BC7 MOV EAX EDI 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG ESI EBX should really be more like: 00000194: 8D3D98000000 MOV EAX gv.2[_MM_Main]+152 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156 000001A2: F00FB133 LOCK CMPXCHG gv.2[_MM_Main]+56 EBX which should be easy to achieve if compare_exchange took its parameters in the function call instead of on the stack. 3 instructions instead of 5! From jkrell at elego.de Fri Feb 12 12:11:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:11:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111116.0790C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:11:15 Modified files: cm3/m3-sys/m3back/src/: Stackx86.i3 Stackx86.m3 Codex86.m3 M3x86.m3 Log message: work in progress: atomics, note that Visual C++ interlockedor/and/xor are cmpxchg loops, probably wrong approach taken here currently, the code doesn't disasm as intended and I need to check if the intended operations exist From jkrell at elego.de Fri Feb 12 12:19:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 12:19:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212111926.E75D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 12:19:26 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: atomics: better, important to not generate escape byte for most operations, still looks like the indirection problem compxchg had, if not other problems (such as returning the before vs. after value which I haven't checked on) From jkrell at elego.de Fri Feb 12 13:43:15 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:43:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124315.E87CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:43:15 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: use inc/dec for atomic add/sub of 1 or -1 before: lea esi,[_MM_Main+38h] mov ebx, 1 lock inc dword ptr [esi], ebx mov dword ptr [_MM_Main+9Ch],esi after: lea esi,[_MM_Main+38h] lock inc dword ptr [esi] mov dword ptr [_MM_Main+9Ch],esi ideal: lock inc dword ptr [_MM_Main+38h] aha but I think I know why, will try for ideal I thought this was only going to save one byte: add foo,1 vs. inc foo but we were loading 1 into a register as well (we could have gotten to add foo,1, but no point now) the unop changes not actually used here no unop is atomic, inc/dec are implemented separately I tried using the table based stuff but it is confusing diff: Index: Codex86.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.i3,v retrieving revision 1.18 diff -u -r1.18 Codex86.i3 --- Codex86.i3 11 Feb 2010 14:59:51 -0000 1.18 +++ Codex86.i3 12 Feb 2010 12:41:14 -0000 @@ -60,8 +60,9 @@ lock_compare_exchange (READONLY dest, src: Operand); pushOp (READONLY src: Operand); popOp (READONLY dest: Operand); - decOp (READONLY op: Operand); - unOp (op: Op; READONLY dest: Operand); + decOp (READONLY op: Operand; locked := FALSE); + incOp (READONLY op: Operand; locked := FALSE); + unOp (op: Op; READONLY dest: Operand; locked := FALSE); mulOp (READONLY src: Operand); imulOp (READONLY dest, src: Operand); imulImm (READONLY dest, src: Operand; imm, imsize: INTEGER); Index: Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.55 diff -u -r1.55 Codex86.m3 --- Codex86.m3 12 Feb 2010 11:19:26 -0000 1.55 +++ Codex86.m3 12 Feb 2010 12:41:14 -0000 @@ -92,6 +92,7 @@ pushOp := pushOp; popOp := popOp; decOp := decOp; + incOp := incOp; unOp := unOp; mulOp := mulOp; imulOp := imulOp; @@ -1019,26 +1020,49 @@ END; END popOp; -PROCEDURE decOp (t: T; READONLY op: Operand) = + +PROCEDURE incOrDecOp (t: T; READONLY op: Operand; locked: BOOLEAN; incOrDec: [0..1]) = VAR ins: Instruction; + name := ARRAY [0..1] OF TEXT{"INC", "DEC"}[incOrDec]; BEGIN - Mn(t, "DEC"); MnOp(t, op); + ins.lock := locked; + Mn(t, name); MnOp(t, op); + <* ASSERT op.loc = OLoc.mem OR op.loc = OLoc.register *> - IF op.loc = OLoc.register THEN - ins.opcode := 16_48 + op.reg[0]; + + IF locked THEN + ins.mrmpres := TRUE; + ins.disp := 0; + ins.dsize := 0; + ins.modrm := 8 * incOrDec + op.reg[0]; + ins.opcode := 16_FF; + writecode(t, ins); + ELSIF op.loc = OLoc.register THEN + ins.opcode := 16_40 + 8 * incOrDec + op.reg[0]; writecode(t, ins); ELSE <* ASSERT op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 4 *> - build_modrm(t, op, t.opcode[1], ins); + build_modrm(t, op, t.opcode[incOrDec], ins); ins.opcode := 16_FF; writecode(t, ins); log_global_var(t, op.mvar, -4); END + END incOrDecOp; + +PROCEDURE incOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 0); + END incOp; + +PROCEDURE decOp (t: T; READONLY op: Operand; locked := FALSE) = + BEGIN + incOrDecOp(t, op, locked, 1); END decOp; -PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp1 (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR ins: Instruction; BEGIN + ins.lock := locked; ins.opcode := opcode[op].imm32; IF dest.loc = OLoc.mem THEN get_op_size(dest.mvar.mvar_type, ins); @@ -1057,11 +1081,14 @@ END END unOp1; -PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand) = +PROCEDURE unOp (t: T; op: Op; READONLY dest: Operand; locked := FALSE) = VAR destA: ARRAY OperandPart OF Operand; destSize := SplitOperand(dest, destA); BEGIN + (* future: we could use cmpxchg loop *) + <* ASSERT (destSize = 1) OR (NOT locked) *> + IF destSize = 2 AND (op IN SET OF Op{Op.oNEG, Op.oNOT}) THEN CASE op OF | Op.oNOT => @@ -1079,7 +1106,7 @@ <* ASSERT NOT Is64(destA[destSize - 1].optype) *> FOR i := 0 TO destSize - 1 DO - unOp1(t, op, destA[i]); + unOp1(t, op, destA[i], locked); END; END; END unOp; Index: M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.110 diff -u -r1.110 M3x86.m3 --- M3x86.m3 12 Feb 2010 11:11:15 -0000 1.110 +++ M3x86.m3 12 Feb 2010 12:41:15 -0000 @@ -3004,7 +3004,8 @@ u.vstack.newdest(u.cg.reg[EDI]); ELSE - WITH stack0 = u.vstack.pos(0, "zero"), stop0 = u.vstack.op(stack0) DO + WITH stack0 = u.vstack.pos(0, "zero"), + stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, @@ -4297,15 +4298,16 @@ CONST AtomicOpToOp = ARRAY AtomicOp OF Op { Op.oADD, Op.oSUB, Op.oOR, Op.oAND, Op.oXOR }; CONST AtomicOpName = ARRAY AtomicOp OF TEXT { "add", "sub", "or", "and", "xor" }; -PROCEDURE fetch_and_op (x: U; op: AtomicOp; t: MType; z: ZType; +PROCEDURE fetch_and_op (x: U; atomic_op: AtomicOp; t: MType; z: ZType; <*UNUSED*>order: MemoryOrder) = (* tmp := Mem [s1.A].t; Mem [s1.A].t := tmp op s0.u; s1.u := tmp op s0.u; pop *) + VAR op := AtomicOpToOp[atomic_op]; BEGIN IF x.debug THEN x.wr.Cmd ("fetch_and_op"); - x.wr.OutT (AtomicOpName[op]); + x.wr.OutT (AtomicOpName[atomic_op]); x.wr.TName (t); x.wr.TName (z); x.wr.NL (); @@ -4318,7 +4320,35 @@ RETURN; END; - EVAL x.vstack.dobin(AtomicOpToOp[op], (*symmetric*) op # AtomicOp.Sub, (*overwritesdest*) TRUE, t, locked := TRUE); + (* optimize add 1 => inc, add -1 => dec, sub 1 => dec, sub -1 => inc + * to save a byte encoding the immediate value. + * NOTE: We should do this for reg where t.reguse[reg].last_imm = 1 or -1 also. + *) + + WITH stack0 = x.vstack.pos(0, "fetch_and_op"), + stack1 = x.vstack.pos(1, "fetch_and_op"), + stop0 = x.vstack.op(stack0) DO + IF op IN SET OF Op{Op.oADD, Op.oSUB} THEN + IF stop0.loc = OLoc.imm THEN + WITH imm = stop0.imm DO + IF (TInt.EQ(imm, TInt.One) OR TInt.EQ(imm, TInt.MOne)) THEN + x.vstack.unlock(); + x.vstack.find(stack1, Force.anyreg); + IF (op = Op.oADD) = TInt.EQ(imm, TInt.One) THEN + x.cg.incOp(x.vstack.op(stack1), locked := TRUE); + ELSE + x.cg.decOp(x.vstack.op(stack1), locked := TRUE); + END; + x.vstack.newdest(x.vstack.op(stack1)); + x.vstack.discard(1); + RETURN; + END; + END; + END; + END; + END; + + EVAL x.vstack.dobin(op, (*symmetric*) (*op # AtomicOp.Sub*) FALSE, (*overwritesdest*) TRUE, t, locked := TRUE); END fetch_and_op; From jkrell at elego.de Fri Feb 12 13:45:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:45:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212124559.AB8B02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:45:59 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comments From jkrell at elego.de Fri Feb 12 13:50:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 13:50:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212125040.6D9B62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 13:50:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: don't force into a register, but, alas, too late, it already is, unnecessarily, really could use passing a var here instead of pushing a load_address From jkrell at elego.de Fri Feb 12 14:17:44 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:17:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212131744.60EAE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:17:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Stackx86.m3 Log message: a little more atomic work hack around the wrong level of indirection we now have: _Main__Test_AtomicInteger_FetchAnd: 000001BA: 55 push ebp 000001BB: 8B EC mov ebp,esp 000001BD: 81 EC 00 00 00 00 sub esp,0 000001C3: 53 push ebx 000001C4: 56 push esi 000001C5: 57 push edi 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 000001D2: F0 21 1E lock and dword ptr [esi],ebx 000001D5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001DB: 5F pop edi 000001DC: 5E pop esi 000001DD: 5B pop ebx 000001DE: C9 leave 000001DF: C3 ret _Main__Test_AtomicInteger_FetchDec: 000001E0: 55 push ebp 000001E1: 8B EC mov ebp,esp 000001E3: 81 EC 00 00 00 00 sub esp,0 000001E9: 53 push ebx 000001EA: 56 push esi 000001EB: 57 push edi 000001EC: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001F2: F0 FF 0E lock dec dword ptr [esi] 000001F5: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi 000001FB: 5F pop edi 000001FC: 5E pop esi 000001FD: 5B pop ebx 000001FE: C9 leave 000001FF: C3 ret notice that: - the lea esi is not needed - the mov foo, esi is *wrong* and wrecks the result From jkrell at elego.de Fri Feb 12 14:36:19 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:36:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212133622.B64D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:36:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: nevermind, this is all wrong except for store, load, fence, exchange, and compare_exchange The atomic interface really does *not* expose a bunch of functionality on x86. x86 generally stores the result in memory. We cannot then return the result because we'd have to reread memory. Therefore all these functions will require cmpxchg loops. Probably just write wrapper functions for the C compiler intrinsics.. From jkrell at elego.de Fri Feb 12 14:43:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 12 Feb 2010 14:43:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100212134317.A83ED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/12 14:43:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Stackx86.i3 Stackx86.m3 Log message: remove all the passing around of "locked" since the lock prefix isn't going to be useful except for compare_exchange and lock_compare_exchange (and not even for exchange actually, it doesn't need it) we will be able to do some of add/sub with xadd probably but or/xor/and will just use cmpxchg loops, probably functions From hosking at cs.purdue.edu Fri Feb 12 16:26:04 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 12 Feb 2010 10:26:04 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100212133622.B64D92474001@birch.elegosoft.com> References: <20100212133622.B64D92474001@birch.elegosoft.com> Message-ID: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. On 12 Feb 2010, at 14:36, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/12 14:36:19 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > nevermind, this is all wrong except for store, load, fence, exchange, > and compare_exchange > The atomic interface really does *not* expose a bunch of > functionality on x86. x86 generally stores the result in memory. > We cannot then return the result because we'd have to reread memory. > Therefore all these functions will require cmpxchg loops. > Probably just write wrapper functions for the C compiler intrinsics.. From jay.krell at cornell.edu Fri Feb 12 18:10:47 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 12 Feb 2010 17:10:47 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> References: <20100212133622.B64D92474001@birch.elegosoft.com>, <8AA29CDD-628C-40F0-AC33-5744413046DC@cs.purdue.edu> Message-ID: Value could change in the meantime. I'll implement fetch_and_op with cmpxchg loops soon. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 12 Feb 2010 10:26:04 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > It's fine if the result is stored in memory. We can pick it up from there, right? Rereading memory distinct from the atomic variable is fine. > > On 12 Feb 2010, at 14:36, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/12 14:36:19 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > nevermind, this is all wrong except for store, load, fence, exchange, > > and compare_exchange > > The atomic interface really does *not* expose a bunch of > > functionality on x86. x86 generally stores the result in memory. > > We cannot then return the result because we'd have to reread memory. > > Therefore all these functions will require cmpxchg loops. > > Probably just write wrapper functions for the C compiler intrinsics.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wagner at elego.de Sat Feb 13 11:59:24 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 11:59:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213105924.47CFE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 11:59:24 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: we need to run upgrade from scratch From wagner at elego.de Sat Feb 13 17:02:11 2010 From: wagner at elego.de (Olaf Wagner) Date: Sat, 13 Feb 2010 17:02:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100213160211.B739F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/13 17:02:11 Modified files: cm3/scripts/regression/: Tag: release_branch_cm3_5_8 defs.sh Log message: don't ship anything too early From jkrell at elego.de Sun Feb 14 08:23:25 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:23:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214072326.B75172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:23:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 Log message: atomic fetch_op work in progress almost works, but the levels of indirection are wrong: _Main__Test_AtomicInteger_FetchAnd: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax,esi needs indirection, doesn't need to be use esi but that is ok 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [ebx],esi parameters reversed, odd, given that compare_exchange works 000001DC: 75 F6 jne 000001D4 000001DE: 89 35 9C 00 00 00 mov dword ptr [_MM_Main+9Ch],esi ... should be more like: ... 000001C6: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 000001CC: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] 000001D2: 8B C6 mov eax, [_MM_Main+38h] or DWORD PTR [esi] ** 000001D4: 8B D8 mov ebx,eax 000001D6: 23 DA and ebx,edx 000001D8: F0 0F B1 33 lock cmpxchg dword ptr [esi],ebx OR lock cmpxchg dword ptr [_MM_Main+98h],ebx 000001DC: 75 F6 jne 000001D4 ... From jkrell at elego.de Sun Feb 14 08:40:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 8:40:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214074053.0CCCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 08:40:50 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: very slight restructure to make it simpler, given that in at least two places order seems to get reversed, though they are only related to 32bit operations so this won't likely clear things up...Modula-3 seems to lack a 'next' or 'continue' statement, so I have to reindent a bunch where in C I avoid indentation whereever I can (no 'with', use goto for error handling; heck 'with' always confuses me, I don't know which part of it is 'reevaluated' vs. 'captured' -- does it introduce pointers, or cached copies, or just shortand for long expressions? All three are useful and with can only be done.. From jkrell at elego.de Sun Feb 14 09:33:55 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:33:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083355.B85172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:33:54 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: clarify comment, after checking documentation From jkrell at elego.de Sun Feb 14 09:35:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083509.EE9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:09 Modified files: cm3/m3-sys/m3back/src/: M3x86Rep.i3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 09:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083546.CEE592474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:35:46 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix comment From jkrell at elego.de Sun Feb 14 09:38:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 9:38:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214083855.A512E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 09:38:54 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: comment wordsmithing From jkrell at elego.de Sun Feb 14 10:49:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:49:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214094907.25CC42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:49:06 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix parameter order and indirect in atomic fetch_op; the last store is actually ok, still one wrong indirection to fix From jkrell at elego.de Sun Feb 14 10:59:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 10:59:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214095950.0B5BF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 10:59:50 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup: one statement per line From jkrell at elego.de Sun Feb 14 11:44:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:44:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104417.DCF392474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:44:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: cleanup formating, remove general lock prefix support (only used once, not worth it) From jkrell at elego.de Sun Feb 14 11:45:36 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:45:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214104536.446A72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:45:36 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: 'o' => 'offset' From jkrell at elego.de Sun Feb 14 11:57:32 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:57:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105732.415672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:57:32 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: when loading from register + offset, and offset is 0, use different flags in the instruction so we don't have to waste a byte on the index; more to do here, but this case is known to occur From jkrell at elego.de Sun Feb 14 11:58:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:58:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105818.85EAC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:58:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: add a comment From jkrell at elego.de Sun Feb 14 11:59:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 11:59:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214105945.E37FA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 11:59:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: one statement per line From jkrell at elego.de Sun Feb 14 12:01:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:01:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110142.771C02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:01:42 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "sibpres" => "sib_present" "sib" is the x86 "scale index byte" or such, very often refernced in x86 literature, probably ok to leave cryptic asis From jkrell at elego.de Sun Feb 14 12:03:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:03:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110311.E964B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:03:11 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: "mrmpres" => "mrm_present" "mrm" is short for "mod/rm" or such, which is often referenced in x86 literatue so probably ok to leave cryptic From jkrell at elego.de Sun Feb 14 12:06:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:06:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214110633.F13C82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:06:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: more formatting repair: THEN goes at end of line, ELSE takes its entire line From jkrell at elego.de Sun Feb 14 12:35:48 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:35:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214113548.46E1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:35:48 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: shorten other cases for offset=0 From jkrell at elego.de Sun Feb 14 12:42:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 12:42:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214114206.7F3B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 12:42:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix newlines From jkrell at elego.de Sun Feb 14 13:02:21 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:02:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214120221.50CFC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:02:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix indirection in atomic fetch_and_op just my ignorance using movOp instead of load_ind code is like: _Main__Test_AtomicInteger_FetchOr: 00000250: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] ; atomic variable 00000256: 8B 15 98 00 00 00 mov edx,dword ptr [_MM_Main+98h] ; value to or with 0000025C: 8B 06 mov eax,dword ptr [esi] ; fetch old value 0000025E: 8B D8 mov ebx,eax ; move old value to tmp (this is needed) 00000260: 0B DA or ebx,edx ; compute new value 00000262: F0 0F B1 1E lock cmpxchg dword ptr [esi],ebx ; try to swap 00000266: 75 F6 jne 0000025E ; old value is in eax (always eax; or edx:eax pair for 64bit operations, not yet implemented) ; new value is in, in this case, ebx still could be better, could be: mov edx,dword ptr [_MM_Main+98h] mov eax,[_MM_Main+38h] retry: mov ebx,eax or ebx,edx lock cmpxchg [_MM_Main+38h],ebx jne retry ; old value is in eax ; new value is in, in this case, ebx six instructions instead of seven three registers (eax, ebx, edx) instead of four (eax, ebx, edx, esi) (problem is that we get load_address on the variable first, and we go ahead and enregister that address unnecessarily) And even so: if six instructions is considered too large, we can use a function instead. As well, add, sub, we can do more efficiently with xadd. (still need to check what libatomic does here) also we can probably optimize or(-1) => store_ordered(-1) or(0) => do nothing and(-1) => do nothing and(0) => store_ordered(0) probably they are rare/nonexistant From jkrell at elego.de Sun Feb 14 13:30:45 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:30:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123045.0EDF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:30:45 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: fix level of indirection in atomic swap Like compareExchange, it suffers from unnecessary enregistration of the address of the atomic variable: 0000034A: 8D 35 38 00 00 00 lea esi,[_MM_Main+38h] 00000350: 8B 1D 98 00 00 00 mov ebx,dword ptr [_MM_Main+98h] 00000356: F0 87 1E lock xchg ebx,dword ptr [esi] which should be more like: mov ebx,dword ptr [_MM_Main+98h] lock xchg ebx,[_MM_Main+38h] two instructions instead of three, one register instead of two Though Visual C++ seems to do similar: ; 2 : long __fastcall F1(long b) { return _InterlockedExchange(&a, b); } 00000 8b c1 mov eax, ecx 00002 b9 00 00 00 00 mov ecx, OFFSET _a 00007 87 01 xchg DWORD PTR [ecx], eax 00009 c3 ret 0 notice that it uses a smaller mov to generate the address, because, you know, the instruction needs relocation anyway, you might as well have the relocation include the +38; This is probably something we should look into improving across the board in m3back. From jkrell at elego.de Sun Feb 14 13:36:26 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:36:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214123626.6E3C22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:36:26 Modified files: cm3/m3-sys/m3tests/src/p2/p226/: stderr.pgm stdout.build Log message: commit current output; needs work, but an ok start (it just compiles and runs, some atomic integer stuff; the printouts are just leftover from cas/casp stuff, the results of atomic aren't yet verified/printed, I just look at the disasm, and only integer is tested so far, not any other type) From jkrell at elego.de Sun Feb 14 13:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124522.ADD402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:45:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: slight update, fix newlines, only more nonportable stuff, but output should change slightly, hm? From jkrell at elego.de Sun Feb 14 13:46:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 13:46:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214124606.739AD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 13:46:06 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p227 atomics, doesn't test much yet, just compiles, runs, no output From jkrell at elego.de Sun Feb 14 14:18:56 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:18:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214131856.A81402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:18:56 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: add back underlying inc support, so we can soon optimize add/sub by +1/-1 (including atomic case) to be inc/dec From jkrell at elego.de Sun Feb 14 14:23:42 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:23:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214132342.3625E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:23:42 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: remove more a bit of the generalized lock support that ended up not used From jkrell at elego.de Sun Feb 14 14:38:04 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:38:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214133804.A7B872474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:38:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: verify comment about procedure FixReturnValue and wordsmith it appropriately (half the comment appears to have gone obsolete/incorrect circa Visual C++ 5.0 but let's just stay compatible with older -- the only difference is for calling functions that return 16bit return types) From jkrell at elego.de Sun Feb 14 14:45:27 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134527.704EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:27 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Sun Feb 14 14:45:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 14 Feb 2010 14:45:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100214134544.165C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/14 14:45:44 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 06:00:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:00:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050037.DB9EA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:00:37 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c Added files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 m3makefile Log message: test for sign/zero extension of the return values of functions that return types smaller than 32bits. I'm about to change the code here: the AMD manual recommends specific sequences that are shorter or equal in length to what we use, but in 3 of the 4 cases what we use doesn't match the recommendation From hosking at elego.de Mon Feb 15 06:07:07 2010 From: hosking at elego.de (Antony Hosking) Date: Mon, 15 Feb 2010 6:07:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050707.87E502474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/15 06:07:07 Modified files: cm3/m3-sys/m3front/src/misc/: CG.m3 Log message: Cleaner fix for LONGINT static initialization. From jkrell at elego.de Mon Feb 15 06:08:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:08:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050900.3057A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:08:59 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly, I think I found a bug From jkrell at elego.de Mon Feb 15 06:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215050948.28DF32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:09:48 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test slightly From jkrell at elego.de Mon Feb 15 06:18:18 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:18:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215051818.EA8AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:18:18 Modified files: cm3/m3-sys/m3tests/src/: Test.i3 TestC.c cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: extend test coverage to converting positive values too From jkrell at elego.de Mon Feb 15 06:44:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:44:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215054452.C6A512474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:44:51 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: some refinements, esp. to give some contenxt to diffs From jkrell at elego.de Mon Feb 15 06:51:36 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 6:51:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215055136.E791E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 06:51:36 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 07:03:53 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:03:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215060353.57CED2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:03:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: add line numbers From jkrell at elego.de Mon Feb 15 07:14:33 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:14:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215061433.DEF602474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:14:33 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case; there is a bug here, different output on NT386 vs. LINUXLIBC6, not yet sure which is correct From jkrell at elego.de Mon Feb 15 07:24:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:24:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062435.991372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:24:35 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more From jkrell at elego.de Mon Feb 15 07:26:34 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:26:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215062634.512542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:26:34 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: extend test case more, there is a crash in here.. From jkrell at elego.de Mon Feb 15 07:37:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:37:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063735.EFDE42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:37:35 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix mistake in dec when I put in the inc code; this broke division From jkrell at elego.de Mon Feb 15 07:38:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:38:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215063825.DF4B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:38:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove two newlines From jkrell at elego.de Mon Feb 15 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064124.D73422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:41:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: move and modify assert (maybe we can make it tighter?) From jkrell at elego.de Mon Feb 15 07:42:42 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:42:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215064244.A2D462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:42:42 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: flush more often (at newlines), for debugability From jkrell at elego.de Mon Feb 15 07:55:31 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 7:55:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215065531.B786D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 07:55:31 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: update From jkrell at elego.de Mon Feb 15 08:39:58 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:39:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215073958.C32CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:39:58 Added files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 m3makefile Log message: new smaller test that fails on NT386, non-const int64 division by 1 From jkrell at elego.de Mon Feb 15 08:40:45 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 8:40:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215074045.663582474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 08:40:45 Modified files: cm3/m3-sys/m3tests/src/p2/p229/: Main.m3 Log message: reduce, still fails From jkrell at elego.de Mon Feb 15 09:01:26 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:01:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215080127.EC77D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:01:26 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix div parameter order, and presumably mod From jkrell at elego.de Mon Feb 15 09:32:09 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:32:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083209.84A102474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:32:09 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 09:38:37 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:38:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215083837.C1C312474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:38:37 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: update output From jkrell at elego.de Mon Feb 15 09:59:01 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 9:59:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215085901.B20C42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 09:59:01 Modified files: cm3/m3-sys/m3tests/src/p2/p228/: Main.m3 Log message: add newlines to output, remove 'bug?' comment: uint8 and uint16 are full range in 8 and 16 bits, but uint32 is not, that isn't possible without going to 64bit representation From jkrell at elego.de Mon Feb 15 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090043.F3D7C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:00:43 Added files: cm3/m3-sys/m3tests/src/p2/p228/: stdout.pgm Log message: add expected output From jkrell at elego.de Mon Feb 15 10:06:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:06:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215090608.6D3C62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:06:08 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: enable p228 sign/zero extend return values of functions returning types smaller than 32bits; enable p229 minimal 64bit divide test, that was failing (still need mod, and more) From jkrell at elego.de Mon Feb 15 10:25:08 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 10:25:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215092508.1AE792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 10:25:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 Log message: remove unused functions: get_addsize must_extend aligned From hosking at cs.purdue.edu Mon Feb 15 16:17:12 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 15 Feb 2010 10:17:12 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100215083209.84A102474001@birch.elegosoft.com> References: <20100215083209.84A102474001@birch.elegosoft.com> Message-ID: <05565123-28DB-4C46-B2B2-AE087FB1DCB6@cs.purdue.edu> Good catch! Thanks Jay. On 15 Feb 2010, at 09:32, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/15 09:32:09 > > Modified files: > cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c > > Log message: > fix apparent copy/paste typos in 64bit division/remainder ('mod') From jkrell at elego.de Mon Feb 15 18:44:15 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:44:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174416.15E552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:44:15 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:45:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:45:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174522.E3A852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:45:22 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: THEN at end of line; ELSE on its own line From jkrell at elego.de Mon Feb 15 18:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215174857.E37212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:48:57 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: remove some newlines From jkrell at elego.de Mon Feb 15 18:56:19 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:56:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175621.70FF72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:56:19 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Mon Feb 15 18:58:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 15 Feb 2010 18:58:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100215175821.92A7A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/15 18:58:21 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: some more formating From jkrell at elego.de Wed Feb 17 05:06:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:06:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040644.0A0402474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:06:43 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: avoid returning out of a deep nested loop to workaround apparently problem in older releases such as 5.4.0 (if using current config files) From jkrell at elego.de Wed Feb 17 05:08:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:08:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040849.6D5B12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:08:49 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:09:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:09:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217040923.601552474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:09:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: remove readonly on proc so we can more easily partial merge head and release From jkrell at elego.de Wed Feb 17 05:10:30 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:10:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041030.7BB172474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:10:30 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: remove newline from middle of short comment From jkrell at elego.de Wed Feb 17 05:17:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:17:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217041757.7F2A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:17:57 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial merge with head to support older cm3 (more to do); also reduce intent in this deeply indented functions to 2 spaces from 4 spaces From jkrell at elego.de Wed Feb 17 05:20:39 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:20:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042039.892BE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:20:39 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: partial, very partial undo From jkrell at elego.de Wed Feb 17 05:26:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:26:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217042656.1560B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:26:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: slight variation on the fix for building with older cm3 From jkrell at elego.de Wed Feb 17 05:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043311.5CB372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:33:11 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: whitespace and a little cleanup of repetitive code From jkrell at elego.de Wed Feb 17 05:35:06 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:35:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217043506.A9F962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:35:06 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: whitespace From jkrell at elego.de Wed Feb 17 05:41:21 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:41:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044121.848AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:41:21 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 cm3cfg.common Log message: mostly merge with head From jkrell at elego.de Wed Feb 17 05:42:35 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 5:42:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217044236.22B4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 05:42:35 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: cm3cfg.common Log message: mostly merge with release From jkrell at elego.de Wed Feb 17 06:03:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:03:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050355.C74942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:03:55 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: AMD64_SOLARIS Darwin.common HPUX.common Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Solaris.common Unix.common cm3cfg.common Log message: remove whitspace from ends of lines From jkrell at elego.de Wed Feb 17 06:06:16 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:06:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217050616.C20BB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:06:16 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 AMD64_SOLARIS Darwin.common HPUX.common I386_SOLARIS Linux.common NT386.common SOLgnu SOLsun SPARC64_SOLARIS Unix.common cm3cfg.common Log message: remove whitespace from ends of lines From jkrell at elego.de Wed Feb 17 06:12:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:12:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051255.5D0CA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:12:54 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Darwin.common NT386 NT386.common NT386GNU NT386MINGNU Solaris.common cm3.cfg cm3cfg.common Log message: consistent support/workaround for MxConfig always define all of CR, EOL, M3_PROFILING, SL, in that order From jkrell at elego.de Wed Feb 17 06:16:07 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:16:07 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051607.A784F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:16:07 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:17:41 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:17:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217051742.10BE32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:17:41 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386 NT386GNU NT386MINGNU Log message: remove $id$ From jkrell at elego.de Wed Feb 17 06:20:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:20:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217052002.6D5732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:20:01 Modified files: cm3/m3-sys/cminstall/src/config/: Tag: release_branch_cm3_5_8 ALPHA_OSF FreeBSD3 FreeBSD4 HPPA IBMR2 IRIX5 LINUXELF LINUXLIBC6 NetBSD2_i386 PPC_LINUX SOLgnu SOLsun SPARC Log message: remove whitespace from ends of lines (dead files) From jkrell at elego.de Wed Feb 17 06:44:38 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 6:44:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217054439.649B22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 06:44:38 Added files: cm3/m3-sys/m3tests/src/p2/p228/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile stdout.pgm cm3/m3-sys/m3tests/src/p2/p229/: Tag: release_branch_cm3_5_8 Main.m3 m3makefile Log message: new files from head (branching incompatible with sequential numbers so it behooves us to at least keep the directory listing in sync) From jkrell at elego.de Wed Feb 17 07:25:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:25:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217062500.EE3F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:25:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll stuff for Interix now that I found I don't need it (more stuff here to try removing when I get back to it) From jkrell at elego.de Wed Feb 17 07:31:48 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:31:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063149.1FF4F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:31:48 Removed files: cm3/m3-win/ntdll/: .cvsignore cm3/m3-win/ntdll/src/: m3makefile ntdll.c cm3/m3-win/w32api/: CONTRIBUTIONS Makefile.in README.w32api TODO aclocal.m4 config.guess config.sub configure configure.in install-sh cm3/m3-win/w32api/include/: accctrl.h aclapi.h aclui.h adsprop.h afxres.h amaudio.h amvideo.h audevcod.h aviriff.h aygshell.h basetsd.h basetyps.h bdatypes.h cderr.h cguid.h cmnquery.h comcat.h commctrl.h commdlg.h control.h cpl.h cplext.h custcntl.h dbt.h dde.h ddeml.h devguid.h dhcpcsdk.h dlgs.h docobj.h dsadmin.h dsclient.h dsgetdc.h dshow.h dsquery.h dsrole.h dvdevcod.h dvdmedia.h edevdefs.h errorrep.h errors.h evcode.h exdisp.h exdispid.h fltdefs.h httpext.h icm.h idispids.h il21dec.h imagehlp.h imm.h initguid.h intshcut.h ipexport.h iphlpapi.h ipifcons.h ipinfoid.h iprtrmib.h iptypes.h ipxconst.h ipxrtdef.h ipxtfflt.h isguids.h ks.h ksmedia.h largeint.h lm.h lmaccess.h lmalert.h lmapibuf.h lmat.h lmaudit.h lmbrowsr.h lmchdev.h lmconfig.h lmcons.h lmerr.h lmerrlog.h lmmsg.h lmremutl.h lmrepl.h lmserver.h lmshare.h lmsname.h lmstats.h lmsvc.h lmuse.h lmuseflg.h lmwksta.h lzexpand.h mapi.h mciavi.h mcx.h mgm.h mgmtapi.h mlang.h mmreg.h mmsystem.h mpegtype.h mprapi.h mq.h msacm.h mshtml.h mswsock.h nb30.h nddeapi.h nspapi.h ntdef.h ntdll.h ntdsapi.h ntdsbcli.h ntldap.h ntsecapi.h ntsecpkg.h oaidl.h objbase.h objfwd.h objidl.h objsafe.h objsel.h ocidl.h odbcinst.h ole.h ole2.h ole2ver.h oleacc.h oleauto.h olectl.h olectlid.h oledlg.h oleidl.h pbt.h poppack.h powrprof.h prsht.h psapi.h pshpack1.h pshpack2.h pshpack4.h pshpack8.h qedit.h rapi.h ras.h rasdlg.h raserror.h rassapi.h reason.h regstr.h richedit.h richole.h routprot.h rpc.h rpcdce.h rpcdce2.h rpcdcep.h rpcndr.h rpcnsi.h rpcnsip.h rpcnterr.h rpcproxy.h rtutils.h schannel.h schnlsp.h scrnsave.h sddl.h secext.h security.h servprov.h setupapi.h shellapi.h shldisp.h shlguid.h shlobj.h shlwapi.h snmp.h specstrings.h sql.h sqlext.h sqltypes.h sqlucode.h sspi.h stm.h strmif.h subauth.h svcguid.h tlhelp32.h tmschema.h unknwn.h userenv.h usp10.h uxtheme.h vfw.h vidcap.h vmr9.h vptype.h w32api.h winable.h winbase.h winber.h wincon.h wincrypt.h windef.h windns.h windows.h windowsx.h winerror.h wingdi.h wininet.h winioctl.h winldap.h winnetwk.h winnls.h winnt.h winperf.h winreg.h winresrc.h winsnmp.h winsock.h winsock2.h winspool.h winsvc.h winuser.h winver.h ws2spi.h ws2tcpip.h wsahelp.h wsipx.h wsnetbs.h wtsapi32.h wtypes.h xprtdefs.h zmouse.h cm3/m3-win/w32api/include/ddk/: atm.h batclass.h cfg.h cfgmgr32.h d4drvif.h d4iface.h ddkmapi.h hidclass.h hidpi.h hidsdi.h hidusage.h kbdmou.h mcd.h miniport.h minitape.h mountdev.h mountmgr.h ndis.h ndisguid.h ndistapi.h ndiswan.h netevent.h netpnp.h newdev.h ntapi.h ntdd8042.h ntddbeep.h ntddcdrm.h ntddcdvd.h ntddchgr.h ntdddisk.h ntddk.h ntddkbd.h ntddmou.h ntddndis.h ntddpar.h ntddpcm.h ntddscsi.h ntddser.h ntddstor.h ntddtape.h ntddtdi.h ntddvdeo.h ntddvol.h ntifs.h ntpoapi.h ntstatus.h parallel.h pfhook.h poclass.h scsi.h scsiscan.h scsiwmi.h smbus.h srb.h storport.h tdi.h tdiinfo.h tdikrnl.h tdistat.h tvout.h upssvc.h usb.h usb100.h usbcamdi.h usbdi.h usbioctl.h usbiodef.h usbscan.h usbuser.h video.h videoagp.h win2k.h winddi.h winddk.h winnt4.h winxp.h ws2san.h xfilter.h cm3/m3-win/w32api/lib/: Makefile.in ntdll.def Log message: remove ntdll/w32api stuff w32api might be useful to reduce dependency on C compiler (ie: compiler and linker and C runtime, but not win32 headers/libraries; ie some of the express versions) From jkrell at elego.de Wed Feb 17 07:36:18 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:36:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217063618.E1F2B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:36:18 Modified files: cm3/scripts/python/: pylib.py Log message: remove most ntdll/w32api stuff (need to look into the rest another time) From jkrell at elego.de Wed Feb 17 07:41:24 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:41:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064124.D9C052474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:41:24 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: bring over "AdjustShared" from head Specifically what this does is when using older toolsets, it turns building of anything "shared" into "not shared". This way these config files can deal less with the vagaries of older toolsets. The point being, when mixing these config files with older tools, only to handle building cm3. "old toolset" is defined as "not defining install_symbolic_link" Perhaps we should have something like cm3 -DBOOT or cm3 -DNO_SHARED to better encapsulate this. Note that this is placed in such a way that it doesn't affect all targets. But probably it should. Also this disabled building "shared" on Interix, pending more investigation. (This is what head does.) From jkrell at elego.de Wed Feb 17 07:47:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:47:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217064729.1328B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:47:28 Modified files: cm3/scripts/: README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh cm3/scripts/python/: do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: upgrade.cmd Log message: remove m3staloneback from various lists leave it only in tool/std It is not needed in front/core/boot etc. From jkrell at elego.de Wed Feb 17 07:53:05 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:53:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065306.2DA532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:53:05 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 do-cm3-front.py make-dist.py pylib.py upgrade.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd upgrade.cmd Log message: m3staloneback not needed in many places -- just tool/std -- it isn't any special part of front/back/boot/core -- it isn't actually used anywhere, it also doesn't need to be filtered out of non-Win32 platforms, since it should build and work everywhere (just, again, we don't use it) From jkrell at elego.de Wed Feb 17 07:58:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 7:58:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217065815.5BDD92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 07:58:14 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 README backup-pkgs.sh boot-cm3-build-on-target.sh boot-cm3-core.sh copy-bootarchives.sh make-src-dist-sys.sh pack-crossbuild.sh cm3/scripts/python/: Tag: release_branch_cm3_5_8 pylib.py cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: libdump, fix_nl also not needed in upgrade/cross stuff add m3staloneback back to 'core' group, because in fact 'core' is never used, useless, no need to mess with it (should just remove it, pylib.py should be updated to use the other data files..) From jkrell at elego.de Wed Feb 17 08:22:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:22:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072229.61EF92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:22:28 Modified files: cm3/scripts/python/: pylib.py cm3/scripts/win/: pkginfo.cmd Log message: fix_nl, libdump not so important, and don't need filtering From jkrell at elego.de Wed Feb 17 08:23:50 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:23:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072351.10EF42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:23:50 Modified files: cm3/scripts/: boot-cm3-build-on-target.sh boot-cm3-core.sh boot-cm3-with-m3.sh copy-bootarchives.sh pack-crossbuild.sh Log message: adjust filters: fix_nl, libdump ought to be, and may already be, very portable From jkrell at elego.de Wed Feb 17 08:25:51 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:25:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072551.343612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:25:51 Removed files: cm3/scripts/python/: do-cm3-comm.py do-cm3-core.py do-cm3-gui.py do-cm3-base.py Log message: remove useless stuff From jkrell at elego.de Wed Feb 17 08:26:49 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:26:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217072649.D2C9C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:26:49 Removed files: cm3/scripts/python/: do-cm3-caltech-parser.py do-cm3-front.py Log message: remove more useless From jkrell at elego.de Wed Feb 17 08:30:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:30:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073058.49A002474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:30:57 Modified files: cm3/scripts/python/: pylib.py Log message: remove 'core' and 'base' groups, they aren't useful From jkrell at elego.de Wed Feb 17 08:32:04 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:32:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073207.854852474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:32:04 Modified files: cm3/scripts/python/: pylib.py Log message: comments From jkrell at elego.de Wed Feb 17 08:34:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:34:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073455.39C712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:34:55 Modified files: cm3/scripts/: backup-pkgs.sh Log message: fix_nl, libdump not so important From jkrell at elego.de Wed Feb 17 08:35:31 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:35:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073531.7E0F82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:35:31 Modified files: cm3/scripts/python/: upgrade.py Log message: ok to build mklib in first pass, its dependency on m3core has been reduced From jkrell at elego.de Wed Feb 17 08:39:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:39:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217073956.10AAD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:39:55 Modified files: cm3/scripts/python/: make-dist.py pylib.py Log message: ok to build mklib early, no need to list m3objfile twice From jkrell at elego.de Wed Feb 17 08:47:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:47:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074726.86A542474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:47:25 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: remove dependency on m3core/WinNT in order to work with older Unix m3core From jkrell at elego.de Wed Feb 17 08:48:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:48:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217074858.0DFDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:48:57 Modified files: cm3/m3-sys/libdump/src/: Main.m3 Log message: cleanup From jkrell at elego.de Wed Feb 17 08:58:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 8:58:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217075801.CA9A42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 08:58:00 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: remove ntdll/interix stuff, I thought I already had From jkrell at elego.de Wed Feb 17 09:16:23 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:16:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217081623.522202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:16:23 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 NT386.common Log message: remove ConvertLibsToStandalone, it is in cm3cfg.common now From jkrell at elego.de Wed Feb 17 09:42:02 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:42:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217084202.347572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:42:02 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 09:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085152.287D92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:51:52 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Tag: release_branch_cm3_5_8 Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and partial merge with head (mainly whitespace, also stuff under ifdef) From jkrell at elego.de Wed Feb 17 09:53:01 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:53:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085301.72C8C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:53:01 Modified files: cm3/m3-sys/cminstall/src/config-no-install/: Unix.common Log message: workaround for building with old tools (e.g. LINUXLIBC6 5.4.0) and reorder 'a and b and c' to 'a and c and b' or such to put faster parts earlier From jkrell at elego.de Wed Feb 17 09:54:57 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 9:54:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217085457.EBC092474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 09:54:57 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: a little more test coverage, forgot the output file From jkrell at elego.de Wed Feb 17 11:40:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:40:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104014.16E3E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:40:14 Modified files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 m3makefile RTIO.i3 Added files: cm3/m3-libs/m3core/src/runtime/common/: Tag: release_branch_cm3_5_8 RTIOc.c Log message: some longint int support from head From jkrell at elego.de Wed Feb 17 11:46:14 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 11:46:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217104614.4A1642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 11:46:14 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: Tag: release_branch_cm3_5_8 parse.c Log message: from head: fix longint div and presumably mod From jkrell at elego.de Wed Feb 17 12:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217111834.4EECB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:18:34 Modified files: cm3/m3-sys/libdump/src/: Tag: release_branch_cm3_5_8 Main.m3 Log message: from head: reduce dependency on newer m3core From jkrell at elego.de Wed Feb 17 12:25:44 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:25:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217112544.C37E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:25:44 Modified files: cm3/m3-libs/libm3/src/os/WIN32/: FSWin32.m3 FileWin32.m3 Log message: don't truncate file sizes to 32bits From jkrell at elego.de Wed Feb 17 12:43:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:43:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217114354.C6B212474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:43:54 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 12:54:43 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 12:54:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217115443.E7E722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 12:54:43 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing From jkrell at elego.de Wed Feb 17 13:17:52 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:17:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217121752.C30AB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:17:52 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a bit more testing: in particular I want to verify that 32bit div/mod doesn't generate a function call, when we alter m3cg From jkrell at elego.de Wed Feb 17 13:25:46 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:25:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217122547.038012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:25:46 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: we don't need m3_div, m3_divL, m3_mod, m3_modL We can "just" use gcc's support "directly". Granted, on many targets, that will generate calls to __divdi3, __udivdi3, __moddi3, __umoddi3, but heck, our hand.c code generated such calls as well, and for platforms for which gcc is not the compiler/linker, we have libgcc.c. This *might* be a deoptimization on some platforms, e.g. SOLsun. That is, if we are going to call a function, better to call their helpers instead of our libgcc stand-ins. However it is likely an optimization on all 64bit platforms all gcc platforms all 32bit operations leaving the deoptimization only on 32bit non-gcc platforms when using longint (Note that m3_divL, m3_modL still used by NT386; m3_div, m3_mod never were) From jkrell at elego.de Wed Feb 17 13:45:55 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:45:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217124556.0D9AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:45:55 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 stdout.pgm Log message: a little more test coverage From jkrell at elego.de Wed Feb 17 13:55:25 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 17 Feb 2010 13:55:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217125525.5CF8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/17 13:55:25 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c test_hand.c Log message: remove 32bit helpers: m3_div_old m3_div m3_mod_old m3_mod TestDiv32 leaving, at least, 64bit helpers for m3back: m3_div64 (Win32 only, else static) m3_mod64 (Win32 only, else static) From hosking at elego.de Wed Feb 17 22:40:49 2010 From: hosking at elego.de (Antony Hosking) Date: Wed, 17 Feb 2010 22:40:49 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100217214049.A3D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/17 22:40:49 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: Add UNUSED_SIGN macro. From hosking at elego.de Thu Feb 18 03:33:15 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 3:33:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218023315.67F322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 03:33:15 Modified files: cm3/m3-sys/m3middle/src/: M3CG_BinRd.m3 M3CG_Rd.m3 TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 cm3/m3-sys/m3front/src/builtinAtomic/: AtomicModule.mg cm3/m3-sys/m3front/src/builtinInfo/: InfoThisLine.m3 cm3/m3-sys/m3front/src/builtinOps/: BitSize.m3 Dec.m3 Number.m3 cm3/m3-sys/m3front/src/builtinWord/: And.mg Divide.mg Extract.mg GE.mg GT.mg Insert.mg LE.mg LT.mg Minus.mg Mod.mg Module.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddExpr.m3 AddressExpr.m3 ArrayExpr.m3 Expr.m3 IntegerExpr.m3 ModExpr.m3 ReelExpr.m3 SetExpr.m3 SubtractExpr.m3 cm3/m3-sys/m3front/src/misc/: CG.m3 Scanner.m3 TipeDesc.m3 cm3/m3-sys/m3front/src/stmts/: CaseStmt.m3 cm3/m3-sys/m3front/src/types/: ArrayType.m3 EnumType.m3 OpenArrayType.m3 SubrangeType.m3 Type.m3 cm3/m3-sys/m3tools/src/: M3Builtin.m3 M3Const.m3 M3Lexer.m3 M3Type.m3 Log message: Drastic simplification of TInt/TWord. These no longer simulate INTEGER arithmetic directly, but simply provide support for arithmetic up to the precision of any target. As a result, users of these interfaces must explicitly ensure that their results do not exceed the bounds of their target integer precision. One side-effect has been fixes to some remaining bugs in range-checking for CARDINAL/LONGCARD. Index: m3middle/src/M3CG_BinRd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_BinRd.m3,v retrieving revision 1.9 diff -c -r1.9 M3CG_BinRd.m3 *** m3middle/src/M3CG_BinRd.m3 11 Jan 2010 22:04:48 -0000 1.9 --- m3middle/src/M3CG_BinRd.m3 18 Feb 2010 02:30:47 -0000 *************** *** 407,426 **** | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, NUMBER (val.x), val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), NUMBER (byte.x), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN ! TWord.Subtract (TInt.Zero, val, val); ! END; RETURN val; END Scan_Tint; --- 407,424 ---- | M3CG_Binary.Int8 => n_bytes := 8; sign := +1; | M3CG_Binary.NInt8 => n_bytes := 8; sign := -1; ELSE ! ok := TInt.FromInt (i, val); <*ASSERT ok*> RETURN val; END; val := TInt.Zero; shift := 0; FOR i := 0 TO n_bytes-1 DO ! ok := TInt.FromInt (GetByte (s), byte); <*ASSERT ok*> TWord.Shift (byte, shift, byte); TWord.Or (val, byte, val); INC (shift, 8); END; ! IF (sign < 0) THEN TWord.Subtract (TInt.Zero, val, val); END; RETURN val; END Scan_Tint; Index: m3middle/src/M3CG_Rd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_Rd.m3,v retrieving revision 1.7 diff -c -r1.7 M3CG_Rd.m3 *** m3middle/src/M3CG_Rd.m3 30 Jan 2010 21:28:34 -0000 1.7 --- m3middle/src/M3CG_Rd.m3 18 Feb 2010 02:30:48 -0000 *************** *** 364,377 **** result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, NUMBER (result.x), result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), NUMBER (result.x), result) THEN ! RETURN result; ! END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), NUMBER (tmp.x), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; --- 364,375 ---- result, tmp: Target.Int; value, used: INTEGER; BEGIN value := Convert.ToInt (SUBARRAY (buf, 0, len), used); ! IF (used = len) AND TInt.FromInt (value, result) THEN RETURN result; ELSIF (buf[0] # '-') THEN ! IF TInt.New (SUBARRAY (buf, 0, len), result) THEN RETURN result END; ELSE (* Target doesn't handle negative values *) ! IF TInt.New (SUBARRAY (buf, 1, len-1), tmp) AND TInt.Subtract (TInt.Zero, tmp, result) THEN RETURN result; END; Index: m3middle/src/TInt.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.i3,v retrieving revision 1.25 diff -c -r1.25 TInt.i3 *** m3middle/src/TInt.i3 8 Feb 2010 16:42:41 -0000 1.25 --- m3middle/src/TInt.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,74 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! signed integer operations. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new target value, otherwise they return FALSE. *) ! FROM Target IMPORT Int, IBytes; CONST ! Zero = Int{NUMBER (IBytes), IBytes{ 0,0,..}}; ! One = Int{NUMBER (IBytes), IBytes{ 1,0,..}}; ! Two = Int{NUMBER (IBytes), IBytes{ 2,0,..}}; ! Three = Int{NUMBER (IBytes), IBytes{ 3,0,..}}; ! Four = Int{NUMBER (IBytes), IBytes{ 4,0,..}}; ! Eight = Int{NUMBER (IBytes), IBytes{ 8,0,..}}; ! Ten = Int{NUMBER (IBytes), IBytes{10,0,..}}; ! ThirtyOne = Int{NUMBER (IBytes), IBytes{31,0,..}}; ! ThirtyTwo = Int{NUMBER (IBytes), IBytes{32,0,..}}; ! SixtyThree= Int{NUMBER (IBytes), IBytes{63,0,..}}; ! SixtyFour = Int{NUMBER (IBytes), IBytes{64,0,..}}; ! F3FF = Int{NUMBER (IBytes), IBytes{16_FF,16_F3,0,..}}; ! x0400 = Int{NUMBER (IBytes), IBytes{0,4,0,..}}; ! x0800 = Int{NUMBER (IBytes), IBytes{0,8,0,..}}; ! x0F00 = Int{NUMBER (IBytes), IBytes{0,16_F,0,..}}; ! ! (* 'M' for Minus (negative) *) ! ! MOne = Int{NUMBER (IBytes), IBytes{16_FF,..}}; ! MThirtyOne = Int{NUMBER (IBytes), IBytes{16_E1,16_FF,..}}; ! MSixtyThree= Int{NUMBER (IBytes), IBytes{16_C1,16_FF,..}}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) - PROCEDURE IntI (READONLY x: Int; n: CARDINAL; VAR i: Int): BOOLEAN; - (* converts a target integer 'x' to a target integer 'i' *) - PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; n: CARDINAL; ! VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns a if a >= 0, -a if a < 0, or overflow *) - PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN; - (* returns '-a' unless there's an overflow *) - PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) --- 10,48 ---- (* Modula-3 target description ! This interface provides simulations of signed integer operations, ! at the maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined ! below return TRUE if they succeed in producing a new value, otherwise they return FALSE. *) ! FROM Target IMPORT Int; ! ! CONST Size = BITSIZE(Int); CONST ! Zero = Int{ 0, 0,..}; ! One = Int{ 1, 0,..}; ! MOne = Int{16_FF,..}; ! PROCEDURE FromInt (x: INTEGER; VAR i: Int): BOOLEAN; (* converts a host integer 'x' to a target integer 'i' *) PROCEDURE ToInt (READONLY i: Int; VAR x: INTEGER): BOOLEAN; (* converts a target integer 'i' to a host integer 'x' *) ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; VAR i: Int): BOOLEAN; (* converts the string of decimal characters in 'chars' to an integer value in 'i' *) PROCEDURE Add (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a + b' unless there's an overflow *) PROCEDURE Subtract (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a - b' unless there's an overflow *) PROCEDURE Multiply (READONLY a, b: Int; VAR i: Int): BOOLEAN; (* returns 'a * b' unless there's an overflow *) *************** *** 81,101 **** PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* returns 'a = b' *) - PROCEDURE NE (READONLY a, b: Int): BOOLEAN; - (* returns 'a # b' *) - PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* returns 'a < b' *) - PROCEDURE GT (READONLY a, b: Int): BOOLEAN; - (* returns 'a > b' *) - PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* returns 'a <= b' *) - PROCEDURE GE (READONLY a, b: Int): BOOLEAN; - (* returns 'a >= b' *) - PROCEDURE ToText (READONLY i: Int): TEXT; (* converts 'i' to a printable string. *) --- 55,66 ---- *************** *** 103,111 **** (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): INTEGER; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns -1 if 'buf' is too short. *) END TInt. --- 68,79 ---- (* converts 'i' to a printable string in 'buf'. Returns the number of characters in the string. Returns -1 if 'buf' is too short. *) ! PROCEDURE ToBytes (READONLY i: Int; VAR buf: ARRAY OF [0..255]): CARDINAL; (* converts 'i' to the shortest sequence of bytes in little-endian order which when sign-extended equal 'i'. Returns the number of ! significant bytes in the result. Returns 0 if 'buf' is too short. *) ! ! PROCEDURE Chop (VAR i: Int; n: CARDINAL); ! (* Extract the low-order 'n' bytes of 'i', sign extended. *) END TInt. Index: m3middle/src/TInt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.m3,v retrieving revision 1.22 diff -c -r1.22 TInt.m3 *** m3middle/src/TInt.m3 10 Feb 2010 13:09:59 -0000 1.22 --- m3middle/src/TInt.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,15 **** MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; --- 9,15 ---- MODULE TInt; IMPORT Word, TWord, Text; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; *************** *** 17,109 **** And = Word.And; CONST ! Mask = 16_FF; ! SignMask = 16_80; ! Base = 16_100; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; ! PROCEDURE FromInt (x: INTEGER; n: CARDINAL; VAR r: Int): BOOLEAN = BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := And (x, Mask); x := x DIV Base; END; ! RETURN (n > 0) AND (x = 0 OR x = -1); END FromInt; ! TYPE Sign = {Bad, Neg, Pos}; ! ! PROCEDURE CheckSign (READONLY r: Int; n: CARDINAL): Sign = BEGIN ! <*ASSERT n # 0*> ! IF And (r.x[r.n-1], SignMask) = 0 THEN ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) # 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # 0 THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Pos; ! ELSE ! IF n < r.n THEN ! IF And (r.x[n-1], SignMask) = 0 THEN RETURN Sign.Bad END; ! FOR i := n TO r.n-1 DO ! IF r.x[i] # Mask THEN RETURN Sign.Bad END; ! END; ! END; ! RETURN Sign.Neg; END; - END CheckSign; - PROCEDURE IntI (READONLY r: Int; n: CARDINAL; VAR x: Int): BOOLEAN = - VAR sign := CheckSign (r, n); j := 0; result := TRUE; - BEGIN - CASE sign OF - | Sign.Bad => result := FALSE; - | Sign.Pos => j := 0; - | Sign.Neg => j := Mask; - END; - x.n := n; - FOR i := 0 TO r.n-1 DO x.x[i] := r.x[i] END; - FOR i := r.n TO n-1 DO x.x[i] := j END; - RETURN result; - END IntI; - - PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = - VAR sign := CheckSign (r, BITSIZE (INTEGER) DIV BITSIZE (IByte)); - result := TRUE; - BEGIN (* ensure the result has the right sign extension *) ! CASE sign OF ! | Sign.Bad => result := FALSE; ! | Sign.Pos => x := 0; ! | Sign.Neg => x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := r.n-1 TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r.x[i]); END; ! RETURN result; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; n: CARDINAL; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; IF (NUMBER (x) = 1) THEN ! r.x[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r.x[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ! digit.x[0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; --- 17,74 ---- And = Word.And; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! SignMask = LShift (1, BITSIZE (IByte) - 1); ! Base = Mask + 1; Digits = ARRAY [0..9] OF CHAR { '0','1','2','3','4','5','6','7','8','9'}; + Ten = Int{10,0,..}; ! PROCEDURE FromInt (x: INTEGER; VAR r: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := And (x, Mask); x := x DIV Base; END; ! RETURN (x = 0 OR x = -1); END FromInt; ! PROCEDURE ToInt (READONLY r: Int; VAR x: INTEGER): BOOLEAN = ! CONST Extras = BITSIZE (INTEGER) DIV BITSIZE (IByte); ! VAR j := 0; sign_chunk := MIN (Extras - 1, LAST(Int)); BEGIN ! (* check that any extra bits are the same as the sign bit *) ! IF And (r [sign_chunk], SignMask) # 0 THEN j := Mask; END; ! FOR i := Extras TO LAST(Int) DO ! IF r [i] # j THEN RETURN FALSE; END; END; (* ensure the result has the right sign extension *) ! IF j = 0 ! THEN x := 0; ! ELSE x := Word.Not (0); END; (* finally, pack the bits *) ! FOR i := LAST(Int) TO 0 BY -1 DO ! x := Word.Or (LShift (x, BITSIZE (IByte)), r[i]); END; ! RETURN TRUE; END ToInt; ! PROCEDURE New (READONLY x: ARRAY OF CHAR; VAR r: Int): BOOLEAN = CONST ZERO = ORD ('0'); ZEROZERO = 10 * ZERO + ZERO; VAR tmp, digit: Int; BEGIN ! r := Zero; IF (NUMBER (x) = 1) THEN ! r[0] := ORD (x[0]) - ZERO; ELSIF (NUMBER (x) = 2) THEN ! r[0] := 10 * ORD (x[0]) + ORD (x[1]) - ZEROZERO; ELSE ! digit := Zero; FOR i := FIRST (x) TO LAST (x) DO ! digit [0] := ORD (x[i]) - ZERO; IF NOT Multiply (r, Ten, tmp) THEN RETURN FALSE; END; IF NOT Add (tmp, digit, r) THEN RETURN FALSE; END; END; *************** *** 113,206 **** PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); carry := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR n := MIN (a.n, b.n); borrow := 0; r_sign := Sign.Bad; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); ! BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := CheckSign (r, n); <*ASSERT r_sign # Sign.Bad*> RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; - PROCEDURE Negate (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - RETURN Subtract(Zero, a, r); - END Negate; - - PROCEDURE Abs (READONLY a: Int; VAR r: Int): BOOLEAN = - (* It is safe for r to alias a *) - BEGIN - IF GE(a, Zero) THEN - r := a; - RETURN TRUE; - END; - RETURN Negate(a, r); - END Abs; - PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! n := MIN (a.n, b.n); k, carry: INTEGER; q: Int; ! p := ARRAY [0.. 2 * NUMBER (IBytes) - 1] OF IByte {0, ..}; ! a_sign := CheckSign (a, n); b_sign := CheckSign (b, n); BEGIN ! IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN ! RETURN FALSE ! END; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO k := i + j; ! carry := Word.Times (a.x[i], b.x[j]); WHILE carry # 0 DO ! carry := carry + p[k]; ! p[k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! r.n := n; FOR i := 0 TO n-1 DO r.x[i] := p[i]; END; ! q.n := n; FOR i := 0 TO n-1 DO q.x[i] := p[i+n]; END; (* compute the top half *) ! IF And (a.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b.x[n-1], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! CASE CheckSign (r, n) OF ! | Sign.Bad => <*ASSERT FALSE*> ! | Sign.Pos => carry := 0; ! | Sign.Neg => carry := Mask; ! END; ! FOR i := 0 TO n-1 DO ! IF q.x[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; --- 78,145 ---- PROCEDURE Add (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR carry := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a [i] + b [i] + carry; ! r [i] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign # b_sign) OR (a_sign = r_sign); END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int): BOOLEAN = (* It is safe for r to alias a or b *) ! VAR borrow := 0; ! a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! r_sign : Word.T; ! BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := And (borrow, Mask); borrow := And (RShift (borrow, BITSIZE (IByte)), 1); END; ! r_sign := And (r [LAST(Int)], SignMask); RETURN (a_sign = b_sign) OR (a_sign = r_sign); END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int): BOOLEAN = VAR ! k, carry: INTEGER; ! q: Int; ! p := ARRAY [0.. 2 * NUMBER(Int) - 1] OF IByte {0, ..}; BEGIN ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO k := i + j; ! carry := Word.Times (a [i], b [j]); WHILE carry # 0 DO ! carry := carry + p [k]; ! p [k] := And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); INC (k); END; END; END; ! FOR i := 0 TO LAST(Int) DO r[i] := p[i]; END; ! FOR i := 0 TO LAST(Int) DO q[i] := p[i+NUMBER(Int)]; END; (* compute the top half *) ! IF And (a [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, b, q); END; ! IF And (b [LAST(Int)], SignMask) # 0 THEN EVAL Subtract (q, a, q); END; (* there is overflow if the top half is not equal to to the sign bit of the low half *) ! carry := 0; ! IF And (r [LAST(Int)], SignMask) # 0 THEN carry := Mask; END; ! FOR i := 0 TO LAST(Int) DO ! IF q[i] # carry THEN RETURN FALSE; END; END; RETURN TRUE; *************** *** 224,250 **** VAR num := a; den := b; ! num_neg: BOOLEAN; ! den_neg: BOOLEAN; ! n := MIN (a.n, b.n); ! a_sign := CheckSign (a, n); ! b_sign := CheckSign (b, n); ! min: Int; BEGIN - IF (a_sign = Sign.Bad) OR (b_sign = Sign.Bad) THEN - RETURN FALSE - END; - IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := a_sign = Sign.Neg; ! den_neg := b_sign = Sign.Neg; ! (* check for the only possible overflow: FIRST DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; --- 163,182 ---- VAR num := a; den := b; ! num_neg : BOOLEAN; ! den_neg : BOOLEAN; ! min : Int; BEGIN IF EQ (b, Zero) THEN RETURN FALSE; END; IF EQ (a, Zero) THEN q := Zero; r := Zero; RETURN TRUE; END; (* grab the signs *) ! num_neg := And (a [LAST(Int)], SignMask) # 0; ! den_neg := And (b [LAST(Int)], SignMask) # 0; ! (* check for the only possible overflow: FIRST(Int) DIV -1 *) IF num_neg AND den_neg THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (a, min) AND EQ (b, MOne) THEN RETURN FALSE; END; *************** *** 296,327 **** *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! IF (CheckSign (a, n) = Sign.Bad) OR (CheckSign (b, n) = Sign.Bad) THEN ! RETURN FALSE; ! END; ! FOR i := 0 TO n-1 DO ! IF a.x[i] # b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := CheckSign (a, a.n); ! b_sign := CheckSign (b, b.n); ! n := MIN (a.n, b.n); ! BEGIN ! <*ASSERT a_sign # Sign.Bad*> ! <*ASSERT b_sign # Sign.Bad*> ! IF (a_sign # b_sign) THEN RETURN (a_sign = Sign.Neg); END; ! ! IF CheckSign (a, n) = Sign.Bad THEN RETURN a_sign = Sign.Neg END; ! IF CheckSign (b, n) = Sign.Bad THEN RETURN b_sign = Sign.Pos END; ! ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; --- 228,249 ---- *) PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := 0 TO LAST(Int) DO ! IF a[i] # b[i] THEN RETURN FALSE; END; END; RETURN TRUE; END EQ; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = ! VAR a_sign := And (a [LAST(Int)], SignMask); ! b_sign := And (b [LAST(Int)], SignMask); ! BEGIN ! IF (a_sign # b_sign) THEN RETURN (a_sign # 0); END; ! ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; *************** *** 333,355 **** RETURN EQ (a, b) OR LT (a, b); END LE; - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN NOT EQ (a, b); - END NE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT (b, a); - END GT; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; --- 255,262 ---- RETURN EQ (a, b) OR LT (a, b); END LE; PROCEDURE ToText (READONLY r: Int): TEXT = ! VAR result: ARRAY [0..BITSIZE (Int)] OF CHAR; BEGIN RETURN Text.FromChars(SUBARRAY(result, 0, ToChars(r, result))); END ToText; *************** *** 360,369 **** minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..BITSIZE (IByte) * NUMBER (IBytes)] OF CHAR; rr := r; ! quo, rem, min: Int; ! n := r.n; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; --- 267,276 ---- minus : BOOLEAN := FALSE; bump : BOOLEAN := FALSE; i, j : INTEGER; ! result : ARRAY [0..Size] OF CHAR; rr := r; ! quo, rem: Int; ! min : Int; BEGIN IF EQ (r, Zero) THEN result [0] := '0'; *************** *** 372,381 **** ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r.x[n-1], SignMask) # 0 THEN ! TWord.Shift (MOne, n * BITSIZE (IByte) - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; --- 279,288 ---- ELSE (* handle a non-zero number *) (* get rid of negative numbers *) ! IF And (r [LAST(Int)], SignMask) # 0 THEN ! TWord.Shift (MOne, Size - 1, min); IF EQ (r, min) THEN ! (* 2's complement makes FIRST(Int) a special case *) bump := TRUE; EVAL Add (rr, One, rr); END; *************** *** 386,397 **** (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem.x [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST *) IF (bump) THEN result [nDigits] := '0'; j := 0; --- 293,304 ---- (* convert the bulk of the digits *) WHILE LT (Zero, rr) DO TWord.DivMod (rr, Ten, quo, rem); ! result [nDigits] := Digits [rem [0]]; rr := quo; INC (nDigits); END; ! (* fixup FIRST (Int) *) IF (bump) THEN result [nDigits] := '0'; j := 0; *************** *** 399,405 **** i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; --- 306,312 ---- i := ORD (result [j]) - ORD ('0'); INC (i); IF (i < 10) THEN ! result [j] := Digits [i]; EXIT; END; result [j] := '0'; *************** *** 416,422 **** (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO --- 323,329 ---- (* build the result buffer *) j := 0; ! IF (minus) THEN buf [0] := '-'; j := 1; END; FOR k := nDigits-1 TO 0 BY -1 DO *************** *** 426,447 **** RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): INTEGER = ! VAR n := r.n; j := 0; k := n; BEGIN (* strip the sign extension *) ! IF And (r.x[n-1], SignMask) # 0 THEN j := Mask END; ! FOR i := n-1 TO 0 BY -1 DO ! IF r.x[i] # j THEN EXIT END; ! DEC (k); ! END; ! <* ASSERT (k = 0) = (EQ(r, Zero) OR EQ(r, MOne)) *> ! INC(k, ORD(k = 0)); (* increment if 0 *) ! IF k > NUMBER (buf) THEN RETURN -1 END; (* unpack the bytes *) ! FOR i := 0 TO k-1 DO buf[i] := r.x[i] END; ! RETURN k; END ToBytes; BEGIN END TInt. --- 333,365 ---- RETURN j; END ToChars; ! PROCEDURE ToBytes (READONLY r: Int; VAR buf: ARRAY OF [0..255]): CARDINAL = ! VAR j := NUMBER(Int); BEGIN (* strip the sign extension *) ! DEC (j); ! IF (r[j] = 0) THEN ! WHILE (j > 0) AND (r[j] = 0) AND (r[j-1] < 16_80) DO DEC (j); END; ! ELSIF (r[j] = 16_ff) THEN ! WHILE (j > 0) AND (r[j] = 16_ff) AND (r[j-1] >= 16_80) DO DEC (j); END; ! END; ! INC (j); ! ! IF j > NUMBER (buf) THEN RETURN 0 END; ! (* unpack the bytes *) ! FOR i := 0 TO j-1 DO buf[i] := r[i] END; ! ! RETURN j; END ToBytes; + PROCEDURE Chop (VAR r: Int; n: CARDINAL) = + BEGIN + IF And (r [n-1], SignMask) = 0 + THEN FOR i := n TO LAST(Int) DO r [i] := 0 END; + ELSE FOR i := n TO LAST(Int) DO r [i] := Mask END; + END; + END Chop; + BEGIN END TInt. Index: m3middle/src/TWord.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.i3,v retrieving revision 1.8 diff -c -r1.8 TWord.i3 *** m3middle/src/TWord.i3 24 Jan 2010 12:29:14 -0000 1.8 --- m3middle/src/TWord.i3 18 Feb 2010 02:30:49 -0000 *************** *** 10,17 **** (* Modula-3 target description ! This interface provides simulations of the target machine's ! unsigned integer operations. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, --- 10,17 ---- (* Modula-3 target description ! This interface provides simulations of unsigned integer operations, at the ! maximum precision supported by any target. Unless otherwise specified, the arithmetic operations defined below return TRUE if they succeed in producing a new target value, *************** *** 20,26 **** FROM Target IMPORT Int; ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) --- 20,28 ---- FROM Target IMPORT Int; ! CONST Size = BITSIZE(Int); ! ! PROCEDURE New (READONLY chars: ARRAY OF CHAR; base: [2..16]; VAR i: Int): BOOLEAN; (* converts the string of characters in 'chars' representing a base 'base' number to an integer value in 'i' *) *************** *** 43,54 **** PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; (* a < b *) ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; (* a <= b *) ! PROCEDURE EQ (READONLY a, b: Int): BOOLEAN; (* a = b *) ! PROCEDURE NE (READONLY a, b: Int): BOOLEAN; (* a # b *) ! PROCEDURE GE (READONLY a, b: Int): BOOLEAN; (* a >= b *) ! PROCEDURE GT (READONLY a, b: Int): BOOLEAN; (* a > b *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) --- 45,55 ---- PROCEDURE DivMod (READONLY x, y: Int; VAR q, r: Int); (* returns 'q = x DIV y', and 'r = x MOD y', but assumes that 'y # 0' *) ! PROCEDURE LT (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LT (a, b)' *) ! ! PROCEDURE LE (READONLY a, b: Int): BOOLEAN; ! (* returns 'Word.LE (a, b)' *) PROCEDURE And (READONLY a, b: Int; VAR i: Int); (* returns 'Word.And (a, b)' *) *************** *** 62,83 **** PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (x, n)' *) ! PROCEDURE LeftShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.LeftShift (x, n)' *) ! PROCEDURE RightShift (READONLY x: Int; n: CARDINAL; VAR r: Int); ! (* returns 'Word.RightShift (x, n)' *) ! PROCEDURE Rotate (READONLY x: Int; n: INTEGER; VAR r: Int); ! (* returns 'Word.Rotate (x, n)' *) ! PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (x, i, n)' *) ! PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (x, y, i, n)' *) END TWord. --- 63,84 ---- PROCEDURE Not (READONLY a: Int; VAR i: Int); (* returns 'Word.Not (a)' *) ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int); ! (* returns 'Word.Shift (a, b)' *) ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.LeftShift (a, b)' *) ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int); ! (* returns 'Word.RightShift (a, b)' *) ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int); ! (* returns 'Word.Rotate (a, b)' *) ! PROCEDURE Extract (READONLY a: Int; b, c: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Extract (a, b, c)' *) ! PROCEDURE Insert (READONLY a, b: Int; c, d: CARDINAL; VAR r: Int): BOOLEAN; ! (* returns 'Word.Insert (a, b, c, d)' *) END TWord. Index: m3middle/src/TWord.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v retrieving revision 1.15 diff -c -r1.15 TWord.m3 *** m3middle/src/TWord.m3 10 Feb 2010 16:33:10 -0000 1.15 --- m3middle/src/TWord.m3 18 Feb 2010 02:30:49 -0000 *************** *** 9,32 **** MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte, IBytes; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = 16_FF; ! Base = 16_100; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; n: CARDINAL; ! VAR r: Int): BOOLEAN = ! VAR rr: IBytes; digit: INTEGER; ch: CHAR; BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); --- 9,30 ---- MODULE TWord; IMPORT Word, TInt; ! FROM Target IMPORT Int, IByte; CONST (* IMPORTS *) RShift = Word.RightShift; LShift = Word.LeftShift; CONST ! Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte)); ! Base = Mask + 1; (*------------------------------------------- unsigned integer operations ---*) ! PROCEDURE New (READONLY x: ARRAY OF CHAR; base: [2..16]; VAR r: Int): BOOLEAN = ! VAR rr: Int; digit: INTEGER; ch: CHAR; BEGIN ! r := TInt.Zero; FOR i := FIRST (x) TO LAST (x) DO ch := x [i]; IF ('0' <= ch) AND (ch <= '9') THEN digit := ORD (ch) - ORD ('0'); *************** *** 36,49 **** END; (* rr := r * base *) ! rr := IBytes {0,..}; ! FOR i := 0 TO n-1 DO ! VAR carry := Word.Times (r.x[i], base); BEGIN ! FOR j := i TO n-1 DO IF carry = 0 THEN EXIT END; ! INC (carry, rr[j]); ! rr[j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 34,47 ---- END; (* rr := r * base *) ! rr := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! VAR carry := Word.Times (r[i], base); BEGIN ! FOR j := i TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! INC (carry, rr [j]); ! rr [j] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 53,61 **** (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO n-1 DO ! INC (carry, rr[i]); ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; --- 51,59 ---- (* r := rr + digit *) VAR carry := digit; BEGIN ! FOR i := 0 TO LAST(Int) DO ! INC (carry, rr [i]); ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; IF carry # 0 THEN RETURN FALSE END; *************** *** 66,106 **** END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! carry := a.x[i] + b.x[i] + carry; ! r.x[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! borrow := a.x[i] - b.x[i] - borrow; ! r.x[i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r := Int{n}; ! FOR i := 0 TO n-1 DO ! FOR j := 0 TO n-1 DO ! carry := Word.Times (a.x[i], b.x[j]); ! FOR k := i + j TO n-1 DO IF carry = 0 THEN EXIT END; ! carry := carry + r.x[k]; ! r.x[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; --- 64,99 ---- END New; PROCEDURE Add (READONLY a, b: Int; VAR r: Int) = ! VAR carry := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! carry := a[i] + b[i] + carry; ! r[i] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END Add; PROCEDURE Subtract (READONLY a, b: Int; VAR r: Int) = ! VAR borrow := 0; BEGIN ! FOR i := 0 TO LAST(Int) DO ! borrow := a [i] - b [i] - borrow; ! r [i] := Word.And (borrow, Mask); borrow := Word.And (RShift (borrow, BITSIZE (IByte)), 1); END; END Subtract; PROCEDURE Multiply (READONLY a, b: Int; VAR r: Int) = ! VAR carry: INTEGER; BEGIN ! r := TInt.Zero; ! FOR i := 0 TO LAST(Int) DO ! FOR j := 0 TO LAST(Int) DO ! carry := Word.Times (a[i], b[j]); ! FOR k := i + j TO LAST(Int) DO IF carry = 0 THEN EXIT END; ! carry := carry + r[k]; ! r[k] := Word.And (carry, Mask); carry := RShift (carry, BITSIZE (IByte)); END; END; *************** *** 136,168 **** quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den: ARRAY [0..NUMBER (IBytes)+1] OF INTEGER; ! n := MIN (x.n, y.n); BEGIN - <*ASSERT n # 0*> (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO n-1 DO ! num[i] := x.x[i]; IF num[i] # 0 THEN max_num := i END; ! den[i] := y.x[i]; IF den[i] # 0 THEN max_den := i END; ! END; ! FOR i := n TO LAST (num) DO ! num[i] := 0; ! den[i] := 0; END; ! q := Int{n}; ! r := Int{n}; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q.x [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r.x[0] := carry; RETURN; END; --- 129,155 ---- quo_est : INTEGER; num_hi : INTEGER; x1,x2,x3: INTEGER; ! num, den := ARRAY [0..NUMBER (Int)+1] OF INTEGER {0,..}; BEGIN (* initialize the numerator and denominator, and find the highest non-zero digits *) ! FOR i := 0 TO LAST(Int) DO ! num[i] := x[i]; IF num[i] # 0 THEN max_num := i; END; ! den[i] := y[i]; IF den[i] # 0 THEN max_den := i; END; END; ! q := TInt.Zero; ! r := TInt.Zero; IF max_den = 0 THEN (* single digit denominator case *) carry := 0; FOR j := max_num TO 0 BY -1 DO tmp := carry * Base + num [j]; ! q [j] := tmp DIV den[0]; carry := tmp MOD den[0]; END; ! r[0] := carry; RETURN; END; *************** *** 237,243 **** END; (* store the quotient digit. *) ! q.x [i - 1] := quo_est; END; (* finally, compute the remainder *) --- 224,230 ---- END; (* store the quotient digit. *) ! q [i - 1] := quo_est; END; (* finally, compute the remainder *) *************** *** 246,420 **** END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; ! FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN TRUE END END; ! FOR i := n-1 TO 0 BY -1 DO ! IF a.x[i] < b.x[i] THEN RETURN TRUE; ! ELSIF a.x[i] > b.x[i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; - PROCEDURE xEQ (READONLY a, b: Int): BOOLEAN = - VAR n := MIN (a.n, b.n); - BEGIN - <*ASSERT n # 0*> - FOR i := n-1 TO 0 BY -1 DO - IF a.x[i] # b.x[i] THEN - RETURN FALSE; - END; - END; - FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END; - FOR i := n TO b.n-1 DO IF b.x[i] # 0 THEN RETURN FALSE END END; - RETURN TRUE; - END xEQ; - - PROCEDURE EQ (READONLY a, b: Int): BOOLEAN = - VAR x := xEQ(a, b); - BEGIN - <* ASSERT x = xEQ(b, a) *> - <* ASSERT x = (LE(a, b) AND LE(b, a)) *> - RETURN x; - END EQ; - - PROCEDURE NE (READONLY a, b: Int): BOOLEAN = - VAR x := NOT xEQ(a, b); - BEGIN - <* ASSERT x = (NOT xEQ(b, a)) *> - <* ASSERT x = (LT(a, b) OR LT(b, a)) *> - RETURN x; - END NE; - - PROCEDURE GE (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LE(b, a); - END GE; - - PROCEDURE GT (READONLY a, b: Int): BOOLEAN = - BEGIN - RETURN LT(b, a); - END GT; - PROCEDURE And (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (a.x[i], b.x[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Or (a.x[i], b.x[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = - VAR n := MIN (a.n, b.n); BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.Xor (a.x[i], b.x[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = - VAR n := a.n; BEGIN ! <*ASSERT n # 0*> ! r.n := n; ! FOR i := 0 TO n-1 DO ! r.x[i] := Word.And (Word.Not (a.x[i]), Mask); END; END Not; ! PROCEDURE LeftShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := n-1 TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a.x[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a.x[z-1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; - n := a.n; size := n * BITSIZE (IByte); BEGIN ! <*ASSERT n # 0*> ! IF b >= size THEN ! r := Int{n}; ! ELSIF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! IF z <= n-1 THEN x1 := RShift (a.x[z], i); END; ! IF z+1 <= n-1 THEN x2 := LShift (a.x[z+1], j); END; ! r.x[k] := Word.And (Word.Or (x1, x2), Mask); END; - r.n := a.n; END; END RightShift; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF b > 0 THEN (* left shift *) ! LeftShift(a, b, r); ! ELSE (* right shift *) ! RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: IBytes; ! n := a.n; size := n * BITSIZE (IByte); BEGIN - <*ASSERT n # 0*> b := b MOD size; IF b = 0 THEN --- 233,338 ---- END DivMod; PROCEDURE LT (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN FALSE; END LT; PROCEDURE LE (READONLY a, b: Int): BOOLEAN = BEGIN ! FOR i := LAST(Int) TO 0 BY -1 DO ! IF a [i] < b [i] THEN RETURN TRUE; ! ELSIF a [i] > b [i] THEN RETURN FALSE; END; END; RETURN TRUE; END LE; PROCEDURE And (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (a [i], b[i]); END; END And; PROCEDURE Or (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Or (a [i], b[i]); END; END Or; PROCEDURE Xor (READONLY a, b: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.Xor (a [i], b[i]); END; END Xor; PROCEDURE Not (READONLY a: Int; VAR r: Int) = BEGIN ! FOR i := 0 TO LAST(Int) DO ! r [i] := Word.And (Word.Not (a [i]), Mask); END; END Not; ! PROCEDURE Shift (READONLY a: Int; b: INTEGER; VAR r: Int) = ! BEGIN ! IF ABS (b) >= Size THEN ! r := TInt.Zero; ! ELSIF b > 0 ! THEN LeftShift(a, b, r); ! ELSE RightShift(a, -b, r); ! END; ! END Shift; ! ! PROCEDURE LeftShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := LAST(Int) TO 0 BY -1 DO z := k - w; x1 := 0; x2 := 0; ! IF z >= 0 THEN x1 := LShift (a[z], i); END; ! IF z-1 >= 0 THEN x2 := RShift (a[z-1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END LeftShift; ! PROCEDURE RightShift (READONLY a: Int; b: [0..Size-1]; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; BEGIN ! IF b = 0 THEN (* no shift *) r := a; ELSE w := b DIV BITSIZE (IByte); i := b MOD BITSIZE (IByte); j := BITSIZE (IByte) - i; ! FOR k := 0 TO LAST(Int) DO z := k + w; x1 := 0; x2 := 0; ! IF z <= LAST(Int) THEN x1 := RShift (a[z], i); END; ! IF z+1 <= LAST(Int) THEN x2 := LShift (a[z+1], j); END; ! r[k] := Word.And (Word.Or (x1, x2), Mask); END; END; END RightShift; ! PROCEDURE Rotate (READONLY a: Int; b: INTEGER; n: CARDINAL; VAR r: Int) = VAR w, i, j, z, x1, x2: INTEGER; ! tmp: Int; ! size := n * BITSIZE (IByte); BEGIN b := b MOD size; IF b = 0 THEN *************** *** 426,436 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a.x[z MOD n], i); ! x2 := RShift (a.x[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); --- 344,354 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k - w; x1 := 0; x2 := 0; ! x1 := LShift (a[z MOD n], i); ! x2 := RShift (a[(z-1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; ELSE (* right rotate *) w := (-b) DIV BITSIZE (IByte); *************** *** 438,485 **** j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a.x[z MOD n], i); ! x2 := LShift (a.x[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := Int {a.n, tmp}; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r.x[w] := Word.And (r.x[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST (IBytes) DO r.x[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; - size := x.n * BITSIZE (IByte); BEGIN ! IF i + n > size THEN RETURN FALSE; END; ! RightShift (x, i + n, yy); ! LeftShift (yy, n, r); ! LeftShift (y, size - n, yy); ! RightShift (yy, size - n, yyy); Or (r, yyy, r); ! LeftShift (r, i, yyyy); r := yyyy; ! LeftShift (x, size - i, yy); ! RightShift (yy, size - i, yyy); Or (r, yyy, r); RETURN TRUE; --- 356,401 ---- j := BITSIZE (IByte) - i; FOR k := 0 TO n-1 DO z := k + w; x1 := 0; x2 := 0; ! x1 := RShift (a[z MOD n], i); ! x2 := LShift (a[(z+1) MOD n], j); tmp[k] := Word.And (Word.Or (x1, x2), Mask); END; ! r := tmp; END; END Rotate; PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR w, b: INTEGER; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -i, r); w := n DIV BITSIZE (IByte); b := n MOD BITSIZE (IByte); ! r[w] := Word.And (r[w], RShift (Mask, BITSIZE (IByte) - b)); ! FOR k := w + 1 TO LAST(Int) DO r[k] := 0; END; RETURN TRUE; END Extract; PROCEDURE Insert (READONLY x, y: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN = VAR yy, yyy, yyyy: Int; BEGIN ! IF i + n > Size THEN RETURN FALSE; END; ! Shift (x, -(i + n), yy); ! Shift (yy, n, r); ! Shift (y, Size - n, yy); ! Shift (yy, -(Size - n), yyy); Or (r, yyy, r); ! Shift (r, i, yyyy); r := yyyy; ! Shift (x, Size - i, yy); ! Shift (yy, -(Size - i), yyy); Or (r, yyy, r); RETURN TRUE; Index: m3middle/src/Target.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.i3,v retrieving revision 1.49 diff -c -r1.49 Target.i3 *** m3middle/src/Target.i3 8 Feb 2010 16:00:54 -0000 1.49 --- m3middle/src/Target.i3 18 Feb 2010 02:30:49 -0000 *************** *** 191,210 **** (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target INTEGER (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) RECORD ! n: CARDINAL; (* only bytes [0..n-1] contain valid bits *) ! x := IBytes{0,..}; (* default is Zero *) ! END; ! IBytes = ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; - PROCEDURE TargetIntToDiagnosticText(a: Int): TEXT; - TYPE Int_type = RECORD cg_type : CGType; (* representation *) --- 191,204 ---- (*-------------------------------------------------------- integer values ---*) ! (* The bits of a target integer (in 2's complement) are stored in an array of small host values, with the low order bits in the first element of the array. *) TYPE ! Int = (* OPAQUE *) ARRAY [0..7] OF IByte; IByte = BITS 8 FOR [0..16_ff]; TYPE Int_type = RECORD cg_type : CGType; (* representation *) Index: m3middle/src/Target.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.m3,v retrieving revision 1.85 diff -c -r1.85 Target.m3 *** m3middle/src/Target.m3 8 Feb 2010 07:17:14 -0000 1.85 --- m3middle/src/Target.m3 18 Feb 2010 02:30:49 -0000 *************** *** 8,33 **** MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils, Fmt; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; - 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; - PROCEDURE Init64 () = BEGIN Integer := Int64; --- 8,18 ---- MODULE Target; ! IMPORT Text, TargetMap, M3RT, TextUtils; VAR (*CONST*) CCs : REF ARRAY OF CallingConvention; PROCEDURE Init64 () = BEGIN Integer := Int64; *************** *** 82,131 **** Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{NUMBER(IBytes), IBytes{16_80,FF,..}}; ! Int8.max := Int{NUMBER(IBytes), IBytes{16_7f,00,..}}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{NUMBER(IBytes), IBytes{00,16_80,FF,..}}; ! Int16.max := Int{NUMBER(IBytes), IBytes{FF,16_7f,00,..}}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{NUMBER(IBytes), IBytes{00,00,00,16_80,FF,..}}; ! Int32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,16_7f,00,..}}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,16_80}}; ! Int64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,16_7f}}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{NUMBER(IBytes), IBytes{00,00,..}}; ! Word8.max := Int{NUMBER(IBytes), IBytes{FF,00,..}}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{NUMBER(IBytes), IBytes{00,00,00,..}}; ! Word16.max := Int{NUMBER(IBytes), IBytes{FF,FF,00,..}}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,..}}; ! Word32.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,00,..}}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{NUMBER(IBytes), IBytes{00,00,00,00,00,00,00,00}}; ! Word64.max := Int{NUMBER(IBytes), IBytes{FF,FF,FF,FF,FF,FF,FF,FF}}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; --- 67,116 ---- Int8.cg_type := CGType.Int8; Int8.size := 8; Int8.align := 8; ! Int8.min := Int{16_80,FF,..}; ! Int8.max := Int{16_7f,00,..}; Int16.cg_type := CGType.Int16; Int16.size := 16; Int16.align := 16; ! Int16.min := Int{00,16_80,FF,..}; ! Int16.max := Int{FF,16_7f,00,..}; Int32.cg_type := CGType.Int32; Int32.size := 32; Int32.align := 32; ! Int32.min := Int{00,00,00,16_80,FF,..}; ! Int32.max := Int{FF,FF,FF,16_7f,00,..}; Int64.cg_type := CGType.Int64; Int64.size := 64; Int64.align := 64; ! Int64.min := Int{00,00,00,00,00,00,00,16_80}; ! Int64.max := Int{FF,FF,FF,FF,FF,FF,FF,16_7f}; Word8.cg_type := CGType.Word8; Word8.size := 8; Word8.align := 8; ! Word8.min := Int{00,00,..}; ! Word8.max := Int{FF,00,..}; Word16.cg_type := CGType.Word16; Word16.size := 16; Word16.align := 16; ! Word16.min := Int{00,00,00,..}; ! Word16.max := Int{FF,FF,00,..}; Word32.cg_type := CGType.Word32; Word32.size := 32; Word32.align := 32; ! Word32.min := Int{00,00,00,00,00,..}; ! Word32.max := Int{FF,FF,FF,FF,00,..}; Word64.cg_type := CGType.Word64; Word64.size := 64; Word64.align := 64; ! Word64.min := Int{00,00,00,00,00,00,00,00}; ! Word64.max := Int{FF,FF,FF,FF,FF,FF,FF,FF}; Integer := Int32; (* default for the 32-bit platforms *) Longint := Int64; *************** *** 137,144 **** Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0}; ! Void.max := Int{0}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; --- 122,129 ---- Void.cg_type := CGType.Void; Void.size := 0; Void.align := Byte; ! Void.min := Int{0,..}; ! Void.max := Int{0,..}; Real.cg_type := CGType.Reel; Real.pre := Precision.Short; Index: m3back/src/Codex86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Codex86.m3,v retrieving revision 1.79 diff -c -r1.79 Codex86.m3 *** m3back/src/Codex86.m3 15 Feb 2010 17:48:57 -0000 1.79 --- m3back/src/Codex86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 9,15 **** MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord; FROM TargetMap IMPORT CG_Bytes; --- 9,15 ---- MODULE Codex86; IMPORT Fmt, TargetMap, M3x86Rep, M3ID, M3CG_Ops, Word, M3ObjFile, Wrx86, Target; ! IMPORT TInt, TWord, Text; FROM TargetMap IMPORT CG_Bytes; *************** *** 18,24 **** FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize, TZero; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; --- 18,24 ---- FROM M3CG_Ops IMPORT ErrorHandler; FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, x86Var, x86Proc, NRegs, OperandSize, GetOperandSize; ! FROM M3x86Rep IMPORT RegistersForByteOperations, RegName, SplitOperand, Is64, SplitImm, OperandPart, GetTypeSize; FROM M3x86Rep IMPORT EAX, EDX, ESP, EBP, ECX; FROM M3ObjFile IMPORT Seg; *************** *** 252,258 **** op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TZero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; --- 252,258 ---- op.reg[0] IN RegistersForByteOperations ) OR (op.loc = OLoc.mem AND CG_Bytes[op.mvar.mvar_type] = 1) *> IF op.loc = OLoc.register THEN ! movImmT(t, op, TInt.Zero); END; build_modrm(t, op, t.opcode[0], ins); ins.escape := TRUE; *************** *** 379,392 **** PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; ! IF TInt.GE(imm, Target.Int8.min) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; --- 379,395 ---- PROCEDURE immOp1 (t: T; op: Op; READONLY dest: Operand; READONLY imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register OR dest.loc = OLoc.mem *> ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("immOp1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; ! IF TInt.LE(Target.Int8.min, imm) AND TInt.LE(imm, Target.Int8.max) THEN ins.imsize := 1; ELSE ins.imsize := 4; *************** *** 465,473 **** t.set_label(compare_label); | Op.oSHL => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); --- 468,476 ---- t.set_label(compare_label); | Op.oSHL => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[1], destA[0]); immOp1(t, op, destA[1], immMinus32); *************** *** 482,490 **** END | Op.oSHR => ! IF TInt.GE(imm, TInt.ThirtyTwo) THEN ! IF TInt.NE(imm, TInt.ThirtyTwo) THEN ! EVAL TInt.Subtract(imm, TInt.ThirtyTwo, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); --- 485,493 ---- END | Op.oSHR => ! IF TInt.LE(Target.Int{32,0,..}, imm) THEN ! IF NOT TInt.EQ(imm, Target.Int{32,0,..}) THEN ! EVAL TInt.Subtract(imm, Target.Int{32,0,..}, immMinus32); (* Ideally we'd do a virtual move in the register alloator. *) movOp1(t, destA[0], destA[1]); immOp1(t, op, destA[0], immMinus32); *************** *** 513,518 **** --- 516,522 ---- PROCEDURE binOp1WithShiftCount (t: T; op: Op; READONLY dest, src: Operand; READONLY shiftCount: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT NOT Is64(src.optype) *> *************** *** 549,559 **** <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.GE(shiftCount.imm, Target.Int8.min) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; ELSE --- 553,564 ---- <* ASSERT src.loc = OLoc.register *> <* ASSERT shiftCount.loc = OLoc.register OR shiftCount.loc = OLoc.imm *> <* ASSERT shiftCount.loc # OLoc.register OR shiftCount.reg[0] = ECX *> ! <* ASSERT shiftCount.loc # OLoc.imm OR (TInt.LE(Target.Int8.min, shiftCount.imm) AND TInt.LE(shiftCount.imm, Target.Int8.max)) *> IF shiftCount.loc = OLoc.imm THEN IF NOT TInt.ToInt(shiftCount.imm, ins.imm) THEN ! t.Err("binOp: unable to convert immediate to INTEGER:" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(shiftCount.imm, buf)))); END; ins.imsize := 1; ELSE *************** *** 908,916 **** PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm)); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> --- 913,924 ---- PROCEDURE movImmT (t: T; READONLY dest: Operand; imm: Target.Int) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN ! IF (NOT TInt.ToInt(imm, ins.imm)) ! AND (NOT TWord.LE(imm, Target.Word32.max)) THEN ! t.Err("movImmT: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(imm, buf)))); END; IF dest.loc # OLoc.register THEN <* ASSERT dest.loc = OLoc.mem *> *************** *** 921,927 **** ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TZero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; --- 929,935 ---- ins.imsize := CG_Bytes[dest.mvar.mvar_type]; writecode(t, ins); log_global_var(t, dest.mvar, -4 - CG_Bytes[dest.mvar.mvar_type]); ! ELSIF TInt.EQ(imm, TInt.Zero) THEN binOp(t, Op.oXOR, dest, dest); ELSE ins.opcode := 16_B8 + dest.reg[0]; *************** *** 934,940 **** PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, BYTESIZE(imm), immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); --- 942,948 ---- PROCEDURE movImmI (t: T; READONLY dest: Operand; imm: INTEGER) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(imm, immT) THEN t.Err("movImmI: unable to convert INTEGER to Target.Int"); END; t.movImmT(dest, immT); *************** *** 942,954 **** PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 950,966 ---- PROCEDURE pushOp1 (t: T; READONLY src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN Mn(t, "PUSH"); MnOp(t, src); CASE src.loc OF | OLoc.imm => ins.opcode := 16_68; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("pushOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1073,1079 **** unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TZero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> --- 1085,1091 ---- unOp1(t, op, destA[1]); | Op.oNEG => unOp1(t, op, destA[0]); ! t.binOp(Op.oADC, destA[1], Operand {loc := OLoc.imm, imm := TInt.Zero, optype := Type.Word32}); unOp1(t, op, destA[1]); ELSE <* ASSERT FALSE *> *************** *** 1104,1109 **** --- 1116,1122 ---- PROCEDURE imulOp (t: T; READONLY dest, src: Operand) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT dest.loc = OLoc.register *> <* ASSERT src.loc # OLoc.mem OR CG_Bytes[src.mvar.mvar_type] = 4 *> *************** *** 1111,1118 **** IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN ! t.Err("imulOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm)); END; ins.imsize := 4; writecode(t, ins); --- 1124,1134 ---- IF src.loc = OLoc.imm THEN build_modrm(t, t.reg[dest.reg[0]], dest, ins); ins.opcode := 16_69; ! IF (NOT TInt.ToInt(src.imm, ins.imm)) ! AND (NOT TWord.LE(src.imm, Target.Word32.max)) ! THEN ! t.Err("imulOp: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(src.imm, buf)))); END; ins.imsize := 4; writecode(t, ins); *************** *** 1195,1201 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) --- 1211,1217 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) decOp(t, t.reg[EAX]); (* DEC EAX *) set_label(t, endlab); (* .endlab *) *************** *** 1221,1227 **** set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TZero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) --- 1237,1243 ---- set_label(t, diffsignlab); (* .diffsignlab *) noargOp(t, Op.oCDQ); (* CDQ *) idivOp(t, divisor); (* IDIV EAX, divisor *) ! immOp(t, Op.oCMP, t.reg[EDX], TInt.Zero); (* CMP EDX, #0 *) brOp(t, Cond.E, endlab); (* JE endlab *) binOp(t, Op.oADD, t.reg[EDX], divisor); (* ADD EDX, divisor *) set_label(t, endlab); (* .endlab *) *************** *** 1479,1492 **** PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) AND (NOT TWord.LE(val.imm, Target.Word32.max)) THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(val.imm)); END; ins.imsize := CG_Bytes[type]; END; --- 1495,1512 ---- PROCEDURE store_ind1 (t: T; READONLY val, ind: Operand; offset: ByteOffset; type: MType) = VAR ins: Instruction; + buf: ARRAY [0..BITSIZE(Target.Int)] OF CHAR; BEGIN <* ASSERT ind.loc = OLoc.register AND val.loc # OLoc.mem *> ins.opcode := 16_88; IF val.loc = OLoc.imm THEN ins.opcode := 16_C6; ! IF (NOT TInt.ToInt(val.imm, ins.imm)) ! AND (NOT TWord.LE(val.imm, Target.Word32.max)) ! THEN ! t.Err("store_ind1: unable to convert immediate to INTEGER: " & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(val.imm, buf)))); END; ins.imsize := CG_Bytes[type]; END; *************** *** 2324,2330 **** 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); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; --- 2344,2350 ---- WHILE f_lit # NIL DO FOR i := 0 TO f_lit.flit_size - 1 DO ! EVAL TInt.FromInt(f_lit.arr[i], tint); t.parent.init_int(f_lit.loc + i, tint, Type.Word8); END; *************** *** 2332,2338 **** END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TZero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; --- 2352,2358 ---- END; WHILE abscall # NIL DO ! t.parent.init_int(abscall.loc, TInt.Zero, Type.Int32); t.obj.relocate(intvar.symbol, abscall.loc, abscall.sym); abscall := abscall.link; END; Index: m3back/src/M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.126 diff -c -r1.126 M3x86.m3 *** m3back/src/M3x86.m3 15 Feb 2010 17:58:21 -0000 1.126 --- m3back/src/M3x86.m3 18 Feb 2010 02:30:50 -0000 *************** *** 1105,1117 **** pad_init(u, o); len := TInt.ToBytes(value, bytes); - IF NOT (len <= NUMBER(bytes) AND len <= CG_Bytes[t] AND len > 0) THEN - u.Err("init_int: len:" & Fmt.Int(len) & " type:" & Target.TypeNames[t] & " value:" & Target.TargetIntToDiagnosticText(value)); - END; <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TZero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; --- 1105,1114 ---- pad_init(u, o); len := TInt.ToBytes(value, bytes); <* ASSERT len > 0 *> <* ASSERT len <= NUMBER(bytes) *> <* ASSERT len <= CG_Bytes[t] *> ! IF TInt.LT(value, TInt.Zero) THEN FOR i := len TO CG_Bytes[t] - 1 DO bytes[i] := 16_FF; END; *************** *** 1506,1512 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; --- 1503,1509 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.NZ, label); END if_true; *************** *** 1520,1526 **** u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TZero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; --- 1517,1523 ---- u.wr.NL (); END; ! u.vstack.doimm (Op.oCMP, TInt.Zero, FALSE); u.cg.brOp (Cond.Z, label); END if_false; *************** *** 1802,1808 **** END; u.vstack.unlock(); ! u.vstack.pushimmT(TZero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = --- 1799,1805 ---- END; u.vstack.unlock(); ! u.vstack.pushimmT(TInt.Zero, Type.Addr); END load_nil; PROCEDURE load_integer (u: U; t: IType; READONLY i: Target.Int) = *************** *** 2166,2172 **** pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TZero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; --- 2163,2169 ---- pop_param(u, Type.Addr); pop_param(u, Type.Addr); call_int_proc (u, proc); ! u.vstack.pushimmT(TInt.Zero, Type.Word32); condset(u, CompareOpCond [op], t); ELSE proc := CompareOpProc [op]; *************** *** 2323,2336 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR TInt.NE(u.vstack.op(stack1).imm, TZero) THEN (* shift non-constant *) --- 2320,2333 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHL, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); END END ELSE ! IF (u.vstack.loc(stack1) # OLoc.imm) OR NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero) THEN (* shift non-constant *) *************** *** 2385,2391 **** TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF TInt.NE(u.vstack.op(stack0).imm, TZero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); --- 2382,2388 ---- TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); u.vstack.set_imm(stack0, and); ! IF NOT TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN u.vstack.find(stack1, Force.anytemp); u.cg.immOp(Op.oSHR, u.vstack.op(stack1), u.vstack.op(stack0).imm); u.vstack.newdest(u.vstack.op(stack1)); *************** *** 2395,2401 **** (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (TInt.NE(u.vstack.op(stack1).imm, TZero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; --- 2392,2398 ---- (* shift a non-constant or non-zero *) ! IF ((u.vstack.loc(stack1) # OLoc.imm) OR (NOT TInt.EQ(u.vstack.op(stack1).imm, TInt.Zero))) THEN IF Is64(t) THEN do_custom_calling_convention_shift_64 (u, Builtin.shift_right_64); RETURN; *************** *** 2452,2458 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2449,2456 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2505,2511 **** IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); --- 2503,2510 ---- IF NOT TInt.ToInt(u.vstack.op(stack0).imm, rotateCount) THEN u.Err("unable to convert rotate count to host integer"); END; ! TWord.Rotate(u.vstack.op(stack1).imm, -rotateCount, ! Target.Integer.bytes, rotate); u.vstack.set_imm(stack1, rotate); ELSE TWord.And(u.vstack.op(stack0).imm, MaximumShift[t], and); *************** *** 2749,2757 **** u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in copy_n"); END; --- 2748,2756 ---- u.vstack.unlock(); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in copy_n"); END; *************** *** 2806,2815 **** IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN --- 2805,2814 ---- IF forward THEN u.cg.noargOp(Op.oCLD); ELSE ! IF NOT TInt.FromInt(n, tn) THEN u.Err("string_copy: unable to convert n to target int"); END; ! IF NOT TInt.FromInt(size, tsize) THEN u.Err("string_copy: unable to convert size to target int"); END; IF NOT TInt.Subtract(tn, TInt.One, tNMinus1) THEN *************** *** 2940,2948 **** u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := TInt.One; ! | 4 => shift := TInt.Two; ! | 8 => shift := TInt.Three; ELSE u.Err("Unknown MType size in zero_n"); END; --- 2939,2947 ---- u.vstack.find(stack0, Force.anyreg); CASE CG_Bytes[t] OF ! 2 => shift := Target.Int{1,0,..}; ! | 4 => shift := Target.Int{2,0,..}; ! | 8 => shift := Target.Int{3,0,..}; ELSE u.Err("Unknown MType size in zero_n"); END; *************** *** 2953,2959 **** start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TZero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); --- 2952,2958 ---- start_int_proc (u, Builtin.memset); pop_param (u, z); ! u.vstack.pushimmT (TInt.Zero, Type.Word32); pop_param (u, Type.Word32); pop_param (u, Type.Addr); call_int_proc (u, Builtin.memset); *************** *** 3013,3019 **** stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TZero, optype := t }, stop0, i * size, faketype[size]); END END --- 3012,3018 ---- stop0 = u.vstack.op(stack0) DO u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); FOR i := 0 TO n - 1 DO ! u.cg.store_ind(Operand { loc := OLoc.imm, imm := TInt.Zero, optype := t }, stop0, i * size, faketype[size]); END END *************** *** 3155,3168 **** u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TZero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TZero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); --- 3154,3167 ---- u.vstack.unlock(); WITH stack0 = u.vstack.pos(0, "check_nil") DO IF u.vstack.loc(stack0) = OLoc.imm THEN ! IF TInt.EQ(u.vstack.op(stack0).imm, TInt.Zero) THEN reportfault(u, code); END ELSE u.vstack.find(stack0, Force.anyreg, RegSet {}, TRUE); IF NOT u.vstack.non_nil(u.vstack.reg(stack0)) THEN ! u.cg.immOp(Op.oCMP, u.vstack.op(stack0), TInt.Zero); safelab := u.cg.reserve_labels(1, TRUE); u.cg.brOp(Cond.NE, safelab); reportfault(u, code); *************** *** 3194,3200 **** END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.GE(u.vstack.lower(u.vstack.reg(stack0)), i) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); --- 3193,3199 ---- END ELSE u.vstack.find(stack0, Force.anyreg); ! IF TInt.LE(i, u.vstack.lower(u.vstack.reg(stack0))) THEN (* ok *) ELSIF TInt.LT(u.vstack.upper(u.vstack.reg(stack0)), i) THEN reportfault(u, code); *************** *** 3232,3238 **** u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.GT(u.vstack.lower(u.vstack.reg(stack0)), i) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); --- 3231,3237 ---- u.vstack.find(stack0, Force.anyreg); IF TInt.LE(u.vstack.upper(u.vstack.reg(stack0)), i) THEN (* ok *) ! ELSIF TInt.LT(i, u.vstack.lower(u.vstack.reg(stack0))) THEN reportfault(u, code); ELSE u.cg.immOp(Op.oCMP, u.vstack.op(stack0), i); *************** *** 3279,3287 **** reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.GE(lo, a) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TZero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); --- 3278,3286 ---- reportfault(u, code); ELSIF TInt.LE(hi, b) THEN check_lo(u, t, a, code); ! ELSIF TInt.LE(a, lo) THEN check_hi(u, t, b, code); ! ELSIF TInt.EQ(a, TInt.Zero) THEN (* 0 <= x <= b ==> UNSIGNED(x) <= b *) safelab := u.cg.reserve_labels(1, TRUE); u.cg.immOp(Op.oCMP, u.vstack.op(stack0), b); *************** *** 3457,3463 **** u.wr.NL (); END; ! IF NOT TInt.FromInt(i, Target.Integer.bytes, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; --- 3456,3462 ---- u.wr.NL (); END; ! IF NOT TInt.FromInt(i, ti) THEN u.Err("add_offset: failed to convert i to target integer"); END; *************** *** 3642,3650 **** IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Four); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], TInt.Eight); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE --- 3641,3649 ---- IF Target.FloatType [t] THEN <* ASSERT depth = 0 *> IF t = Type.Reel THEN ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{4,0,..}); ELSE ! u.cg.immOp(Op.oSUB, u.cg.reg[ESP], Target.Int{8,0,..}); END; u.cg.f_storeind(u.cg.reg[ESP], 0, t); ELSE *************** *** 3694,3706 **** WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, Target.Integer.bytes, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.GT(ts, TInt.ThirtyTwo) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); --- 3693,3705 ---- WITH stack0 = u.vstack.pos(0, "pop_struct") DO ! IF NOT TInt.FromInt(s, ts) THEN u.Err("pop_struct: unable to convert s to target int"); END; (* if the struct is "large", use rep mov to copy it to the machine stack *) ! IF TInt.LT(Target.Int{32,0,..}, ts) THEN u.cg.immOp(Op.oSUB, u.cg.reg[ESP], ts); u.vstack.find(stack0, Force.regset, RegSet { ESI }); *************** *** 3880,3886 **** IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); --- 3879,3885 ---- IF (NOT realproc.stdcall) (* => caller cleans *) AND u.call_param_size[u.in_proc_call - 1] > 0 THEN ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_direct: unable to convert param_size to target integer"); END; u.cg.immOp(Op.oADD, u.cg.reg[ESP], call_param_size); *************** *** 3939,3945 **** (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], Target.Integer.bytes, call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; --- 3938,3944 ---- (* caller-cleans calling convention *) ! IF NOT TInt.FromInt(u.call_param_size[u.in_proc_call - 1], call_param_size) THEN u.Err("call_indirect: unable to convert param_size to target integer"); END; *************** *** 4027,4033 **** u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TZero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], --- 4026,4032 ---- u.vstack.unlock(); IF realproc.lev = 0 THEN ! u.vstack.pushimmT(TInt.Zero, Type.Word32); ELSE u.vstack.pushnew(Type.Addr, Force.anyreg); u.cg.get_frame(u.vstack.op(u.vstack.pos(0, "load_static_link")).reg[0], *************** *** 4047,4053 **** IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TZero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); --- 4046,4052 ---- IF realproc.lev = 0 THEN u.vstack.corrupt(ECX, operandPart := 0); ! u.cg.movImmT(u.cg.reg[ECX], TInt.Zero); ELSE u.vstack.unlock(); u.vstack.corrupt(ECX, operandPart := 0); *************** *** 4060,4066 **** PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TZero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); --- 4059,4065 ---- PROCEDURE intregcmp (u: U; tozero: BOOLEAN; type: Type): BOOLEAN = BEGIN IF tozero THEN ! u.vstack.doimm(Op.oCMP, TInt.Zero, FALSE); RETURN FALSE; ELSE RETURN u.vstack.dobin(Op.oCMP, TRUE, FALSE, type); Index: m3back/src/M3x86Rep.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86Rep.i3,v retrieving revision 1.28 diff -c -r1.28 M3x86Rep.i3 *** m3back/src/M3x86Rep.i3 14 Feb 2010 08:35:08 -0000 1.28 --- m3back/src/M3x86Rep.i3 18 Feb 2010 02:30:50 -0000 *************** *** 146,161 **** PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST TZero = TInt.Zero; ! CONST UnsignedType = ARRAY IType OF IType { Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { TInt.ThirtyOne, TInt.ThirtyOne, ! TInt.SixtyThree, TInt.SixtyThree }; ! ! CONST MinimumShift = ARRAY IType OF Target.Int { TInt.MThirtyOne, TInt.MThirtyOne, ! TInt.MSixtyThree, TInt.MSixtyThree }; CONST BitCountMask = MaximumShift; --- 146,162 ---- PROCEDURE GetOperandSize(READONLY op: Operand): OperandSize; PROCEDURE GetTypeSize(type: Type): OperandSize; ! CONST UnsignedType = ARRAY IType OF IType { ! Type.Word32, Type.Word32, ! Type.Word64, Type.Word64 }; ! CONST MaximumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; ! CONST MinimumShift = ARRAY IType OF Target.Int { ! Target.Int{31,0,..}, Target.Int{31,0,..}, ! Target.Int{63,0,..}, Target.Int{63,0,..}}; CONST BitCountMask = MaximumShift; Index: m3back/src/Stackx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Stackx86.m3,v retrieving revision 1.93 diff -c -r1.93 Stackx86.m3 *** m3back/src/Stackx86.m3 14 Feb 2010 13:23:42 -0000 1.93 --- m3back/src/Stackx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 16,22 **** FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize, TZero; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; --- 16,22 ---- FROM M3CG IMPORT Type, MType, ZType, IType, Sign, Label, ByteOffset; FROM M3CG_Ops IMPORT ErrorHandler; ! FROM M3x86Rep IMPORT Operand, MVar, Regno, OLoc, VLoc, NRegs, Force, Is64, OperandPart, RegName, OperandSize; FROM M3x86Rep IMPORT RegistersForByteOperations, RegSet, FlToInt, x86Var, x86Proc, NoStore, SplitOperand, SplitMVar, GetTypeSize, GetOperandSize; FROM M3x86Rep IMPORT IsInt, IsWord, EAX, ECX, EDX, EBX, ESI, EDI, UnsignedType, MaximumShift, MinimumShift, BitCountMask, IntType; *************** *** 101,107 **** Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TZero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; --- 101,107 ---- Register = RECORD stackp : INTEGER := -1; last_store : MVar := NoStore; ! last_imm : Target.Int := TInt.Zero; lowbound : Target.Int; upbound : Target.Int; imm : BOOLEAN := FALSE; *************** *** 780,786 **** PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, Target.Integer.bytes, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); --- 780,786 ---- PROCEDURE pushimmI (t: T; immI: INTEGER; type: Type) = VAR immT: Target.Int; BEGIN ! IF NOT TInt.FromInt(immI, immT) THEN t.Err("pushimmI: unable to convert to target integer"); END; t.pushimmT(immT, type); *************** *** 974,983 **** WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, Target.Integer.bytes, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, Target.Integer.bytes, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN --- 974,983 ---- WITH stop0 = t.vstack[pos(t, 0, "doloadaddress")] DO IF v.loc = VLoc.temp AND v.parent # t.current_proc THEN t.cg.get_frame(stop0.reg[0], v.parent, t.current_proc); ! IF NOT TInt.FromInt(o, to) THEN t.Err("doloadaddress: unable to convert o"); END; ! IF NOT TInt.FromInt(v.offset, tvoffset) THEN t.Err("doloadaddress: unable to convert v.offset"); END; IF NOT TInt.Add(to, tvoffset, ti) THEN *************** *** 1234,1240 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1234,1240 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1294,1300 **** IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TZero); neglabel := t.cg.reserve_labels(1, TRUE); --- 1294,1300 ---- IF (a = Sign.Positive AND b = Sign.Negative) OR (a = Sign.Negative AND b = Sign.Positive) THEN ! t.cg.immOp(Op.oCMP, t.cg.reg[EDX], TInt.Zero); neglabel := t.cg.reserve_labels(1, TRUE); *************** *** 1323,1329 **** IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.GT(imm, Target.Int8.max) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE --- 1323,1329 ---- IF (stop0.loc = OLoc.mem AND ((overwritesdest AND NOT stop0.mvar.var.stack_temp) OR CG_Bytes[stop0.mvar.mvar_type] = 2 OR ! (CG_Bytes[stop0.mvar.mvar_type] = 1 AND (TInt.LT(Target.Int8.max, imm) OR TInt.LT(imm, Target.Int8.min))))) OR stop0.loc = OLoc.imm THEN find(t, stack0, Force.anyreg); ELSE *************** *** 1347,1353 **** WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Negate(stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; --- 1347,1353 ---- WITH stack0 = pos(t, 0, "doneg"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, neg) THEN t.Err("doneg: Negate overflowed"); END; stop0.imm := neg; *************** *** 1367,1380 **** WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.Abs(stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TZero); lab := t.cg.reserve_labels(1, TRUE); --- 1367,1382 ---- WITH stack0 = pos(t, 0, "doabs"), stop0 = t.vstack[stack0] DO IF stop0.loc = OLoc.imm THEN ! IF TInt.LT (stop0.imm, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, stop0.imm, stop0.imm) THEN ! t.Err("doabs: Abs overflowed"); ! END; END; ELSE find(t, stack0, Force.anytemp); IF (stop0.loc = OLoc.mem) OR (GetOperandSize(stop0) > 1) THEN ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); lab := t.cg.reserve_labels(1, TRUE); *************** *** 1426,1452 **** (* shift non-constant by a constant *) ! IF TInt.NE(stop0.imm, TZero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, MaximumShift[type]) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.GT(stop0.imm, TZero) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; --- 1428,1454 ---- (* shift non-constant by a constant *) ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN (* shift non-constant by a non-zero constant *) find(t, stack1, Force.anytemp); ! IF TInt.LT(MaximumShift[type], stop0.imm) OR TInt.LT(stop0.imm, MinimumShift[type]) THEN (* shifting "too far" just yields zero *) t.cg.binOp(Op.oXOR, stop1, stop1); ! ELSIF TInt.LT(TInt.Zero, stop0.imm) THEN (* positive shift is left shift *) t.cg.immOp(Op.oSHL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, tShiftCount) THEN t.Err("doshift: Negate overflowed"); END; *************** *** 1461,1467 **** END ELSE ! IF ((stop1.loc # OLoc.imm) OR (TInt.NE(stop1.imm, TZero))) THEN (* shift by a non-constant *) --- 1463,1469 ---- END ELSE ! IF ((stop1.loc # OLoc.imm) OR (NOT TInt.EQ(stop1.imm, TInt.Zero))) THEN (* shift by a non-constant *) *************** *** 1476,1482 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); --- 1478,1484 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); ovflshift := t.cg.reserve_labels(1, TRUE); *************** *** 1484,1490 **** t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); --- 1486,1492 ---- t.cg.brOp(Cond.GE, leftlab); t.cg.unOp(Op.oNEG, stop0); ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHR, stop1); t.cg.brOp(Cond.Always, endlab); *************** *** 1494,1500 **** t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, TInt.ThirtyTwo); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); --- 1496,1502 ---- t.cg.brOp(Cond.Always, endlab); t.cg.set_label(leftlab); (* .leftlab *) ! t.cg.immOp(Op.oCMP, stop0, Target.Int{32,0,..}); t.cg.brOp(Cond.GE, ovflshift); t.cg.unOp(Op.oSHL, stop1); t.cg.set_label(endlab); *************** *** 1528,1536 **** IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, stop1.imm); ELSE ! IF TInt.NE(stop0.imm, TZero) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1530,1539 ---- IF NOT TInt.ToInt(stop0.imm, rotateCount) THEN t.Err("dorotate: failed to convert rotateCount to host integer"); END; ! TWord.Rotate(stop1.imm, rotateCount, ! Target.Integer.bytes, stop1.imm); ELSE ! IF NOT TInt.EQ(stop0.imm, TInt.Zero) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1538,1548 **** find(t, stack1, Force.anytemp); ! IF TInt.GT(stop0.imm, TZero) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Negate(stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); --- 1541,1551 ---- find(t, stack1, Force.anytemp); ! IF TInt.LT(TInt.Zero, stop0.imm) THEN TWord.And(stop0.imm, BitCountMask[type], stop0.imm); t.cg.immOp(Op.oROL, stop1, stop0.imm); ELSE ! IF NOT TInt.Subtract(TInt.Zero, stop0.imm, stop0.imm) THEN t.Err("dorotate: negate overflowed"); END; TWord.And(stop0.imm, BitCountMask[type], stop0.imm); *************** *** 1554,1560 **** END ELSE ! IF ((stop0.loc # OLoc.imm) OR (TInt.NE(stop0.imm, TZero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; --- 1557,1563 ---- END ELSE ! IF ((stop0.loc # OLoc.imm) OR (NOT TInt.EQ(stop0.imm, TInt.Zero))) THEN IF is64 THEN (* needs work *) RETURN FALSE; *************** *** 1567,1573 **** find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TZero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); --- 1570,1576 ---- find(t, stack1, Force.anyreg); END; ! t.cg.immOp(Op.oCMP, stop0, TInt.Zero); leftlab := t.cg.reserve_labels(1, TRUE); endlab := t.cg.reserve_labels(1, TRUE); *************** *** 1705,1715 **** find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, Target.Integer.bytes, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(TInt.ThirtyTwo, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; --- 1708,1718 ---- find(t, stack0, Force.anyreg); END; ! IF NOT TInt.FromInt(n, tn) THEN t.Err("doextract_n: failed to convert n to target integer"); END; ! IF NOT TInt.Subtract(Target.Int{32,0,..}, tn, t32MinusN) THEN t.Err("doextract_n: Subtract overflowed"); END; *************** *** 1759,1765 **** IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF TInt.NE(tint, TZero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; --- 1762,1768 ---- IF sign THEN TWord.Shift(TInt.One, n - 1, tint); TWord.And(stop0.imm, tint, tint); ! IF NOT TInt.EQ(tint, TInt.Zero) THEN TWord.Shift(Target.Word32.max, n, tint); TWord.Or(stop0.imm, tint, stop0.imm); END; *************** *** 1770,1783 **** IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); --- 1773,1786 ---- IF sign THEN find(t, stack0, Force.anyreg); IF (m + n) < 32 THEN ! IF NOT TInt.FromInt(32 - (m + n), tint) THEN t.Err("doextract_mn: failed to convert 32 - (m + n) to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint); END; IF n < 32 THEN ! IF NOT TInt.FromInt(32 - n, tint) THEN t.Err("doextract_mn: failed to convert 32 - n to target integer"); END; t.cg.immOp(Op.oSAR, stop0, tint); *************** *** 1790,1796 **** END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); --- 1793,1799 ---- END; IF m > 0 THEN ! IF NOT TInt.FromInt(m, tint) THEN t.Err("doextract_mn: failed to m to target integer"); END; t.cg.immOp(Op.oSHR, stop0, tint); *************** *** 1858,1864 **** t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF TInt.NE(stop1.imm, TZero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END --- 1861,1867 ---- t.cg.binOp(Op.oAND, stop2, t.cg.reg[maskreg]); IF stop1.loc = OLoc.imm THEN ! IF NOT TInt.EQ(stop1.imm, TInt.Zero) THEN t.cg.immOp(Op.oSHL, stop2, stop1.imm); t.cg.immOp(Op.oADD, stop0, stop1.imm); END *************** *** 1997,2003 **** END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, Target.Integer.bytes, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); --- 2000,2006 ---- END; IF m # 0 THEN ! IF NOT TInt.FromInt(m, tint_m) THEN t.Err("doinsert_mn: unable to convert m to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tint_m); *************** *** 2008,2014 **** TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF TWord.NE(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE --- 2011,2017 ---- TWord.Shift(uint_type.max, m + n - uint_type.size, mask_m_n); TWord.Xor(mask_m, mask_m_n, mask); ! IF NOT TInt.EQ(mask, uint_type.max) THEN IF stop1.loc = OLoc.imm THEN TWord.And(stop1.imm, mask, stop1.imm); ELSE *************** *** 2021,2032 **** TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR TInt.NE(stop0.imm, TZero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; --- 2024,2035 ---- TWord.Or(stop1.imm, stop0.imm, stop1.imm); ELSE swap(t); ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END ELSE ! IF stop0.loc # OLoc.imm OR NOT TInt.EQ(stop0.imm, TInt.Zero) THEN t.cg.binOp(Op.oOR, stop1, stop0); END END; *************** *** 2209,2215 **** find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, Target.Integer.bytes, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN --- 2212,2218 ---- find(t, stack1, Force.anyreg, RegSet {}, TRUE); IF stop0.loc = OLoc.imm THEN ! IF NOT TInt.FromInt(size, tsize) THEN t.Err("doindex_address: failed to convert size to target integer"); END; IF NOT TInt.Multiply(stop0.imm, tsize, tint) THEN *************** *** 2244,2250 **** END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, Target.Integer.bytes, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); --- 2247,2253 ---- END ELSIF shift > 0 THEN ! IF NOT TInt.FromInt(shift, tshift) THEN t.Err("doindex_address: failed to convert size to target integer"); END; t.cg.immOp(Op.oSHL, stop0, tshift); *************** *** 2383,2391 **** t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], TInt.F3FF); ! IF TInt.NE(t.rmode[mode], TZero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; --- 2386,2394 ---- t.cg.memFOp(FOp.fSTCW, statusop.mvar); t.cg.movOp(t.cg.reg[statreg], statusop); ! t.cg.immOp(Op.oAND, t.cg.reg[statreg], Target.Int{16_FF,16_F3,0,..}); ! IF NOT TInt.EQ(t.rmode[mode], TInt.Zero) THEN t.cg.immOp(Op.oOR, t.cg.reg[statreg], t.rmode[mode]); END; *************** *** 2540,2546 **** END; t.rmode := ARRAY FlToInt OF Target.Int ! { TZero, TInt.x0400, TInt.x0800, TInt.x0F00 }; t.lowset_table := NIL; t.highset_table := NIL; END init; --- 2543,2552 ---- END; t.rmode := ARRAY FlToInt OF Target.Int ! { Target.Int{0,0,0,..}, ! Target.Int{0,4,0,..}, ! Target.Int{0,8,0,..}, ! Target.Int{0,16_F,0,..}}; t.lowset_table := NIL; t.highset_table := NIL; END init; *************** *** 2633,2639 **** IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TZero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN --- 2639,2645 ---- IF r.last_store # NoStore THEN wr.OutT (" mvar: "); DebugMVar (r.last_store, wr); END; ! IF (NOT TInt.EQ(r.last_imm, TInt.Zero)) THEN wr.OutT (" imm: "); wr.OutT (TInt.ToText (r.last_imm)); END; IF (NOT TInt.EQ(r.lowbound, Target.Integer.min)) THEN Index: m3back/src/Wrx86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/Wrx86.m3,v retrieving revision 1.6 diff -c -r1.6 Wrx86.m3 *** m3back/src/Wrx86.m3 15 Feb 2010 17:45:22 -0000 1.6 --- m3back/src/Wrx86.m3 18 Feb 2010 02:30:51 -0000 *************** *** 153,164 **** PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; - len := TargetInt.ToChars (i, buf); BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, len)); ! OutC (t, ' '); ! OutT (t, Target.TargetIntToDiagnosticText(i)); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = --- 153,161 ---- PROCEDURE TInt (t: T; READONLY i: Target.Int) = VAR buf : ARRAY [0..BITSIZE (Target.Integer)] OF CHAR; BEGIN OutC (t, ' '); ! OutS (t, SUBARRAY (buf, 0, TargetInt.ToChars (i, buf))); END TInt; PROCEDURE BInt (t: T; i: INTEGER) = Index: m3front/src/builtinAtomic/AtomicModule.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinAtomic/AtomicModule.mg,v retrieving revision 1.2 diff -c -r1.2 AtomicModule.mg *** m3front/src/builtinAtomic/AtomicModule.mg 4 Feb 2010 02:11:30 -0000 1.2 --- m3front/src/builtinAtomic/AtomicModule.mg 18 Feb 2010 02:30:51 -0000 *************** *** 10,20 **** Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, TInt; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); --- 10,26 ---- Fence, FetchInc, FetchDec, FetchOr, FetchXor, FetchAnd); ! IMPORT Scope, Tipe, Module, Target; IMPORT Field, M3ID, Value, RecordType; IMPORT EnumType, EnumExpr, EnumElt; PROCEDURE Initialize (name: TEXT) = + CONST + Zero = Target.Int{0,0,..}; + One = Target.Int{1,0,..}; + Two = Target.Int{2,0,..}; + Three = Target.Int{3,0,..}; + Four = Target.Int{4,0,..}; VAR zz, elts: Scope.T; rep: Field.Info; cs: Value.CheckState; BEGIN M := Module.NewDefn (name, TRUE, NIL); *************** *** 40,55 **** elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), TInt.Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), TInt.One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), TInt.Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), TInt.Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), TInt.Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, TInt.Four); IsLockFree.Initialize (); Store.Initialize (); --- 46,61 ---- elts := Scope.PushNew (FALSE, M3ID.NoID); Order := EnumType.New (5, elts); ! Scope.Insert (EnumElt.New (M3ID.Add ("Relaxed"), Zero, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Release"), One, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Acquire"), Two, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("AcquireRelease"), Three, Order)); ! Scope.Insert (EnumElt.New (M3ID.Add ("Sequential"), Four, Order)); Scope.PopNew (); Scope.TypeCheck (elts, cs); Tipe.Define ("Order", Order, FALSE); ! Sequential := EnumExpr.New (Order, Four); IsLockFree.Initialize (); Store.Initialize (); Index: m3front/src/builtinInfo/InfoThisLine.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinInfo/InfoThisLine.m3,v retrieving revision 1.4 diff -c -r1.4 InfoThisLine.m3 *** m3front/src/builtinInfo/InfoThisLine.m3 18 Sep 2007 20:25:21 -0000 1.4 --- m3front/src/builtinInfo/InfoThisLine.m3 18 Feb 2010 02:30:51 -0000 *************** *** 28,34 **** BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, Target.Integer.bytes, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; --- 28,34 ---- BEGIN Scanner.Here (file, line); line := MAX (0, line); ! b := TInt.FromInt (line, val); <*ASSERT b*> RETURN IntegerExpr.New (Int.T, val); END Fold; Index: m3front/src/builtinOps/BitSize.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/BitSize.m3,v retrieving revision 1.3 diff -c -r1.3 BitSize.m3 *** m3front/src/builtinOps/BitSize.m3 18 Sep 2007 20:25:35 -0000 1.3 --- m3front/src/builtinOps/BitSize.m3 18 Feb 2010 02:30:51 -0000 *************** *** 111,121 **** IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, Target.Integer.bytes, size) ! AND TInt.FromInt (unit, Target.Integer.bytes, a) ! AND TInt.FromInt (unit - 1, Target.Integer.bytes, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; --- 111,123 ---- IF (info.class = Type.Class.OpenArray) THEN RETURN NIL END; END; t := Type.CheckInfo (t, info); ! IF TInt.FromInt (info.size, size) ! AND TInt.FromInt (unit, a) ! AND TInt.FromInt (unit - 1, b) AND TInt.Add (size, b, c) AND TInt.Div (c, a, d) + AND NOT TInt.LT (d, Target.Integer.min) + AND NOT TInt.LT (Target.Integer.max, d) THEN RETURN IntegerExpr.New (Int.T, d); ELSE RETURN NIL; END; Index: m3front/src/builtinOps/Dec.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Dec.m3,v retrieving revision 1.12 diff -c -r1.12 Dec.m3 *** m3front/src/builtinOps/Dec.m3 10 Jan 2010 10:46:35 -0000 1.12 --- m3front/src/builtinOps/Dec.m3 18 Feb 2010 02:30:51 -0000 *************** *** 71,77 **** dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); --- 71,77 ---- dec : Expr.T; check : [0..3] := 0; lvalue : CG.Val; ! tmin, tmax, bmin, bmax: Target.Int; cg_type: CG.Type; BEGIN tlhs := Type.CheckInfo (tlhs, info); *************** *** 79,100 **** THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSIF tlhs = LInt.T ! THEN dec := IntegerExpr.New (LInt.T, TInt.One); Expr.Prep (dec); ! ELSE dec := IntegerExpr.New (Int.T, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF tlhs = LInt.T THEN ! IF TInt.LT (Target.Longint.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Longint.max) THEN INC (check, 2) END; ! ELSE ! IF TInt.LT (Target.Integer.min, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, Target.Integer.max) THEN INC (check, 2) END; ! END; END; Expr.CompileLValue (lhs, traced := FALSE); --- 79,94 ---- THEN tlhs := LInt.T; cg_type := Target.Longint.cg_type; ELSE tlhs := Int.T; cg_type := Target.Integer.cg_type; END; + EVAL Type.GetBounds (tlhs, tmin, tmax); IF (NUMBER (ce.args^) > 1) THEN dec := ce.args[1]; ! ELSE dec := IntegerExpr.New (tlhs, TInt.One); Expr.Prep (dec); END; Expr.GetBounds (lhs, bmin, bmax); IF Host.doRangeChk THEN ! IF TInt.LT (tmin, bmin) THEN INC (check) END; ! IF TInt.LT (bmax, tmax) THEN INC (check, 2) END; END; Expr.CompileLValue (lhs, traced := FALSE); Index: m3front/src/builtinOps/Number.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Number.m3,v retrieving revision 1.4 diff -c -r1.4 Number.m3 *** m3front/src/builtinOps/Number.m3 18 Sep 2007 20:25:36 -0000 1.4 --- m3front/src/builtinOps/Number.m3 18 Feb 2010 02:30:51 -0000 *************** *** 64,70 **** e := ce.args[0]; t, index, element: Type.T; min, max, tmp, num: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN IF NOT TypeExpr.Split (e, t) THEN t := Expr.TypeOf (e) END; IF ArrayType.Split (t, index, element) THEN t := index END; --- 64,69 ---- *************** *** 77,83 **** IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); --- 76,83 ---- IF TInt.LT (max, min) THEN CG.Load_integer (Target.Integer.cg_type, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN CG.Load_integer (Target.Integer.cg_type, num); ELSE Error.Warn (2, "result of NUMBER too large"); *************** *** 90,96 **** PROCEDURE Fold (ce: CallExpr.T): Expr.T = VAR min, max, tmp, num: Target.Int; t, index, elem: Type.T; e: Expr.T; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN e := ce.args[0]; IF NOT TypeExpr.Split (e, t) THEN --- 90,95 ---- *************** *** 102,108 **** IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; --- 101,109 ---- IF (e = NIL) THEN RETURN NIL END; IF ArrayExpr.GetBounds (e, min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (num, Target.Integer.max) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; END; *************** *** 114,120 **** IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; --- 115,122 ---- IF TInt.LT (max, min) THEN RETURN IntegerExpr.New (Int.T, TInt.Zero); ELSIF TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, num) ! AND NOT TInt.LT (Target.Integer.max, num) THEN RETURN IntegerExpr.New (Int.T, num); ELSE RETURN NIL; Index: m3front/src/builtinWord/And.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/And.mg,v retrieving revision 1.1 diff -c -r1.1 And.mg *** m3front/src/builtinWord/And.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/And.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,17 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; IMPORT IntegerExpr, Formal, Value, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.And (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.And (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Divide.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Divide.mg,v retrieving revision 1.1 diff -c -r1.1 Divide.mg *** m3front/src/builtinWord/Divide.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Divide.mg 18 Feb 2010 02:30:51 -0000 *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Extract.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Extract.mg,v retrieving revision 1.1 diff -c -r1.1 Extract.mg *** m3front/src/builtinWord/Extract.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/Extract.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, Host, Card; IMPORT Target, TInt, TWord, Value, Formal, CheckExpr, Error; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 32,67 **** IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Integer_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Integer_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Integer_types[rep].size - i2, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Integer_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Integer_types[rep].size - i1, Target.Integer.bytes, max); ! <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) --- 32,65 ---- IF x1 AND x2 THEN (* we can use the extract_mn operator *) ! IF (i1 + i2 > Word_types[rep].size) THEN Error.Warn (2, "Word.Extract: i+n value out of range"); CG.Load_integer (Target.Integer.cg_type, TInt.One); CG.Check_hi (Target.Integer.cg_type, TInt.Zero, CG.RuntimeError.ValueOutOfRange); ELSE Expr.Compile (ce.args[0]); ! CG.Extract_mn (Word_types[rep].cg_type, FALSE, i1, i2); END; ELSIF x2 THEN (* we can use the extract_n operator *) ! b := TInt.FromInt (Word_types[rep].size - i2, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract_n (Word_types[rep].cg_type, FALSE, i2); ELSIF x1 THEN (* we need the general purpose extract operator, but can simplify the range checking code *) ! b := TInt.FromInt (Word_types[rep].size - i1, max); <*ASSERT b*> Expr.Compile (ce.args[0]); CG.Force (); CG.Load_intt (i1); CheckExpr.EmitChecks (ce.args[2], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); ELSE (* we need the general purpose extract operator *) *************** *** 72,79 **** CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); --- 70,76 ---- CG.RuntimeError.ValueOutOfRange); t2 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t1); CG.Push (t2); CG.Add (Target.Integer.cg_type); *************** *** 85,91 **** CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Integer_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; --- 82,88 ---- CG.Force (); CG.Push (t1); CG.Push (t2); ! CG.Extract (Word_types[rep].cg_type, sign := FALSE); CG.Free (t1); CG.Free (t2); END; *************** *** 95,115 **** BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) AND (0 <= i) AND (i <= Integer_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.ToInt (e1, i1)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 92,114 ---- BEGIN e := Expr.ConstValue (e); IF (e = NIL) THEN RETURN FALSE END; ! RETURN IntegerExpr.ToInt (e, i) ! AND (0 <= i) AND (i <= Word_types[rep].size); END GetBitIndex; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0: Expr.T; w0, result: Target.Int; i1, i2: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); ! IF (e0 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT GetBitIndex (ce.args[1], i1) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR i1 + i2 > Word_types[rep].size ! OR NOT TWord.Extract (w0, i1, i2, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; *************** *** 117,123 **** VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Integer_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; --- 116,122 ---- VAR min_bits, max_bits: Target.Int; i: INTEGER; BEGIN Expr.GetBounds (ce.args[2], min_bits, max_bits); ! IF TInt.ToInt (max_bits, i) AND i < Word_types[rep].size THEN IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN EVAL Type.GetBounds (T, min, max); END; Index: m3front/src/builtinWord/GE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GE.mg,v retrieving revision 1.1 diff -c -r1.1 GE.mg *** m3front/src/builtinWord/GE.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/GT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/GT.mg,v retrieving revision 1.1 diff -c -r1.1 GT.mg *** m3front/src/builtinWord/GT.mg 4 Feb 2010 20:00:45 -0000 1.1 --- m3front/src/builtinWord/GT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Insert.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Insert.mg,v retrieving revision 1.1 diff -c -r1.1 Insert.mg *** m3front/src/builtinWord/Insert.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Insert.mg 18 Feb 2010 02:30:51 -0000 *************** *** 8,18 **** IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 8,18 ---- IMPORT IntegerExpr, Type, ProcType, CheckExpr, Card; IMPORT Target, TInt, TWord, Value, Formal, Host; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 30,37 **** CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Integer_types[rep].size, Target.Integer.bytes, max); ! <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); --- 30,36 ---- CG.RuntimeError.ValueOutOfRange); t3 := CG.Pop (); IF Host.doRangeChk THEN ! b := TInt.FromInt (Word_types[rep].size, max); <*ASSERT b*> CG.Push (t2); CG.Push (t3); CG.Add (Target.Integer.cg_type); *************** *** 45,70 **** CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Integer_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1, e2, e3: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; ! t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! e2 := Expr.ConstValue (ce.args[2]); ! e3 := Expr.ConstValue (ce.args[3]); ! IF (e0 = NIL) OR (NOT IntegerExpr.Split (e0, w0, t)) OR ! (e1 = NIL) OR (NOT IntegerExpr.Split (e1, w1, t)) OR ! (e2 = NIL) OR (NOT IntegerExpr.ToInt (e2, i2)) OR ! (e3 = NIL) OR (NOT IntegerExpr.ToInt (e3, i3)) OR ! NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; RETURN IntegerExpr.New (T, result); END Fold; --- 44,77 ---- CG.Force (); CG.Push (t2); CG.Push (t3); ! CG.Insert (Word_types[rep].cg_type); CG.Free (t2); CG.Free (t3); END Compile; + PROCEDURE GetBitIndex (e: Expr.T; VAR i: INTEGER): BOOLEAN = + BEGIN + e := Expr.ConstValue (e); + IF (e = NIL) THEN RETURN FALSE END; + RETURN IntegerExpr.ToInt (e, i) + AND (0 <= i) AND (i <= Word_types[rep].size); + END GetBitIndex; + PROCEDURE Fold (ce: CallExpr.T): Expr.T = ! VAR e0, e1: Expr.T; w0, w1, result: Target.Int; i2, i3: INTEGER; t: Type.T; BEGIN e0 := Expr.ConstValue (ce.args[0]); e1 := Expr.ConstValue (ce.args[1]); ! IF (e0 = NIL) OR (e1 = NIL) ! OR NOT IntegerExpr.Split (e0, w0, t) ! OR NOT IntegerExpr.Split (e1, w1, t) ! OR NOT GetBitIndex (ce.args[2], i2) ! OR NOT GetBitIndex (ce.args[3], i3) ! OR i2 + i3 > Word_types[rep].size ! OR NOT TWord.Insert (w0, w1, i2, i3, result) THEN RETURN NIL; END; + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END Fold; Index: m3front/src/builtinWord/LE.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LE.mg,v retrieving revision 1.1 diff -c -r1.1 LE.mg *** m3front/src/builtinWord/LE.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LE.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/LT.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/LT.mg,v retrieving revision 1.1 diff -c -r1.1 LT.mg *** m3front/src/builtinWord/LT.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/LT.mg 18 Feb 2010 02:30:51 -0000 *************** *** 49,56 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 49,63 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Minus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Minus.mg,v retrieving revision 1.1 diff -c -r1.1 Minus.mg *** m3front/src/builtinWord/Minus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Minus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Minus (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Subtract (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Mod.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Mod.mg,v retrieving revision 1.1 diff -c -r1.1 Mod.mg *** m3front/src/builtinWord/Mod.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Mod.mg 18 Feb 2010 02:30:51 -0000 *************** *** 32,37 **** --- 32,38 ---- VAR w0, w1, result: Target.Int; BEGIN IF GetArgs (ce.args, w0, w1) AND TWord.Mod (w0, w1, result) THEN + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 42,49 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = --- 43,57 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE GetBounds (ce: CallExpr.T; VAR min, max: Target.Int) = *************** *** 56,61 **** --- 64,70 ---- ELSE min := TInt.Zero; TWord.Subtract (max_b, TInt.One, max); + TInt.Chop (max, Word_types[rep].bytes); END; END GetBounds; Index: m3front/src/builtinWord/Module.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Module.mg,v retrieving revision 1.1 diff -c -r1.1 Module.mg *** m3front/src/builtinWord/Module.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Module.mg 18 Feb 2010 02:30:51 -0000 *************** *** 15,22 **** PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); ! <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN --- 15,21 ---- PROCEDURE SetRep (): INTEGER = VAR min, max: Target.Int; b: BOOLEAN; BEGIN ! b := Type.GetBounds (T, min, max); <*ASSERT b*> FOR i := FIRST (Word_types) TO LAST (Word_types) DO WITH t = Word_types[i] DO IF TWord.LE (max, t.max) THEN *************** *** 30,37 **** PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, Target.Integer.bytes, size); ! <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order --- 29,35 ---- PROCEDURE Initialize (name: TEXT) = VAR zz: Scope.T; size: Target.Int; b: BOOLEAN; rep := SetRep (); BEGIN ! b := TInt.FromInt (Word_types[rep].size, size); <*ASSERT b*> M := Module.NewDefn (name, TRUE, NIL); (* WARNING: The following list must be in the same order Index: m3front/src/builtinWord/Not.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Not.mg,v retrieving revision 1.1 diff -c -r1.1 Not.mg *** m3front/src/builtinWord/Not.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Not.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; --- 5,11 ---- GENERIC MODULE Not (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; ! IMPORT IntegerExpr, Value, Formal, Type, ProcType, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; *************** *** 31,36 **** --- 31,37 ---- e := Expr.ConstValue (ce.args[0]); IF (e # NIL) AND IntegerExpr.Split (e, w, t) THEN TWord.Not (w, result); + TInt.Chop (result, Integer_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Or.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Or.mg,v retrieving revision 1.1 diff -c -r1.1 Or.mg *** m3front/src/builtinWord/Or.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Or.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Or (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Or (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Or (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Plus.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Plus.mg,v retrieving revision 1.1 diff -c -r1.1 Plus.mg *** m3front/src/builtinWord/Plus.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Plus.mg 18 Feb 2010 02:30:51 -0000 *************** *** 4,10 **** GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 4,10 ---- GENERIC MODULE Plus (Rep); ! IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord, TInt; IMPORT IntegerExpr, Value, Formal, Type, ProcType; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Add (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/builtinWord/Rotate.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Rotate.mg,v retrieving revision 1.1 diff -c -r1.1 Rotate.mg *** m3front/src/builtinWord/Rotate.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Rotate.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Formal, Type, SubrangeType; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max : Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Rotate (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Rotate_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN ! TWord.Rotate (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.Rotate (w0, -i1, Word_types[rep].bytes, result); ! TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Shift.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Shift.mg,v retrieving revision 1.1 diff -c -r1.1 Shift.mg *** m3front/src/builtinWord/Shift.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Shift.mg 18 Feb 2010 02:30:51 -0000 *************** *** 7,17 **** IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 7,18 ---- IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, SubrangeType, Formal; IMPORT Int, IntegerExpr, Value, ProcType, CheckExpr, Target, TInt, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z, ZL, ZR: CallExpr.MethodList; VAR formals, formalsL, formalsR: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; ! VAR max: Target.Int; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 35,63 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Integer_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Integer_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = - VAR max: Target.Int; - b := TInt.FromInt (Integer_types[rep].size-1, Target.Integer.bytes, max); BEGIN - <* ASSERT b *> Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Integer_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 36,58 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Shift (Word_types[rep].cg_type); END Compile; PROCEDURE CompileL (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_left (Word_types[rep].cg_type); END CompileL; PROCEDURE CompileR (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CheckExpr.EmitChecks (ce.args[1], TInt.Zero, max, CG.RuntimeError.ValueOutOfRange); ! CG.Shift_right (Word_types[rep].cg_type); END CompileR; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 68,74 **** --- 63,71 ---- IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 81,89 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 78,88 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 96,104 **** e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Integer_types[rep].size THEN TWord.Shift (w0, -i1, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; --- 95,105 ---- e1 := Expr.ConstValue (ce.args[1]); IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND (e1 # NIL) AND IntegerExpr.ToInt (e1, i1) ! AND 0 <= i1 AND i1 < Word_types[rep].size THEN + TWord.And (w0, Word_types[rep].max, w0); TWord.Shift (w0, -i1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 106,113 **** PROCEDURE Initialize (r: INTEGER) = VAR ! max : Target.Int; ! b := TInt.FromInt (Integer_types[r].size-1, Target.Integer.bytes, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); --- 107,113 ---- PROCEDURE Initialize (r: INTEGER) = VAR ! b := TInt.FromInt (Word_types[r].size-1, max); sub := SubrangeType.New (TInt.Zero, max, Int.T, FALSE); f0 := Formal.NewBuiltin ("x", 0, T); Index: m3front/src/builtinWord/Times.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Times.mg,v retrieving revision 1.1 diff -c -r1.1 Times.mg *** m3front/src/builtinWord/Times.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Times.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,11 **** GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; --- 5,11 ---- GENERIC MODULE Times (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Word_types; *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Multiply (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; *************** *** 41,48 **** BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! RETURN (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) AND ! (e1 # NIL) AND IntegerExpr.Split (e1, w1, t); END GetArgs; PROCEDURE Initialize (r: INTEGER) = --- 42,56 ---- BEGIN e0 := Expr.ConstValue (args[0]); e1 := Expr.ConstValue (args[1]); ! IF (e0 # NIL) AND IntegerExpr.Split (e0, w0, t) ! AND (e1 # NIL) AND IntegerExpr.Split (e1, w1, t) ! THEN ! TWord.And (w0, Word_types[rep].max, w0); ! TWord.And (w1, Word_types[rep].max, w1); ! RETURN TRUE; ! ELSE ! RETURN FALSE; ! END; END GetArgs; PROCEDURE Initialize (r: INTEGER) = Index: m3front/src/builtinWord/Xor.mg =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinWord/Xor.mg,v retrieving revision 1.1 diff -c -r1.1 Xor.mg *** m3front/src/builtinWord/Xor.mg 4 Feb 2010 20:00:46 -0000 1.1 --- m3front/src/builtinWord/Xor.mg 18 Feb 2010 02:30:51 -0000 *************** *** 5,17 **** GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN --- 5,17 ---- GENERIC MODULE Xor (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Type, ProcType; ! IMPORT IntegerExpr, Value, Formal, Target, TWord, TInt; FROM Rep IMPORT T; ! FROM TargetMap IMPORT Word_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; ! VAR rep: [FIRST (Word_types) .. LAST (Word_types)]; PROCEDURE Check (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN *************** *** 23,29 **** BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Integer_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = --- 23,29 ---- BEGIN Expr.Compile (ce.args[0]); Expr.Compile (ce.args[1]); ! CG.Xor (Word_types[rep].cg_type); END Compile; PROCEDURE Fold (ce: CallExpr.T): Expr.T = *************** *** 31,36 **** --- 31,37 ---- BEGIN IF GetArgs (ce.args, w0, w1) THEN TWord.Xor (w0, w1, result); + TInt.Chop (result, Word_types[rep].bytes); RETURN IntegerExpr.New (T, result); END; RETURN NIL; Index: m3front/src/exprs/AddExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddExpr.m3,v retrieving revision 1.4 diff -c -r1.4 AddExpr.m3 *** m3front/src/exprs/AddExpr.m3 10 Jan 2010 05:12:05 -0000 1.4 --- m3front/src/exprs/AddExpr.m3 18 Feb 2010 02:30:51 -0000 *************** *** 172,178 **** EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) AND TInt.Add (max_a, max_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 172,181 ---- EVAL Type.GetBounds (p.type, min, max); Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); ! IF TInt.Add (min_a, min_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Add (max_a, max_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/exprs/AddressExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddressExpr.m3,v retrieving revision 1.8 diff -c -r1.8 AddressExpr.m3 *** m3front/src/exprs/AddressExpr.m3 8 Feb 2010 12:03:30 -0000 1.8 --- m3front/src/exprs/AddressExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 39,45 **** PROCEDURE New (READONLY value: Target.Int): Expr.T = VAR p: P; BEGIN - IF TWord.LT (Target.Address.max, value) THEN RETURN NIL END; p := NEW (P); ExprRep.Init (p); p.value := value; --- 39,44 ---- *************** *** 66,72 **** IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => TWord.Add (p.value, i, j); c := New (j); RETURN c # NIL; ELSE RETURN FALSE; END; END Add; --- 65,75 ---- IF NOT IntegerExpr.Split (b, i, t) THEN RETURN FALSE END; TYPECASE a OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Add (p.value, i, j); ! TInt.Chop (j, Target.Address.bytes); ! c := New (j); ! RETURN TRUE; ELSE RETURN FALSE; END; END Add; *************** *** 82,102 **** IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => TWord.Subtract (i, p.value, k); c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN c # NIL; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN --- 85,111 ---- IF IntegerExpr.Split (b, j, t) THEN TWord.Subtract (i, j, k); + TInt.Chop (k, Target.Address.bytes); c := New (k); ELSE (* address - address *) TYPECASE b OF | NULL => RETURN FALSE; ! | P(p) => ! TWord.Subtract (i, p.value, k); ! TInt.Chop (k, Target.Address.bytes); ! c := IntegerExpr.New (t, k); ELSE RETURN FALSE; END; END; ! RETURN TRUE; END Subtract; PROCEDURE Compare (a, b: Expr.T; VAR sign: INTEGER): BOOLEAN = VAR x, y: Target.Int; BEGIN IF NOT SplitPair (a, b, x, y) THEN RETURN FALSE END; + TWord.And (x, Target.Address.max, x); + TWord.And (y, Target.Address.max, y); IF TWord.LT (x, y) THEN sign := -1 ELSIF TWord.LT (y, x) THEN Index: m3front/src/exprs/ArrayExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ArrayExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ArrayExpr.m3 *** m3front/src/exprs/ArrayExpr.m3 18 Sep 2007 20:25:54 -0000 1.6 --- m3front/src/exprs/ArrayExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 103,117 **** END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); --- 103,116 ---- END; IF p.index = NIL THEN min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <* ASSERT b *> ELSE EVAL Type.GetBounds (p.index, min, max); END; (* correct for the base index of the array *) IF NOT TInt.Subtract (int, min, offs) THEN RETURN FALSE END; ! IF TInt.LT (offs, TInt.Zero) THEN RETURN FALSE END; b := TInt.ToInt (offs, i); <* ASSERT b *> n := LAST (p.args^); *************** *** 125,140 **** BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), Target.Integer.bytes, max); ! <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE RETURN FALSE; END; END GetBounds; --- 124,140 ---- BEGIN TYPECASE array OF | NULL => RETURN FALSE; ! | P(p) => ! IF p.index = NIL THEN ! (* open array type *) ! min := TInt.Zero (* FIRST (p.args^) *); ! b := TInt.FromInt (LAST (p.args^), max); <*ASSERT b*> ! RETURN TRUE; ! ELSE ! RETURN Type.GetBounds (p.index, min, max); ! END; ! ELSE ! RETURN FALSE; END; END GetBounds; *************** *** 214,220 **** END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), Target.Integer.bytes, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); --- 214,222 ---- END; IF (solidElt # NIL) ! AND TInt.FromInt (LAST (p.args^), nn) ! AND NOT TInt.LT (nn, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, nn) THEN p.kind := Kind.FixedOpen; index := SubrangeType.New (TInt.Zero, nn, Int.T, FALSE); p.solidType := ArrayType.New (index, solidElt); *************** *** 335,341 **** EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, Target.Integer.bytes, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. --- 337,343 ---- EVAL Type.CheckInfo (p.tipe, info); align := info.alignment; b := TInt.ToInt (nn_elts, n_elts); <*ASSERT b*> ! b := TInt.FromInt (n_args, nn_args); <*ASSERT b*> (* If this is a direct structure assignment, the LHS has already * been prepped and compiled -- save it. Index: m3front/src/exprs/Expr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/Expr.m3,v retrieving revision 1.8 diff -c -r1.8 Expr.m3 *** m3front/src/exprs/Expr.m3 25 Sep 2009 02:42:12 -0000 1.8 --- m3front/src/exprs/Expr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 98,104 **** GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; --- 98,104 ---- GetBounds (t, min, max); IF TInt.LE (TInt.Zero, min) THEN RETURN CG.Sign.Positive; ELSIF TInt.LE (max, TInt.Zero) THEN RETURN CG.Sign.Negative; ! ELSE RETURN CG.Sign.Unknown; END; END GetSign; Index: m3front/src/exprs/IntegerExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/IntegerExpr.m3,v retrieving revision 1.9 diff -c -r1.9 IntegerExpr.m3 *** m3front/src/exprs/IntegerExpr.m3 8 Feb 2010 13:02:20 -0000 1.9 --- m3front/src/exprs/IntegerExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 38,58 **** VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; v: Target.Int; t := type = LInt.T; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF type = Int.T THEN ! IF NOT TInt.IntI (value, Target.Integer.bytes, v) THEN RETURN NIL END; ! ELSIF type = LInt.T THEN ! IF NOT TInt.IntI (value, Target.Longint.bytes, v) THEN RETURN NIL END; ! ELSE RETURN NIL END; p := NEW (P); ExprRep.Init (p); ! p.value := v; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) --- 38,59 ---- VAR cache := ARRAY BOOLEAN, [-7 .. 64] OF P {ARRAY [-7 .. 64] OF P{NIL, ..},..}; PROCEDURE New (type: Type.T; READONLY value: Target.Int): Expr.T = ! VAR p: P; n: INTEGER; t := Type.IsSubtype (type, LInt.T); ! min, max: Target.Int; BEGIN IF TInt.ToInt (value, n) AND (FIRST (cache[t]) <= n) AND (n <= LAST (cache[t])) THEN p := cache[t][n]; IF (p # NIL) THEN RETURN p; END; END; ! IF NOT Type.GetBounds (type, min, max) ! OR TInt.LT (value, min) ! OR TInt.LT (max, value) THEN ! <*ASSERT FALSE*> ! END; p := NEW (P); ExprRep.Init (p); ! p.value := value; p.type := type; p.checked := TRUE; IF TInt.ToInt (value, n) *************** *** 94,127 **** END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 95,134 ---- END Compare; PROCEDURE Add (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Add (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Add; PROCEDURE Subtract (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Subtract (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Subtract; PROCEDURE Multiply (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF NOT TInt.Multiply (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Multiply; PROCEDURE Div (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 129,140 **** RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN --- 136,149 ---- RETURN FALSE; END; IF NOT TInt.Div (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Div; PROCEDURE Mod (a, b: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, y, min, max, res: Target.Int; t: Type.T; BEGIN IF NOT SplitPair (a, b, x, y, t) THEN RETURN FALSE END; IF TInt.EQ (y, TInt.Zero) THEN *************** *** 142,190 **** RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN c # NIL; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; ! END; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR res: Target.Int; BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF TInt.LE (TInt.Zero, p.value) THEN ! c := a; RETURN TRUE; ! END; ! IF NOT TInt.Subtract (TInt.Zero, p.value, res) THEN ! RETURN FALSE; ! END; ! c := New (p.type, res); RETURN c # NIL; ! ELSE RETURN FALSE; END; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = BEGIN ! TYPECASE a OF ! | NULL => RETURN FALSE; ! | P(p) => IF NOT TInt.ToInt (p.value, i) THEN ! RETURN FALSE; ! END; ! RETURN TRUE; ! ELSE RETURN FALSE; ! END; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): --- 151,194 ---- RETURN FALSE; END; IF NOT TInt.Mod (x, y, res) THEN RETURN FALSE END; + IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; + IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := New (t, res); ! RETURN TRUE; END Mod; PROCEDURE Negate (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! RETURN TRUE; END Negate; PROCEDURE Abs (a: Expr.T; VAR c: Expr.T): BOOLEAN = ! VAR x, min, max, res: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF TInt.LT (x, TInt.Zero) THEN ! IF NOT TInt.Subtract (TInt.Zero, x, res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; ! c := New (t, res); ! ELSE ! c := a; END; + RETURN TRUE; END Abs; PROCEDURE ToInt (a: Expr.T; VAR i: INTEGER): BOOLEAN = + VAR x: Target.Int; t: Type.T; BEGIN ! IF NOT Split (a, x, t) THEN RETURN FALSE END; ! IF NOT TInt.ToInt (x, i) THEN RETURN FALSE END; ! RETURN TRUE; END ToInt; PROCEDURE SplitPair (a, b: Expr.T; VAR x, y: Target.Int; VAR t: Type.T): Index: m3front/src/exprs/ModExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ModExpr.m3,v retrieving revision 1.5 diff -c -r1.5 ModExpr.m3 *** m3front/src/exprs/ModExpr.m3 4 May 2008 11:03:46 -0000 1.5 --- m3front/src/exprs/ModExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 181,202 **** END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR min_b, max_b: Target.Int; ! OneI := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; ! OneL := Target.Int{Target.Longint.bytes, Target.IBytes{1,0,..}}; ! One := ARRAY[Class.cINT..Class.cLINT] OF Target.Int { OneI, OneL }; ! MaxI := Target.Integer.max; ! MaxL := Target.Longint.max; ! Max := ARRAY [Class.cINT..Class.cLINT] OF Target.Int { MaxI, MaxL }; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, One[p.class], max) THEN ! max := Max[p.class]; END; END; ELSE --- 181,198 ---- END Fold; PROCEDURE GetBounds (p: P; VAR min, max: Target.Int) = ! VAR tmin, tmax, min_b, max_b: Target.Int; BEGIN IF (p.class = Class.cINT) OR (p.class = Class.cLINT) THEN + EVAL Type.GetBounds (p.type, tmin, tmax); Expr.GetBounds (p.b, min_b, max_b); IF TInt.LT (min_b, TInt.Zero) OR TInt.LT (max_b, TInt.Zero) THEN ExprRep.NoBounds (p, min, max); ELSE min := TInt.Zero; ! IF NOT TInt.Subtract (max_b, TInt.One, max) ! OR TInt.LT (max, tmin) OR TInt.LT (tmax, max) THEN ! max := tmax; END; END; ELSE Index: m3front/src/exprs/ReelExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ReelExpr.m3,v retrieving revision 1.6 diff -c -r1.6 ReelExpr.m3 *** m3front/src/exprs/ReelExpr.m3 8 Feb 2010 12:03:31 -0000 1.6 --- m3front/src/exprs/ReelExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 9,15 **** MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Int, LInt, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT --- 9,15 ---- MODULE ReelExpr; IMPORT M3, CG, Expr, ExprRep, Type, Target, TInt, TFloat; ! IMPORT M3Buf, Reel, LReel, EReel, IntegerExpr; TYPE P = Expr.T OBJECT *************** *** 172,222 **** END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; res: Target.Int; n: CARDINAL; BEGIN - IF t = Int.T THEN n := Target.Integer.bytes; - ELSIF t = LInt.T THEN n := Target.Longint.bytes; - ELSE RETURN FALSE END; IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), n, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN c # NIL; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = --- 172,218 ---- END Abs; PROCEDURE Floor (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Floor (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Floor; PROCEDURE Ceiling (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Ceiling (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Ceiling; PROCEDURE Trunc (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Trunc (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Trunc; PROCEDURE Round (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = ! VAR x: Target.Float; min, max, res: Target.Int; BEGIN IF NOT Split (a, x) THEN RETURN FALSE END; ! IF NOT TInt.FromInt (TFloat.Round (x), res) THEN RETURN FALSE END; ! IF NOT Type.GetBounds (t, min, max) THEN RETURN FALSE END; ! IF TInt.LT (res, min) OR TInt.LT (max, res) THEN RETURN FALSE END; c := IntegerExpr.New (t, res); ! RETURN TRUE; END Round; PROCEDURE Float (a: Expr.T; t: Type.T; VAR c: Expr.T): BOOLEAN = Index: m3front/src/exprs/SetExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SetExpr.m3,v retrieving revision 1.6 diff -c -r1.6 SetExpr.m3 *** m3front/src/exprs/SetExpr.m3 2 Jan 2010 21:31:48 -0000 1.6 --- m3front/src/exprs/SetExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 10,16 **** IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module; TYPE Node = REF RECORD --- 10,16 ---- IMPORT M3, CG, Expr, ExprRep, Type, Error, IntegerExpr, EnumExpr; IMPORT RangeExpr, KeywordExpr, SetType, AssignStmt, CheckExpr; ! IMPORT M3ID, Target, TInt, TWord, Bool, M3Buf, Module, Text; TYPE Node = REF RECORD *************** *** 564,579 **** END; END Compile; - PROCEDURE TargetIntToDiagnosticText(name: TEXT; a: Target.Int): TEXT = - VAR t := ""; - b: INTEGER; - BEGIN - IF NOT TInt.ToInt(a, b) THEN - t := "**"; - END; - RETURN t & name & ":" & Target.TargetIntToDiagnosticText(a); - END TargetIntToDiagnosticText; - PROCEDURE CompileBig (p: P; VAR info: Type.Info): CG.Var = VAR range : Type.T; --- 564,569 ---- *************** *** 590,603 **** n : Node; b : BOOLEAN; tmp : Target.Int; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 580,594 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN b := SetType.Split (p.tipe, range); <* ASSERT b *> EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 659,666 **** PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = BEGIN ! CG.Load_integer (Target.Integer.cg_type, value); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; --- 650,659 ---- PROCEDURE EmitAssign (set: CG.Var; index: INTEGER; READONLY value: Target.Int) = + VAR tmp := value; BEGIN ! TInt.Chop (tmp, Target.Integer.bytes); ! CG.Load_integer (Target.Integer.cg_type, tmp); CG.Store_int (Target.Integer.cg_type, set, index * Grain); <* ASSERT Grain = Target.Integer.size *> END EmitAssign; *************** *** 689,694 **** --- 682,688 ---- n : Node; b : BOOLEAN; tmp : Target.Int; + buf: ARRAY [0..TInt.Size] OF CHAR; BEGIN Type.Compile (p.tipe); nWords := info.size DIV Grain; *************** *** 699,707 **** EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" ! & TargetIntToDiagnosticText("min", min_T) ! & "," & TargetIntToDiagnosticText("max", max_T) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; --- 693,701 ---- EVAL Type.GetBounds (range, min_T, max_T); IF NOT TInt.ToInt (min_T, minT) OR NOT TInt.ToInt (max_T, maxT) THEN ! Error.Msg ("set domain too large (" & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(min_T, buf))) & ".." & ! Text.FromChars (SUBARRAY(buf, 0, TInt.ToChars(max_T, buf))) & ")"); minT := FIRST (INTEGER); maxT := LAST (INTEGER); END; *************** *** 793,800 **** IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; curWord := w1; curMask := TInt.Zero; --- 787,796 ---- IF (w1 # curWord) THEN (* write the mask we've accumulated *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord*Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; curWord := w1; curMask := TInt.Zero; *************** *** 802,812 **** IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! full, is_const); END; curWord := w2; curMask := right [b2]; --- 798,811 ---- IF (w1 # w2) THEN (* write the full words [w1..w2-1] *) TWord.Or (curMask, left [b1], tmp); + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + w1 * Target.Integer.pack, Target.Integer.size, tmp, is_const); FOR i := w1 + 1 TO w2 - 1 DO + tmp := full; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + i * Target.Integer.pack, Target.Integer.size, ! tmp, is_const); END; curWord := w2; curMask := right [b2]; *************** *** 819,837 **** (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, curMask, is_const); END; END GenLiteral; PROCEDURE Init () = - VAR Zero := Target.Int{Target.Integer.bytes, Target.IBytes{0,..}}; BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (Zero, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); TWord.Shift (full, i, left [i]); END; END Init; --- 818,840 ---- (* write the last mask *) IF NOT TInt.EQ (curMask, TInt.Zero) THEN + tmp := curMask; + TInt.Chop (tmp, Target.Integer.bytes); CG.Init_int (offset + curWord * Target.Integer.pack, ! Target.Integer.size, tmp, is_const); END; END GenLiteral; PROCEDURE Init () = BEGIN Grain := MAX (Target.Integer.size, Target.Set_grain); ! TWord.Not (TInt.Zero, full); ! TWord.And (full, Target.Word.max, full); FOR i := 0 TO Grain - 1 DO TWord.Shift (full, i + 1 - Grain, right [i]); + TWord.And (right[i], Target.Word.max, right[i]); TWord.Shift (full, i, left [i]); + TWord.And (left[i], Target.Word.max, left[i]); END; END Init; Index: m3front/src/exprs/SubtractExpr.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SubtractExpr.m3,v retrieving revision 1.5 diff -c -r1.5 SubtractExpr.m3 *** m3front/src/exprs/SubtractExpr.m3 10 Jan 2010 05:12:18 -0000 1.5 --- m3front/src/exprs/SubtractExpr.m3 18 Feb 2010 02:30:52 -0000 *************** *** 62,68 **** VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN --- 62,68 ---- VAR ta: Type.T; BEGIN ta := Type.Base (Expr.TypeOf (p.a)); ! IF (p.extended) AND EnumType.Is (ta) THEN ta := Int.T; ELSIF Type.IsSubtype (ta, Addr.T) AND Type.IsSubtype (Type.Base (Expr.TypeOf (p.b)), Addr.T) THEN *************** *** 189,195 **** ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN --- 189,197 ---- ELSIF (p.extended) AND EnumExpr.Split (e1, x1, t1) AND IntegerExpr.Split (e2, x2, t1) ! AND TInt.Subtract (x1, x2, x3) ! AND NOT TInt.LT (x3, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x3) THEN e3 := IntegerExpr.New (t1, x3); ELSIF ReelExpr.Subtract (e1, e2, e3) THEN ELSIF AddressExpr.Subtract (e1, e2, e3) THEN *************** *** 205,211 **** Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND TInt.Subtract (max_a, min_b, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; --- 207,215 ---- Expr.GetBounds (p.a, min_a, max_a); Expr.GetBounds (p.b, min_b, max_b); IF TInt.Subtract (min_a, max_b, smin) ! AND NOT TInt.LT (smin, min) AND NOT TInt.LT (max, smin) ! AND TInt.Subtract (max_a, min_b, smax) ! AND NOT TInt.LT (smax, min) AND NOT TInt.LT (max, smax) THEN IF TInt.LT (min, smin) THEN min := smin END; IF TInt.LT (smax, max) THEN max := smax END; END; Index: m3front/src/misc/CG.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/CG.m3,v retrieving revision 1.35 diff -c -r1.35 CG.m3 *** m3front/src/misc/CG.m3 15 Feb 2010 05:07:07 -0000 1.35 --- m3front/src/misc/CG.m3 18 Feb 2010 02:30:53 -0000 *************** *** 940,946 **** (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := Target.Longint.size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; --- 940,946 ---- (* send out some number of bytes *) EVAL FindInitType (n_bytes, init_pc, t); size := TargetMap.CG_Size[t]; ! excess := TWord.Size - size; IF (excess = 0) THEN cg.init_int (init_pc DIV Target.Byte, init_bits, t); init_bits := TInt.Zero; *************** *** 984,1001 **** PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; v, tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; - EVAL TInt.IntI (value, Target.Longint.bytes, v); AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := Target.Longint.size - (o - init_pc) - s; END; IF (o = init_pc) --- 984,1000 ---- PROCEDURE Init_int (o: Offset; s: Size; READONLY value: Target.Int; is_const: BOOLEAN) = ! VAR bit_offset: CARDINAL; itype: Type; tmp: Target.Int; BEGIN IF (NOT in_init) THEN PushPending (NEW (IntNode, o := o, s := s, v := value), is_const); RETURN; END; AdvanceInit (o); IF Target.Little_endian THEN bit_offset := o - init_pc; ! ELSE bit_offset := TWord.Size - (o - init_pc) - s; END; IF (o = init_pc) *************** *** 1003,1010 **** AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, v, itype); ! ELSIF TWord.Insert (init_bits, v, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); --- 1002,1009 ---- AND (FindInitType (s DIV Target.Byte, init_pc, itype)) AND (TargetMap.CG_Size[itype] = s) THEN (* simple, aligned integer initialization *) ! cg.init_int (o DIV Target.Byte, value, itype); ! ELSIF TWord.Insert (init_bits, value, bit_offset, s, tmp) THEN init_bits := tmp; ELSE Err ("unable to stuff bit field value??"); *************** *** 1013,1021 **** END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; --- 1012,1023 ---- END Init_int; PROCEDURE Init_intt (o: Offset; s: Size; value: INTEGER; is_const: BOOLEAN) = ! VAR val: Target.Int; b := TInt.FromInt (value, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (value, "integer const not representable") END; Init_int (o, s, val, is_const); END Init_intt; *************** *** 1807,1815 **** END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; --- 1809,1820 ---- END Load_byte_address; PROCEDURE Load_intt (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; Load_integer (Target.Integer.cg_type, val); END Load_intt; *************** *** 2760,2768 **** END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, Target.Integer.bytes, val); BEGIN ! IF NOT b THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; --- 2765,2776 ---- END AsBytes; PROCEDURE Push_int (i: INTEGER) = ! VAR val: Target.Int; b := TInt.FromInt (i, val); BEGIN ! IF NOT b ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) ! THEN ErrI (i, "integer not representable") END; cg.load_integer (Target.Integer.cg_type, val); END Push_int; Index: m3front/src/misc/Scanner.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/Scanner.m3,v retrieving revision 1.7 diff -c -r1.7 Scanner.m3 *** m3front/src/misc/Scanner.m3 4 May 2008 11:03:47 -0000 1.7 --- m3front/src/misc/Scanner.m3 18 Feb 2010 02:30:53 -0000 *************** *** 509,515 **** IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), Target.Integer.bytes, val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN --- 509,515 ---- IF (ch = '_') THEN (* scan a based integer *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) OR NOT TInt.ToInt (val, base) OR (base < 2) OR (16 < base) THEN *************** *** 524,542 **** END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Long.bytes, val)) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, ! Target.Word.bytes, val)) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; cur.token := TK.tINTEGERCONST; cur.int := val; END; --- 524,546 ---- END; IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF (len = 0) ! OR NOT (TWord.New (SUBARRAY (buf, 0, len), base, val)) ! OR TWord.LT (Target.Long.max, val) THEN Error.Msg ("illegal based LONGINT literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Longint.bytes); cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF (len = 0) ! OR NOT TWord.New (SUBARRAY (buf, 0, len), base, val) ! OR TWord.LT (Target.Word.max, val) THEN Error.Msg ("illegal based INTEGER literal, zero used"); val := TInt.Zero; END; + TInt.Chop (val, Target.Integer.bytes); cur.token := TK.tINTEGERCONST; cur.int := val; END; *************** *** 551,558 **** (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 555,563 ---- (***** Rd.UnGetChar (input); *****) DEC (input_ptr); input_buf[input_ptr] := ORD ('.'); ! IF NOT TInt.New (SUBARRAY (buf, 0, len-1), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 617,632 **** (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Longint.bytes, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), ! Target.Integer.bytes, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; --- 622,639 ---- (* already scanned a decimal integer *) IF (ch = 'l') OR (ch = 'L') THEN GetCh (); (* eat the precision character *) ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Longint.min) ! OR TInt.LT (Target.Longint.max, val) THEN Error.Msg ("illegal LONGINT literal, zero used"); val := TInt.Zero; END; cur.token := TK.tLONGINTCONST; cur.int := val; ELSE ! IF NOT TInt.New (SUBARRAY (buf, 0, len), val) ! OR TInt.LT (val, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, val) THEN Error.Msg ("illegal INTEGER literal, zero used"); val := TInt.Zero; END; *************** *** 675,681 **** THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, Target.Integer.bytes, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; --- 682,688 ---- THEN Error.Msg ("missing closing quote on character literal"); ELSE GetCh (); END; ! IF NOT TInt.FromInt (val, cur.int) THEN Error.Msg ("illegal character literal"); END; END ScanChar; Index: m3front/src/misc/TipeDesc.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/TipeDesc.m3,v retrieving revision 1.5 diff -c -r1.5 TipeDesc.m3 *** m3front/src/misc/TipeDesc.m3 1 Apr 2008 00:02:58 -0000 1.5 --- m3front/src/misc/TipeDesc.m3 18 Feb 2010 02:30:53 -0000 *************** *** 145,155 **** PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.IBytes)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN TWord.Subtract (TInt.Zero, ii, i); END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); --- 145,158 ---- PROCEDURE AddBigX (READONLY ii: Target.Int) = CONST Sign = ARRAY BOOLEAN OF INTEGER { 16_40, 16_c0 }; ! VAR x: ARRAY [0..LAST (Target.Int)] OF [0..255]; key, n_bytes: INTEGER; i := ii; BEGIN key := Sign [TInt.LT (i, TInt.Zero)]; ! IF (key # 16_40) THEN ! TWord.Subtract (TInt.Zero, ii, i); ! TInt.Chop (i, Target.Integer.bytes); ! END; (* extract the bytes *) n_bytes := TInt.ToBytes (i, x); Index: m3front/src/stmts/CaseStmt.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/stmts/CaseStmt.m3,v retrieving revision 1.4 diff -c -r1.4 CaseStmt.m3 *** m3front/src/stmts/CaseStmt.m3 4 May 2008 11:03:48 -0000 1.4 --- m3front/src/stmts/CaseStmt.m3 18 Feb 2010 02:30:53 -0000 *************** *** 247,253 **** PROCEDURE CompleteTree (t: Tree; min, max: Target.Int): BOOLEAN = VAR x, y: Target.Int; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN WHILE (t # NIL) DO IF TInt.LT (t.max, min) OR TInt.LT (max, t.min) THEN --- 247,252 ---- *************** *** 256,273 **** IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, One, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, One, max) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, One, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, One, min) THEN RETURN TRUE; END; t := t.greater; --- 255,280 ---- IF TInt.Subtract (t.min, min, x) AND TInt.Subtract (max, t.max, y) AND TInt.LT (y, x) THEN ! IF TInt.Add (t.max, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.greater, x, max) THEN RETURN FALSE END; END; ! IF NOT TInt.Subtract (t.min, TInt.One, max) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.less; ELSE ! IF TInt.Subtract (t.min, TInt.One, x) ! AND NOT TInt.LT (x, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, x) THEN IF NOT CompleteTree (t.less, min, x) THEN RETURN FALSE END; END; ! IF NOT TInt.Add (t.max, TInt.One, min) ! OR TInt.LT (x, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, x) THEN RETURN TRUE; END; t := t.greater; *************** *** 458,464 **** next: Target.Int; oc, xc: Stmt.Outcomes; l_bodies, l_else, l_end: INTEGER; - One := Target.Int{Target.Integer.bytes, Target.IBytes{1,0,..}}; BEGIN p.tree := CollapseTree (p.tree); l_bodies := CG.Next_label (p.nCases); --- 465,470 ---- *************** *** 485,491 **** CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, One, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; --- 491,499 ---- CG.Push (x); CG.Load_integer (Target.Integer.cg_type, t.max); CG.If_compare (Target.Integer.cg_type, CG.Cmp.LE, l_bodies+t.body, CG.Maybe); ! IF NOT TInt.Add (t.max, TInt.One, next) ! OR TInt.LT (next, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, next) THEN IF (t.greater # NIL) THEN Error.Msg ("case label too large") END; next := t.max; END; Index: m3front/src/types/ArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/ArrayType.m3,v retrieving revision 1.5 diff -c -r1.5 ArrayType.m3 *** m3front/src/types/ArrayType.m3 4 May 2008 11:03:48 -0000 1.5 --- m3front/src/types/ArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 309,315 **** VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, Target.Integer.bytes, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); --- 309,315 ---- VAR n, m, res: Target.Int; x: INTEGER; BEGIN x := Type.InitCost (p.element, zeroed); ! IF NOT TInt.FromInt (x, m) THEN RETURN LAST (INTEGER); END; n := Type.Number (p.index); Index: m3front/src/types/EnumType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/EnumType.m3,v retrieving revision 1.7 diff -c -r1.7 EnumType.m3 *** m3front/src/types/EnumType.m3 4 May 2008 11:03:49 -0000 1.7 --- m3front/src/types/EnumType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 44,50 **** n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); --- 44,50 ---- n := Ident.ParseList (); j := Ident.top - n; FOR i := 0 TO n - 1 DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (Ident.stack[j + i], val, p)); END; DEC (Ident.top, n); *************** *** 70,76 **** BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, Target.Integer.bytes, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); --- 70,76 ---- BEGIN p := Create (Scope.PushNew (FALSE, M3ID.NoID)); FOR i := 0 TO LAST (elt_nms) DO ! b := TInt.FromInt (i, val); <*ASSERT b*> Scope.Insert (EnumElt.New (M3ID.Add (elt_nms[i]), val, p)); END; Scope.PopNew (); *************** *** 121,127 **** PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO --- 121,129 ---- PROCEDURE SetRep (p: P) = VAR max: Target.Int; BEGIN ! IF NOT TInt.FromInt (p.n_elts-1, max) ! OR TInt.LT (max, Target.Integer.min) ! OR TInt.LT (Target.Integer.max, max) THEN Error.Msg ("enumeration type too large"); END; FOR i := FIRST (Rep) TO LAST (Rep) DO *************** *** 158,164 **** p.info.hash := hash; END Check; - PROCEDURE CheckAlign (p: P; offset: INTEGER): BOOLEAN = VAR sz := TargetMap.Word_types [p.rep].size; --- 160,165 ---- *************** *** 172,178 **** RETURN (offset + sz) <= (z0 + Target.Integer.size); END CheckAlign; - PROCEDURE Compiler (p: P) = VAR v := Scope.ToList (p.scope); BEGIN --- 173,178 ---- *************** *** 222,230 **** VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, Target.Integer.bytes, max) THEN ! RETURN 1; ! END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; --- 222,228 ---- VAR max: Target.Int; BEGIN IF (p.n_elts <= 0) OR (zeroed) THEN RETURN 0; END; ! IF NOT TInt.FromInt (p.n_elts-1, max) THEN RETURN 1 END; IF TInt.EQ (TargetMap.Word_types[p.rep].max, max) THEN RETURN 0; ELSE RETURN 1; Index: m3front/src/types/OpenArrayType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/OpenArrayType.m3,v retrieving revision 1.4 diff -c -r1.4 OpenArrayType.m3 *** m3front/src/types/OpenArrayType.m3 18 Sep 2007 20:26:11 -0000 1.4 --- m3front/src/types/OpenArrayType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 209,217 **** PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), ! Target.Integer.bytes, m) ! AND TInt.FromInt (20, Target.Integer.bytes, n) (* guess 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; --- 209,216 ---- PROCEDURE InitCoster (p: P; zeroed: BOOLEAN): INTEGER = VAR n, m, res: Target.Int; x: INTEGER; BEGIN ! IF TInt.FromInt (Type.InitCost (p.element, zeroed), m) ! AND TInt.FromInt (20, n) (* guess that there are 20 elements *) AND TInt.Multiply (m, n, res) AND TInt.ToInt (res, x) THEN RETURN x; Index: m3front/src/types/SubrangeType.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/SubrangeType.m3,v retrieving revision 1.7 diff -c -r1.7 SubrangeType.m3 *** m3front/src/types/SubrangeType.m3 15 Jan 2010 21:50:12 -0000 1.7 --- m3front/src/types/SubrangeType.m3 18 Feb 2010 02:30:53 -0000 *************** *** 78,91 **** PROCEDURE SetRep (p: P) = BEGIN - IF Type.IsSubtype (p.baseType, LInt.T) - THEN p.rep := Target.Longint.cg_type; - ELSE p.rep := Target.Integer.cg_type; - END; - IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; RETURN; END; --- 78,90 ---- PROCEDURE SetRep (p: P) = BEGIN IF TInt.LT (p.max, p.min) THEN p.min := TInt.Zero; p.max := TInt.MOne; + IF Type.IsSubtype (p.baseType, LInt.T) + THEN p.rep := Target.Longint.cg_type; + ELSE p.rep := Target.Integer.cg_type; + END; RETURN; END; *************** *** 102,109 **** (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) ! AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; --- 101,107 ---- (* look for a signed type *) FOR i := FIRST (TargetMap.Integer_types) TO LAST (TargetMap.Integer_types) DO WITH z = TargetMap.Integer_types[i] DO ! IF TInt.LE (z.min, p.min) AND TInt.LE (p.max, z.max) THEN p.rep := z.cg_type; RETURN; END; END; *************** *** 277,283 **** END BitWidth; VAR (*CONST*) ! power : ARRAY [0..BITSIZE (Target.Int)] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = --- 275,281 ---- END BitWidth; VAR (*CONST*) ! power : ARRAY [0..TInt.Size] OF Target.Int; powers_done := FALSE; PROCEDURE BuildPowerTables () = *************** *** 306,312 **** rep_max := Target.Integer.max; END; ! IF zeroed AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; --- 304,311 ---- rep_max := Target.Integer.max; END; ! IF zeroed ! AND TInt.LE (p.min, TInt.Zero) AND TInt.LE (TInt.Zero, p.max) THEN RETURN 0; END; *************** *** 340,347 **** VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) ! OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN --- 339,345 ---- VAR info: Type.Info; BEGIN EVAL Type.CheckInfo (p, info); ! IF TInt.LT (TInt.Zero, p.min) OR TInt.LT (p.max, TInt.Zero) THEN CG.Load_integer (info.stk_type, p.min); CG.Store_indirect (info.stk_type, 0, info.size); ELSIF zeroed THEN Index: m3front/src/types/Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/Type.m3,v retrieving revision 1.8 diff -c -r1.8 Type.m3 *** m3front/src/types/Type.m3 4 May 2008 11:03:49 -0000 1.8 --- m3front/src/types/Type.m3 18 Feb 2010 02:30:53 -0000 *************** *** 392,399 **** IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, max); ! <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; --- 392,398 ---- IF (c = Class.Subrange) THEN b := SubrangeType.Split (u, min, max); <*ASSERT b*> ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), max); <*ASSERT b*> RETURN max; ELSIF (c = Class.Integer) THEN min := Target.Integer.min; *************** *** 411,417 **** END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND TInt.LE (max, Target.Integer.max) THEN RETURN max; END; Error.Msg ("type has too many elements"); --- 410,417 ---- END; IF TInt.Subtract (max, min, tmp) AND TInt.Add (tmp, TInt.One, max) ! AND NOT TInt.LT (max, Target.Integer.min) ! AND NOT TInt.LT (Target.Integer.max, max) THEN RETURN max; END; Error.Msg ("type has too many elements"); *************** *** 425,432 **** b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), Target.Integer.bytes, min); ! <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; --- 425,431 ---- b := SubrangeType.Split (u, min, max); <*ASSERT b*> RETURN TRUE; ELSIF (c = Class.Enum) THEN ! b := TInt.FromInt (EnumType.NumElts (u), min); <*ASSERT b*> b := TInt.Subtract (min, TInt.One, max); <*ASSERT b*> min := TInt.Zero; RETURN TRUE; Index: m3tools/src/M3Builtin.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Builtin.m3,v retrieving revision 1.5 diff -c -r1.5 M3Builtin.m3 *** m3tools/src/M3Builtin.m3 18 Sep 2007 20:26:30 -0000 1.5 --- m3tools/src/M3Builtin.m3 18 Feb 2010 02:30:54 -0000 *************** *** 111,117 **** val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, Target.Integer.bytes, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); --- 111,117 ---- val.type := M3Type.Integer; val.class := M3Const.Class.Integer; MustBe (info.size >= 0); ! MustBe (TInt.FromInt (info.size, val.int)); END; ELSE NotImpl ("BYTESIZE(expr)"); Index: m3tools/src/M3Const.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Const.m3,v retrieving revision 1.6 diff -c -r1.6 M3Const.m3 *** m3tools/src/M3Const.m3 16 Jan 2010 02:29:10 -0000 1.6 --- m3tools/src/M3Const.m3 18 Feb 2010 02:30:54 -0000 *************** *** 861,868 **** Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) ! AND TInt.FromInt (b.info, Target.Integer.bytes, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); --- 861,867 ---- Err ("bad operand for subscript operation"); ELSIF (b.class = Class.Integer) THEN (* ok *) ! ELSIF (b.class = Class.Enum) AND TInt.FromInt (b.info, b.int) THEN (* ok *) ELSE Err ("bad operand for subscript operation"); *************** *** 1161,1167 **** BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, Target.Integer.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalInt; --- 1160,1166 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Integer; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalInt; *************** *** 1171,1177 **** BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, Target.Longint.bytes, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; --- 1170,1176 ---- BEGIN val.class := Class.Integer; val.type := M3Type.Longint; ! IF NOT TInt.FromInt (s.info, val.int) THEN Err ("illegal integer value"); END; END EvalLInt; Index: m3tools/src/M3Lexer.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Lexer.m3,v retrieving revision 1.4 diff -c -r1.4 M3Lexer.m3 *** m3tools/src/M3Lexer.m3 18 Sep 2007 20:26:30 -0000 1.4 --- m3tools/src/M3Lexer.m3 18 Feb 2010 02:30:54 -0000 *************** *** 89,96 **** SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t, Target.Integer.bytes); ! | TK_Long_const => FixInt (t, Target.Longint.bytes); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); --- 89,96 ---- SUPER.next (t); CASE t.token OF | TK_Ident => FixID (t); ! | TK_Card_const => FixInt (t); ! | TK_Long_const => FixInt (t); | TK_Real_const => FixFloat (t, Target.Precision.Short); | TK_Longreal_const => FixFloat (t, Target.Precision.Long); | TK_Extended_const => FixFloat (t, Target.Precision.Extended); *************** *** 108,114 **** t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T; bytes: CARDINAL) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO --- 108,114 ---- t.id := M3ID.FromStr (SUBARRAY (t.buffer^, t.offset, t.length)); END FixID; ! PROCEDURE FixInt (t: T) = VAR break := -1; base: INTEGER; BEGIN FOR i := t.offset TO t.offset + t.length - 1 DO *************** *** 120,135 **** END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), bytes, t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), bytes, t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, bytes, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; --- 120,135 ---- END; IF (break < 0) THEN (* scan a simple integer *) ! IF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, t.length), t.int) THEN Err (t, "illegal integer literal"); END; ! ELSIF NOT TInt.New (SUBARRAY (t.buffer^, t.offset, break - t.offset), t.int) OR NOT TInt.ToInt (t.int, base) OR (base < 2) OR (16 < base) THEN Err (t, "illegal base for integer literal"); ELSIF NOT TWord.New (SUBARRAY (t.buffer^, break+1, t.offset + t.length - break - 1), ! base, t.int) THEN Err (t, "illegal based integer literal"); END; END FixInt; Index: m3tools/src/M3Type.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3tools/src/M3Type.m3,v retrieving revision 1.6 diff -c -r1.6 M3Type.m3 *** m3tools/src/M3Type.m3 16 Jan 2010 02:29:11 -0000 1.6 --- m3tools/src/M3Type.m3 18 Feb 2010 02:30:54 -0000 *************** *** 45,55 **** PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; - One := Target.Int{Target.Integer.bytes, TInt.One.x}; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, One, max) THEN RETURN max; END; RETURN Target.Integer.max; --- 45,54 ---- PROCEDURE Number (t: T): Target.Int = VAR min, max, tmp: Target.Int; BEGIN IF t.get_bounds (min, max) AND TInt.Subtract (max, min, tmp) ! AND TInt.Add (tmp, TInt.One, max) THEN RETURN max; END; RETURN Target.Integer.max; *************** *** 248,254 **** PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, Target.Integer.bytes, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); --- 247,253 ---- PROCEDURE GetEnumInfo (self: Enum; VAR x: Info) RAISES {Error} = VAR n_elts := NUMBER (self.elements^); max: Target.Int; rep: EnumRep; BEGIN ! IF NOT TInt.FromInt (n_elts-1, max) THEN Err ("enumeration type too large"); END; rep := FindEnumRep (max); *************** *** 289,296 **** VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, Target.Integer.size, max); ! <*ASSERT b*> RETURN TRUE; END EnumBounds; --- 288,294 ---- VAR b: BOOLEAN; BEGIN min := TInt.Zero; ! b := TInt.FromInt (NUMBER (self.elements^) - 1, max); <*ASSERT b*> RETURN TRUE; END EnumBounds; From hosking at elego.de Thu Feb 18 04:01:14 2010 From: hosking at elego.de (Antony Hosking) Date: Thu, 18 Feb 2010 4:01:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218030114.E3D712474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/18 04:01:14 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: Avoid warning for 64-bit INTEGER. From jkrell at elego.de Thu Feb 18 08:30:35 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 8:30:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218073035.2628C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 08:30:35 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: more information when this assertion fails, as it now does: == package C:\dev2\cm3.2\m3-libs\m3core == +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 new source -> compiling RTHooks.i3 "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 *** *** runtime error: *** <*ASSERT*> failed. *** file "..\src\M3x86.m3", line 1114 *** Stack trace: FP PC Procedure --------- --------- ------------------------------- 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 confusion here about signed vs. unsigned integers; the signed number 158 requires 2 bytes but the unsigned number 158 only requirs 1 byte From jay.krell at cornell.edu Thu Feb 18 09:09:30 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100218073035.2628C2474001@birch.elegosoft.com> References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 09:54:16 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 9:54:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218085416.592572474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 09:54:16 Added files: cm3/m3-sys/m3back/src/: TWordOld.i3 TWordOld.m3 TIntOld.i3 TIntOld.m3 Log message: initial copies of previous versions, we'll have to adapt to put them into place, and then gradually maybe turn them into the new versions, keeping things working as we go; I'm not too keen on debugging things otherwise right now From jkrell at elego.de Thu Feb 18 10:07:09 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 10:07:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218090709.D28FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 10:07:09 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsWord => TypeIsUnsignedInt IsInt => TypeIsSignedInt Is64 => TypeIs64 From jay.krell at cornell.edu Thu Feb 18 11:05:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 10:05:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: Another problem now is that 64bit rotate of constants doesn't get the type size correct. Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? - Jay From: jay.krell at cornell.edu To: jkrell at elego.de; m3commit at elegosoft.com Date: Thu, 18 Feb 2010 08:09:30 +0000 Subject: Re: [M3commit] CVS Update: cm3 Tony there are multiple related problems here. 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. e.g. in InitTypecell. And maybe similar for 16/32/64, I don't know. 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. I'll see what I can do. I'll probably add TWord.ToBytes and if the value fits using it, accept it. - Jay > Date: Thu, 18 Feb 2010 08:30:35 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/18 08:30:35 > > Modified files: > cm3/m3-sys/m3back/src/: M3x86.m3 > > Log message: > more information when this assertion fails, as it now does: > > == package C:\dev2\cm3.2\m3-libs\m3core == > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > new source -> compiling RTHooks.i3 > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > *** > *** runtime error: > *** <*ASSERT*> failed. > *** file "..\src\M3x86.m3", line 1114 > *** > > Stack trace: > FP PC Procedure > --------- --------- ------------------------------- > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > confusion here about signed vs. unsigned integers; > the signed number 158 requires 2 bytes but the unsigned number 158 > only requirs 1 byte > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Thu Feb 18 12:31:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:31:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113110.D1F722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:31:10 Added files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Removed files: cm3/m3-sys/m3back/src/: TIntOld.m3 TIntOld.i3 TWordOld.i3 TWordOld.m3 Log message: rename these files; they derive directly from m3middle/TInt, TWord From jkrell at elego.de Thu Feb 18 12:38:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:38:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218113822.D8B4B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:38:22 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Wrx86.m3 Log message: go back a few versions: cvs -z3 upd -r 1.126 M3x86.m3 cvs -z3 upd -r 1.93 Stackx86.m3 cvs -z3 upd -r 1.79 Codex86.m3 cvs -z3 upd -r 1.28 M3x86Rep.i3 cvs -z3 upd -r 1.6 Wrx86.m3 This does not build, but the previous didn't work anyway. The history will be easier to see here when I commit something that builds and works (I already have it). From jkrell at elego.de Thu Feb 18 12:41:37 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 12:41:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218114137.81CF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 12:41:37 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: rename the interface/end from TInt/TWord to M3BackInt/M3BackWord (yes, I realize it sounds like 'backward') From jkrell at elego.de Thu Feb 18 14:05:00 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:05:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130500.4C0A52474001@birch.elegosoft.com> 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") From jkrell at elego.de Thu Feb 18 14:08:24 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:08:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218130824.62F942474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:08:24 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: assert earlier From jkrell at elego.de Thu Feb 18 14:12:34 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:12:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131234.32E2D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:12:34 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix dumb out of order initialization, should fix the problem building showheap From jkrell at elego.de Thu Feb 18 14:13:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 14:13:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218131314.E78672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 14:13:14 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: remove procuedures New and IntI that we don't use From jkrell at elego.de Thu Feb 18 15:09:56 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:09:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218140956.2E5F62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:09:56 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Log message: fix converting Target.Int to M3Back.Int, test p227 much better now but still a problem with 1 MODUL 1 (wierd considering that 1 MODL 1 works); all this was working but still recovering from TInt changes From jkrell at elego.de Thu Feb 18 15:20:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 18 Feb 2010 15:20:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100218142048.257322474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/18 15:20:48 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: fix typo in test case, duh From hosking at cs.purdue.edu Thu Feb 18 18:07:57 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:07:57 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, Message-ID: I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). On 18 Feb 2010, at 05:05, Jay K wrote: > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > - Jay > > > From: jay.krell at cornell.edu > To: jkrell at elego.de; m3commit at elegosoft.com > Date: Thu, 18 Feb 2010 08:09:30 +0000 > Subject: Re: [M3commit] CVS Update: cm3 > > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > From hosking at cs.purdue.edu Thu Feb 18 18:02:18 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 12:02:18 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com> Message-ID: It probably makes sense for me to repair this in the front-end. Let me look into it. On 18 Feb 2010, at 03:09, Jay K wrote: > Tony there are multiple related problems here. > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > e.g. in InitTypecell. > And maybe similar for 16/32/64, I don't know. > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > I'll see what I can do. > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > - Jay > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > To: m3commit at elegosoft.com > > From: jkrell at elego.de > > Subject: [M3commit] CVS Update: cm3 > > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > Modified files: > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > Log message: > > more information when this assertion fails, as it now does: > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > new source -> compiling RTHooks.i3 > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > *** > > *** runtime error: > > *** <*ASSERT*> failed. > > *** file "..\src\M3x86.m3", line 1114 > > *** > > > > Stack trace: > > FP PC Procedure > > --------- --------- ------------------------------- > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > confusion here about signed vs. unsigned integers; > > the signed number 158 requires 2 bytes but the unsigned number 158 > > only requirs 1 byte > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Thu Feb 18 22:08:58 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 18 Feb 2010 21:08:58 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: You had changed TWord.Rotate() uses to assume Target.Integer.bytes. x: M3x86Rep.Operand; TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) What probably would have worked is more like: TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. Precision affects the intermediate results. That's the only possible problem that stood out to me on a quick read. Whatever it all was though, the compiler no longer worked, basically not at all, even if I removed the assertions about integers fitting in their claimed types. I wasn't too keen on debugging that right now but I should before much longer. I'd rather not keep a separate copy of TInt/TWord.. - Jay > From: hosking at cs.purdue.edu > Date: Thu, 18 Feb 2010 12:07:57 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > - Jay > > > > > > From: jay.krell at cornell.edu > > To: jkrell at elego.de; m3commit at elegosoft.com > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > Subject: Re: [M3commit] CVS Update: cm3 > > > > Tony there are multiple related problems here. > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > e.g. in InitTypecell. > > And maybe similar for 16/32/64, I don't know. > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > I'll see what I can do. > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > - Jay > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > To: m3commit at elegosoft.com > > > From: jkrell at elego.de > > > Subject: [M3commit] CVS Update: cm3 > > > > > > CVSROOT: /usr/cvs > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > Modified files: > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > Log message: > > > more information when this assertion fails, as it now does: > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > new source -> compiling RTHooks.i3 > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > *** > > > *** runtime error: > > > *** <*ASSERT*> failed. > > > *** file "..\src\M3x86.m3", line 1114 > > > *** > > > > > > Stack trace: > > > FP PC Procedure > > > --------- --------- ------------------------------- > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > confusion here about signed vs. unsigned integers; > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > only requirs 1 byte > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 18 23:11:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 18 Feb 2010 17:11:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100218073035.2628C2474001@birch.elegosoft.com>, , , , Message-ID: <357F3AF3-577B-4346-875F-613135F023E7@cs.purdue.edu> Rotate now has an extra parameter to indicate the bytes rotated. You do need to use TInt.Chop to treat the result as having the correct size. (See how folding is done in m3front/src/builtinWord operations.) Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 18 Feb 2010, at 16:08, Jay K wrote: > You had changed TWord.Rotate() uses to assume Target.Integer.bytes. > x: M3x86Rep.Operand; > TWord.Rotate(x.imm, m, n) => TWord.Roate(x.imm, Target.Integer.bytes, m, n) > What probably would have worked is more like: > TWord.Rotate(x.imm, m, n) => TWord.Rotate(x.imm, TypeSize(x.optype) * 4, m, n) > > > Most uses of TWord/TInt are ok with the new always 8 byte precision, but Rotate is special. > Precision affects the intermediate results. > > > That's the only possible problem that stood out to me on a quick read. > Whatever it all was though, the compiler no longer worked, basically not at all, > even if I removed the assertions about integers fitting in their claimed types. > I wasn't too keen on debugging that right now but I should before much longer. > I'd rather not keep a separate copy of TInt/TWord.. > > > - Jay > > > > From: hosking at cs.purdue.edu > > Date: Thu, 18 Feb 2010 12:07:57 -0500 > > To: jay.krell at cornell.edu > > CC: m3commit at elegosoft.com > > Subject: Re: [M3commit] CVS Update: cm3 > > > > I'm not sure what you mean about the type size... Please elaborate. Do you have a test case? > > Yes, my intention here is that *no* client should presume anything about the actual precision of TInt/TWord. Indeed, we could make it larger, and should be able to without affecting clients. The only thing clients must do when manipulating Target.Int with TWord is to realise that the results are still interpreted in the TInt.Size space. To get a smaller interpretation they must explicitly use TInt.Chop to cut down to the desired number of bytes (and so sign-extend from that smaller size out to the TInt.Size). You will need to use Chop in places where you insert/extract/rotate/Xor (i.e., the sign needs extending in the result). > > > > On 18 Feb 2010, at 05:05, Jay K wrote: > > > > > Another problem now is that 64bit rotate of constants doesn't get the type size correct. > > > Anyway I'm trying to get things back to working by bringing in the old code, only in m3back, and then can find the actual problems.. > > > I agree it is simpler now that TInt/TWord have a fixed precision of exactly 64 bits. Maybe make it even larger, say 72 bytes, a) to fix that warning a different way b) to sort of get better testing? > > > > > > - Jay > > > > > > > > > From: jay.krell at cornell.edu > > > To: jkrell at elego.de; m3commit at elegosoft.com > > > Date: Thu, 18 Feb 2010 08:09:30 +0000 > > > Subject: Re: [M3commit] CVS Update: cm3 > > > > > > Tony there are multiple related problems here. > > > > > > 1) The front end likes to output values between 128 and 256 with type Int8 instead of Word8. > > > e.g. in InitTypecell. > > > And maybe similar for 16/32/64, I don't know. > > > > > > 2) Even if the front end used the correct Word8 for them, m3back needs to use TWord.ToBytes vs. TInt.ToBytes for unsigned types, but TWord.ToBytes doesn't exist. > > > > > > I'll see what I can do. > > > I'll probably add TWord.ToBytes and if the value fits using it, accept it. > > > > > > - Jay > > > > > > > Date: Thu, 18 Feb 2010 08:30:35 +0000 > > > > To: m3commit at elegosoft.com > > > > From: jkrell at elego.de > > > > Subject: [M3commit] CVS Update: cm3 > > > > > > > > CVSROOT: /usr/cvs > > > > Changes by: jkrell at birch. 10/02/18 08:30:35 > > > > > > > > Modified files: > > > > cm3/m3-sys/m3back/src/: M3x86.m3 > > > > > > > > Log message: > > > > more information when this assertion fails, as it now does: > > > > > > > > == package C:\dev2\cm3.2\m3-libs\m3core == > > > > > > > > +++ C:\cm3\bin\cm3.exe -build -DROOT=C:/dev2/cm3.2 -DCM3_VERSION_TEXT=d5.8.2 > > > > > > > > new source -> compiling RTHooks.i3 > > > > "..\src\runtime\common\RTHooks.i3", line 15: len:2 t:Int.8 CG_Bytes[t]:1 158 > > > > > > > > *** > > > > *** runtime error: > > > > *** <*ASSERT*> failed. > > > > *** file "..\src\M3x86.m3", line 1114 > > > > *** > > > > > > > > Stack trace: > > > > FP PC Procedure > > > > --------- --------- ------------------------------- > > > > 0x12f5cc 0x43c230 init_int + 0x488 in ..\src\M3x86.m3 > > > > 0x12f5f8 0x63f506 init_int + 0xa5 in ..\src\M3CG_Check.m3 > > > > 0x12f638 0x4fe1ce Init_int + 0x1be in ..\src\misc\CG.m3 > > > > 0x12f65c 0x4fe33e DumpInt + 0x34 in ..\src\misc\CG.m3 > > > > 0x12f6a4 0x4fc86a DumpPendingNodes + 0x2c2 in ..\src\misc\CG.m3 > > > > 0x12f6cc 0x4fa4c6 Bind_segment + 0xe0 in ..\src\misc\CG.m3 > > > > 0x12f72c 0x4c71e8 GenLinkerInfo + 0x7d7 in ..\src\values\Module.m3 > > > > 0x12f770 0x4c577c CompileInterface + 0x30a in ..\src\values\Module.m3 > > > > 0x12f7a8 0x4c5252 Compile + 0x24d in ..\src\values\Module.m3 > > > > 0x12f804 0x4aff65 DoCompile + 0x7cd in ..\src\misc\M3Front.m3 > > > > > > > > confusion here about signed vs. unsigned integers; > > > > the signed number 158 requires 2 bytes but the unsigned number 158 > > > > only requirs 1 byte > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 12:28:32 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 12:28:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219112832.B05CD2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 12:28:32 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: Expand test coverage to more sizes of sets. Something is really odd here. A set of >32 elements is being correctly handled as a set of two integers, for purposes of comparison, but I don't see where the code to do that is. A set of one integer, I see that. The code is correct, but I don't know where it is coming from. From jay.krell at cornell.edu Fri Feb 19 13:17:17 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 19 Feb 2010 12:17:17 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100219112832.B05CD2474001@birch.elegosoft.com> References: <20100219112832.B05CD2474001@birch.elegosoft.com> Message-ID: > Something is really odd here. Finally found it. There is a general notion of "solid" types. For which equality comparison can be an inlined word by word comparison. See EqualExpr.m3 / Max_unroll. - Jay > Date: Fri, 19 Feb 2010 12:28:32 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/19 12:28:32 > > Modified files: > cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 > > Log message: > Expand test coverage to more sizes of sets. > Something is really odd here. > A set of >32 elements is being correctly handled > as a set of two integers, for purposes of comparison, > but I don't see where the code to do that is. > A set of one integer, I see that. > The code is correct, but I don't know where it is coming from. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 19 14:13:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:13:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219131345.F3D372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:13:45 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Log message: current output From jkrell at elego.de Fri Feb 19 14:28:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:28:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132855.959C72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:28:55 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: replace set_ne (not equal) and seq_eq (equal) with !memcmp or !!memcmp From jkrell at elego.de Fri Feb 19 14:29:55 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 19 Feb 2010 14:29:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100219132955.B63AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/19 14:29:55 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: eliminate set_eq and set_ne From jkrell at elego.de Sun Feb 21 10:52:50 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 10:52:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221095250.D74B82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 10:52:50 Modified files: cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c Log message: UNUSED_INTEGER is a long not an int From jkrell at elego.de Sun Feb 21 12:25:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 12:25:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221112506.112E32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 12:25:06 Modified files: cm3/m3-sys/m3back/src/: Wrx86.m3 Log message: restore losting cleanup: THEN goes at end of line and go beyond that: factor common code into a function (original authors seemed very keen on manual inlining, which is kind of nice, but leads to a lot of duplicate code; we should strongly consider adding inlining in m3back) simple guard against a form of overflow that I have trouble believing is possible, but the guard is super cheap From jkrell at elego.de Sun Feb 21 14:56:24 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 21 Feb 2010 14:56:24 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100221135624.71EEF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/21 14:56:24 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.m3 M3BackInt.i3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 02:42:04 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 2:42:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222014204.55A562474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 02:42:04 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I somehow missed this file as part of: remove the various renaming, IMPORT FOO AS BAR, diff minimization tricks that I put in to substitute M3BackInt for TInt Still using M3BackInt here, spend a bit of time trying to use TInt but so far fails badly From jkrell at elego.de Mon Feb 22 03:25:22 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 3:25:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222022522.BFCD32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 03:25:22 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: gut M3BackWord such that TWord does most of the work; each function is basically zero extend, call TWord, Chop; Insert/Extract have more stringent size limit; still more to do in M3BackInt From jkrell at elego.de Mon Feb 22 09:59:38 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 9:59:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222085938.C29A22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 09:59:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 Log message: temporary version that does all the world old way and new way and asserts they match, including making copies because aliasing does exist (in this very file, look at the uses of subtract in divide) From jkrell at elego.de Mon Feb 22 10:00:43 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 10:00:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222090043.937532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 10:00:43 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: comment, formating (don't bury major semantics in VAR) From jkrell at elego.de Mon Feb 22 11:25:55 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:25:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102555.EA0EC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:25:55 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version, something is wrong and I should do the version where everything is done both ways and checked From jkrell at elego.de Mon Feb 22 11:27:17 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102717.5A3482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:17 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: remove another IMPORT Foo AS Bar renaming From jkrell at elego.de Mon Feb 22 11:27:59 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 11:27:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222102759.71ECF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 11:27:59 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: remove unused procedure New From jkrell at elego.de Mon Feb 22 13:43:52 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 13:43:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222124352.AD5252474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 13:43:52 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackWord.m3 Log message: temporary version that does everything old and new and asserts they match; beware of aliasing, when you do things twice, the inputs tend to get clobbered From jkrell at elego.de Mon Feb 22 14:01:25 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:01:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222130125.BC64D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:01:25 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: go back to only doing things once this time with a different Chop function though, not sure that matters From jkrell at elego.de Mon Feb 22 14:24:50 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:24:50 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222132450.D4FCF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:24:50 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "ToTargetInt" => "ZeroExtend" remove unused: LShift, RShift, Word, IByte, IBytes From jkrell at elego.de Mon Feb 22 14:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135721.A49DC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackWord.m3 Log message: "Chop" => "UnsignedTruncate" From jkrell at elego.de Mon Feb 22 14:57:51 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 14:57:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222135751.996A82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 14:57:51 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove most of the code -- delegating to TInt Add Subtract Multiply Div Mod (DivMod) -- which I understood least well EQ LT the following significant functions remain and might merit further attention: SignExtend ZeroExtend SignedTruncate UnsignedTruncate ToBytes ToBytes I haven't looked into much. It could be that TInt.ToBytes can work. But possible problems already reported. TInt.Chop might be useful, but I'm sure we are missing some functionality in terms of signed vs. unsigned. Two functions are needed for widening and two for narrowing. As well, ToChars should have signed and unsigned variations, though we only use it for debug code and we aren't sensitive to incorrect printing of large positive numbers. Something is also still fishy with ToInt and/or FromInt. Whenever I convert them, I hit problems (assertion failures in RTCollector/RTAllocator) I haven't tried the double work + assert approach to them. They look so simple.. From jkrell at elego.de Mon Feb 22 22:16:35 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:16:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222211635.665C92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:16:35 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: temporary version that does double work + assert in ToInt and FromInt From jkrell at elego.de Mon Feb 22 22:21:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:21:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212102.750822474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:21:02 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Wrx86.m3 Log message: TargetIntToDiagnosticText => ToDiagnosticText TIntToDiagnosticText => TargetIntToDiagnosticText From jkrell at elego.de Mon Feb 22 22:23:10 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:23:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222212310.DC54C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:23:10 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: use FIRST and LAST instead of 0 and 7 From jkrell at elego.de Mon Feb 22 22:34:02 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 22:34:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222213402.9534E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 22:34:02 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: fix typo From jkrell at elego.de Mon Feb 22 23:54:32 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:54:32 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225432.E87372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:54:32 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: in TInt.ToInt, pack the bytes even if there is overflow; caller can pay attention to the overflow or not From jkrell at elego.de Mon Feb 22 23:57:21 2010 From: jkrell at elego.de (Jay Krell) Date: Mon, 22 Feb 2010 23:57:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100222225722.056AE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:01:02 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:01:02 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100222225722.056AE2474001@birch.elegosoft.com> References: <20100222225722.056AE2474001@birch.elegosoft.com> Message-ID: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) From hosking at cs.purdue.edu Tue Feb 23 02:03:03 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 20:03:03 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com> <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu> Message-ID: P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 02:30:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 01:30:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: I'm still a bit leary of Chop and ToBytes. I *suspect* we need a bit more in TWord to make this all hold together. Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > From hosking at cs.purdue.edu Tue Feb 23 03:10:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Mon, 22 Feb 2010 21:10:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, Message-ID: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> On 22 Feb 2010, at 20:30, Jay K wrote: > I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. > I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 20:03:03 -0500 >> To: hosking at cs.purdue.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> >> >> P.S. The assumption is that results from operations that overflow should be discarded. >> >> >> Antony Hosking | Associate Professor | Computer Science | Purdue University >> 305 N. University Street | West Lafayette | IN 47907 | USA >> Office +1 765 494 6001 | Mobile +1 765 427 5484 >> >> >> >> >> >> >> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >> >> Jay, If you want that behavior, just do: >> >> TInt.Chop(x, BYTESIZE(INTEGER), x); >> TInt.ToInt(x, i) >> >> On 22 Feb 2010, at 23:57, Jay Krell wrote: >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/22 23:57:21 >> >> Modified files: >> cm3/m3-sys/m3back/src/: M3BackInt.m3 >> >> Log message: >> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >> >> From jay.krell at cornell.edu Tue Feb 23 03:30:08 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 02:30:08 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > >> I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > >> I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > >> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >> >> >> I don't entirely ignore ToInt's boolean. >> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >> >> >> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >> >> >> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >> >> >> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >> >> >> And then rewriting hand.c in Modula-3. >> >> >> And then other stuff. >> >> >> ..Jay >> >> >> ________________________________ >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>> To: hosking at cs.purdue.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> >>> >>> P.S. The assumption is that results from operations that overflow should be discarded. >>> >>> >>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>> 305 N. University Street | West Lafayette | IN 47907 | USA >>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>> >>> >>> >>> >>> >>> >>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>> >>> Jay, If you want that behavior, just do: >>> >>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>> TInt.ToInt(x, i) >>> >>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>> >>> CVSROOT: /usr/cvs >>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>> >>> Modified files: >>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>> >>> Log message: >>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>> >>> > From jkrell at elego.de Tue Feb 23 12:11:38 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:11:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223111138.C3F5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:11:38 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: remove TargetIntToDiagnosticText, no callers outside of M3BackInt.m3 From jkrell at elego.de Tue Feb 23 12:54:04 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 12:54:04 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223115404.4A5E02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 12:54:04 Added files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 m3makefile stdout.pgm Log message: add test case for set_singleton This might be endian and/or word size specific. But heck, I can at least compare NT386, LINUXLIBC6, I386_DARWIN. And maybe adjust the infrastructure to cope with it. From jkrell at elego.de Tue Feb 23 13:04:17 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 13:04:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223120417.D92412474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 13:04:17 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: add to test case From jkrell at elego.de Tue Feb 23 14:00:57 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 14:00:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223130057.614652474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 14:00:57 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: ulong => size_t in the interest of Win64, the only platform for which these are different, and size_t is probably the intent From hosking at cs.purdue.edu Tue Feb 23 14:35:39 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 08:35:39 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> Message-ID: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- >> From: hosking at cs.purdue.edu >> Date: Mon, 22 Feb 2010 21:10:10 -0500 >> To: jay.krell at cornell.edu >> CC: m3commit at elegosoft.com >> Subject: Re: [M3commit] CVS Update: cm3 >> >> On 22 Feb 2010, at 20:30, Jay K wrote: >> >>> I'm still a bit leary of Chop and ToBytes. >> >> Chop is just the same as a C cast. >> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >> >> ToBytes simply returns the significant bytes. >> >>> I *suspect* we need a bit more in TWord to make this all hold together. >> >> I don't see the need. I think this speaks to confusion on your part... >> >>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>> >>> >>> I don't entirely ignore ToInt's boolean. >>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>> >>> >>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>> >>> >>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>> >>> >>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>> >>> >>> And then rewriting hand.c in Modula-3. >>> >>> >>> And then other stuff. >>> >>> >>> ..Jay >>> >>> >>> ________________________________ >>>> From: hosking at cs.purdue.edu >>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>> To: hosking at cs.purdue.edu >>>> CC: m3commit at elegosoft.com >>>> Subject: Re: [M3commit] CVS Update: cm3 >>>> >>>> >>>> >>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>> >>>> >>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>> >>>> >>>> >>>> >>>> >>>> >>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>> >>>> Jay, If you want that behavior, just do: >>>> >>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>> TInt.ToInt(x, i) >>>> >>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>> >>>> CVSROOT: /usr/cvs >>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>> >>>> Modified files: >>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>> >>>> Log message: >>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>> >>>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:05:35 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:05:35 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150535.710962474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:05:35 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: more testing From jkrell at elego.de Tue Feb 23 16:06:37 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:06:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223150637.B7D3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:06:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3x86.m3 Log message: another not very useful function in hand.c bites the dust, at least under #ifdef use bts instruction instead of calling set_singleton bts's notion of how to index bits happens to line up with set_singleton (assuming test p230 is complete enough) bts isn't fast, but surely this is better overall due to drastically fewer instructions note that set_singleton test cases tend to generate very large code zeroing stuff I was not able to get coverage of several addressing modes, so they are left issuing errors and asserts. That is, among: bts mem, reg bts reg, imm8 bts reg, reg possibly bts mem, imm8 I was only able to get bts reg, reg to hit. Still to ponder gcc backend? I had hoped to get this done in the frontend but became stumped. ? It's just a shift and and, should be achievable portably. ? From jkrell at elego.de Tue Feb 23 16:11:39 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:11:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223151139.450FB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:11:39 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_singleton from NT386 maybe we can remove it from others too? From jay.krell at cornell.edu Tue Feb 23 16:27:06 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 15:27:06 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: I'd rather move along to other things.. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 08:35:39 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Tue Feb 23 16:51:52 2010 From: jkrell at elego.de (Jay Krell) Date: Tue, 23 Feb 2010 16:51:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223155153.166A92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/23 16:51:52 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: implementation of direct thread suspend/resume for interix been sitting on it and almost deleted it direct suspend/resume can be achieve by writing certain control codes to the correct files in /procfs the context of a suspended thread can be gotten by reading a file However I'd like to at least avoid opening the files repeatedly. Here we open them in thread create. I don't remember why Interix can't use the portable code. It doesn't have SA_SIGINFO but that doesn't prove it. It is empirically showable that the context is on the stack. So maybe we just have a single parameter signal handler and a null context? From hosking at cs.purdue.edu Tue Feb 23 18:39:49 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 12:39:49 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu> <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu> Message-ID: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > >> >> ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? >> I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. >> >> >> - Jay >> >> >> ---------------------------------------- >>> From: hosking at cs.purdue.edu >>> Date: Mon, 22 Feb 2010 21:10:10 -0500 >>> To: jay.krell at cornell.edu >>> CC: m3commit at elegosoft.com >>> Subject: Re: [M3commit] CVS Update: cm3 >>> >>> On 22 Feb 2010, at 20:30, Jay K wrote: >>> >>>> I'm still a bit leary of Chop and ToBytes. >>> >>> Chop is just the same as a C cast. >>> i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. >>> >>> ToBytes simply returns the significant bytes. >>> >>>> I *suspect* we need a bit more in TWord to make this all hold together. >>> >>> I don't see the need. I think this speaks to confusion on your part... >>> >>>> Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) >>>> >>>> >>>> I don't entirely ignore ToInt's boolean. >>>> I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. >>>> >>>> >>>> I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. >>>> >>>> >>>> Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. >>>> (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) >>>> >>>> >>>> What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. >>>> >>>> >>>> And then rewriting hand.c in Modula-3. >>>> >>>> >>>> And then other stuff. >>>> >>>> >>>> ..Jay >>>> >>>> >>>> ________________________________ >>>>> From: hosking at cs.purdue.edu >>>>> Date: Mon, 22 Feb 2010 20:03:03 -0500 >>>>> To: hosking at cs.purdue.edu >>>>> CC: m3commit at elegosoft.com >>>>> Subject: Re: [M3commit] CVS Update: cm3 >>>>> >>>>> >>>>> >>>>> P.S. The assumption is that results from operations that overflow should be discarded. >>>>> >>>>> >>>>> Antony Hosking | Associate Professor | Computer Science | Purdue University >>>>> 305 N. University Street | West Lafayette | IN 47907 | USA >>>>> Office +1 765 494 6001 | Mobile +1 765 427 5484 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On 22 Feb 2010, at 20:01, Tony Hosking wrote: >>>>> >>>>> Jay, If you want that behavior, just do: >>>>> >>>>> TInt.Chop(x, BYTESIZE(INTEGER), x); >>>>> TInt.ToInt(x, i) >>>>> >>>>> On 22 Feb 2010, at 23:57, Jay Krell wrote: >>>>> >>>>> CVSROOT: /usr/cvs >>>>> Changes by: jkrell at birch. 10/02/22 23:57:21 >>>>> >>>>> Modified files: >>>>> cm3/m3-sys/m3back/src/: M3BackInt.m3 >>>>> >>>>> Log message: >>>>> remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) >>>>> >>>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Tue Feb 23 19:15:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 18:15:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> References: <20100222225722.056AE2474001@birch.elegosoft.com>, ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Tue Feb 23 20:00:07 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Tue, 23 Feb 2010 14:00:07 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , , <48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , , , , , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu> Message-ID: I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: > So we need TWord.ToBytes? > > - Jay > > From: hosking at cs.purdue.edu > Date: Tue, 23 Feb 2010 12:39:49 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com; jay.krell at cornell.edu > Subject: Re: [M3commit] CVS Update: cm3 > > Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. > These TInt functions should be interpreted as having C arithmetic semantics. > > On 23 Feb 2010, at 08:35, Tony Hosking wrote: > > That can be fixed... > > On 22 Feb 2010, at 21:30, Jay K wrote: > > > ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? > I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. > > > - Jay > > > ---------------------------------------- > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 21:10:10 -0500 > To: jay.krell at cornell.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 22 Feb 2010, at 20:30, Jay K wrote: > > I'm still a bit leary of Chop and ToBytes. > > Chop is just the same as a C cast. > i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. > > ToBytes simply returns the significant bytes. > > I *suspect* we need a bit more in TWord to make this all hold together. > > I don't see the need. I think this speaks to confusion on your part... > > Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) > > > I don't entirely ignore ToInt's boolean. > I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. > > > I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. > > > Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. > (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) > > > What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. > > > And then rewriting hand.c in Modula-3. > > > And then other stuff. > > > ..Jay > > > ________________________________ > From: hosking at cs.purdue.edu > Date: Mon, 22 Feb 2010 20:03:03 -0500 > To: hosking at cs.purdue.edu > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > > > P.S. The assumption is that results from operations that overflow should be discarded. > > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > > > On 22 Feb 2010, at 20:01, Tony Hosking wrote: > > Jay, If you want that behavior, just do: > > TInt.Chop(x, BYTESIZE(INTEGER), x); > TInt.ToInt(x, i) > > On 22 Feb 2010, at 23:57, Jay Krell wrote: > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/22 23:57:21 > > Modified files: > cm3/m3-sys/m3back/src/: M3BackInt.m3 > > Log message: > remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Wed Feb 24 00:08:32 2010 From: jay.krell at cornell.edu (Jay K) Date: Tue, 23 Feb 2010 23:08:32 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: References: <20100222225722.056AE2474001@birch.elegosoft.com>, , ,,<48085E62-6C4C-4ECD-B1CB-F94CE7C5B10E@cs.purdue.edu>, , ,,, ,,, , , <6A1F915C-A970-4485-8293-9E523DB278BA@cs.purdue.edu>, , , , <72B5DA75-B33A-4414-9E14-6625FA5816FB@cs.purdue.edu>, , <09B1E13B-15E0-452B-83E7-1F976049793C@cs.purdue.edu>, , Message-ID: I'll have to show you where the values are coming from. I don't know offhand. Could be from m3back, or m3front, I don't know. This stuff largely is runnable/testable from arbitrary hosts. cd scripts/python ./do-cm3-std.py realclean NT386 ./do-cm3-std.py buildship NT386 to get the data we are interested in, would want to change this code e.g.: C:\dev2\cm3.2\m3-sys\m3back\src\Codex86.m3(386): IF (NOT M3BackInt.ToInt(imm, ins.imm)) AND (NOT M3BackWord.LE(imm, M3BackInt.Word32.max)) THEN Note that most of the uses of ToInt in m3back don't do that, e.g.: IF shiftCount.loc = OLoc.imm THEN IF NOT M3BackInt.ToInt(shiftCount.imm, ins.imm) THEN t.Err("binOp: unable to convert immediate to INTEGER:" & M3BackInt.ToDiagnosticText(shiftCount.imm)); END; ins.imsize := 1; And at least one of these examples is so far unreachable -- the one in bitTestAndSet that I added yesterday. But some are not, I didn't go here randomly. bitTestAndSet seems unusual but ok in that many x86 instructions can take a one byte signed immediate value, but bitTestAndSet seems to take a one byte unsigned immediate value. - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 14:00:07 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 I guess I am uncertain what it is you are trying to achieve. The Modula-3 frontend never generates unsigned integers. Everything is signed. If you want to represent (unsigned) then, yes, I guess you want TWord.TBytes. On 23 Feb 2010, at 13:15, Jay K wrote: So we need TWord.ToBytes? - Jay From: hosking at cs.purdue.edu Date: Tue, 23 Feb 2010 12:39:49 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com; jay.krell at cornell.edu Subject: Re: [M3commit] CVS Update: cm3 Actually, on second thought, of course it cannot be fixed. The signed value 128 *does* require 2 bytes to represent. (char)128 == -128. (short)128 == 128. These TInt functions should be interpreted as having C arithmetic semantics. On 23 Feb 2010, at 08:35, Tony Hosking wrote: That can be fixed... On 22 Feb 2010, at 21:30, Jay K wrote: ToBytes claims the value 128 requires 2 bytes. Which is reasonable. But not always expected. There should be an unsigned version that claims 1 byte? I can look into Chop and ToBytes more, but I am at least currently reusing add/subtract/multiple/div/mod/shift/rotate/toint/fromint/tochars, not bad. - Jay ---------------------------------------- From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 21:10:10 -0500 To: jay.krell at cornell.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 On 22 Feb 2010, at 20:30, Jay K wrote: I'm still a bit leary of Chop and ToBytes. Chop is just the same as a C cast. i.e., (char)0xFFFFFFFF and (char)0x000000FF return the same value (char)-1. ToBytes simply returns the significant bytes. I *suspect* we need a bit more in TWord to make this all hold together. I don't see the need. I think this speaks to confusion on your part... Look at my current M3BackInt.m3. It is almost entirely now delegating to TInt/TWord, except it has its own conversions back and forth. It applies Widen before every operation, chop after every one. They are different for unsigned vs. signed. (Hm, unsigned narrow should probably check that the value fits, and the caller can ignore that or not.) I don't entirely ignore ToInt's boolean. I then check if the value fits in Word32. If it does, I ignore the overflow, knowing the value converted "reasonably". If it doesn't, I error. I think TWord.ToWord, which doesn't exist, would do what I want -- allow for 0-2^n and fail otherwise. Further, I should chose TWord.ToWord vs. TInt.ToInt based on the types I have. And then the frontend shouldn't claim 255 is an Int8. And such. (I'm not sure how I'm getting away with this currently, maybe something odd in my ToBytes.) What is there now is in pretty good shape, and M3BackInt/Word reinvent exceedingly little code now. I'd be plenty ok moving to other stuff now, such as atomic8/16/64 (and more testing of atomic32, which I think are done and working). I wasn't too keen spending the time adapting to the TInt/TWord changes, but I also didn't want the two nearly identical copies, esp. since I haven't read through DivMod to understand it. And then rewriting hand.c in Modula-3. And then other stuff. ..Jay ________________________________ From: hosking at cs.purdue.edu Date: Mon, 22 Feb 2010 20:03:03 -0500 To: hosking at cs.purdue.edu CC: m3commit at elegosoft.com Subject: Re: [M3commit] CVS Update: cm3 P.S. The assumption is that results from operations that overflow should be discarded. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 22 Feb 2010, at 20:01, Tony Hosking wrote: Jay, If you want that behavior, just do: TInt.Chop(x, BYTESIZE(INTEGER), x); TInt.ToInt(x, i) On 22 Feb 2010, at 23:57, Jay Krell wrote: CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/22 23:57:21 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: remove local versions of ToInt and FromInt now that TInt.ToInt packs the bytes even if there is overflow (the right solution I suspect it TWord.ToWord) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Wed Feb 24 00:26:36 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 0:26:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100223232636.612802474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 00:26:35 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: 1UL => ((size_t)1) again with Win64 in mind From jkrell at elego.de Wed Feb 24 08:56:15 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 8:56:15 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224075620.035032474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 08:56:15 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case to cover constants From jkrell at elego.de Wed Feb 24 09:05:54 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 9:05:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224080554.A1B902474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 09:05:54 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test case From jkrell at elego.de Wed Feb 24 12:33:28 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:33:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224113329.3FC5F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:33:28 Modified files: cm3/m3-ui/bicycle/src/: m3makefile cm3/m3-ui/cmvbt/src/: m3makefile cm3/m3-ui/codeview/src/: m3makefile cm3/m3-ui/formsedit/src/: m3makefile cm3/m3-ui/formsvbt/src/: m3makefile cm3/m3-ui/formsview/src/: m3makefile cm3/m3-ui/images/src/: m3makefile cm3/m3-ui/juno-2/juno-app/src/: m3makefile cm3/m3-ui/mg/src/: m3makefile cm3/m3-ui/mgkit/src/: m3makefile cm3/m3-ui/ui/test/Argus/src/: m3makefile cm3/m3-ui/ui/test/BadBricks/src/: m3makefile cm3/m3-ui/ui/test/ButtonTest/src/: m3makefile cm3/m3-ui/ui/test/Cards/src/: m3makefile cm3/m3-ui/ui/test/ColorMonster/src/: m3makefile cm3/m3-ui/ui/test/Draw/src/: m3makefile cm3/m3-ui/ui/test/EyesVBT/src/: m3makefile cm3/m3-ui/ui/test/Hello/src/: m3makefile cm3/m3-ui/ui/test/Monster/src/: m3makefile cm3/m3-ui/ui/test/Sketch2/src/: m3makefile cm3/m3-ui/ui/test/StarAnim/src/: m3makefile cm3/m3-ui/ui/test/Track/src/: m3makefile cm3/m3-ui/ui/test/TypeInTest/src/: m3makefile cm3/m3-ui/ui-tests/pixmapcomtest/src/: m3makefile cm3/m3-ui/ui-tests/test25/src/: m3makefile cm3/m3-ui/ui-tests/texturecomtest/src/: m3makefile cm3/m3-ui/vbtkit/src/: m3makefile cm3/m3-ui/videovbt/src/: m3makefile cm3/m3-ui/webvbt/src/: m3makefile cm3/m3-ui/webvbt/src/hyperpage/src/: m3makefile cm3/m3-ui/zeus/src/: m3makefile Log message: HasGui => HasTrestle I suspect this won't matter shortly, I think I know what is wrong with X on Interix, just need to configure it as not having the shared memory extension.. From jkrell at elego.de Wed Feb 24 12:57:09 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 12:57:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224115709.67B632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 12:57:09 Modified files: cm3/m3-sys/m3tests/src/p0/p053/: Main.m3 Log message: extend test -- this gets more addressing modes From jkrell at elego.de Wed Feb 24 13:23:29 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:23:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122329.71DBF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:23:29 Modified files: cm3/m3-sys/m3tests/src/p2/p230/: Main.m3 stdout.pgm Log message: extend test From jkrell at elego.de Wed Feb 24 13:28:00 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:28:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224122800.E307A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:28:00 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 Log message: another little helper function bites the dust, at least for NT386 replace size_t __stdcall set_member(size_t elt, size_t* set) { register size_t word = elt / SET_GRAIN; register size_t bit = elt % SET_GRAIN; return (set[word] & (((size_t)1) << bit)) != 0; } with bt instruction which does it all, and leaves the result in the carry flag (some gymnastics then to get the carry flag) before: 0000003C: 56 push esi 0000003D: 53 push ebx 0000003E: FF 15 30 00 00 00 call dword ptr [T$111+30h] Shouldn't this be a direct call, save a byte? 00000044: 89 45 F4 mov dword ptr [ebp-0Ch],eax 11 bytes, 4 instructions (plus the function!) after, attempt #1 0000003C: 0F A3 1E bt dword ptr [esi],ebx 0000003F: 0F 92 45 F0 setb byte ptr [ebp-10h] 00000043: 33 D2 xor edx,edx 00000045: 8A 55 F0 mov dl,byte ptr [ebp-10h] 00000048: 89 55 F4 mov dword ptr [ebp-0Ch],edx 15 bytes, 5 instructions so many to extract the carry! Probably a win, but larger. Attempt #2: Let's try a different approach to capturing the result: 000000D1: 0F A3 1E bt dword ptr [esi],ebx 000000D4: 1B D2 sbb edx,edx 000000D6: F7 DA neg edx 000000D8: 89 55 F8 mov dword ptr [ebp-8],edx 10 bytes, 4 instructions (though I think the old approach could get by with 10, using a direct call) We can probably replace setcc other places similarly (see below). I had tried: xor eax, eax adc eax, 0 That didn't work. I suspect xor clobbered the carry. We could make that work by reserving and clearing the register earlier. However it is 11 bytes instead of 1 and this sbb, neg is how Visual C++ compiles: int F(unsigned a, unsigned b) { return a < b; } (further note: > is < but reversed, <= is < but inc instead of neg, and, importantly == and != are xor, op, sete regL, should be a nice win over our current strategy, if we can reserve/xor the register ahead of op) Note that now we get the various addressing modes (where set_singleton did not), however I couldn't get them to work, probably not encoding them with the right amount of indirection, so I force reg/reg addressing. Not ideal but probably still much better. Note that set_member is pretty heavily used, though none of these changes affects set that fit in 32 bits. We really should try to improve gcc backend? From jkrell at elego.de Wed Feb 24 13:30:19 2010 From: jkrell at elego.de (Jay Krell) Date: Wed, 24 Feb 2010 13:30:19 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100224123019.7CBDF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/24 13:30:19 Modified files: cm3/m3-libs/m3core/src/Csupport/Common/: hand.c Log message: remove set_member on NT386, see m3back changes, m3back generates x86 bt (bit test) instruction instead From jkrell at elego.de Thu Feb 25 08:15:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:15:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225071542.1EA6C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:15:42 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: replace cat with fs_contents From jkrell at elego.de Thu Feb 25 08:29:14 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:29:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225072914.6F3F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:29:14 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: on non-posix, look for \cygwin\bin\date.exe \cygwin\bin\bc.exe \cygwin\bin\awk.exe \cygwin\bin\cat.exe and use them if they exist Still, this won't let date even work on Solaris. Notice how pkgmap.sh just builds its own from one line of portable C. Awk I think we can remove just by using wc -l instead of wc? cat multiple files could be concating fs_contents? wc via split with newlines as the delimiter? bc we can just use "0" if it isn't there or maybe actually write an expression evaluator? more to do here later.. From jkrell at elego.de Thu Feb 25 08:47:21 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 8:47:21 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225074721.9D9462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 08:47:21 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: Remove unncessary use of awk, cat, wc, replacing with fairly portable quake. There is some issue here regarding splitting on \r or \n or both. Date and bc remain. From jkrell at elego.de Thu Feb 25 09:31:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:31:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225083142.8EF262474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:31:39 Modified files: cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadApple.c ThreadFreeBSD.c ThreadInterix.c ThreadPThread.i3 ThreadPThread.m3 ThreadPThreadC.c Log message: Go back a version, I think I showed these changes aren't needed, since the context is on the stack in Interix, just not exposed. From jkrell at elego.de Thu Feb 25 09:40:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:40:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084038.8ABE72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:40:38 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: when splitting 8 byte constants into two 4 byte constants, do chop them into 4 bytes, this fixes the ToInt overflow problem, so that we get e.g. 4:0 0 0 80 instead of 8:0 0 0 80 0 0 0 0 From jkrell at elego.de Thu Feb 25 09:48:23 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 9:48:23 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225084823.A37792474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 09:48:23 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: undo previous, there is a problem From jkrell at elego.de Thu Feb 25 10:10:55 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:10:55 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091055.B3B8D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:10:55 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.m3 Log message: fix to not need result when TInt.ToInt overflows -- chop at 4 bytes in M3BackInt.ToInt From jkrell at elego.de Thu Feb 25 10:12:36 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:12:36 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091236.8196D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:12:36 Modified files: cm3/m3-sys/m3middle/src/: TInt.m3 Log message: go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt From jkrell at elego.de Thu Feb 25 10:17:02 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 10:17:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225091702.A79892474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 10:17:02 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 Log message: scientific names instead of goofy names char => UINT8 u_short => UINT16 short => INT16 long => INT32 From jkrell at elego.de Thu Feb 25 11:07:29 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:07:29 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100729.E4C8A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:07:29 Modified files: cm3/m3-sys/m3objfile/src/: MasmObjFile.m3 NTObjFile.m3 Log message: spaces around binary operators: len-1 => len - 1 cnt-1 => cnt - 1 etc. (except not on ^. or "->") From jkrell at elego.de Thu Feb 25 11:09:48 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:09:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225100948.460292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:09:48 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: THEN usually at end of line, ELSE usually on its own line From jkrell at elego.de Thu Feb 25 11:10:52 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:10:52 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101052.EEE1E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:10:52 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: Grow objfile buffer from 2K to 64K. If anyone thinks this is too piggy, I'm ok with anything: 2K, 4K, 512, etc. From jkrell at elego.de Thu Feb 25 11:19:38 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:19:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225101938.4581B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:19:38 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 From jkrell at elego.de Thu Feb 25 11:30:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:30:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103040.EC33C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:30:40 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: goofy names to scientific names OutC (char) => Out8 OutS (short) => Out16 OutI (int) => Out32 CHAR => UINT8 (requires a loophole array of uint8 to array of char) UINT8 != CHAR UINT8 = BITS 8 FOR [0..255] From jkrell at elego.de Thu Feb 25 11:32:01 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:32:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103202.735AA2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:32:01 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: OutP => OutPathChar; DO on its own line, THEN at end of line From jkrell at elego.de Thu Feb 25 11:33:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:33:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225103311.61C422474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:33:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: DO at end of line (meant to say that in previous) From jkrell at elego.de Thu Feb 25 11:40:43 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:40:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104043.6E18A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:40:43 Modified files: cm3/m3-sys/m3objfile/src/: Coff.i3 MasmObjFile.m3 Log message: upcase hex (ff => FF) From jkrell at elego.de Thu Feb 25 11:42:08 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:42:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104208.3A0492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:42:08 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: spaces around binary minus and plus From jkrell at elego.de Thu Feb 25 11:46:51 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:46:51 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225104652.DBBD42474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:46:51 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: sometimes put two spaces after Out8/N to line up with Out16, Out32 there is some value to the names OutC/S/I but I think 8/16/32 is more sensible implement Out16/32 as small loops over Out8 From jkrell at elego.de Thu Feb 25 11:53:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:53:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105312.17B1A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:53:11 Modified files: cm3/m3-sys/m3objfile/src/: NTObjFile.m3 Log message: fix newlines From jkrell at elego.de Thu Feb 25 11:56:05 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 11:56:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225105606.052012474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 11:56:05 Modified files: cm3/m3-sys/m3objfile/src/: M3ObjFile.i3 NTObjFile.m3 cm3/m3-sys/m3back/src/: Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 Log message: Change m3objfile appendBytes from taking ARRAY of 0..255 to array of bits 8 for 0..255 (aka UINT8) pass the bytes of a Target.Int directly to appendBytes thereby removing our own M3BackInt.ToBytes function, and not even calling TInt.ToBytes violating the abstraction boundary, granted (which Tony declared to be a little fuzzy) From jkrell at elego.de Thu Feb 25 14:06:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:06:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225130640.5FF452474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:06:40 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Removed files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: eliminate M3BackWord drastically reduce M3BackInt to just: FromInt ToInt FromTargetInt ToDiagnosticText which can probably all go into TInt as something like FromIntAndChop ChopAndToInt CopyAndChop ToTextVerbose or somesuch, or caller synthesize add TInt.NE, GT, GE, Abs, Negate TWord.GE, GT which make for a smoother transition for m3back, even if the caller can inline them change TInt.EQ and NE to use structural (infix) comparison move the constants all to TInt to reduce abstraction boundary violations: Three, Four, Eight ThirtyOne, ThirtyTwo, SixtyThree, F3FF x0400, x0800, x0F00, MaxU8 -- changed to Target.Word8.max MThirtyOne, MSixtyThree perhaps not the best choice. At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. Some of the others are encodings for x87 status flags for example. Converting from strings is another not bad idea. The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int where the bytes are passed directly to m3objfile.AppendBytes This should perhaps be revisited. Granted, inconsistency with regard to where I violate the boundary. I have to look into ToBytes again. From jay.krell at cornell.edu Thu Feb 25 14:08:51 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:08:51 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Thu Feb 25 14:09:56 2010 From: jay.krell at cornell.edu (Jay K) Date: Thu, 25 Feb 2010 13:09:56 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225130640.5FF452474001@birch.elegosoft.com> References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: Given the current setup..I still think worthwhile to send diffs (just not in check comments..), attached. Of course, I might have made further edits since producing that, but I try to send latest. - Jay > Date: Thu, 25 Feb 2010 14:06:40 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 14:06:40 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 > M3BackInt.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.i3 Stackx86.m3 Wrx86.i3 > Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 > Removed files: > cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 > > Log message: > eliminate M3BackWord > > drastically reduce M3BackInt to just: > FromInt > ToInt > FromTargetInt > ToDiagnosticText > which can probably all go into TInt as something like > FromIntAndChop > ChopAndToInt > CopyAndChop > ToTextVerbose > or somesuch, or caller synthesize > > add TInt.NE, GT, GE, Abs, Negate > TWord.GE, GT > > which make for a smoother transition for m3back, even if the caller > can inline them > > change TInt.EQ and NE to use structural (infix) comparison > > move the constants all to TInt to reduce abstraction boundary violations: > Three, Four, Eight > ThirtyOne, ThirtyTwo, > SixtyThree, > F3FF > x0400, x0800, x0F00, > MaxU8 -- changed to Target.Word8.max > MThirtyOne, MSixtyThree > > perhaps not the best choice. > At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. > Some of the others are encodings for x87 status flags for example. > Converting from strings is another not bad idea. > > The only abstraction boundary violation remaining now is the avoidance of ToBytes in init_int > where the bytes are passed directly to m3objfile.AppendBytes > This should perhaps be revisited. > Granted, inconsistency with regard to where I violate the boundary. > I have to look into ToBytes again. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From wagner at elegosoft.com Thu Feb 25 14:25:40 2010 From: wagner at elegosoft.com (Olaf Wagner) Date: Thu, 25 Feb 2010 14:25:40 +0100 Subject: [M3commit] CM3 CVS commit hooks on birch, was: Re: CVS Update: cm3 In-Reply-To: References: <20100225130640.5FF452474001@birch.elegosoft.com> Message-ID: <20100225142540.ji0dypxy8kco4oco@mail.elegosoft.com> Quoting Jay K : > Given the current setup..I still think worthwhile to send diffs > (just not in check comments..), attached. Can we easily (without much efforts) add udiffs to the commit mails sent by the Perl scripts triggered by CVS commits from the cm3 repository? Of course only for text files. If somebody could have a quick look and let us know that would be appreciated. Olaf > - Jay > >> Date: Thu, 25 Feb 2010 14:06:40 +0000 >> To: m3commit at elegosoft.com >> From: jkrell at elego.de >> Subject: [M3commit] CVS Update: cm3 >> >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 14:06:40 >> >> Modified files: >> cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 >> M3BackInt.m3 M3x86.m3 M3x86Rep.i3 >> Stackx86.i3 Stackx86.m3 Wrx86.i3 >> Wrx86.m3 m3makefile >> cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 >> Removed files: >> cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 >> >> Log message: >> eliminate M3BackWord >> >> drastically reduce M3BackInt to just: >> FromInt >> ToInt >> FromTargetInt >> ToDiagnosticText >> which can probably all go into TInt as something like >> FromIntAndChop >> ChopAndToInt >> CopyAndChop >> ToTextVerbose >> or somesuch, or caller synthesize >> >> add TInt.NE, GT, GE, Abs, Negate >> TWord.GE, GT >> >> which make for a smoother transition for m3back, even if the caller >> can inline them >> >> change TInt.EQ and NE to use structural (infix) comparison >> >> move the constants all to TInt to reduce abstraction boundary violations: >> Three, Four, Eight >> ThirtyOne, ThirtyTwo, >> SixtyThree, >> F3FF >> x0400, x0800, x0F00, >> MaxU8 -- changed to Target.Word8.max >> MThirtyOne, MSixtyThree >> >> perhaps not the best choice. >> At least 31, 32, 63, 64, -31, -63, maxu8 aren't super target-dependent. >> Some of the others are encodings for x87 status flags for example. >> Converting from strings is another not bad idea. >> >> The only abstraction boundary violation remaining now is the >> avoidance of ToBytes in init_int >> where the bytes are passed directly to m3objfile.AppendBytes >> This should perhaps be revisited. >> Granted, inconsistency with regard to where I violate the boundary. >> I have to look into ToBytes again. > -- Olaf Wagner -- elego Software Solutions GmbH Gustav-Meyer-Allee 25 / Geb?ude 12, 13355 Berlin, Germany phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95 http://www.elegosoft.com | Gesch?ftsf?hrer: Olaf Wagner | Sitz: Berlin Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194 From jkrell at elego.de Thu Feb 25 14:32:25 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:32:25 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225133225.255292474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:32:25 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 Log message: fix typos in comments From jkrell at elego.de Thu Feb 25 14:45:39 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:39 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134539.B61462474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:39 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:45:57 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:45:57 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134557.D58222474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:45:57 Modified files: cm3/scripts/python/: make-dist.py Log message: very small whitespace diff (looking around here while reconciling head and release, I don't think Hudson runs this) From jkrell at elego.de Thu Feb 25 14:47:12 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:47:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225134713.7CFA72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:47:12 Modified files: cm3/scripts/python/: pylib.py Log message: merge function MakeDebianPackage from release to head (I'll probably get these comments wrong sometimes though!) From jkrell at elego.de Thu Feb 25 14:50:54 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:50:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135054.94D522474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:50:54 Modified files: cm3/scripts/python/: make-deb.py Log message: copy make-deb.py from release to head head made "min" and "std" packages release just makes one -- much simpler to test, and talk about, albeit contributes to bloat when people can't install bits/pieces There are other aspects changed here, like how to specify the input, but it is really just a few lines either way. (current version is 15 lines, previous was 19) From jkrell at elego.de Thu Feb 25 14:55:10 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:55:10 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135510.A4D3D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:55:10 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-core.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:56:11 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:56:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135611.6A2F52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:56:11 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 boot-cm3-with-m3.sh Log message: unimportant reconciliation with head (tempting to just delete the file..) From jkrell at elego.de Thu Feb 25 14:57:53 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:57:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135753.505202474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:57:53 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 copy-bootarchives.sh Log message: unimportant reconciliation with head (very very tempting to just delete the file..nobody uses this cross build stuff; I have done many cross builds, and not using this stuff..and these *.sh variations build more than needed..) From jkrell at elego.de Thu Feb 25 14:59:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 14:59:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225135942.F108D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 14:59:42 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 do-cm3-all.sh Log message: unimportant reconciliation with head (getting a little more interesting, but it is only whitespace and 'all' works for 'realclean' but not generally for 'buildship', 'std' is the useful one) From jkrell at elego.de Thu Feb 25 15:00:28 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:00:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140030.4E6372474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:00:28 Modified files: cm3/scripts/: find-packages.sh Log message: remove a space, match release From jkrell at elego.de Thu Feb 25 15:02:22 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:02:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140222.BC2E12474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:02:22 Modified files: cm3/scripts/: Tag: release_branch_cm3_5_8 pack-crossbuild.sh Log message: unimportant reconciliation with head (can we just delete all the old cross/boot/core stuff?) From jkrell at elego.de Thu Feb 25 15:05:40 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:05:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140540.C92612474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:05:40 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: some minor reconciliation with head From jkrell at elego.de Thu Feb 25 15:06:42 2010 From: jkrell at elego.de (Jay Krell) Date: Thu, 25 Feb 2010 15:06:42 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100225140644.771F02474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/25 15:06:42 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 upgrade.py Log message: some minor reconciliation with head From hosking at cs.purdue.edu Thu Feb 25 18:22:10 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 12:22:10 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100225091236.8196D2474001@birch.elegosoft.com> References: <20100225091236.8196D2474001@birch.elegosoft.com> Message-ID: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> WTF!!!!!! What are you messing with Tint for? I just cleaned it up. Jay, this is getting very annoying. Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 10:12, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/25 10:12:36 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.m3 > > Log message: > go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at cs.purdue.edu Thu Feb 25 20:49:06 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Thu, 25 Feb 2010 14:49:06 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> References: <20100225091236.8196D2474001@birch.elegosoft.com> <503C8B3A-3906-4AF4-8469-3E23028A1C28@cs.purdue.edu> Message-ID: <1D5CAE14-317E-4759-9351-DE963FF781EC@cs.purdue.edu> Jay, my apologies. My response was inappropriate and misplaced. I should have looked more closely at the details of your commits before complaining... It seems you have just added back some of the constants you use, and some of the additional comparisons you use. Again, my apologies. -- Tony Antony Hosking | Associate Professor | Computer Science | Purdue University 305 N. University Street | West Lafayette | IN 47907 | USA Office +1 765 494 6001 | Mobile +1 765 427 5484 On 25 Feb 2010, at 12:22, Tony Hosking wrote: > WTF!!!!!! > > What are you messing with Tint for? I just cleaned it up. > Jay, this is getting very annoying. > > Antony Hosking | Associate Professor | Computer Science | Purdue University > 305 N. University Street | West Lafayette | IN 47907 | USA > Office +1 765 494 6001 | Mobile +1 765 427 5484 > > > > > On 25 Feb 2010, at 10:12, Jay Krell wrote: > >> CVSROOT: /usr/cvs >> Changes by: jkrell at birch. 10/02/25 10:12:36 >> >> Modified files: >> cm3/m3-sys/m3middle/src/: TInt.m3 >> >> Log message: >> go back a version -- don't compute any output bytes in the overflow case of TInt.ToInt > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 12:02:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:02:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110233.645722474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:02:33 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3BackInt.i3 M3BackInt.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: M3BackWord.i3 M3BackWord.m3 Log message: go back a version on these files, two versions on Codex86.m3 bringing back overflow checking for every compile time integer operation cvs -z3 upd -r1.28 Codex86.i3 cvs -z3 upd -r1.89 Codex86.m3 cvs -z3 upd -r1.13 M3BackInt.i3 cvs -z3 upd -r1.15 M3BackInt.m3 cvs -z3 upd -r1.140 M3x86.m3 cvs -z3 upd -r1.34 M3x86Rep.i3 cvs -z3 upd -r1.18 Stackx86.i3 cvs -z3 upd -r1.98 Stackx86.m3 cvs -z3 upd -r1.4 Wrx86.i3 cvs -z3 upd -r1.12 Wrx86.m3 cvs -z3 upd -r1.4 m3makefile cvs -z3 upd -r1.6 M3BackWord.i3 cvs -z3 upd -r1.14 M3BackWord.m3 From jkrell at elego.de Fri Feb 26 12:05:17 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:05:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110517.C94DB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:05:17 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.m3 Log message: 'BITESIZE(IByte) * NUMBER(IBytes)' => 'BITSIZE(Int)' From jkrell at elego.de Fri Feb 26 12:08:56 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:08:56 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110856.552C32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:08:56 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 Log message: add MaxU8 (Yes I know there is Target.Word8.max) From jkrell at elego.de Fri Feb 26 12:09:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:09:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226110959.63F8B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:09:59 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse the constants from TInt (but wrapping them with an explicit precision From jkrell at elego.de Fri Feb 26 12:11:05 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:11:05 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111105.CEC0E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:11:05 Modified files: cm3/m3-sys/m3back/src/: M3BackInt.i3 Log message: reuse more constants from TInt (but wrapping them with an explicit precision); IBytes => Target.Int; remove IByte From jkrell at elego.de Fri Feb 26 12:14:58 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 12:14:58 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226111458.91C632474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 12:14:58 Added files: cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 Log message: initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 13:30:48 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:30:48 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226123048.CDFDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:30:48 Added files: cm3/m3-sys/m3middle/src/: TIntN.m3 Log message: initial copy of m3back/src/M3BackInt.m3 From jkrell at elego.de Fri Feb 26 13:48:34 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 13:48:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226124834.9AB1D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 13:48:34 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 M3BackWord.m3 Log message: introduce type Target.IntN which is Int plus a precision just like the old Target.Int (previously M3BackInt.Int) make TIntN and TWordN support it they are just thin wrappers over TInt, TWord previously named M3BackInt, M3BackWord add small amount of support to TInt: SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate These could, if desired, go into their only users: TIntN, TWordN. (with the understanding that that Target.Int is "revealed" to them.) add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged This is "just" additions. (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) (A little unsatisfactory that N is bytes instead of bits.) (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) While at it, in TIntN, rename things slightly: FromInt => FromHostInteger ToInt => ToHostInteger "Int" is "Target.Int" "HostInteger" is "INTEGER" again, TInt/TWord/m3front/m3middle not much affected. One fishy/uncertain thing in all of this, something to test out, is cross builds that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we really need INTEGER to be 4 bytes throughout m3back? (I know that mklib has little endian dependency.) From jay.krell at cornell.edu Fri Feb 26 13:50:49 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 12:50:49 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: diff attached > Date: Fri, 26 Feb 2010 13:48:34 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Fri Feb 26 14:12:02 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131202.EC20C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:02 Modified files: cm3/m3-sys/cm3/src/: version.quake Log message: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:12:59 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:12:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131259.569732474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:12:59 Modified files: cm3/m3-sys/cm3/src/: Tag: release_branch_cm3_5_8 version.quake Log message: from head: be tolerant of fairly arbitrary echos from sysinfo.sh, by filtering ^CM3_; this is part of scripts reconciliation between head and release From jkrell at elego.de Fri Feb 26 14:17:38 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:17:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226131740.37D642474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:17:38 Modified files: cm3/scripts/: sysinfo.sh Log message: put back echo that I removed in version 1.89 Nov 26 2009, it seems critical for correctness, and the purported reason for removing it has been worked around elsewise, and I'm somewhat suspicious of the stated reason; suspicious of my original changes here too -- the issue is what does cm3 call itself. I think people complained about the inability to build cm3 as easily as other things, or that doing so made it identify itself as some sort of 'unknown' version. Another fix would be to checkin version.quake over here in scripts next to version, or such, not requiring anything to transform it over in m3-sys/cm3/src/m3makefile, maybe I can get Olaf to look at this..it's not very interesting (and I only like interesting things.. :) ) anyway, not critical; the point here is really to make head and release identical From jkrell at elego.de Fri Feb 26 14:26:41 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:26:41 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132644.F23E82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:26:41 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:29:33 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:29:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226132933.C3B5D2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:29:33 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:35:46 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:35:46 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133548.3AFF52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:35:46 Modified files: cm3/scripts/: pkgmap.sh Log message: partial merge with release From jkrell at elego.de Fri Feb 26 14:39:30 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:39:30 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226133930.CBA3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:39:30 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: make m3cc first; shipping is separate, so not sure why this matters (and if we did buildship, m3cc should probably be last, but it wasn't last before anyway) From jkrell at elego.de Fri Feb 26 14:40:27 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:40:27 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134027.C5F1B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:40:27 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: formating only From jkrell at elego.de Fri Feb 26 14:44:12 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:44:12 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226134412.EFEDB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:44:12 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: always install mklib (i.e. for cross builds that target NT386, though we need go fix endian/alignment bugs in it) From jkrell at elego.de Fri Feb 26 14:51:26 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:51:26 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135129.18C0A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:51:26 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: partial merge with release: put back support for old config files (really? Maybe we should just remove it from release); 'fix' the stub config for the sake of hobbled quake readers such as cm3ide (ust earlier build time TARGET to write the file instead of later build time HOST) From jkrell at elego.de Fri Feb 26 14:53:37 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 14:53:37 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226135337.C17C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 14:53:37 Modified files: cm3/scripts/: make-bin-dist-min.sh Log message: complete merge/copy of this file with release From jkrell at elego.de Fri Feb 26 15:01:08 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:01:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140109.63AAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:01:08 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release (we can just copy?) From jkrell at elego.de Fri Feb 26 15:03:09 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 15:03:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226140309.808672474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 15:03:09 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge with release: formating and echoing From hosking at cs.purdue.edu Fri Feb 26 16:10:42 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:10:42 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226110856.552C32474001@birch.elegosoft.com> References: <20100226110856.552C32474001@birch.elegosoft.com> Message-ID: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> On 26 Feb 2010, at 12:08, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:08:56 > > Modified files: > cm3/m3-sys/m3middle/src/: TInt.i3 > > Log message: > add MaxU8 (Yes I know there is Target.Word8.max) So, why? From hosking at cs.purdue.edu Fri Feb 26 16:14:34 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 10:14:34 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226111458.91C632474001@birch.elegosoft.com> References: <20100226111458.91C632474001@birch.elegosoft.com> Message-ID: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> These don't belong here! Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. On 26 Feb 2010, at 12:14, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 12:14:58 > > Added files: > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > Log message: > initial copies from m3back/M3BackInt, M3BackWord From jkrell at elego.de Fri Feb 26 20:21:45 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:21:45 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226192146.05C3B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:21:45 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 cm3/m3-sys/m3middle/src/: TInt.i3 TIntN.i3 Log message: replace MaxU8 with Target.Word8.maxN that I didn't think of until later fix diagnostic in non-occuring internal diagnostic (the stack overflow messages in the backend, which are 'just' a form of assertion) ('fetch_and_op' => 'exchange') From jay.krell at cornell.edu Fri Feb 26 20:22:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:22:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.krell at cornell.edu Fri Feb 26 20:35:42 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 19:35:42 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> References: <20100226111458.91C632474001@birch.elegosoft.com>, <28743EDF-0A2F-458F-89C2-F03B7BACEF84@cs.purdue.edu> Message-ID: Tony, I don't think this complicated TInt/TWord. Whatever I did add to them, we could move. I didn't change their existing code. I just added like four functions to TInt. >>> I want compile time arithmetic that does overflow checks to a specified precision. I actually suspect precision should be given in bits, or perhaps via a CGType, but that is a smaller matter. Currently precision is specified in bytes. It is a small layering over TInt/TWord, but one I'd rather not foist on their clients, since it, as far as I can tell, requires "doubling" the function calls. If every single function is always paired with another, or multiple other, that seems ripe for wrapping up in their own functions. Doesn't it? And then, it turns out, carrying along a precision seems reasonable too, so there is a new type. I understand it'd be more efficient to inline in the caller but I don't like that approach, of having good abstraction boundaries, and then manually partially inlining across them. At the very least therefore, I'd want to add, say: M3x86Rep.Add, Sub, Multiply, Shift that are all one liners over TInt/TWord. Those one liners I have simply put in TIntN/TWordN. Which is just perhaps a nicer factoring. Very hypothetically, other backends could use them. In reality there's only two, without much danger of their being more. I think the best we could hope for is I can "extend" m3back, but it'd still just be m3back and the code could still go there if you really want. By adding four small functions to TInt I avoid TIntN/TWordN knowing the representation. However, by virtue of their living in m3middle, I also made it ok for them to know the representation. As well, as you said, it is only partly opaque. All that is to say, there are many almost identical options here. The code could go in m3back if you really want. Or the functions I added to TInt could go in TIntN/TWordN. Or I could even, in a stretch, not have the overflow checking -- it historically wasn't there. But I think having it is an improvement. I still do blatantly violate the abstraction boundary here: PROCEDURE init_int (u: U; o: ByteOffset; READONLY value: Target.Int; t: Type) = BEGIN ... u.obj.appendBytes(u.init_varstore.seg, SUBARRAY(value, 0, CG_Bytes[t])); appendBytes (s: Seg; READONLY bytes: ARRAY OF UINT8); That is really imho the main outstanding problem in this area. I should try using ToBytes. And if I just ignore its return value, should work. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:14:34 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > These don't belong here! > > Jay, can you please provide a coherent description of what your requirements are for backend compile-time arithmetic? I still don't understand what is causing all this churn. The TInt and TWord interfaces are well-defined, and have intuitive behaviour. If they are not suited to your purposes let's come up with something that is, without complicating the existing support. > > On 26 Feb 2010, at 12:14, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:14:58 > > > > Added files: > > cm3/m3-sys/m3middle/src/: TIntN.i3 TWordN.i3 TWordN.m3 > > > > Log message: > > initial copies from m3back/M3BackInt, M3BackWord > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Fri Feb 26 20:40:40 2010 From: jkrell at elego.de (Jay Krell) Date: Fri, 26 Feb 2010 20:40:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100226194040.F12FC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/26 20:40:40 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: cleanup, at least until some future time that we generate more debug info, which is sorely lacking From jay.krell at cornell.edu Fri Feb 26 21:39:19 2010 From: jay.krell at cornell.edu (Jay K) Date: Fri, 26 Feb 2010 20:39:19 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> References: <20100226110856.552C32474001@birch.elegosoft.com>, <8A2704EF-66E8-47B4-8D30-08C49150200E@cs.purdue.edu> Message-ID: Oops, not a different type, but a constant instead of a variable. Anyway, it is gone. - Jay From: jay.krell at cornell.edu To: hosking at cs.purdue.edu; jkrell at elego.de CC: m3commit at elegosoft.com Subject: RE: [M3commit] CVS Update: cm3 Date: Fri, 26 Feb 2010 19:22:27 +0000 Different types. But I thought of a better way later and so removed MaxU8 just now. - Jay > From: hosking at cs.purdue.edu > Date: Fri, 26 Feb 2010 10:10:42 -0500 > To: jkrell at elego.de > CC: m3commit at elegosoft.com > Subject: Re: [M3commit] CVS Update: cm3 > > On 26 Feb 2010, at 12:08, Jay Krell wrote: > > > CVSROOT: /usr/cvs > > Changes by: jkrell at birch. 10/02/26 12:08:56 > > > > Modified files: > > cm3/m3-sys/m3middle/src/: TInt.i3 > > > > Log message: > > add MaxU8 (Yes I know there is Target.Word8.max) > > So, why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hosking at elego.de Sat Feb 27 01:43:08 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:43:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004309.8C2492474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:43:08 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TWord.i3 TWord.m3 Target.i3 Target.m3 m3makefile Removed files: cm3/m3-sys/m3middle/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate. From hosking at elego.de Sat Feb 27 01:49:47 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 1:49:47 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227004948.3278B2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 01:49:47 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 m3makefile Added files: cm3/m3-sys/m3back/src/: TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Log message: Decontaminate m3middle (TInt and TWord). Add back deprecated TIntN and TWordN until someone has time to fix m3back. It currently manifests significant confusion regarding target integer types. There is sufficient type information around for this confusion to be repaired. I just don't have the time for this. From hosking at cs.purdue.edu Sat Feb 27 01:51:15 2010 From: hosking at cs.purdue.edu (Tony Hosking) Date: Fri, 26 Feb 2010 19:51:15 -0500 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100226124834.9AB1D2474001@birch.elegosoft.com> References: <20100226124834.9AB1D2474001@birch.elegosoft.com> Message-ID: <7E4207F1-C6FD-4421-8A4A-6C08DF566E35@cs.purdue.edu> I've just spent most of the day decontaminating m3middle and putting TIntN and TWordN back into m3back as deprecated modules. m3back needs to be fixed to get rid of these. I don't have time to mess with this stuff and I am peeved that I wasted a whole day on this. On 26 Feb 2010, at 13:48, Jay Krell wrote: > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/26 13:48:34 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 m3makefile > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3 > TWordN.i3 TWordN.m3 Target.i3 > Target.m3 m3makefile > Removed files: > cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3 > M3BackWord.m3 > > Log message: > introduce type Target.IntN which is Int plus a precision > just like the old Target.Int > (previously M3BackInt.Int) > > make TIntN and TWordN support it > they are just thin wrappers over TInt, TWord > previously named M3BackInt, M3BackWord > > add small amount of support to TInt: > SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate > These could, if desired, go into their only users: TIntN, TWordN. > (with the understanding that that Target.Int is "revealed" to them.) > > add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision > > NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged > This is "just" additions. > (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.) > (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN) > (A little unsatisfactory that N is bytes instead of bits.) > (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) ) > > While at it, in TIntN, rename things slightly: > FromInt => FromHostInteger > ToInt => ToHostInteger > > "Int" is "Target.Int" > "HostInteger" is "INTEGER" > > again, TInt/TWord/m3front/m3middle not much affected. > > One fishy/uncertain thing in all of this, something to test out, is cross builds > that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we > really need INTEGER to be 4 bytes throughout m3back? > (I know that mklib has little endian dependency.) From jkrell at elego.de Sat Feb 27 13:02:59 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:02:59 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120259.761E92474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:02:59 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: fix one whitespace From jkrell at elego.de Sat Feb 27 13:09:44 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:09:44 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227120945.000952474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:09:44 Modified files: cm3/m3-demo/calculator/src/: m3makefile cm3/m3-demo/cube/src/: m3makefile cm3/m3-demo/fisheye/src/: m3makefile cm3/m3-demo/mentor/src/: m3makefile cm3/m3-demo/sharedboard/boardclient/src/: m3makefile Log message: 'HasGui' => 'HasTrestle'; fix newlines From jkrell at elego.de Sat Feb 27 13:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121206.3A1B32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:12:06 Modified files: cm3/m3-obliq/obliqbinanim/src/: m3makefile cm3/m3-obliq/obliqbinui/src/: m3makefile cm3/m3-obliq/obliqsrvui/src/: m3makefile cm3/m3-obliq/visualobliq/src/: m3makefile cm3/m3-obliq/voquery/src/: m3makefile cm3/m3-obliq/vorun/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:14:40 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:14:40 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121440.EB5A62474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:14:40 Modified files: cm3/m3-tools/rehearsecode/src/: m3makefile cm3/m3-tools/replayheap/src/: m3makefile cm3/m3-tools/showheap/src/: m3makefile cm3/m3-tools/shownew/src/: m3makefile cm3/m3-tools/showthread/src/: m3makefile cm3/m3-www/deckscape/src/: m3makefile cm3/m3-www/webscape/src/: m3makefile Log message: 'HasGui' => 'HasTrestle' From jkrell at elego.de Sat Feb 27 13:16:11 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:16:11 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227121611.ADCAB2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:16:11 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: fix so it compiles, and pass correct parameters (debug code only) From jkrell at elego.de Sat Feb 27 13:20:09 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:20:09 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227122009.380132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:20:09 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: put back Chop() so that m3front compiles From jkrell at elego.de Sat Feb 27 13:35:17 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 13:35:17 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227123517.5741C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 13:35:17 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 Wrx86.i3 Wrx86.m3 Log message: go back to the versions that work since some files are absent here, this does *not* actually compile, but the history will be more sensible this way Codex86.i3 1.31 Codex86.m3 1.93 M3x86.m3 1.145 M3x86Pre.i3 1.37 Stackx86.i3 1.21 Stackx86.m3 1.102 Wrx86.m3 1.15 Wrx86.i3 1.7 NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) fixes to let it build shall be made very soon From jay.krell at cornell.edu Sat Feb 27 13:36:40 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 12:36:40 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227123517.5741C2474001@birch.elegosoft.com> References: <20100227123517.5741C2474001@birch.elegosoft.com> Message-ID: attached - Jay > Date: Sat, 27 Feb 2010 13:35:17 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 13:35:17 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > go back to the versions that work > since some files are absent here, this does *not* actually compile, > but the history will be more sensible this way > > Codex86.i3 1.31 > Codex86.m3 1.93 > M3x86.m3 1.145 > M3x86Pre.i3 1.37 > Stackx86.i3 1.21 > Stackx86.m3 1.102 > Wrx86.m3 1.15 > Wrx86.i3 1.7 > > NOT reverted: m3makefile, TInt*, TWord* (neither here nor in m3middle) > > fixes to let it build shall be made very soon > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jkrell at elego.de Sat Feb 27 14:55:18 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 14:55:18 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227135518.93B1F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 14:55:18 Modified files: cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.i3 Stackx86.m3 TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 Wrx86.i3 Wrx86.m3 Log message: make it work again possible new issue noticed: range checking on longint, or rather longint subranges and longcard: code might assume the values are already in integer range, and only range check for values not known to be within integer range, or something like that, I need to read this code more.. From jay.krell at cornell.edu Sat Feb 27 14:56:01 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 13:56:01 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From jay.krell at cornell.edu Sat Feb 27 15:01:27 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 14:01:27 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227135518.93B1F2474001@birch.elegosoft.com> References: <20100227135518.93B1F2474001@birch.elegosoft.com> Message-ID: attached > Date: Sat, 27 Feb 2010 14:55:18 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/27 14:55:18 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 > TIntN.i3 TIntN.m3 TWordN.i3 TWordN.m3 > Wrx86.i3 Wrx86.m3 > > Log message: > make it work again > possible new issue noticed: range checking on longint, > or rather longint subranges and longcard: code might assume > the values are already in integer range, and only range check > for values not known to be within integer range, or something > like that, I need to read this code more.. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1.txt URL: From hosking at elego.de Sat Feb 27 17:15:06 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:15:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161506.2B9482474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:15:06 Modified files: cm3/m3-sys/m3front/src/builtinWord/: And.mg Extract.mg Insert.mg Minus.mg Mod.mg Not.mg Or.mg Plus.mg Rotate.mg Shift.mg Times.mg Xor.mg cm3/m3-sys/m3front/src/exprs/: AddressExpr.m3 SetExpr.m3 cm3/m3-sys/m3front/src/misc/: Scanner.m3 TipeDesc.m3 Log message: Forgot to commit Chop => Extend! From hosking at elego.de Sat Feb 27 17:16:43 2010 From: hosking at elego.de (Antony Hosking) Date: Sat, 27 Feb 2010 17:16:43 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227161643.D72132474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: hosking at birch. 10/02/27 17:16:43 Modified files: cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 Log message: Chop Chop. :-) It is the same as Extend. From jkrell at elego.de Sat Feb 27 20:54:08 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:54:08 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195408.910F72474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:54:08 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: IsInt => TypeIsSigned IsWord => TypeIsUnsigned Is64 => TypeIs64 TIntN.T{n := NUMBER(Target.Int), x := ...} => TIntN.T{x := ...} n's default is NUMBER(Target.Int) uint_type.size => typeBitSize (new local) Modula-3 hides pointers vs. values from me, which normally I think is syntacic inconvenience in C, "." vs. "->", I should just be able to always say ".", but maybe there is a pointer after all adjust comments to be less scary when they are about efficiency and not correctness e.g. a few 64bit operations involving constants generate function calls when they could/should be implemented inline interesting point from a code size point of view though, is that we could inline "everything", and a caller who doesn't like the bloat could generally wrap up the operations in a function, if they notice, though we have some obligation to be efficient for people that don't bother looking (specifically, we don't inline some things that Visual C++ does, e.g. rotate64, and we do outline some things same as Visual C++ that processor manual suggests inlining e.g. 64bit shifts) GetOperandSize => OperandGetSize I know the first one reads more like an English sentence, but the second "scales" better I think, more mechanical and higher odds of success to always say TypeOperation than to find a nice English sentence From jkrell at elego.de Sat Feb 27 20:58:33 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 20:58:33 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227195833.B32C52474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 20:58:33 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: the number '32' is suspicious to the reader who knows 64 bit integers are supported, add assert not is64 to indicate that shouldn't get here (at least until we implement that obvious optimization) From jkrell at elego.de Sat Feb 27 21:17:16 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:17:16 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227201716.B67FF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:17:16 Modified files: cm3/m3-sys/m3back/src/: Stackx86.m3 Log message: looking for more "32", fix likely problems in insert/extract of 64bit numbers, esp. with bit offsets/sizes beyond 32 need to add more tests! From jkrell at elego.de Sat Feb 27 21:55:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:55:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205506.49D9F2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:55:06 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: I don't like the phrase 'in words' in a comment, because it sounds like an English usage for 'in summary', so try to clarify by saying 'in 'words' or 'registers'; I'm also not entirely happey that I've introduced yet another unit of measure, bad enough that we have both bits and bytes, maybe we can reduce this From jkrell at elego.de Sat Feb 27 21:58:20 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 21:58:20 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227205820.5D4FE2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 21:58:20 Modified files: cm3/m3-sys/m3back/src/: TIntN.i3 TWordN.i3 Log message: comment out some unused constants: torn between providing the obvious simple clear more complete interface, vs. strictly what is used; this leaves unused probably in TInt/TWord as well, but again, reasonable to also leave them all in From jkrell at elego.de Sat Feb 27 22:03:02 2010 From: jkrell at elego.de (Jay Krell) Date: Sat, 27 Feb 2010 22:03:02 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227210302.986F22474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/27 22:03:02 Modified files: cm3/m3-sys/m3back/src/: TWordN.i3 TWordN.m3 Log message: No need for DivMod here, we just call through to TInt/TWord. From wagner at elego.de Sun Feb 28 00:11:00 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:11:00 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227231101.259432474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:11:00 Modified files: cm3/scripts/: make-src-dist-all.sh make-src-dist-sys.sh pkginfo.txt Added files: cm3/scripts/: all-deps get-all-deps.sh cm3/scripts/regression/: hudson_build_system.sh hudson_pkg_tests.sh cm3/scripts/win/: cvs.c Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:22:01 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:22:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227232201.BADFF2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:22:01 Modified files: cm3/scripts/: make-dist.sh Log message: partial merge of changes from the 5.8 release branch From wagner at elego.de Sun Feb 28 00:30:54 2010 From: wagner at elego.de (Olaf Wagner) Date: Sun, 28 Feb 2010 0:30:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233054.3428C2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: wagner at birch. 10/02/28 00:30:54 Modified files: cm3/scripts/regression/: defs.sh Log message: partial merge of changes from the 5.8 release branch From jkrell at elego.de Sun Feb 28 00:35:28 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:35:28 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227233528.369AC2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:35:28 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Log message: print all labels in the -debug output From jkrell at elego.de Sun Feb 28 00:52:38 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 0:52:38 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100227235238.AF45E2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 00:52:37 Modified files: cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 Stackx86.m3 Log message: mostly resolve the double shift source vs. dest problem the underlying helper function sometimes reverses dest and src, in the interest of getting reg, mem These helper functions need cleanup and unification. build_modrm, load_like_helper, etc. abtract out some assumptions of 32bit sizes to be type-based so that we might inline some shift/insert/extract no actual bug here, only 32bit types get here currently, the rest generate function calls From jay.krell at cornell.edu Sun Feb 28 00:58:34 2010 From: jay.krell at cornell.edu (Jay K) Date: Sat, 27 Feb 2010 23:58:34 +0000 Subject: [M3commit] CVS Update: cm3 In-Reply-To: <20100227235238.AF45E2474001@birch.elegosoft.com> References: <20100227235238.AF45E2474001@birch.elegosoft.com> Message-ID: > mostly resolve the double shift source vs. dest problem Clarification, I don't know of any bug here, just that - the code looked wrong but acted right - the debug output was probably wrong and definitely a little bit missing (I'm sure nobody ever runs cm3 -debug and looks at NT386/foo.molog, but I've been doing that a lot lately, it is similar to cm3cg -y, but shows the generated code as well, interleaved). The actual generated code seemed ok, based on stuff in m3-sys/m3tests. "mostly resolve" as in, the code reads more sensibly now, though there is too much code duplication, build_modrm isn't as useful as it should be.. Also "double shift" doesn't mean "extra shift", but "double precision shift" -- 64bit shift. x86 has the instructions shld and shrd, shift left double, shift right double. You shift a register "into" another a register, instead of shifting in zeros or sign bits. - Jay > Date: Sun, 28 Feb 2010 00:52:38 +0000 > To: m3commit at elegosoft.com > From: jkrell at elego.de > Subject: [M3commit] CVS Update: cm3 > > CVSROOT: /usr/cvs > Changes by: jkrell at birch. 10/02/28 00:52:37 > > Modified files: > cm3/m3-sys/m3back/src/: Codex86.m3 M3x86.m3 M3x86Rep.i3 > Stackx86.m3 > > Log message: > mostly resolve the double shift source vs. dest problem > the underlying helper function sometimes reverses dest and src, in the > interest of getting reg, mem > These helper functions need cleanup and unification. > build_modrm, load_like_helper, etc. > > abtract out some assumptions of 32bit sizes to be type-based > so that we might inline some shift/insert/extract > no actual bug here, only 32bit types get here currently, the > rest generate function calls > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkrell at elego.de Sun Feb 28 01:32:54 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 1:32:54 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228003254.C2D702474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 01:32:53 Modified files: cm3/m3-sys/m3back/src/: M3x86.m3 Log message: inline 64bit shifts by a constant, or at least more instances (e.g. shifting a non-const by a const?) Oh, actually left_shift and right_shift already did this, this now affects "signed shift", which I just don't see much utility in really... including: before: < start_call_direct p.71[_m3_shift64 at 12] 0 Word.64 < load_stack_param Word.32 0 < 00004803: 68FFFFFFFF PUSH $-1 < load_stack_param Word.64 0 < 00004808: 8B5DF8 MOV EBX tv.71[_a] < 0000480B: 8B55FC MOV EDX tv.71[_a]+4 < 0000480E: 52 PUSH EDX < 0000480F: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004810: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004803: 8B5DF8 MOV EBX tv.71[_a] > 00004806: 8B55FC MOV EDX tv.71[_a]+4 > 00004809: 0FACD301 SHRD EBX EDX $1 > 0000480D: D1EA SHR EDX $1 (though this really should use other addressing modes and that'd probably save an instruction) and then tricks like, shifting by more than 32: before: < 00004CA7: 6828000000 PUSH $40 < load_stack_param Word.64 0 < 00004CAC: 8B5DF8 MOV EBX tv.71[_a] < 00004CAF: 8B55FC MOV EDX tv.71[_a]+4 < 00004CB2: 52 PUSH EDX < 00004CB3: 53 PUSH EBX < call_direct p.71[_m3_shift64 at 12] Word.64 < 00004CB4: FF1500000000 CALL p.71[_m3_shift64 at 12] after: > 00004B50: 8B5DF8 MOV EBX tv.71[_a] > 00004B53: 8B55FC MOV EDX tv.71[_a]+4 > 00004B56: 8BD3 MOV EDX EBX > 00004B58: C1E208 SHL EDX $8 > 00004B5B: 33DB XOR EBX EBX move low to high, zero low, shift high by count - 32 though this too could be a lot better, at the very least, move edx ebx could be replaced just with a "virtual move" that reassigns the registers I'm strongly considering inlining all shifts and rotates, though I couldn't get it to work yet. This is a step. also notice this is less than one line changed, just to let the code run that was already there From jkrell at elego.de Sun Feb 28 09:41:22 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 9:41:22 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228084123.101D82474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 09:41:22 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: Main.m3 Log message: add command line switch: -include-less-portable-output which triggers program to print all the output, including word size and/or endian-dependent output None of the output is "fully target dependent", there aren't n different less portable outputs, just 2 or 4 It might be nice to have finer control: -include-endian-specific-output -include-wordsize-specific-output that way we could, e.g. compare PPC_LINUX output with I386_LINUX, etc. instead of forcing PPC_LINUX to only be comparable to e.g. SPARC32_LINUX However I think this is a reasonable compromise. If a test truly *only* has endian-specifity or word-size specifity, that will be allowed for ('infrastructure' coming soon, just a few lines of code in m3makefile), but if a test has any of both, then so far my thinking is all or nothing (otherwise the logic to pick output file will be trickier) From jkrell at elego.de Sun Feb 28 10:12:06 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:12:06 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091206.D8F5A2474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:12:06 Modified files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm Main.m3 Log message: remove line numbers, leave it as an option developer can uncomment to aid debugging From jkrell at elego.de Sun Feb 28 10:18:34 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:18:34 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228091834.588532474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:18:34 Added files: cm3/m3-sys/m3tests/src/p2/p227/: stdout.pgm-little_endian32 Log message: add little endian 32bit output (we'll want at least big_endian32 (PPC, SPARC) and little_endian64 (AMD64); big endian 64 are currently not quite there but close (SPARC64, PPC64, MIPS64) From jkrell at elego.de Sun Feb 28 10:48:01 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 10:48:01 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228094801.912362474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 10:48:01 Modified files: cm3/m3-sys/m3tests/src/: m3makefile Log message: two improvements - zero sized file compare equal to missing files so we don't have to checkin all the little stdout.build, stderr.build files - allow for stuff like stdout.pgm-littleendian32,etc and running a test without and without -include-less-portable-output flag when the flag is omitted, comparison is done to stdout.pgm etc. when the flag is included, a somewhat target specific file is probed for Having "fully target specific" stdout.pgm-NT386 would prevent automatic comparison across targets, ok but not great, and is not allowed here you can have stdout.pgm32 stdout.pgm64 stdout.pgm-little_endian32 stdout.pgm-little_endian64 stdout.pgm-little_endian stdout.pgm-big_endian32 stdout.pgm-big_endian64 stdout.pgm-big_endian pick 2 or 4 of them (though again, big_endian64 is not well represented, and littleendian64 is only one architecture) TARGET_ENDIAN must be defined in the config files All the checked in ones have it. Really cm3 should set this, but things aren't run in the right order. Maybe later (much). p227 uses this to get additional coverage, but some others should use it too -- so that we don't probe for all tests, only the ones that need it, and maybe these test can get the -include-less-portable-output flag That is, we already have some word size specific tests, and so our default is to probe for all tests. This new feature runs specified tests with and without probing. mixed_portability_test() is the name of the new one, though I'm open to other names rename pb_test to build_flags_test rename pr_test to p_run_flags_test This will allow proceeding with less worry, more testing, changing the NT386 insert/extract operations, for example, and gcc backend set_singleton/member, since we can get more testing coverage, don't have to be limited by full portability (though there is still a shortage of some variants, e.g. no working big endian 64bit and only one working little endian 64bit (AMD64) hopefully we can fill these gaps before much longer with MIPS64, SPARC64, PPC64, IA64) What is the difference between "cmp_file" and "compare_file". Someone should do source analysis, flag synonyms in the same context, and error, make the programmer use longer names... go ahead and combine run_test and run_test2, there aren't so many uses of each that it is so disruptive From jkrell at elego.de Sun Feb 28 11:09:53 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:09:53 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228100953.B33862474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:09:53 Modified files: cm3/scripts/win/: Tag: release_branch_cm3_5_8 pkginfo.cmd Log message: partial merge with release: mklib is portable enough, doesn't need a filter (it can compile/link on all platforms, even with old m3core, though it might not work esp. on big endian hosts) From jkrell at elego.de Sun Feb 28 11:11:14 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:11:14 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101114.696F32474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:11:14 Modified files: cm3/scripts/python/: Tag: release_branch_cm3_5_8 make-dist.py Log message: partial merge with head: add mklib From jkrell at elego.de Sun Feb 28 11:13:31 2010 From: jkrell at elego.de (Jay Krell) Date: Sun, 28 Feb 2010 11:13:31 () Subject: [M3commit] CVS Update: cm3 Message-ID: <20100228101331.723192474001@birch.elegosoft.com> CVSROOT: /usr/cvs Changes by: jkrell at birch. 10/02/28 11:13:31 Modified files: cm3/scripts/win/: pkginfo.cmd Log message: partial merge with release: m3staloneback doesn't need a filter, it is very portable, even if it isn't important and nobody ever uses it (it is command line access I believe to code linked into cm3)