<div dir="ltr">Hi Nicolas, Hi Esteban, Hi Igor,<div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 12, 2017 at 5:36 AM, Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> <br><div dir="ltr">Couldn't it be that some Smalltalk memory has been relocated? (I'm thinking of the DisplayScreen bits)<br></div></blockquote><div><br></div><div>That's indeed the main bug.  There are issues with callbacks that confuse the error reporting and make it look like the primSignal:andReturnAs:fromContext: primitive fails when in fact it is the copyBits primitive that is failing.  But the problem is that the copyBits primitive calls back through the lockSurfaces and unlockSurfaces callbacks, and when a scavenge happens this moves destForm or sourceForm and the primitive attempts to access them after the callback and hence ends up accessing bad data and causes the primitive to fail.</div><div><br></div><div>I have fixed lockSurfaces and unlockSurfaces to not access destForm and sourceForm after the lockSurfaces and unlockSurfaces calls (by making sourceHandle and destHandle inst vars of BitBltSimulation) but it's not fully fixed yet.  I think querySurfaces is still involved and then there's the showDisplayBits:Left:Top:Right:Bottom: at the end.</div><div><br></div><div>I think I should commit the fixes I have so far and we should work towards removing all stale accesses from BitBltSimulation>>copyBits and BitBltSimulation>>warpBits.</div><div><br></div><div>These fixes include changing  platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c so that the callback functions can be optional, which reduces the number of callbacks and ups the frame rate a bit.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"></div><div class="gmail_extra">2017-03-12 12:53 GMT+01:00 Esteban Lorenzano <span dir="ltr"><<a href="mailto:estebanlm@gmail.com" target="_blank">estebanlm@gmail.com</a>></span>:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> <br><div style="word-wrap:break-word">Hi, <div><br></div><div>this is lockSurfaceFn: </div><div><br></div><div><div>createLockSurfaceFn</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">       </span>^ FFICallback </div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">               </span>signature: #(void * (void *handle, int *pitch, int x, int y, int w, int h))</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">           </span>block: [ :handle :pitch :x :y :w :h |</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">                 </span>pitch signedLongAt: 1 put: (self get_stride: handle).</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">                 </span>self get_data: handle ]</div></div><div><br></div><div>and</div><div><br></div><div><div>createUnlockSurfaceFn</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">        </span>^ FFICallback </div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">               </span>signature: #(int (void *handle, int x, int y, int w, int h))</div><div><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-tab-span" style="white-space:pre-wrap">          </span>block: [ :handle :x :y :w :h | 0 "Do nothing” ]</div></div><div><br></div><div>cheers!</div><div>Esteban</div><div><br><div><blockquote type="cite"><div>On 12 Mar 2017, at 03:34, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:</div><br class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-interchange-newline"><div><div dir="ltr" style="font-family:helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Hi Esteban,<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 10, 2017 at 7:35 AM, Esteban Lorenzano<span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:estebanlm@gmail.com" target="_blank">estebanlm@gmail.com</a><wbr>></span><span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>Hi,<br><br>I’m tumbling into an error in Pharo, because we use callbacks intensively, in Athens(cairo)-to-World conversion in particular, and people is sending always their crash reports… we made the whole conversion a lot more robust since problems started to arise, but now I hit a wall I cannot solve: I think problem is in something in callbacks.<br></blockquote><div><br></div><div>My original theory is wrong.  As you suspected it is something to do with the callback in primitiveCopyBits via lockSurfaces & unlockSurfaces.  Can you tell me what the callback is and what code installs it into the lockSurfaceFn and unlockSurfaceFn?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>And problem is showing very easy on 64bits (while in 32bits it takes time and is more random).<br><br>Here is the easiest way to reproduce it (in mac):<br><br>wget<span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span><a href="http://files.pharo.org/get-files/60/pharo64-mac-latest.zip" rel="noreferrer" target="_blank">files.pharo.org/get-files<wbr>/60/pharo64-mac-latest.zip</a><br>wget<span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span><a href="http://files.pharo.org/get-files/60/pharo64.zip" rel="noreferrer" target="_blank">files.pharo.org/get-files<wbr>/60/pharo64.zip</a><br>wget<span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span><a href="http://files.pharo.org/get-files/60/sources.zip" rel="noreferrer" target="_blank">files.pharo.org/get-files<wbr>/60/sources.zip</a><br>unzip pharo64-mac-latest.zip<br>unzip pharo64.zip<br>unzip sources.zip<br>./Pharo.app/Contents/MacOS/Pha<wbr>ro ./Pharo64-60438.image eval "VGTigerDemo runDemo"<br><br>eventually (like 5-6 seconds after, if not immediately), you will have a stack like this:<br><br>SmallInteger(Object)>>primitiv<wbr>eFailed:<br>SmallInteger(Object)>>primitiv<wbr>eFailed<br>SmallInteger(VMCallbackContext<wbr>64)>>primSignal:andReturnAs:fr<wbr>omContext:<br>GrafPort>>copyBits<br>GrafPort>>image:at:sourceRect:<wbr>rule:<br>FormCanvas>>image:at:sourceRec<wbr>t:rule:<br>FormCanvas(Canvas)>>drawImage:<wbr>at:sourceRect:<br>FormCanvas(Canvas)>>drawImage:<wbr>at:<br>VGTigerDemo>>runDemo<br>VGTigerDemo class>>runDemo<br>UndefinedObject>>DoIt<br>OpalCompiler>>evaluate<br>OpalCompiler(AbstractCompiler)<wbr>>>evaluate:<br>[ result := Smalltalk compiler evaluate: aStream.<br>self hasSessionChanged<br>       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>ifFalse: [ self stdout<br>                       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>print: result;<br>                       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>lf ] ] in EvaluateCommandLineHandler>>ev<wbr>aluate: in Block: [ result := Smalltalk compiler evaluate: aStream....<br>BlockClosure>>on:do:<br>EvaluateCommandLineHandler>>ev<wbr>aluate:<br>EvaluateCommandLineHandler>>ev<wbr>aluateArguments<br>EvaluateCommandLineHandler>>ac<wbr>tivate<br>EvaluateCommandLineHandler class(CommandLineHandler class)>>activateWith:<br>[ aCommandLinehandler activateWith: commandLine ] in PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>activateSu<wbr>bCommand: in Block: [ aCommandLinehandler activateWith: commandLine ]<br>BlockClosure>>on:do:<br>PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>activateSu<wbr>bCommand:<br>PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>handleSubc<wbr>ommand<br>PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>handleArgu<wbr>ment:<br>[ self<br>       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>handleArgument:<br>               <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>(self arguments<br>                       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>ifEmpty: [ '' ]<br>                       <span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span>ifNotEmpty: [ :arguments | arguments first ]) ] in PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>activate in Block: [ self...<br>BlockClosure>>on:do:<br>PharoCommandLineHandler(BasicC<wbr>ommandLineHandler)>>activate<br>PharoCommandLineHandler>>activ<wbr>ate<br>PharoCommandLineHandler class(CommandLineHandler class)>>activateWith:<br>[ super activateWith: aCommandLine ] in PharoCommandLineHandler class>>activateWith: in Block: [ super activateWith: aCommandLine ]<br><br>Any idea?<br><br>thanks!<br><span class="gmail-m_-6893462261879968108m_-4906969583213588979HOEnZb"><font color="#888888">Esteban</font></span></blockquote></div><br><br clear="all"><div><br></div>--<span class="gmail-m_-6893462261879968108m_-4906969583213588979Apple-converted-space"> </span><br><div class="gmail-m_-6893462261879968108m_-4906969583213588979gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></blockquote></div><br></div></div><br></blockquote></div><br></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>