Skip to content

Instantly share code, notes, and snippets.

@brixen
Created January 31, 2018 17:14
Show Gist options
  • Select an option

  • Save brixen/da4899f2a99ce0ff48d722dc02b8b9da to your computer and use it in GitHub Desktop.

Select an option

Save brixen/da4899f2a99ce0ff48d722dc02b8b9da to your computer and use it in GitHub Desktop.
$ rbx compile -B -e 'def m(a, b)
m { |a| a }
mm { |x, y| a + b }
end'
============= :__script__ ==============
Arguments: 0 required, 0 post, 0 total
Arity: 0
Locals: 0
Stack size: 5
Registers: 0
Literals: 4: :m, <compiled code>, :method_visibility, :add_defn_method
Lines to IP: 1: 0..19
0000: push_rubinius
0001: push_literal :m
0003: push_literal #<Rubinius::CompiledCode:0x1c0 name=m file=(snippet) line=1>
0005: push_scope
0006: push_variables
0007: send_method :method_visibility
0009: unwind 0
0011: send_stack :add_defn_method, 4
0014: unwind 0
0016: pop
0017: push_true
0018: ret 0
----------------------------------------
================== :m ==================
Arguments: 2 required, 0 post, 2 total
Arity: 2
Locals: 2: a, b
Stack size: 4
Registers: 0
Literals: 4: <compiled code>, :m, <compiled code>, :mm
Line: 1
Lines to IP: 2: 0..11, 3: 12..24
0000: push_self
0001: create_block #<Rubinius::CompiledCode:0x210 name=m file=(snippet) line=2>
0003: unwind 0
0005: allow_private
0006: send_stack_with_block :m, 0
0009: unwind 0
0011: pop
0012: push_self
0013: create_block #<Rubinius::CompiledCode:0x240 name=m file=(snippet) line=3>
0015: unwind 0
0017: allow_private
0018: send_stack_with_block :mm, 0
0021: unwind 0
0023: ret 0
----------------------------------------
================== :m ==================
Arguments: 1 required, 0 post, 1 total
Arity: 1
Locals: 1: a
Stack size: 3
Registers: 0
Literals: 0
Line: 2
Lines to IP:
0000: push_local 0
0002: ret 0
----------------------------------------
================== :m ==================
Arguments: 2 required, 0 post, 2 total
Arity: 2
Locals: 2: x, y
Stack size: 5
Registers: 0
Literals: 1: :+
Line: 3
Lines to IP:
0000: push_local_depth 1, 0
0003: unwind 0
0005: push_local_depth 1, 1
0008: unwind 0
0010: send_stack :+, 1
0013: unwind 0
0015: ret 0
----------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment