Skip to content

Instantly share code, notes, and snippets.

@vic
Created December 14, 2010 23:25
Show Gist options
  • Select an option

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

Select an option

Save vic/741331 to your computer and use it in GitHub Desktop.
Diff for lib/argv.fy
--- /more/vic/hk/fancy/diff/rb-compiler/argv.asm 2010-12-14 17:22:49.907543001 -0600
+++ /more/vic/hk/fancy/diff/fy-compiler/argv.asm 2010-12-14 17:21:47.639543000 -0600
@@ -1,279 +1,235 @@
============= :__script__ ==============
Arguments: 0 required, 0 total
Locals: 0
-Stack size: 9
-Lines to IP: 17: 0--1, 16: 0-10, 1: 11-18, 16: 19-25, 2: 26-28, 16: 29-58, 36: 59-69, 18: 70-77, 36: 78-84, 19: 85-87, 36: 88-119
+Stack size: 5
+Lines to IP: 17: 0--1, 16: 0-10, 1: 11-17, 36: 18-28, 18: 29-37
0000: push_self
0001: send_stack :public, 0
0004: pop
0005: push_rubinius
0006: push_literal :"for_option:do:"
0008: push_literal #<Rubinius::CompiledMethod for_option:do: file=/more/vic/hk/fancy/lib/argv.fy>
0010: push_scope
0011: push_const_fast :ARGV, 4
0014: send_stack :attach_method, 4
-0017: set_stack_local 0
-0019: push_const_fast :Fancy, 7
-0022: find_const 8
-0024: push_stack_local 0
-0026: push_literal "Runs a given block if an option is in ARGV."
-0028: string_dup
-0029: send_stack :"for:is:", 2
-0032: push_cpath_top
-0033: find_const 11
-0035: meta_push_1
-0036: send_stack :new_from_literal, 1
-0039: dup_top
-0040: push_literal :argnames
-0042: push_literal "op_name"
-0044: string_dup
-0045: push_literal "block"
-0047: string_dup
-0048: make_array 2
-0050: send_stack :[]=, 2
-0053: pop
-0054: send_stack :"meta:", 1
-0057: pop
-0058: pop
-0059: push_self
-0060: send_stack :public, 0
-0063: pop
-0064: push_rubinius
-0065: push_literal :"for_options:do:"
-0067: push_literal #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
-0069: push_scope
-0070: push_const_fast :ARGV, 20
-0073: send_stack :attach_method, 4
-0076: set_stack_local 1
-0078: push_const_fast :Fancy, 21
-0081: find_const 8
-0083: push_stack_local 1
-0085: push_literal "Runs a given block if any of the given options is in ARGV."
-0087: string_dup
-0088: send_stack :"for:is:", 2
-0091: push_cpath_top
-0092: find_const 11
-0094: meta_push_1
-0095: send_stack :new_from_literal, 1
-0098: dup_top
-0099: push_literal :argnames
-0101: push_literal "op_names"
-0103: string_dup
-0104: push_literal "block"
-0106: string_dup
-0107: make_array 2
-0109: send_stack :[]=, 2
-0112: pop
-0113: send_stack :"meta:", 1
-0116: pop
-0117: pop
-0118: push_true
-0119: ret
+0017: pop
+0018: push_self
+0019: send_stack :public, 0
+0022: pop
+0023: push_rubinius
+0024: push_literal :"for_options:do:"
+0026: push_literal #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
+0028: push_scope
+0029: push_const_fast :ARGV, 8
+0032: send_stack :attach_method, 4
+0035: pop
+0036: push_true
+0037: ret
----------------------------------------
========== :"for_option:do:" ===========
Arguments: 2 required, 2 total
Locals: 2: op_name, block
Stack size: 4
Lines to IP: 16: 0--1, 3: 0--1, 4: 0-7, 15: 8-9, 16: 10-13
0000: push_const_fast :ARGV, 1
0003: push_local 0 # op_name
0005: send_stack :"index:", 1
0008: create_block #<Rubinius::CompiledMethod for_option:do: file=/more/vic/hk/fancy/lib/argv.fy>
0010: send_stack :"if_do:", 1
0013: ret
----------------------------------------
========== :"for_option:do:" ===========
Arguments: 1 required, 1 total
Locals: 1: idx
Stack size: 6
Lines to IP: 15: 0-4, 5: 5-14, 11: 15-16, 14: 17-18, 15: 19-23
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_self
0005: push_local_depth 1, 1
0008: send_stack :":argcount", 0
0011: meta_push_0
0012: send_stack :":>", 1
0015: create_block #<Rubinius::CompiledMethod for_option:do: file=/more/vic/hk/fancy/lib/argv.fy>
0017: create_block #<Rubinius::CompiledMethod for_option:do: file=/more/vic/hk/fancy/lib/argv.fy>
0019: allow_private
0020: send_stack :"if:then:else:", 3
0023: ret
----------------------------------------
========== :"for_option:do:" ===========
Arguments: 0 required, 0 total
Locals: 0
Stack size: 4
Lines to IP: 11: 0--1, 6: 0-12, 10: 13-14, 11: 15-18
0000: push_const_fast :ARGV, 1
0003: push_local_depth 1, 0
0006: meta_push_1
0007: send_stack :":+", 1
0010: send_stack :":[]", 1
0013: create_block #<Rubinius::CompiledMethod for_option:do: file=/more/vic/hk/fancy/lib/argv.fy>
0015: send_stack :"if_do:", 1
0018: ret
----------------------------------------
========== :"for_option:do:" ===========
Arguments: 1 required, 1 total
Locals: 1: arg
Stack size: 4
Lines to IP: 10: 0-3, 7: 4-10, 8: 11-20, 9: 21-30, 10: 31-34
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_local_depth 3, 1
0007: push_local 0
0009: make_array 1
0011: send_stack :"call:", 1
0014: pop
0015: push_const_fast :ARGV, 2
0018: push_local_depth 2, 0
0021: send_stack :"remove_at:", 1
0024: pop
0025: push_const_fast :ARGV, 4
0028: push_local_depth 2, 0
0031: send_stack :"remove_at:", 1
0034: ret
----------------------------------------
========== :"for_option:do:" ===========
Arguments: 0 required, 0 total
Locals: 0
Stack size: 3
-Lines to IP: 14: 0--1, 13: 0--1, 12: 0-2, 13: 3-12, 14: 13-16
+Lines to IP: 14: 0--1, 13: 0--1, 12: 0-6, 13: 7-12, 14: 13-16
0000: push_local_depth 2, 1
0003: send_stack :":call", 0
0006: pop
0007: push_const_fast :ARGV, 2
0010: push_local_depth 1, 0
0013: send_stack :"remove_at:", 1
0016: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 2 required, 2 total
Locals: 2: op_names, block
Stack size: 4
Lines to IP: 36: 0--1, 20: 0--1, 21: 0-4, 35: 5-6, 36: 7-10
0000: push_local 0 # op_names
0002: send_stack :":size", 0
0005: create_block #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
0007: send_stack :"times:", 1
0010: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 1 required, 1 total
Locals: 1: i
Stack size: 6
Lines to IP: 35: 0-4, 22: 5-18, 34: 19-20, 35: 21-25
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_self
0005: push_const_fast :ARGV, 1
0008: push_local_depth 1, 0
0011: push_local 0
0013: send_stack :":[]", 1
0016: send_stack :"index:", 1
0019: create_block #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
0021: allow_private
0022: send_stack :"if:then:", 2
0025: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 1 required, 1 total
Locals: 1: idx
Stack size: 6
Lines to IP: 34: 0-3, 33: 4-4, 23: 5-14, 29: 15-16, 32: 17-18, 33: 19-26
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_self
0005: push_local_depth 2, 1
0008: send_stack :":argcount", 0
0011: meta_push_0
0012: send_stack :":>", 1
0015: create_block #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
0017: create_block #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
0019: allow_private
0020: send_stack :"if:then:else:", 3
0023: pop
0024: push_true
0025: raise_return
0026: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 0 required, 0 total
Locals: 0
Stack size: 5
Lines to IP: 29: 0-0, 24: 1-13, 28: 14-15, 29: 16-20
0000: push_self
0001: push_const_fast :ARGV, 1
0004: push_local_depth 1, 0
0007: meta_push_1
0008: send_stack :":+", 1
0011: send_stack :":[]", 1
0014: create_block #<Rubinius::CompiledMethod for_options:do: file=/more/vic/hk/fancy/lib/argv.fy>
0016: allow_private
0017: send_stack :"if:then:", 2
0020: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 1 required, 1 total
Locals: 1: arg
Stack size: 4
Lines to IP: 28: 0-3, 25: 4-10, 26: 11-20, 27: 21-30, 28: 31-34
0000: cast_for_single_block_arg
0001: set_local 0
0003: pop
0004: push_local_depth 4, 1
0007: push_local 0
0009: make_array 1
0011: send_stack :"call:", 1
0014: pop
0015: push_const_fast :ARGV, 2
0018: push_local_depth 2, 0
0021: send_stack :"remove_at:", 1
0024: pop
0025: push_const_fast :ARGV, 4
0028: push_local_depth 2, 0
0031: send_stack :"remove_at:", 1
0034: ret
----------------------------------------
========== :"for_options:do:" ==========
Arguments: 0 required, 0 total
Locals: 0
Stack size: 3
-Lines to IP: 32: 0--1, 31: 0--1, 30: 0-2, 31: 3-12, 32: 13-16
+Lines to IP: 32: 0--1, 31: 0--1, 30: 0-6, 31: 7-12, 32: 13-16
0000: push_local_depth 3, 1
0003: send_stack :":call", 0
0006: pop
0007: push_const_fast :ARGV, 2
0010: push_local_depth 1, 0
0013: send_stack :"remove_at:", 1
0016: ret
----------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment