Paste: hello dis

Author: mnestic
Mode: assembly-x86
Date: Tue, 15 Dec 2009 23:54:48
Plain Text |
( scratchpad ) Loading resource:basis/tools/disassembler/gdb/gdb.factor
USE: tools.disassembler.gdb \ hello disassemble
[Thread debugging using libthread_db enabled]
[New Thread 0xb77ea6c0 (LWP 30093)]
[New Thread 0xaef8fb90 (LWP 30094)]
0xb7f31410 in __kernel_vsyscall ()
Dump of assembler code from 0xaf7dfbd0 to 0xaf7dfbf0:
0xaf7dfbd0: mov    $0xb438986b,%eax
0xaf7dfbd5: add    $0x4,%esi
0xaf7dfbd8: mov    %eax,(%esi)
0xaf7dfbda: mov    $0xaf7dfbe4,%ebx
0xaf7dfbdf: jmp    0xaf411610
0xaf7dfbe4: add    %al,(%eax)
0xaf7dfbe6: add    %al,(%eax)
0xaf7dfbe8: add    %al,(%eax)
0xaf7dfbea: add    %al,(%eax)
0xaf7dfbec: add    %al,(%eax)
0xaf7dfbee: add    %al,(%eax)
End of assembler dump.

Annotation: foo dis

Author: mnestic
Mode: factor
Date: Wed, 16 Dec 2009 00:01:44
Plain Text |
( scratchpad ) : foo ( -- ) { 1 2 3 } [ 1 + ] map . ;
( scratchpad ) 
( scratchpad ) \ foo optimized.
[
    3 dup 0 <array>
    dup >R "COMPLEX SHUFFLE" 0 "COMPLEX SHUFFLE" \ ( gensym ) [
        pick pick fixnum< [
            ( 5266786 5266790 5267231 -- 5266786 5267231 5266786 5266790 5267231 )
            >R >R >R >R dup >R
            { 1 2 3 } >R R> swap 2 fixnum+fast slot 1 +
            R> R> >R R> swap 2 fixnum+fast set-slot
            R> R> R> "COMPLEX SHUFFLE" 1 fixnum+fast
            "COMPLEX SHUFFLE" ( gensym )
        ] [ 3drop ] if
    ] label R> .
]
( scratchpad ) \ foo test-mr.
=== word: foo, label: foo

_label 0 
_prologue T{ stack-frame
    { total-size 64 }
    { spill-area-size 8 }
    { calls-vm? t }
} 
_label 1 
##gc EAX ECX 32 { } { } f 
##load-immediate EAX 48 
##load-immediate ECX 0 
##allot EDX 20 array EBP 
##set-slot-imm EAX EDX 1 2 
##set-slot-imm ECX EDX 2 2 
##set-slot-imm ECX EDX 3 2 
##set-slot-imm ECX EDX 4 2 
##inc-d 3 
##inc-r 1 
##replace EDX R 0 
_label 2 
_spill EDX int-rep T{ spill-slot } 
_spill EAX int-rep T{ spill-slot { n 4 } } 
_branch 7 
_label 3 
_reload EDX int-rep T{ spill-slot } 
_label 4 
##load-reference EBP { 1 2 3 } 
##add-imm EBX ECX 32 
##shr-imm EBX EBX 2 
##add-imm EBX EBX -2 
##slot EBP EBP EBX 
##load-immediate EBX 16 
##inc-d -1 
##inc-r 5 
##replace ECX R 2 
##replace EBP D 1 
##replace EDX R 4 
##replace EBX D 0 
##replace ECX R 0 
##replace EDX R 1 
##replace EAX R 3 
_label 5 
##call + 
_label 6 
##peek EDX R 4 
_spill EDX int-rep T{ spill-slot } 
##peek EBP D 0 
##peek EBX R 0 
##peek EDX R 1 
##peek ECX R 2 
##peek EAX R 3 
_spill EAX int-rep T{ spill-slot { n 4 } } 
##add-imm EBX EBX 32 
##shr-imm EBX EBX 2 
##add-imm EBX EBX -2 
##set-slot EBP EDX EBX 
##write-barrier EDX EBX EAX EBP 
##add-imm ECX ECX 16 
##inc-d 2 
##inc-r -5 
_label 7 
_reload EAX int-rep T{ spill-slot { n 4 } } 
_compare-branch 3 ECX EAX cc< 
_label 8 
##peek EAX R 0 
##inc-d -3 
##inc-d 1 
##inc-r -1 
##replace EAX D 0 
_label 9 
_epilogue T{ stack-frame
    { total-size 64 }
    { spill-area-size 8 }
    { calls-vm? t }
} 
##jump . 
_spill-area-size 8 

( scratchpad ) \ foo disassemble
[Thread debugging using libthread_db enabled]
[New Thread 0xb77ea6c0 (LWP 30093)]
[New Thread 0xaef8fb90 (LWP 30094)]
0xb7b8536f in std::_Rb_tree_insert_and_rebalance ()
   from /usr/lib/libstdc++.so.6
