<div dir="ltr">I've just seen that the title said ABI for code jitted by Cog.<div><br></div><div>The Smalltalk-to-Smalltalk calling convention is described in StackToRegisterMappingCogit class>>callingConvention method comment. Calls to C use standard OS/Processor dependent calling conventions through the trampolines (routines performing stack switch, potential register saves, etc.). Calls from C to jitted code go through enilopmarts (trampolines written backwards, opposite of trampoline behavior)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 14, 2018 at 4:07 PM, Clément Bera <span dir="ltr"><<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Javier,<div><br></div><div><b>Frame layout:</b> See CoInterpreter>><wbr>initializeFrameIndices method code and comment which describe frame layout and provide correct indices.<div><br></div><div><b>Shape of the code:</b> I assume you're talking about shape of machine code version of methods/blocks. This is described in the CogMethod class comment. </div><div><br></div><div>To detect where a method starts and ends:</div><div>- the compiled method / compiled block in the heap has a pointer to the cog method in the code zone.</div><div>- from the cog method pointer, you've got a fixed offset to the entries to start executing machine code. See entryOffset / noCheckEntryOffset instance variables in Cogit class comment, note that in 32 bits I believe there's a jump back for Smi/Char in the entries so executable code actually starts before the entry and there's no reference to exactly where it starts (we have references only to places that can be called).</div><div>- from the cog method pointer, you can read in the header the block size to know where executable code stops and map for mcpc - bcpc debugging starts (See Cogit>>mapStartFor:, executable ends at cog method pointer + block size - 1)</div><div><br></div><div>Have fun :-)</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 14, 2018 at 3:32 PM, Javier Pimás <span dir="ltr"><<a href="mailto:elpochodelagente@gmail.com" target="_blank">elpochodelagente@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">For debugging aid, I'd like to know if there is any cheatsheet with things like frame layout in the native stack (offset of the compiled method, the receiver, temporaries) and shape of the code (i.e. how to detect where a method starts and ends). <div><br></div><div>Cheers,</div><div>Pocho<span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_-3064125974915179643gmail-m_-7025672014444116673gmail_signature"><div dir="ltr">Javier Pimás<br>Ciudad de Buenos Aires</div></div>
</font></span></div></div><span class="HOEnZb"><font color="#888888">
<br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-3064125974915179643gmail_signature"><div dir="ltr"><span style="font-size:12.8px">Clément Béra</span><div style="font-size:12.8px">Pharo consortium engineer</div><div style="font-size:12.8px"><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.<wbr>com/</a><br></div><div style="font-size:12.8px"><span style="line-height:16px">Bâtiment B 40, avenue Halley 59650 </span><span style="font-weight:bold;line-height:16px">Villeneuve d'Ascq</span></div></div></div>
</font></span></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-size:12.8px">Clément Béra</span><div style="font-size:12.8px">Pharo consortium engineer</div><div style="font-size:12.8px"><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.com/</a><br></div><div style="font-size:12.8px"><span style="line-height:16px">Bâtiment B 40, avenue Halley 59650 </span><span style="font-weight:bold;line-height:16px">Villeneuve d'Ascq</span></div></div></div>
</div>