<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hm. Ok. TInt.Multiply allows aliasing but TWord.Multiply does not.<BR>
 <BR>
 <BR>
MODULE Main;<BR>IMPORT RTIO, Target, TInt, TWord;<BR>
VAR a,b:Target.Int;<BR>BEGIN<BR>EVAL TInt.FromInt(1, BYTESIZE(INTEGER), a);<BR>EVAL TInt.FromInt(1, BYTESIZE(INTEGER), b);<BR>TWord.Multiply(a, b, a);<BR>RTIO.PutText(TInt.ToText(a));<BR>RTIO.Flush();<BR>END Main.<BR><BR>
 <BR>
prints 0.<BR>
 <BR>
The code in m3back:<BR>
 <BR>
 <BR>
PROCEDURE doindex_address (t: T; shift, size: INTEGER; neg: BOOLEAN) =<BR>...<BR>
        (* Beware TWord.Multiply: x * 1 = 0 *)<BR>
        IF NOT TInt.Multiply(stop0.imm, tsize, stop0.imm) THEN<BR>          t.Err("doindex_address: multiply overflowed");<BR>        END;<BR><BR>
 <BR>
 <BR>
 - Jay<BR><BR> <BR>
<HR id=stopSpelling>
From: hosking@cs.purdue.edu<BR>Date: Wed, 20 Jan 2010 20:00:39 -0500<BR>To: hosking@cs.purdue.edu<BR>CC: m3devel@elegosoft.com; m3commit@elegosoft.com; jay.krell@cornell.edu<BR>Subject: Re: [M3devel] [M3commit] m3back using Target.Int in place of INTEGER a lot now<BR><BR>
<DIV>Jay, I don't know what you are talking about there being a bug in TWord.Multiply.</DIV>
<DIV><BR></DIV>
<DIV>This little program prints out 2, as would be expected:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>MODULE Main;</DIV>
<DIV>IMPORT RTIO, TInt, TWord, Target;</DIV>
<DIV><BR></DIV>
<DIV>VAR i := TInt.Two;</DIV>
<DIV>    j: Target.Int;</DIV>
<DIV>    buf: ARRAY[0..10] OF CHAR;</DIV>
<DIV>BEGIN</DIV>
<DIV>  TWord.Multiply (i, TInt.One, j);</DIV>
<DIV>  FOR k := 0 TO TInt.ToChars (i, buf) DO</DIV>
<DIV>    RTIO.PutChar(buf[k]);</DIV>
<DIV>  END;</DIV>
<DIV>  RTIO.PutChar('\n');</DIV>
<DIV>  RTIO.Flush();</DIV>
<DIV>END Main.</DIV>
<DIV><BR></DIV></DIV><BR>
<DIV>
<DIV>On 20 Jan 2010, at 18:59, Tony Hosking wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE>
<DIV style="WORD-WRAP: break-word">Where's the bug in TWord.Multiply?
<DIV>If there were a bug we would have seen it by now surely?</DIV>
<DIV><BR>
<DIV><SPAN style="FONT-SIZE: 12px" class=ecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV><FONT class=ecxApple-style-span color=#0000ff><FONT class=ecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Antony Hosking</SPAN></SPAN></FONT></FONT><FONT class=ecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN class=ecxApple-converted-space> </SPAN>|<SPAN class=ecxApple-converted-space> </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span>Associate Professor</SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span> | Computer Science | Purdue University</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span>305 N. University Street | West Lafayette | IN 47907 | USA</SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Office</SPAN></SPAN></FONT><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span> <?XML:NAMESPACE PREFIX = SKYPE /><SKYPE:SPAN id=softomate_v3_highlight_0 class=skype_v3_tb_injection title=Call this phone number in United States of America with Skype: +17654946001 rtl="1" skypeid="0" skypeaction="call" nof="" isfax="" freecall="" fwidth=".w16" type=".flex" mode=".compat" path="file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/" durex2="%DADDYHEIGHT%" durex="%DADDYWIDTH%" context="+1 765 494 6001"><SKYPE:SPAN id=skype_v3_tb_img_r0 class=skype_v3_tb_imgR></SKYPE:SPAN><SKYPE:SPAN id=skype_v3_tb_text0 class=skype_v3_tb_injectionIn><SKYPE:SPAN id=skype_v3_tb_innerText0 class=skype_v3_tb_innerText> +1 765 494 6001 </SKYPE:SPAN></SKYPE:SPAN><SKYPE:SPAN id=skype_v3_tb_img_s0 class=skype_v3_tb_imgS></SKYPE:SPAN><SKYPE:SPAN style="BACKGROUND-IMAGE: url(file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/inactive_a.compat.flex.w16.gif)" id=skype_v3_tb_droppart_0 class=skype_v3_tb_imgA title="Skype actions" skypeid="0" skypeaction="drop" skypesms="0"><SKYPE:SPAN style="BACKGROUND-IMAGE: url(file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/famfamfam/US.gif)" id=skype_v3_tb_img_f0 class=skype_v3_tb_imgFlag></SKYPE:SPAN></SKYPE:SPAN></SKYPE:SPAN> <SKYPE:SPAN id=softomate_v3_print_0 class=skype_v3_tb_injection_print context="">+1 765 494 6001</SKYPE:SPAN>  |<SPAN class=ecxApple-converted-space> </SPAN></SPAN></SPAN></FONT><FONT class=ecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Mobile</SPAN></SPAN></FONT><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN class=ecxApple-converted-space> </SPAN><SKYPE:SPAN id=softomate_v3_highlight_1 class=skype_v3_tb_injection title=Call this phone number in United States of America with Skype: +17654275484 skypeid="1" skypeaction="call" nof="" isfax="" freecall="" fwidth=".w16" type=".flex" mode=".compat" path="file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/" durex2="%DADDYHEIGHT%" durex="%DADDYWIDTH%" context="+1 765 427 5484"><SKYPE:SPAN style="BACKGROUND-IMAGE: url(file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/inactive_a.compat.flex.w16.gif)" id=skype_v3_tb_droppart_1 class=skype_v3_tb_imgA title="Skype actions" skypeid="1" skypeaction="drop" skypesms="1"><SKYPE:SPAN style="BACKGROUND-IMAGE: url(file://C:/Users/jay/Temp/__SkypeIEToolbar_Cache/e70d95847a8f5723cfca6b3fd9946506/static/famfamfam/US.gif)" id=skype_v3_tb_img_f1 class=skype_v3_tb_imgFlag></SKYPE:SPAN></SKYPE:SPAN><SKYPE:SPAN id=skype_v3_tb_img_s1 class=skype_v3_tb_imgS></SKYPE:SPAN><SKYPE:SPAN id=skype_v3_tb_text1 class=skype_v3_tb_injectionIn><SKYPE:SPAN id=skype_v3_tb_innerText1 class=skype_v3_tb_innerText> +1 765 427 5484 </SKYPE:SPAN></SKYPE:SPAN><SKYPE:SPAN id=skype_v3_tb_img_r1 class=skype_v3_tb_imgR></SKYPE:SPAN></SKYPE:SPAN> <SKYPE:SPAN id=softomate_v3_print_1 class=skype_v3_tb_injection_print context="">+1 765 427 5484</SKYPE:SPAN> </SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span face=GillSans-Light><BR class=ecxkhtml-block-placeholder></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class=ecxApple-interchange-newline></SPAN></DIV></SPAN><BR class=ecxApple-interchange-newline></DIV><BR>
<DIV>
<DIV>On 20 Jan 2010, at 10:05, Jay K wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxhmmessage>This is fairly large and tedious. If anyone has the patience to look at every single line, please do. Thanks.<BR>I did look through pretty much every single line in search of the one bug I saw working on it.<BR>It turns out the bug was in TWord though. TWord.Multiply(x, 1) = 0.<BR>Which broke INC, it was adding 0 instead 1.<BR>You could see the bug in RTIO.PutString where it just kept outputing the first character.<BR>So I use TInt.Multiply instead.<BR> <BR> - Jay<BR> <BR>
<HR id=ecxstopSpelling>
From:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A><BR>To:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:jkrell@elego.de">jkrell@elego.de</A>;<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</A><BR>Date: Wed, 20 Jan 2010 15:02:27 +0000<BR>Subject: Re: [M3commit] CVS Update: cm3<BR><BR>diff attached<BR><BR><BR><BR><BR><BR> <BR>> Date: Wed, 20 Jan 2010 16:01:32 +0000<BR>> To:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</A><BR>> From:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:jkrell@elego.de">jkrell@elego.de</A><BR>> Subject: [M3commit] CVS Update: cm3<BR>><SPAN class=ecxApple-converted-space> </SPAN><BR>> CVSROOT: /usr/cvs<BR>> Changes by: jkrell@birch. 10/01/20 16:01:32<BR>><SPAN class=ecxApple-converted-space> </SPAN><BR>> Modified files:<BR>> cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3<SPAN class=ecxApple-converted-space> </SPAN><BR>> M3x86Rep.i3 Stackx86.i3 Stackx86.m3<SPAN class=ecxApple-converted-space> </SPAN><BR>> cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3<SPAN class=ecxApple-converted-space> </SPAN><BR>><SPAN class=ecxApple-converted-space> </SPAN><BR>> Log message:<BR>> convert much of m3back to use Target.Int instead of INTEGER<BR>> This should at least allow it to propagate constant LONGINTs<BR>> as well as perhaps otherwise help with implementing LONGINT,<BR>> since the virtual stack is now of Target.Int instead of INTEGER<BR>><SPAN class=ecxApple-converted-space> </SPAN><BR>> Beware that TWord.Multiply(x, 1) = 0, so I use TInt.Multiply instead<BR>><SPAN class=ecxApple-converted-space> </SPAN><BR>> Also note that there's still a lot of "INTEGER" used.<BR>><SPAN class=ecxApple-converted-space> </SPAN><BR></DIV></SPAN></BLOCKQUOTE></DIV><BR></DIV></DIV></BLOCKQUOTE></DIV><BR>                                        </body>
</html>