[Vm-dev] Shape/ABI of code jitted by cog?

Clément Bera bera.clement at gmail.com
Wed Feb 14 15:07:09 UTC 2018


Hi Javier,

*Frame layout:* See CoInterpreter>>initializeFrameIndices method code and
comment which describe frame layout and provide correct indices.

*Shape of the code:* I assume you're talking about shape of machine code
version of methods/blocks. This is described in the CogMethod class
comment.

To detect where a method starts and ends:
- the compiled method / compiled block in the heap has a pointer to the cog
method in the code zone.
- 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).
- 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)

Have fun :-)

On Wed, Feb 14, 2018 at 3:32 PM, Javier Pimás <elpochodelagente at gmail.com>
wrote:

>
> 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).
>
> Cheers,
> Pocho
>
> --
> Javier Pimás
> Ciudad de Buenos Aires
>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180214/e6e44810/attachment.html>


More information about the Vm-dev mailing list