<div dir="ltr">Hi Tim,<div><br></div><div>    the attributes are only ever meaningful for static functions.  gcc (and other compilers) use faster register-based calling conventions where possible when the optimize.  Non-static functions can&#39;t be so optimized because they have to accord with the Application Binary Interface (ABI) and on x86 that&#39;s a purely stack-based calling convention.  But static functions are not visible outside the file and so the optimizer is free to so optimize.  But that breaks the use of static functions within gdb; gdb only knows how to call functions that accord with the ABI.  Given that we don&#39;t care too much about performance in the Debug and Assert VMs but we /do/ care about debuggability (and hence being able to call useful functions, be they static or not) I try and apply the &quot;don&#39;t use register parameters&quot; attribute to these functions.</div><div><br></div><div>Des this make sense to you?  Cuz if it isn&#39;t you need to understand it before you can fix it, otherwise you&#39;ll waste a lot of effort chasing down rat holes.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 31, 2015 at 3:33 PM, gettimothy <span dir="ltr">&lt;<a href="mailto:gettimothy@zoho.com" target="_blank">gettimothy@zoho.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><u></u><div><div style="font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif"><div>Hi all.</div><div><br></div><div><br></div><div>I implemented a simple test case to test my theory that my platform does not support the regparms(0) function attribute and my theory is bunk. bleah.</div><div><br></div><div>I modified this autotools tutorial&#39;s source files at </div><div><br></div><div><a href="http://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html" target="_blank">http://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html</a><br></div><div><br></div><div>to mimic the __attribute__((regparms(0))) behavior in cog.</div><div><br></div><div>I could not recreate the error under any compination of PRODUCTION and #if #else conditions.</div><div>I am at a loss at the moment (and sick with a cold) so I will have to revisit this later.</div><div>CMakeVMMakerSqueak dev is blocked by this issue.</div><div><br></div><div><br></div><div>I added a test.h file to the src directory that looks like this:</div><div><br></div><div><br></div><div><br><blockquote style="border-top-color:rgb(204,204,204);border-left-color:rgb(204,204,204);border-right-color:rgb(204,204,204);border-bottom-color:rgb(204,204,204);border-top-width:1px;border-left-width:1px;border-right-width:1px;border-bottom-width:1px;border-top-style:solid;border-left-style:solid;border-right-style:solid;border-bottom-style:solid;padding-top:7px;padding-right:7px;padding-bottom:7px;padding-left:7px;background-color:rgb(245,245,245)"><div> bash-4.2$ cat test.h <br>#undef NoDbgRegParms<br>#define PRODUCTION 1<br>#if !PRODUCTION &amp;&amp; defined(__GNUC__) &amp;&amp; !defined(NoDbgRegParms)<br># define NoDbgRegParms __attribute__ ((regparm(0)))<br>#else<br># define NoDbgRegParms __attribute__ ((deprecated))<br>#endif<br><br>int plus (int a, int b) NoDbgRegParms;</div></blockquote><br>and modified the main.c .<br><blockquote style="border-top-color:rgb(204,204,204);border-left-color:rgb(204,204,204);border-right-color:rgb(204,204,204);border-bottom-color:rgb(204,204,204);border-top-width:1px;border-left-width:1px;border-right-width:1px;border-bottom-width:1px;border-top-style:solid;border-left-style:solid;border-right-style:solid;border-bottom-style:solid;padding-top:7px;padding-right:7px;padding-bottom:7px;padding-left:7px;background-color:rgb(245,245,245)"><div>bash-4.2$ cat src/main.c<br>#include &lt;config.h&gt; <br>#include &lt;stdio.h&gt;<br>#include &quot;test.h&quot;<br><br>int main(void){<br>  int p;<br><br>  puts(&quot;Hello World!&quot;);<br>  puts (&quot;This is &quot; PACKAGE_STRING &quot;.&quot;);<br><br>  p=plus(3,3);<br><br>  printf(&quot;%d\n&quot;,p);<br>  return 0;<br>}<br><br>int plus (int a, int b) {<br> return a + b;<br>}<br><br><blockquote style="border-top-color:rgb(204,204,204);border-left-color:rgb(204,204,204);border-right-color:rgb(204,204,204);border-bottom-color:rgb(204,204,204);border-top-width:1px;border-left-width:1px;border-right-width:1px;border-bottom-width:1px;border-top-style:solid;border-left-style:solid;border-right-style:solid;border-bottom-style:solid;padding-top:7px;padding-right:7px;padding-bottom:7px;padding-left:7px;background-color:rgb(245,245,245)"><div> </div></blockquote><br><br></div></blockquote></div></div></div><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div>