Hi Igor,<br><br><div class="gmail_quote">On Wed, Mar 28, 2012 at 5:43 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
or perhaps not..<br>
i am trying to build the cog cocoa VMs using configs made by Esteban..<br>
<br>
CogCocoaIOSConfig new<br>
&quot;       generateForDebug;&quot;<br>
        generateForRelease;<br>
        addExternalPlugins: #( FT2Plugin  );<br>
        addInternalPlugins: #( UnixOSProcessPlugin );<br>
        generateSources; generate.<br>
<br>
<br>
it is not a functional bug.. because if i use #generateForDebug,<br>
everything works fine (but slow ;)<br>
but if i do #genearateForRelease, VM crashes with following:<br>
<br>
Program received signal EXC_BAD_ACCESS, Could not access memory.<br>
Reason: KERN_INVALID_ADDRESS at address: 0x5eedca7a<br></blockquote><div><br></div><div> 0x5eedca7a = 5EEDCA5E + a little, one orf my bad hex puns.  This is early in initialization in Cogit&gt;compileClosedPICPrototype.  5EEDCA5E  is used as a branch target in the PIC prototype.  The concretize methods need to know whether a jump target is pointing to a fixup or is some real address to jump to.  Look at the code generated for Cogit&gt;addressIsInInstructions: in the various concretize methods for jumps.  Looks like the optimizer is decidging that addressIsInInstructions: is always true.</div>
<div><br></div><div>e.g. what if you redefine Cogit&gt;addressIsInInstructions: so that instead of</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^self cCode: &#39;address &gt;= (void *)&amp;abstractOpcodes[0] &amp;&amp; address &lt; (void *)&amp;abstractOpcodes[opcodeIndex]&#39;</div>
<div>we use</div><div><span class="Apple-style-span"><span class="Apple-tab-span" style="white-space:pre">        </span>^self cCode: &#39;(unsigned long)(address) &gt;= (</span>unsigned long<span class="Apple-style-span">)&amp;abstractOpcodes[0] &amp;&amp; address &lt; (</span>unsigned long<span class="Apple-style-span">)&amp;abstractOpcodes[opcodeIndex]&#39;</span></div>
<div><span class="Apple-style-span"><br></span></div><div><span class="Apple-style-span">?</span></div><div><span class="Apple-style-span"><br></span></div><div><span class="Apple-style-span">HTH</span></div><div><span class="Apple-style-span">Eliot</span></div>
<div><span class="Apple-style-span"><br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
0x0000dfb6 in concretizeAt ()<br>
(gdb) bt<br>
#0  0x0000dfb6 in concretizeAt ()<br>
#1  0x00014996 in generateInstructionsAt ()<br>
#2  0x000000c9 in ?? ()<br>
<br>
i am not sure how to squeeze more info about this crash point..<br>
because stack trace is cut by gdb,<br>
which /.another rant here./ stupidly stops scanning stack frames once<br>
it discovers a frame which code is outside of memory covered by debug<br>
information..<br>
<br>
Ah.. yes.. and addition info.. the difference between generateForDebug<br>
and generateForRelease<br>
<br>
compilerFlagsRelease<br>
        ^#(<br>
        &quot;&#39;-fobjc-direct-dispatch&#39;&quot;<br>
        &#39;-msse3&#39;<br>
        &quot;&#39;-msse4.1&#39;&quot;<br>
        &quot;&#39;-msse4.2&#39;&quot;<br>
        &quot;&#39;-mdynamic-no-pic&#39;&quot;<br>
        &quot;&#39;-fwritable-strings&#39;&quot;<br>
        &#39;-Os&#39;<br>
        &#39;-fvisibility=hidden&#39;<br>
        &#39;-funroll-loops&#39;<br>
        &quot;&#39;-fno-asm&#39;&quot;<br>
        &#39;-fasm-blocks&#39;<br>
        &#39;-finline-functions&#39;<br>
        &#39;-mfpmath=sse&#39;<br>
        &#39;-fomit-frame-pointer&#39;<br>
        &#39;-march=pentium-m&#39;<br>
        &#39;-mtune=prescott&#39;<br>
        &#39;-falign-functions=16&#39;<br>
        &#39;-fno-gcse&#39;<br>
        &#39;-fno-cse-follow-jumps&#39;<br>
        &#39;-std=gnu99&#39;<br>
        &#39;-DBUILD_FOR_OSX&#39;<br>
        &#39;-DUSE_INLINE_MEMORY_ACCESSORS&#39;<br>
        &#39;-DLSB_FIRST&#39;<br>
        &#39;-DUSE_INLINE_MEMORY_ACCESSORS&#39;<br>
        &#39;-DHAVE_SYS_TIME_H&#39;<br>
        &#39;-DHAVE_NANOSLEEP&#39;<br>
        &#39;-DICC_DEBUG=0&#39;<br>
        &#39;-DICC_OPTLEVEL=&quot;speedHLO&quot;&#39;<br>
        &#39;-DICC_OPT_IPO_FOR_SINGLE_FILE_COMPILATION=1&#39;<br>
        &#39;-DICC_OPT_PARALLEL=0&#39;<br>
        &#39;-DICC_OPT_PREFETCH_INSERTION=1&#39;<br>
        &#39;-DICC_OPT_PROVIDE_FRAME_PTR=0&#39;<br>
        &#39;-DICC_OPT_USE_ARCH_IA32=&quot;SSE42&quot;&#39;)<br>
<br>
<br>
compilerFlagsDebug<br>
        ^#(<br>
           &#39;-g3&#39;<br>
           &#39;-O0&#39;<br>
           &#39;-DDEBUGVM=1&#39;)<br>
<font color="#888888"><br>
--<br>
Best regards,<br>
Igor Stasenko.<br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>