Dump of assembler code from 0xaf8b31b0 to 0xaf8b32f0:
0xaf8b31b0: push   $0x40
0xaf8b31b5: push   $0xaf8b31b0
0xaf8b31ba: sub    $0x34,%esp
0xaf8b31bd: mov    $0x809121c,%eax
0xaf8b31c2: mov    (%eax),%ecx
0xaf8b31c4: add    $0x20,%ecx
0xaf8b31c7: mov    0x8(%eax),%eax
0xaf8b31ca: cmp    %eax,%ecx
0xaf8b31cc: jle    0xaf8b3201
0xaf8b31d2: mov    $0x8091218,%eax
0xaf8b31d7: mov    (%eax),%eax
0xaf8b31d9: lea    -0x4(%esp),%ecx
0xaf8b31dd: mov    %ecx,(%eax)
0xaf8b31df: mov    %esi,0x8(%eax)
0xaf8b31e2: mov    %edi,0xc(%eax)
0xaf8b31e5: lea    0x28(%esp),%eax
0xaf8b31e9: movl   $0x8091218,0x8(%esp)
0xaf8b31f1: movl   $0x0,0x4(%esp)
0xaf8b31f9: mov    %eax,(%esp)
0xaf8b31fc: call   0x8077700 <inline_gc>
0xaf8b3201: mov    $0x30,%eax
0xaf8b3206: xor    %ecx,%ecx
0xaf8b3208: mov    $0x809121c,%edx
0xaf8b320d: mov    (%edx),%ebp
0xaf8b320f: movl   $0x8,0x0(%ebp)
0xaf8b3216: or     $0x2,%ebp
0xaf8b3219: addl   $0x20,(%edx)
0xaf8b321c: mov    %eax,0x2(%ebp)
0xaf8b321f: mov    %ecx,0x6(%ebp)
0xaf8b3222: mov    %ecx,0xa(%ebp)
0xaf8b3225: mov    %ecx,0xe(%ebp)
0xaf8b3228: add    $0xc,%esi
0xaf8b322b: add    $0x4,%edi
0xaf8b322e: mov    %ebp,(%edi)
0xaf8b3230: mov    %ebp,0x20(%esp)
0xaf8b3234: mov    %eax,0x24(%esp)
0xaf8b3238: jmp    0xaf8b32bb
0xaf8b323d: mov    0x20(%esp),%ebp
0xaf8b3241: mov    $0xb523b4f2,%edx
0xaf8b3246: lea    0x20(%ecx),%ebx
0xaf8b3249: shr    $0x2,%ebx
0xaf8b324c: add    $0xfffffffe,%ebx
0xaf8b324f: mov    (%edx,%ebx,1),%edx
0xaf8b3252: mov    $0x10,%ebx
0xaf8b3257: sub    $0x4,%esi
0xaf8b325a: add    $0x14,%edi
0xaf8b325d: mov    %ecx,-0x8(%edi)
0xaf8b3260: mov    %edx,-0x4(%esi)
0xaf8b3263: mov    %ebp,-0x10(%edi)
0xaf8b3266: mov    %ebx,(%esi)
0xaf8b3268: mov    %ecx,(%edi)
0xaf8b326a: mov    %ebp,-0x4(%edi)
0xaf8b326d: mov    %eax,-0xc(%edi)
0xaf8b3270: call   0xaf1fe480
0xaf8b3275: mov    -0x10(%edi),%ebp
0xaf8b3278: mov    %ebp,0x20(%esp)
0xaf8b327c: mov    (%esi),%edx
0xaf8b327e: mov    (%edi),%ebx
0xaf8b3280: mov    -0x4(%edi),%ebp
0xaf8b3283: mov    -0x8(%edi),%ecx
0xaf8b3286: mov    -0xc(%edi),%eax
0xaf8b3289: mov    %eax,0x24(%esp)
0xaf8b328d: add    $0x20,%ebx
0xaf8b3290: shr    $0x2,%ebx
0xaf8b3293: add    $0xfffffffe,%ebx
0xaf8b3296: mov    %edx,0x0(%ebp,%ebx,1)
0xaf8b329a: lea    0x0(%ebp,%ebx,1),%eax
0xaf8b329e: shr    $0x8,%eax
0xaf8b32a1: movb   $0xc0,-0x4f9127f8(%eax)
0xaf8b32a8: shr    $0xa,%eax
0xaf8b32ab: movb   $0xc0,0x808e9a6(%eax)
0xaf8b32b2: add    $0x10,%ecx
0xaf8b32b5: add    $0x8,%esi
0xaf8b32b8: sub    $0x14,%edi
0xaf8b32bb: mov    0x24(%esp),%eax
0xaf8b32bf: cmp    %eax,%ecx
0xaf8b32c1: jl     0xaf8b323d
0xaf8b32c7: mov    (%edi),%eax
0xaf8b32c9: sub    $0xc,%esi
0xaf8b32cc: add    $0x4,%esi
0xaf8b32cf: sub    $0x4,%edi
0xaf8b32d2: mov    %eax,(%esi)
0xaf8b32d4: add    $0x3c,%esp
0xaf8b32d7: mov    $0xaf8b32e1,%ebx
0xaf8b32dc: jmp    0xaf4a1800
0xaf8b32e1: add    %al,(%eax)
0xaf8b32e3: add    %al,(%eax)
0xaf8b32e5: add    %al,(%eax)
0xaf8b32e7: add    %al,(%eax)
0xaf8b32e9: add    %al,(%eax)
0xaf8b32eb: add    %al,(%eax)
0xaf8b32ed: add    %al,(%eax)
0xaf8b32ef: add    %ah,(%eax)
End of assembler dump.

Annotation: compiler.graphiz

Author: mnestic
Mode: factor
Date: Wed, 16 Dec 2009 00:13:36
Plain Text |
compiler.graphiz output of the control flow graph http://screencast.com/t/OTkyZGNm

New Annotation

Summary:
Author:
Mode:
Body: