<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true"><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; "><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; "><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><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'">OK, remind me again what happens with @M3nogc.  That will prevent movement, and should allow you to protect state as you originally intended, without worrying about it being GC'd or moved..</font></span></div><div><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'"><span class="Apple-style-span" style="font-size: medium;"><br></span></font></div><div><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'"><span class="Apple-style-span" style="font-size: medium;">From what you are saying though, it appears that even with @M3nogc the corruption is not deterministic.  Which does make it tricky to nail down where it occurs.</span></font></div><div><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'"><span class="Apple-style-span" style="font-size: medium;"><br></span></font></div></span></span></span></span></span></span></span></span></div></span></div></span> </div><br><div><div>On 29 Sep 2009, at 01:39, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; 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: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">oops, thanks, I forgot gc is compacting.<br><br>I don't see how to use a hardware breakpoint,<br>the corruption seems to always move around.<br> <br>This is an attempt to set a hardware breakpoint programmatically based<br>on what the runtime addresses happen to be.<br> <br>I do know these bytes are getting overwritten.<br>If I assert they are zero in Join, inevitably the assert fails.<br> <br>I think I might try to vary the Juno pixmaps, see if the altered<br>data appears in the corruption, try to prove, as it appears,<br>that the corruption is pixmap data.<br><br>Thanks,<br> - Jay<br><br><br> <br><hr id="stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>Date: Mon, 28 Sep 2009 10:04:55 -0400<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] help debugging Juno..sanity check?<br><br>Huh?  I don't understand the point of all of this.  Threads can be moved by the GC, even if referenced from globals.  The only way to prevent a thread moving is to keep a reference to it on some thread stack.  (I still don't know what you are trying to achieve -- why not use a hardware breakpoint in the debugger?).  That's how I found the race in ScrollerVBTClass.m3.<div><div><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; "><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; "><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><span class="ecxApple-style-span" style="font-size: medium; "><font class="ecxApple-style-span" color="#0000ff" face="'Gill Sans'"><br></font></span></div></span></span></span></span></span></span></span></span></div></span></div></span></div><div><div>On 28 Sep 2009, at 09:11, 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; color: rgb(0, 0, 0); word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">So, I know that ThreadWin32.T instances are prone to being overwritten.<br> <br>So I did this:<br> <br> <br>  T = BRANDED "Thread.T Win32-1.0" OBJECT<br>>      pad1: ARRAY [0..16_1000] OF CHAR;<br>>      protect: ARRAY [0..16_1] OF CHAR;<br>>      pad2: ARRAY [0..16_1000] OF CHAR;<br> <br>And then there are two occurences of NEW(T):<br> <br><br>      next_self          := NEW(T);<br>>      Protect(next_self);<br><br> <br>PROCEDURE CreateT (act: Activation): T =<br>  (* LL = 0, because allocating a traced reference may cause<br>     the allocator to start a collection which will call "SuspendOthers"<br>     which will try to acquire "activeMu". *)<br>  VAR t := NEW(T, act := act);<br>  BEGIN<br>>    Protect(t);<br><br> <br>PROCEDURE Protect(t: T)=<br>VAR old: WinDef.DWORD;<br>BEGIN<br> EVAL WinBase.VirtualProtect(LOOPHOLE(ADR(t.protect), SIZE_T), 1, PAGE_READONLY, ADR(old));<br>END Protect;<br><br> <br>This should catch any writes to these fields.<br> <br> <br>Now, a thread can be garbage collected and reused.<br>And I'd want to unprotect this memory.<br>Or prevent the garbage collector from deciding any thread is garbage.<br> Second option seems easier and suffices.<br> <br> <br>So:<br> <br> <br>VAR<br>threads: ARRAY[0..2000] OF T;  (* big enough for our purposes *)<br>threadCount: INTEGER;<br><br> <br>and more completely:<br> <br>PROCEDURE Protect(t: T)=<br>VAR old: WinDef.DWORD;<br>BEGIN<br> EVAL WinBase.VirtualProtect(LOOPHOLE(ADR(t.protect), SIZE_T), 1, PAGE_READONLY, ADR(old));<br> RTIO.PutInt(threadCount);<br> RTIO.PutText(" ");<br> RTIO.PutAddr(ADR(threads));<br> RTIO.PutText(" ");<br> RTIO.PutAddr(ADR(t.protect));<br> RTIO.PutText("\n");<br> threads[threadCount] := t;<br> INC(threadCount);<br>END Protect;<br><br> <br>And just in case, I emptied out the FreeSlot function.<br> <br> <br>But yet I get:<br> <br>0 0xe2abe0 0x1141021<br>1 0xe2abe0 0x114b429<br>2 0xe2abe0 0x11a2311<br>3 0xe2abe0 0x11a48b1<br>4 0xe2abe0 0x11ab499<br>5 0xe2abe0 0x12e9f11<br>6 0xe2abe0 0x12d211d<br><strong>7 0xe2abe0 0x11bd691<br></strong>8 0xe2abe0 0x11d1011<br>9 0xe2abe0 0x11d3e2d<br>10 0xe2abe0 0x11d6759<br>11 0xe2abe0 0x11d8bd1<br>12 0xe2abe0 0x12089f1<br>13 0xe2abe0 0x1211455<br>14 0xe2abe0 0x12138cd<br>15 0xe2abe0 0x1215ecd<br>16 0xe2abe0 0x12184cd<br>17 0xe2abe0 0x121bcd5<br>18 0xe2abe0 0x121e35d<br>Grow (0x210000) => 0x2120000   total: 4.1M   span: 17.9M   density: 23%<br>(b60.9d4): Access violation - code c0000005 (first chance)<br>First chance exceptions are reported before any exception handling.<br>This exception may be expected and handled.<br>eax=011b0000 ebx=00010000 ecx=00000060 edx=00000000 esi=011b0000 edi=011bd000<br>eip=78545e37 esp=01cae5ec ebp=01cae5f0 iopl=0         nv up ei pl nz na pe nc<br>cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206<br>MSVCR90!fastzero_I+0x20:<br>78545e37 660f7f07        movdqa  xmmword ptr [edi],xmm0 ds:0023:011bd000=0000000<br>0000000000000000000000000<br>0:003> k<br>ChildEBP RetAddr<br>01cae5f0 78545ea9 MSVCR90!fastzero_I+0x20<br>01cae610 005dad48 MSVCR90!_VEC_memzero+0x36<br>01cae634 005d1f34 m3core!RTMisc__Zero+0x1f<br>01cae68c 005c8191 m3core!RTHeapRep__LongAlloc+0xf3<br>01cae6d8 005c7793 m3core!RTAllocator__AllocTraced+0xec<br>01cae70c 005c728d m3core!RTAllocator__GetTracedObj+0x8c<br>01cae730 005d07d9 m3core!RTHooks__AllocateTracedObj+0x15<br>01cae784 005d033f m3core!RTCollector__CollectSomeInStateZero+0x45e<br>01cae798 005cffd6 m3core!RTCollector__CollectSome+0x6e<br>01cae7dc 005c817c m3core!RTHeapRep__CollectEnough+0x9b<br>01cae81c 005c7d06 m3core!RTAllocator__AllocTraced+0xd7<br>01cae858 005c7348 m3core!RTAllocator__GetOpenArray+0x97<br>01cae880 00f9f50d m3core!RTHooks__AllocateOpenArray+0x19<br>01cae930 00f9f201 m3ui!WinScrnPixmap__PixmapFromRaw__ConvertColor+0x8f<br>01cae958 00f9e22f m3ui!WinScrnPixmap__PixmapFromRaw+0x71<br>01cae9ac 00eb4121 m3ui!WinScrnPixmap__Load+0x320<br>01caeee4 00eb298d m3vbtkit!Image__ScaleRaw+0xb30<br>01caef44 00fb2b72 m3vbtkit!Image__ApplyScaled1+0x166<br>01caef70 00fc0af8 m3ui!VBTRep__PixmapApply+0xbf<br>01caefcc 00fa6766 m3ui!Palette__ResolvePixmap+0x7db<br>0:003> r edi<br><strong>edi=011bd000<br></strong>0:003><br> <br> <br>What am I confused about?<br> <br>Why does it seem that even if I store some pointers in globals, they are getting garbage collected and reused?<br> <br>I should debug BuildGlobalMap??<br> <br> - Jay<br></div></span></blockquote></div><br></div></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></body></html>