[racket-dev] Easy disassembly of JIT-compiled procedures

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Fri May 23 14:09:46 EDT 2014

Yes, as it says in the README, it requires a very recent version of
Racket. I should add that version requirement to the info file, but I
had forgotten the syntax when I was editing the file.

Sam

On Fri, May 23, 2014 at 2:02 PM, Roman Klochkov <kalimehtar at mail.ru> wrote:
> And now it is broken in 6.0.1
>
>> (require disassemble)
> . . ..\..\..\..\Program Files\Racket\collects\ffi\unsafe.rkt:198:2: ffi-obj:
> couldn't get "scheme_jit_find_code_end" from #f
>
> I installed it from pkgs.racket-lang.org
> Maybe should be something like #ifdef or depend on another version of Racket
> (now it depends upon Racket6.0.0.4)
>
> Wed, 21 May 2014 19:50:05 -0400 от Sam Tobin-Hochstadt
> <samth at cs.indiana.edu>:
>
> On Wed, May 21, 2014 at 6:12 PM, Neil Toronto <neil.toronto at gmail.com>
> wrote:
>> On 05/21/2014 02:09 PM, Sam Tobin-Hochstadt wrote:
>>>
>>> Racketeers,
>>>
>>> Thanks to some improvements from Matthew, my `disassemble` package is
>>> now much easier to use.
>>>
>>> [samth at punge:~/sw/disassemble (master) plt] racket
>>> Welcome to Racket v6.0.1.10.
>>>>
>>>> (require disassemble)
>>>> (define (const x) 1)
>>>> (disassemble const)
>>>
>>> 00000000 8943FC mov [ebx-0x4],eax
>>> 00000003 83C3FC add ebx,byte -0x4
>>> 00000006 B803000000 mov eax,0x3
>>> 0000000B 83C41C add esp,byte +0x1c
>>> 0000000E 5F pop edi
>>> 0000000F 5E pop esi
>>> 00000010 5B pop ebx
>>> 00000011 5D pop ebp
>>> 00000012 C3 ret
>>>>
>>>>
>>
>> That's crazy awesome. What were the improvements?
>
> First, Racket now tells you the end of the machine code for a jitted
> procedure with `scheme_jit_find_code_end` (so messing about with
> guessing the size is no longer needed) and it also can JIT on-demand
> (so you don't have to call a function before disassembling it) with
> `scheme_jit_now`.
>
> Sam
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
>
>
> --
> Roman Klochkov


Posted on the dev mailing list.