[M3commit] m3back using Target.Int in place of INTEGER a lot now

Tony Hosking hosking at cs.purdue.edu
Thu Jan 21 02:00:39 CET 2010


Jay, I don't know what you are talking about there being a bug in TWord.Multiply.

This little program prints out 2, as would be expected:

MODULE Main;
IMPORT RTIO, TInt, TWord, Target;

VAR i := TInt.Two;
    j: Target.Int;
    buf: ARRAY[0..10] OF CHAR;
BEGIN
  TWord.Multiply (i, TInt.One, j);
  FOR k := 0 TO TInt.ToChars (i, buf) DO
    RTIO.PutChar(buf[k]);
  END;
  RTIO.PutChar('\n');
  RTIO.Flush();
END Main.


On 20 Jan 2010, at 18:59, Tony Hosking wrote:

> Where's the bug in TWord.Multiply?
> If there were a bug we would have seen it by now surely?
> 
> 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 20 Jan 2010, at 10:05, Jay K wrote:
> 
>> This is fairly large and tedious. If anyone has the patience to look at every single line, please do. Thanks.
>> I did look through pretty much every single line in search of the one bug I saw working on it.
>> It turns out the bug was in TWord though. TWord.Multiply(x, 1) = 0.
>> Which broke INC, it was adding 0 instead 1.
>> You could see the bug in RTIO.PutString where it just kept outputing the first character.
>> So I use TInt.Multiply instead.
>>  
>>  - Jay
>>  
>> From: jay.krell at cornell.edu
>> To: jkrell at elego.de; m3commit at elegosoft.com
>> Date: Wed, 20 Jan 2010 15:02:27 +0000
>> Subject: Re: [M3commit] CVS Update: cm3
>> 
>> diff attached
>> 
>> 
>> 
>> 
>> 
>>  
>> > Date: Wed, 20 Jan 2010 16:01: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/01/20 16:01:32
>> > 
>> > Modified files:
>> > cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3 
>> > M3x86Rep.i3 Stackx86.i3 Stackx86.m3 
>> > cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 
>> > 
>> > Log message:
>> > convert much of m3back to use Target.Int instead of INTEGER
>> > This should at least allow it to propagate constant LONGINTs
>> > as well as perhaps otherwise help with implementing LONGINT,
>> > since the virtual stack is now of Target.Int instead of INTEGER
>> > 
>> > Beware that TWord.Multiply(x, 1) = 0, so I use TInt.Multiply instead
>> > 
>> > Also note that there's still a lot of "INTEGER" used.
>> > 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20100120/2107472c/attachment-0002.html>


More information about the M3commit mailing list