Skip to content

Instantly share code, notes, and snippets.

@alexanderjsingleton
Created October 18, 2015 01:55
Show Gist options
  • Save alexanderjsingleton/60ad487d0c156b77b607 to your computer and use it in GitHub Desktop.
Save alexanderjsingleton/60ad487d0c156b77b607 to your computer and use it in GitHub Desktop.
➜ Desktop ruby fizzbuzz.rb
fizzbuzz
== disasm: <RubyVM::InstructionSequence:fizzbuzz@fizzbuzz.rb>===========
== catch table
| catch type: break st: 0004 ed: 0008 sp: 0000 cont: 0008
|------------------------------------------------------------------------
local table (size: 2, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] array<Arg>
0000 trace 8 ( 3)
0002 trace 1 ( 4)
0004 getlocal_OP__WC__0 2
0006 send <callinfo!mid:map!, argc:0, block:block in fizzbuzz>
0008 trace 16 ( 19)
0010 leave ( 4)
== disasm: <RubyVM::InstructionSequence:block in fizzbuzz@fizzbuzz.rb>==
== catch table
| catch type: redo st: 0000 ed: 0086 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0086 sp: 0000 cont: 0086
|------------------------------------------------------------------------
local table (size: 4, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s3)
[ 4] number<Arg>[ 3] divisibleBy3[ 2] divisibleBy5
0000 trace 256 ( 4)
0002 trace 1 ( 5)
0004 trace 1
0006 getlocal_OP__WC__0 4
0008 putobject 3
0010 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0012 putobject_OP_INT2FIX_O_0_C_
0013 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0015 setlocal_OP__WC__0 3
0017 trace 1 ( 6)
0019 trace 1
0021 getlocal_OP__WC__0 4
0023 putobject 5
0025 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0027 putobject_OP_INT2FIX_O_0_C_
0028 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0030 setlocal_OP__WC__0 2
0032 trace 1 ( 17)
0034 getlocal_OP__WC__0 3 ( 9)
0036 dup
0037 branchunless 42
0039 pop
0040 getlocal_OP__WC__0 2
0042 branchif 61
0044 getlocal_OP__WC__0 3 ( 11)
0046 branchif 70
0048 getlocal_OP__WC__0 2 ( 13)
0050 branchif 79
0052 trace 1 ( 16)
0054 putself
0055 getlocal_OP__WC__0 4
0057 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0059 jump 86 ( 17)
0061 trace 1 ( 10)
0063 putself
0064 putstring "FizzBuzz"
0066 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0068 jump 86 ( 17)
0070 trace 1 ( 12)
0072 putself
0073 putstring "Fizz"
0075 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0077 jump 86 ( 17)
0079 trace 1 ( 14)
0081 putself
0082 putstring "Buzz"
0084 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0086 trace 512 ( 18)
0088 leave ( 16)
super_fizzbuzz
== disasm: <RubyVM::InstructionSequence:super_fizzbuzz@fizzbuzz.rb>=====
== catch table
| catch type: break st: 0004 ed: 0008 sp: 0000 cont: 0008
|------------------------------------------------------------------------
local table (size: 2, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] array<Arg>
0000 trace 8 ( 25)
0002 trace 1 ( 26)
0004 getlocal_OP__WC__0 2
0006 send <callinfo!mid:map!, argc:0, block:block in super_fizzbuzz>
0008 trace 16 ( 37)
0010 leave ( 26)
== disasm: <RubyVM::InstructionSequence:block in super_fizzbuzz@fizzbuzz.rb>
== catch table
| catch type: redo st: 0000 ed: 0086 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0086 sp: 0000 cont: 0086
|------------------------------------------------------------------------
local table (size: 2, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s3)
[ 2] element<Arg>
0000 trace 256 ( 26)
0002 trace 1 ( 27)
0004 getlocal_OP__WC__0 2
0006 putobject 3
0008 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0010 putobject_OP_INT2FIX_O_0_C_
0011 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0013 branchunless 35
0015 getlocal_OP__WC__0 2
0017 putobject 5
0019 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0021 putobject_OP_INT2FIX_O_0_C_
0022 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0024 branchunless 35
0026 trace 1 ( 28)
0028 putself
0029 putstring "FizzBuzz"
0031 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0033 jump 86 ( 27)
0035 trace 1 ( 29)
0037 getlocal_OP__WC__0 2
0039 putobject 3
0041 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0043 putobject_OP_INT2FIX_O_0_C_
0044 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0046 branchunless 57
0048 trace 1 ( 30)
0050 putself
0051 putstring "Fizz"
0053 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0055 jump 86 ( 29)
0057 trace 1 ( 31)
0059 getlocal_OP__WC__0 2
0061 putobject 5
0063 opt_mod <callinfo!mid:%, argc:1, ARGS_SKIP>
0065 putobject_OP_INT2FIX_O_0_C_
0066 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0068 branchunless 79
0070 trace 1 ( 32)
0072 putself
0073 putstring "Buzz"
0075 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0077 jump 86 ( 31)
0079 trace 1 ( 34)
0081 putself
0082 getlocal_OP__WC__0 2
0084 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0086 trace 512 ( 36)
0088 leave ( 34)
➜ Desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment