<html><head><base href="x-msg://296/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">More accurately, BYTESIZE(ADDRESS)?<div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><font class="Apple-style-span" color="#0000FF"><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Antony Hosking</span></span></font></font><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-converted-space"> </span>|<span class="Apple-converted-space"> </span></span></span><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; ">Associate Professor</span></span><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; "> | Computer Science | Purdue University</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; ">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Office</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "> +1 765 494 6001 |<span class="Apple-converted-space"> </span></span></span></font><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Mobile</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-converted-space"> </span>+1 765 427 5484</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><br class="khtml-block-placeholder"></font></div></span></span></span></span></span></span></span><br class="Apple-interchange-newline"></span></div></span></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On 5 Apr 2010, at 10:40, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">I think we can safely dispense with RTMachine.PointerAlignment and use BYTESIZE(INTEGER).<br>NT386 is the only current exception.<br>Even though it isn't required, of any x86 target, it seems the overwhelming practice.<br> <br> - Jay<br> <br><hr id="stopSpelling">Subject: Re: [M3devel] RTMachine.PointerAlignment = 1 on NT?<br>From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>Date: Mon, 5 Apr 2010 10:25:20 -0400<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br><br>Yes, correct. Pointers from the stacks may be "derived" from object base references by the compiler or through use of VAR/READONLY parameters. So, the pointer values from the stack themselves need not be aligned. The PointerAlignment tells the collector at what alignment to expect to find pointers stored in the stack. Some compilers/targets may not require that pointer-valued fields in the stack be stored at aligned locations.<div><br></div><div><br></div><div><br><div><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div style="word-wrap: break-word; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div><font class="ecxApple-style-span" color="#0000ff"><font class="ecxApple-style-span" face="Gill Sans"><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Antony Hosking</span></span></font></font><font class="ecxApple-style-span" face="Gill Sans"><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxApple-converted-space"> </span>|<span class="ecxApple-converted-space"> </span></span></span><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; ">Associate Professor</span></span><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; "> | Computer Science | Purdue University</span></span></font></div><div><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light; ">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="ecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Office</span></span></font><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxApple-style-span" style="font-family: GillSans-Light; "> +1 765 494 6001 |<span class="ecxApple-converted-space"> </span></span></span></font><font class="ecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Mobile</span></span></font><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxApple-converted-space"> </span>+1 765 427 5484</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></span><br class="ecxApple-interchange-newline"></div><br><div><div>On 5 Apr 2010, at 08:03, Jay K wrote:</div><br class="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">hm I guess pointers themselves (not where they are stored) need not have any alignemnt?<br>We might only have a pointer into an array of bytes to keep the array alive,<br>no pointer to the base of the array?<br> <br>PROCEDURE F1()<br>VAR a: ARRAY OF CHAR := NEW(CHAR, 10);<br> i: INTEGER;<br>BEGIN<br> FOR i := FIRST(a) TO LAST(a) DO<br> something with a[i];<br> END<br>END F1;<br><br>might only have pointers to elements in a?<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:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Date: Mon, 5 Apr 2010 11:55:16 +0000<br>Subject: Re: [M3devel] RTMachine.PointerAlignment = 1 on NT?<br><br>Interesting:<br> <br>PROCEDURE NoteStackLocations (start, stop: ADDRESS) =<br> VAR fp : UNTRACED REF ADDRESS := start;<br> BEGIN<br> IF NOT (start < stop) THEN RETURN END;<br> stop := stop - ADRSIZE (ADDRESS); (* so we don't overrun the valid addresses *)<br> WHILE fp <= stop DO (* with the memory read on the next line. *)<br> WITH page = AddressToPage(fp^) DO<br> IF page # NIL AND page.desc.space = Space.Previous THEN<br> IF RTMachine.PointerAlignment = 1 THEN<br> IF Word.And(LOOPHOLE(fp, INTEGER), BYTESIZE(INTEGER) - 1) # 0 THEN<br> RTIO.PutText("pointer found on unaligned stack stack=");<br> RTIO.PutAddr(fp);<br> RTIO.PutText(" addr=");<br> RTIO.PutAddr(fp^);<br> RTIO.PutText("\n");<br> RTIO.Flush();<br> END;<br> END;<br> IF page.desc.pure<br> THEN PromotePage(page, PromoteReason.AmbiguousPure);<br> ELSE PromotePage(page, PromoteReason.AmbiguousImpure);<br> END;<br> END;<br> END;<br> INC(fp, RTMachine.PointerAlignment);<br> END;<br> END NoteStackLocations;<br><br> <br>generates a fair amount of output:<br><br><br>C:\dev2\cm3.2\m3-sys\mklib>cm3<br>--- building in NT386 ---<br>ignoring ..\src\m3overrides<br>pointer found on unaligned stack stack=0x12f3d2 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f11e addr=0x1400000<br>pointer found on unaligned stack stack=0x12f186 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f12e addr=0x1780000<br>pointer found on unaligned stack stack=0x12f1ba addr=0x1400000<br>pointer found on unaligned stack stack=0x12f442 addr=0x1460147<br>new source -> compiling Main.m3<br>pointer found on unaligned stack stack=0x12f3d2 addr=0x1400000<br> -> linking mklib.exe<br> <br> <br>I need to look a bit more, see what these values are.<br> We are probably being way over conservative, on NT.<br> Such unaligned values as 0x1460147 surely shouldn't count as traced pointers.<br> This example only has one but usually I see many more.<br> <br> <br>C:\dev2\cm3.2\m3-sys\cm3>cm3<br>--- building in NT386 ---<br>ignoring ..\src\m3overrides<br>pointer found on unaligned stack stack=0x12f3d2 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f642 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f176 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f11e addr=0x1400000<br>pointer found on unaligned stack stack=0x12f12a addr=0x1780000<br>pointer found on unaligned stack stack=0x12f1b6 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f61e addr=0x1400000<br>pointer found on unaligned stack stack=0x12f6de addr=0x1900069<br>pointer found on unaligned stack stack=0x12f43e addr=0x1400000<br>pointer found on unaligned stack stack=0x12f156 addr=0x1400000<br>pointer found on unaligned stack stack=0x12f66e addr=0x1400000<br>pointer found on unaligned stack stack=0x12f72e addr=0x1900069<br>pointer found on unaligned stack stack=0x12f792 addr=0x1cc0000<br>pointer found on unaligned stack stack=0x12fb26 addr=0x1d7015c<br>pointer found on unaligned stack stack=0x12fb52 addr=0x1d90142<br><br> <br>All this scanning around in memory the garbage collector has to do, doesn't that kill working set?<br>It makes all heap and stack part of the working set? Even if I'm not going to access it for long periods?<br> <br> <br> - Jay<br> <br> <hr id="ecxecxstopSpelling">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:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Date: Mon, 5 Apr 2010 11:41:10 +0000<br>Subject: [M3devel] RTMachine.PointerAlignment = 1 on NT?<br><br>For the vast majority of platforms:<br> <br> <br>RTMachine.PointerAlignment = BYTESIZE(INTEGER).<br> <br> <br>except 1 for NT386, 2 for M68K (dead).<br> <br> <br> PointerAlignment = BYTESIZE(INTEGER);<br> (* The C compiler allocates all pointers on 'PointerAlignment'-byte<br> boundaries. The garbage collector scans thread stacks, but only<br> looks at these possible pointer locations. Setting this value<br> smaller than is needed will only make your system run slower.<br> Setting it too large will cause the collector to collect storage<br> that is not free. *)<br><br> <br>I suggest this is not exactly true.<br> 1) Of what relevance is the C compiler? vs. the Modula-3 compiler.<br> 2) We really think the number is 1 for NT386? <span class="ecxApple-converted-space"> </span><br> <br>I understand I could say:<br>void F(void* traced)<br>{<br>#pragma pack(1)<br> struct { char a; void* p} = {0, traced};<br>}<br> <br>but<br> 1) That seems highly unlikely.<br> 2) Do we really anticipate the case where C code is the *only* holder of a traced reference?<br> And more so, it wasn't a parameter to the C code -- the location of parameters is controlled by Modula-3, assuming a pointer-aligned stack.<br> 3) Can't we know/assume/verify that Modula-3 code only stores pointers at more aligned location?<br> <br> <br>My real goal is to make there only be one RTMachine for systems that don't have stack walkers.<br>Leave SOLgnu/SOLsun alone.<br>(Later on implement stack walking for many platforms via libunwind.)<br> <br> <br>There are I believe only two differences to iron out. Allocation size (8K vs. 64K) and PointerAlignment (1 vs. BYTESIZE(INTEGER)).<br>There is a reason for NT to be 64K allocation size -- that is what VirtualAlloc uses.<br>I can test 64K on others.<br>Historically smaller is probably more efficient.<br>These days larger but not *too* large is probably more efficient.<br>64K should work fine on all platforms. Heck, even something larger like 1MB is probably good.<br>I'll test out 64K.<br> <br> <br>Can/should we have "paranoidgc" imply PointerAlignment = 1, and report whenever a pointer is found at a location with alignment less than BYTESIZE(pointer)?<br> <br> <br>A form of this is reasonable today, right? If PointerAligment = 1, I can have it report any found at less than BYTESIZE(pointer), test it a while, if none found, elevate NT386 to that value?<br>If any found, that'll help educate me/us on why it is 1, and maybe how to change it, or why leave it alone.<br> <br> <br> - Jay<br> <br><br></div></span></blockquote></div><br></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></div></body></html>