[Pharo-dev] Compiler Explorer (for the Compiler guys) #offtopic

Clément Bera bera.clement at gmail.com
Wed Oct 18 09:05:58 EDT 2017


On Wed, Oct 18, 2017 at 1:42 PM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

>
>
> On Wed, Oct 18, 2017 at 3:36 AM, Tudor Girba <tudor at tudorgirba.com> wrote:
>
>> Hi,
>>
>> This is already available since some time in the GTInspector. You can
>> just inspect a compiled method. You will get both the bytecode and the AST
>> (with source tracking, too). In fact, this was one of the original reasons
>> why GTInspector exists: I wanted to figure out how the AST is structured so
>> that I can write queries against it :).
>>
>
>
> Sure, we just miss machine code :)
>

Yeah the machine code is what matters.


> But...AFAIR to get the machine code of a method it needs VMMaker to be
> loaded....
>

I was thinking of changing that, adding a primitive which answers a
CogMethod as a bytearray, but you still need to use external libs such as
gdb/lldb to disassemble your binary (which is possible but not working out
of the box everywhere and it does not make sense to include that as part of
the VM), and you still need something extracted from VMMaker to make sense
out of the CogMethod header and CogMethod map, which has a lot of
dependencies, so likely the whole VMMaker itself. And I'm not talking about
all the different CogMethod flavors.

With VMMaker loaded you can do it with in-image compilation but you will
have the machine code with only unlinked sends. With linked send it's more
difficult as you need to really simulate the whole runtime.

Overall there's no amazing solution. In the example shown it's easier as in
C++ the code is not modified while it runs and you've already have gdb/lldb
APIs to show what they show.



>
>
>
>
>
>>
>>
>> Cheers,
>> Doru
>>
>>
>> On Oct 17, 2017, at 10:03 PM, Esteban A. Maringolo <emaringolo at gmail.com>
>> wrote:
>>
>> I'm sure we could do this with ease, because we already can see the
>> bytecodes.
>>
>> https://godbolt.org/
>>
>> Regards!
>>
>> Esteban A. Maringolo
>>
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "The coherence of a trip is given by the clearness of the goal."
>>
>>
>>
>>
>>
>>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
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.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20171018/4868aa30/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiled-method-bytecode.png
Type: image/png
Size: 98926 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20171018/4868aa30/attachment.png>


More information about the Pharo-dev mailing list