Skip to content

Instantly share code, notes, and snippets.

@enebo
Created May 7, 2015 23:22
Show Gist options
  • Save enebo/06b5a6ab73c9f9bee26d to your computer and use it in GitHub Desktop.
Save enebo/06b5a6ab73c9f9bee26d to your computer and use it in GitHub Desktop.
Instructions:
BB [1:LBL_0:-1]
%v_2 = copy(nil)
%v_3 = copy(%v_2)
%t_a_4 = copy(%v_2)
%v_1 = copy(%v_2)
BB [2:LBL_1:-1]
%self = recv_self()
line_num(;n: 2)
%t_a_4 = copy(Array:[Fixnum:1, Fixnum:2, Fixnum:3])
line_num(;n: 3)
binding_store(%t_a_4, a(0:0) ;scope_name: ../snippets/perf3.rb)
%v_1 = call_1f(%t_a_4, Fixnum:2 ;n:[], t:NO, cl:false)
%t_a_4 = binding_load(a(0:0) ;scope: ../snippets/perf3.rb)
%v_2 = call_1f(%t_a_4, Fixnum:1 ;n:[], t:NO, cl:false)
%t_a_4 = binding_load(a(0:0) ;scope: ../snippets/perf3.rb)
%v_3 = copy(Array:[%v_1, %v_2])
%v_2 = to_ary(%v_3)
%v_3 = masgn_reqd(%v_2 ;index: 0, pre: -1, post: -1)
attr_assign(%t_a_4, Fixnum:1, %v_3 ;n:[]=, t:UN, cl:false)
%t_a_4 = binding_load(a(0:0) ;scope: ../snippets/perf3.rb)
%v_3 = masgn_reqd(%v_2 ;index: 1, pre: -1, post: -1)
attr_assign(%t_a_4, Fixnum:2, %v_3 ;n:[]=, t:UN, cl:false)
line_num(;n: 4)
return(Fixnum:1)
BB [3:LBL_2:-1]
a = [1,2,3]
a[1], a[2] = a[2], a[1]
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment