Skip to content

Instantly share code, notes, and snippets.

@vic
Created December 14, 2010 22:35
Show Gist options
  • Select an option

  • Save vic/741243 to your computer and use it in GitHub Desktop.

Select an option

Save vic/741243 to your computer and use it in GitHub Desktop.
Diff between rbx-compiler and fy-compiler output for lib/compiler/ast/message_send.fy
--- /more/vic/hk/fancy/diff/rb-compiler/compiler/ast/message_send.asm 2010-12-14 16:28:36.511543000 -0600
+++ /more/vic/hk/fancy/diff/fy-compiler/compiler/ast/message_send.asm 2010-12-14 16:27:46.175543001 -0600
@@ -1,720 +1,720 @@
============= :__script__ ==============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
Lines to IP: 83: 0--1, 82: 0-3, 1: 4-9, 82: 10-30
0000: push_rubinius
0001: push_literal :AST
0003: push_nil
0004: push_const_fast :Fancy, 2
0007: send_stack :open_class_under, 3
0010: dup_top
0011: push_rubinius
0012: swap_stack
0013: push_literal :__class_init__
0015: swap_stack
0016: push_literal #<Rubinius::CompiledMethod AST file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0018: swap_stack
0019: push_scope
0020: swap_stack
0021: send_stack :attach_method, 4
0024: pop
0025: send_stack :__class_init__, 0
0028: pop
0029: push_true
0030: ret
----------------------------------------
================= :AST =================
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
Lines to IP: 31: 2-4, 3: 5-11, 31: 12-30, 54: 31-33, 33: 34-40, 54: 41-59, 80: 60-62, 57: 63-69, 80: 70-88
0000: push_self
0001: add_scope
0002: push_rubinius
0003: push_literal :MessageSend
0005: push_const_fast :Node, 2
0008: push_scope
0009: send_stack :open_class, 3
0012: dup_top
0013: push_rubinius
0014: swap_stack
0015: push_literal :__class_init__
0017: swap_stack
0018: push_literal #<Rubinius::CompiledMethod MessageSend file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0020: swap_stack
0021: push_scope
0022: swap_stack
0023: send_stack :attach_method, 4
0026: pop
0027: send_stack :__class_init__, 0
0030: pop
0031: push_rubinius
0032: push_literal :MessageArgs
0034: push_const_fast :Node, 8
0037: push_scope
0038: send_stack :open_class, 3
0041: dup_top
0042: push_rubinius
0043: swap_stack
0044: push_literal :__class_init__
0046: swap_stack
0047: push_literal #<Rubinius::CompiledMethod MessageArgs file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0049: swap_stack
0050: push_scope
0051: swap_stack
0052: send_stack :attach_method, 4
0055: pop
0056: send_stack :__class_init__, 0
0059: pop
0060: push_rubinius
0061: push_literal :RubyArgs
0063: push_const_fast :MessageArgs, 11
0066: push_scope
0067: send_stack :open_class, 3
0070: dup_top
0071: push_rubinius
0072: swap_stack
0073: push_literal :__class_init__
0075: swap_stack
0076: push_literal #<Rubinius::CompiledMethod RubyArgs file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0078: swap_stack
0079: push_scope
0080: swap_stack
0081: send_stack :attach_method, 4
0084: pop
0085: send_stack :__class_init__, 0
0088: ret
----------------------------------------
============= :MessageSend =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
Lines to IP: 5: 2-2, 4: 3-10, 5: 11-42, 22: 43-66, 26: 67-85, 30: 86-99
0000: push_self
0001: add_scope
0002: push_self
0003: push_literal :name
0005: push_literal :receiver
0007: push_literal :args
0009: make_array 3
0011: allow_private
0012: send_stack :"read_write_slots:", 1
0015: pop
0016: push_self
0017: send_stack :public, 0
0020: pop
0021: push_self
0022: push_literal "message:to:args:"
0024: string_dup
0025: allow_private
0026: send_stack :"define_constructor_class_method:", 1
0029: push_rubinius
0030: push_literal :"initialize:message:to:args:"
0032: push_literal #<Rubinius::CompiledMethod initialize:message:to:args: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0034: push_scope
0035: push_variables
0036: send_stack :method_visibility, 0
0039: send_stack :add_defn_method, 4
0042: pop
0043: push_self
0044: send_stack :public, 0
0047: pop
0048: push_rubinius
0049: push_literal :"bytecode:"
0051: push_literal #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0053: push_scope
0054: push_variables
0055: send_stack :method_visibility, 0
0058: send_stack :add_defn_method, 4
0061: pop
0062: push_self
0063: send_stack :public, 0
0066: pop
0067: push_rubinius
0068: push_literal :":ruby_block?"
0070: push_literal #<Rubinius::CompiledMethod :ruby_block? file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0072: push_scope
0073: push_variables
0074: send_stack :method_visibility, 0
0077: send_stack :add_defn_method, 4
0080: pop
0081: push_self
0082: send_stack :public, 0
0085: pop
0086: push_rubinius
0087: push_literal :":ruby_send?"
0089: push_literal #<Rubinius::CompiledMethod :ruby_send? file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0091: push_scope
0092: push_variables
0093: send_stack :method_visibility, 0
0096: send_stack :add_defn_method, 4
0099: ret
----------------------------------------
==== :"initialize:message:to:args:" ====
Arguments: 4 required, 4 total
Locals: 4: @line, @name, @receiver, @args
Stack size: 5
Lines to IP: 5: 0-19
0000: push_local 0 # @line
0002: set_ivar 0
0004: pop
0005: push_local 1 # @name
0007: set_ivar 1
0009: pop
0010: push_local 2 # @receiver
0012: set_ivar 2
0014: pop
0015: push_local 3 # @args
0017: set_ivar 3
0019: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 1 required, 1 total
Locals: 1: g
Stack size: 5
Lines to IP: 22: 0-0, 8: 1-8, 10: 9-10, 21: 11-12, 22: 13-17
0000: push_self
0001: push_ivar 0
0003: push_const_fast :Super, 2
0006: send_stack :"is_a?:", 1
0009: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0011: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0013: allow_private
0014: send_stack :"if:then:else:", 3
0017: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 5
Lines to IP: 10: 0--1, 9: 0-14, 10: 15-18
0000: push_const_fast :SuperSend, 1
0003: push_ivar 2
0005: push_ivar 3
0007: push_ivar 4
0009: send_stack :"new:message:args:", 3
0012: push_local_depth 1, 0
0015: send_stack :"bytecode:", 1
0018: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 1: sym
Stack size: 6
-Lines to IP: 21: 0--1, 12: 0--1, 11: 0-4, 12: 5-13, 13: 14-17, 14: 18-18, 13: 19-21, 14: 22-36, 15: 37-40, 15: 41-49, 16: 50-55, 21: 56-56, 16: 57-61, 18: 62-63, 20: 64-65, 21: 66-70
+Lines to IP: 21: 0--1, 12: 0--1, 11: 0-4, 12: 5-13, 13: 14-17, 14: 18-18, 13: 19-21, 14: 22-36, 15: 37-49, 16: 50-55, 21: 56-56, 16: 57-61, 18: 62-63, 20: 64-65, 21: 66-70
0000: push_ivar 0
0002: push_local_depth 1, 0
0005: send_stack :"bytecode:", 1
0008: pop
0009: push_ivar 2
0011: push_local_depth 1, 0
0014: send_stack :"bytecode:", 1
0017: pop
0018: push_self
0019: push_local_depth 1, 0
0022: allow_private
0023: send_stack :pos, 1
0026: pop
0027: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0029: push_ivar 0
0031: push_const_fast :Self, 6
0034: send_stack :"is_a?:", 1
0037: send_stack :"if:", 1
0040: pop
0041: push_ivar 9
0043: push_ivar 0
0045: push_self
0046: allow_private
0047: send_stack :":ruby_send?", 0
0050: send_stack :"method_name:ruby_send:", 2
0053: set_local 0
0055: pop
0056: push_self
0057: push_self
0058: allow_private
0059: send_stack :":ruby_block?", 0
0062: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0064: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0066: allow_private
0067: send_stack :"if:then:else:", 3
0070: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 2
Lines to IP: 14: 0-6
0000: push_local_depth 2, 0
0003: send_stack :allow_private, 0
0006: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 5
Lines to IP: 18: 0--1, 17: 0-11, 18: 12-15
0000: push_local_depth 2, 0
0003: push_local_depth 1, 0
0006: push_ivar 0
0008: send_stack :":size", 0
0011: push_false
0012: send_stack :send_with_block, 3
0015: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 5
Lines to IP: 20: 0--1, 19: 0-11, 20: 12-15
0000: push_local_depth 2, 0
0003: push_local_depth 1, 0
0006: push_ivar 0
0008: send_stack :":size", 0
0011: push_false
0012: send_stack :send, 3
0015: ret
----------------------------------------
=========== :":ruby_block?" ============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 1
-Lines to IP: 26: 0--1, 25: 0-1, 26: 2-5
+Lines to IP: 26: 0--1, 25: 0-5
0000: push_ivar 0
0002: send_stack :":has_block?", 0
0005: ret
----------------------------------------
============ :":ruby_send?" ============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 1
-Lines to IP: 30: 0--1, 29: 0-1, 30: 2-5
+Lines to IP: 30: 0--1, 29: 0-5
0000: push_ivar 0
0002: send_stack :":ruby_args?", 0
0005: ret
----------------------------------------
============= :MessageArgs =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
Lines to IP: 35: 2-2, 34: 3-6, 35: 7-38, 41: 39-62, 45: 63-81, 49: 82-100, 53: 101-114
0000: push_self
0001: add_scope
0002: push_self
0003: push_literal :args
0005: make_array 1
0007: allow_private
0008: send_stack :"read_slots:", 1
0011: pop
0012: push_self
0013: send_stack :public, 0
0016: pop
0017: push_self
0018: push_literal "args:"
0020: string_dup
0021: allow_private
0022: send_stack :"define_constructor_class_method:", 1
0025: push_rubinius
0026: push_literal :"initialize:args:"
0028: push_literal #<Rubinius::CompiledMethod initialize:args: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0030: push_scope
0031: push_variables
0032: send_stack :method_visibility, 0
0035: send_stack :add_defn_method, 4
0038: pop
0039: push_self
0040: send_stack :public, 0
0043: pop
0044: push_rubinius
0045: push_literal :"bytecode:"
0047: push_literal #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0049: push_scope
0050: push_variables
0051: send_stack :method_visibility, 0
0054: send_stack :add_defn_method, 4
0057: pop
0058: push_self
0059: send_stack :public, 0
0062: pop
0063: push_rubinius
0064: push_literal :":size"
0066: push_literal #<Rubinius::CompiledMethod :size file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0068: push_scope
0069: push_variables
0070: send_stack :method_visibility, 0
0073: send_stack :add_defn_method, 4
0076: pop
0077: push_self
0078: send_stack :public, 0
0081: pop
0082: push_rubinius
0083: push_literal :":ruby_args?"
0085: push_literal #<Rubinius::CompiledMethod :ruby_args? file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0087: push_scope
0088: push_variables
0089: send_stack :method_visibility, 0
0092: send_stack :add_defn_method, 4
0095: pop
0096: push_self
0097: send_stack :public, 0
0100: pop
0101: push_rubinius
0102: push_literal :":has_block?"
0104: push_literal #<Rubinius::CompiledMethod :has_block? file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0106: push_scope
0107: push_variables
0108: send_stack :method_visibility, 0
0111: send_stack :add_defn_method, 4
0114: ret
----------------------------------------
========= :"initialize:args:" ==========
Arguments: 2 required, 2 total
Locals: 2: @line, @args
Stack size: 3
Lines to IP: 35: 0-9
0000: push_local 0 # @line
0002: set_ivar 0
0004: pop
0005: push_local 1 # @args
0007: set_ivar 1
0009: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 1 required, 1 total
Locals: 1: g
Stack size: 3
Lines to IP: 41: 0--1, 38: 0-1, 40: 2-3, 41: 4-7
0000: push_ivar 0
0002: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0004: send_stack :"each:", 1
0007: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 1 required, 1 total
Locals: 1: a
Stack size: 4
Lines to IP: 40: 0-3, 39: 4-8, 40: 9-12
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_local 0
0006: push_local_depth 1, 0
0009: send_stack :"bytecode:", 1
0012: ret
----------------------------------------
=============== :":size" ===============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 1
-Lines to IP: 45: 0--1, 44: 0-1, 45: 2-5
+Lines to IP: 45: 0--1, 44: 0-5
0000: push_ivar 0
0002: send_stack :":size", 0
0005: ret
----------------------------------------
============ :":ruby_args?" ============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 2
Lines to IP: 49: 0-0, 48: 1-3, 49: 4-8
0000: push_self
0001: push_const_fast :RubyArgs, 1
0004: allow_private
0005: send_stack :"is_a?:", 1
0008: ret
----------------------------------------
============ :":has_block?" ============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 1
Lines to IP: 53: 0-1
0000: push_false
0001: ret
----------------------------------------
============== :RubyArgs ===============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 7
Lines to IP: 68: 2-55, 75: 56-79, 79: 80-93
0000: push_self
0001: add_scope
0002: push_self
0003: send_stack :public, 0
0006: pop
0007: push_self
0008: push_literal "args:"
0010: string_dup
0011: allow_private
0012: send_stack :"define_constructor_class_method:", 1
0015: push_rubinius
0016: push_literal :"initialize:args:"
0018: push_literal #<Rubinius::CompiledMethod initialize:args: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0020: push_scope
0021: push_variables
0022: send_stack :method_visibility, 0
0025: send_stack :add_defn_method, 4
0028: pop
0029: push_self
0030: send_stack :public, 0
0033: pop
0034: push_self
0035: push_literal "args:block:"
0037: string_dup
0038: allow_private
0039: send_stack :"define_constructor_class_method:", 1
0042: push_rubinius
0043: push_literal :"initialize:args:block:"
0045: push_literal #<Rubinius::CompiledMethod initialize:args:block: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0047: push_scope
0048: push_variables
0049: send_stack :method_visibility, 0
0052: send_stack :add_defn_method, 4
0055: pop
0056: push_self
0057: send_stack :public, 0
0060: pop
0061: push_rubinius
0062: push_literal :"bytecode:"
0064: push_literal #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0066: push_scope
0067: push_variables
0068: send_stack :method_visibility, 0
0071: send_stack :add_defn_method, 4
0074: pop
0075: push_self
0076: send_stack :public, 0
0079: pop
0080: push_rubinius
0081: push_literal :":has_block?"
0083: push_literal #<Rubinius::CompiledMethod :has_block? file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0085: push_scope
0086: push_variables
0087: send_stack :method_visibility, 0
0090: send_stack :add_defn_method, 4
0093: ret
----------------------------------------
========= :"initialize:args:" ==========
Arguments: 2 required, 2 total
Locals: 2: @line, @args
Stack size: 6
Lines to IP: 68: 0--1, 58: 0--1, 68: 0-9, 58: 10-24
0000: push_local 0 # @line
0002: set_ivar 0
0004: pop
0005: push_local 1 # @args
0007: set_ivar 1
0009: pop
0010: push_literal "Forward to message initialize:args:block:"
0012: string_dup
0013: pop
0014: push_self
0015: push_ivar 0
0017: push_ivar 1
0019: push_nil
0020: allow_private
0021: send_stack :"initialize:args:block:", 3
0024: ret
----------------------------------------
====== :"initialize:args:block:" =======
Arguments: 3 required, 3 total
Locals: 3: @line, @args, @block
Stack size: 6
Lines to IP: 68: 0--1, 60: 0--1, 68: 0-14, 59: 15-24, 60: 25-30, 67: 31-32, 68: 33-36
0000: push_local 0 # @line
0002: set_ivar 0
0004: pop
0005: push_local 1 # @args
0007: set_ivar 1
0009: pop
0010: push_local 2 # @block
0012: set_ivar 2
0014: pop
0015: create_block #<Rubinius::CompiledMethod initialize:args:block: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0017: push_ivar 1
0019: push_const_fast :Array, 5
0022: send_stack :"is_a?:", 1
0025: send_stack :"unless:", 1
0028: pop
0029: push_ivar 2
0031: create_block #<Rubinius::CompiledMethod initialize:args:block: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0033: send_stack :"if_nil:", 1
0036: ret
----------------------------------------
====== :"initialize:args:block:" =======
Arguments: 0 required, 0 total
Locals: 0
Stack size: 2
Lines to IP: 59: 0-7
0000: push_ivar 0
0002: send_stack :":array", 0
0005: set_ivar 0
0007: ret
----------------------------------------
====== :"initialize:args:block:" =======
Arguments: 0 required, 0 total
Locals: 0
Stack size: 4
Lines to IP: 67: 0-0, 61: 1-11, 66: 12-13, 67: 14-18
0000: push_self
0001: push_ivar 0
0003: send_stack :":last", 0
0006: push_const_fast :Identifier, 3
0009: send_stack :"kind_of?:", 1
0012: create_block #<Rubinius::CompiledMethod initialize:args:block: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0014: allow_private
0015: send_stack :"if:then:", 2
0018: ret
----------------------------------------
====== :"initialize:args:block:" =======
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
Lines to IP: 66: 0-0, 62: 1-29, 65: 30-31, 66: 32-36
0000: push_self
0001: push_ivar 0
0003: send_stack :":last", 0
0006: send_stack :":string", 0
0009: push_literal nil
0011: dup_top
0012: is_nil
0013: goto_if_false 27
0015: pop
0016: push_cpath_top
0017: find_const 4
0019: push_literal "^&\\w"
0021: meta_push_0
0022: send_stack :new, 2
0025: set_literal nil
0027: send_stack :":=~", 1
0030: create_block #<Rubinius::CompiledMethod initialize:args:block: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0032: allow_private
0033: send_stack :"if:then:", 2
0036: ret
----------------------------------------
====== :"initialize:args:block:" =======
Arguments: 0 required, 0 total
Locals: 0
Stack size: 6
-Lines to IP: 65: 0--1, 64: 0--1, 63: 0-1, 64: 2-7, 64: 8-25, 65: 26-31
+Lines to IP: 65: 0--1, 64: 0--1, 63: 0-1, 64: 2-25, 65: 26-31
0000: push_ivar 0
0002: send_stack :pop, 0
0005: set_ivar 2
0007: pop
0008: push_const_fast :Identifier, 4
0011: push_ivar 2
0013: send_stack :":line", 0
0016: push_ivar 2
0018: send_stack :":string", 0
0021: meta_push_1
0022: meta_push_neg_1
0023: send_stack :"from:to:", 2
0026: send_stack :"new:string:", 2
0029: set_ivar 2
0031: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 1 required, 1 total
Locals: 1: g
Stack size: 3
Lines to IP: 75: 0--1, 74: 0--1, 71: 0-1, 73: 2-3, 74: 4-11, 75: 12-15
0000: push_ivar 0
0002: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0004: send_stack :"each:", 1
0007: pop
0008: create_block #<Rubinius::CompiledMethod bytecode: file=/more/vic/hk/fancy/lib/compiler/ast/message_send.fy>
0010: push_ivar 4
0012: send_stack :"if:", 1
0015: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 1 required, 1 total
Locals: 1: a
Stack size: 4
Lines to IP: 73: 0-3, 72: 4-8, 73: 9-12
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_local 0
0006: push_local_depth 1, 0
0009: send_stack :"bytecode:", 1
0012: ret
----------------------------------------
============= :"bytecode:" =============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 3
Lines to IP: 74: 0-8
0000: push_ivar 0
0002: push_local_depth 1, 0
0005: send_stack :"bytecode:", 1
0008: ret
----------------------------------------
============ :":has_block?" ============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 1
-Lines to IP: 79: 0--1, 78: 0-4, 79: 5-8
+Lines to IP: 79: 0--1, 78: 0-8
0000: push_ivar 0
0002: send_stack :":nil?", 0
0005: send_stack :":not", 0
0008: ret
----------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment