[Vm-dev] Shape/ABI of code jitted by cog?
elpochodelagente at gmail.com
Wed Feb 14 16:44:59 UTC 2018
Great! I'll have a look at all this and ask for more info if needed,
On Wed, Feb 14, 2018 at 12:11 PM, Clément Bera <bera.clement at gmail.com>
> I've just seen that the title said ABI for code jitted by Cog.
> 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)
> On Wed, Feb 14, 2018 at 4:07 PM, Clément Bera <bera.clement at gmail.com>
>> 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
>> 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).
>>> Javier Pimás
>>> Ciudad de Buenos Aires
>> Clément Béra
>> Pharo consortium engineer
>> Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
> Clément Béra
> Pharo consortium engineer
> Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
Ciudad de Buenos Aires
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev