Skip to content

Instantly share code, notes, and snippets.

@platinumthinker
Created December 21, 2016 04:08
Show Gist options
  • Select an option

  • Save platinumthinker/2c25cb4c9cf0a324bf532f96a0940934 to your computer and use it in GitHub Desktop.

Select an option

Save platinumthinker/2c25cb4c9cf0a324bf532f96a0940934 to your computer and use it in GitHub Desktop.
erlang map
{module, aa}. %% version = 0
{exports, [{aa,1},
{bb,1},
{get1,2},
{get2,2},
{module_info,0},
{module_info,1},
{new1,0},
{new2,0}]}.
{attributes, []}.
{labels, 19}.
{function, aa, 1, 2}.
{label,1}.
{line,[{location,"aa.erl",12}]}.
{func_info,{atom,aa},{atom,aa},1}.
{label,2}.
{test,is_map,{f,3},[{x,0}]}.
{line,[{location,"aa.erl",12}]}.
{put_map_assoc,{f,0},{x,0},{x,0},1,{list,[{atom,aa},{atom,a}]}}.
return.
{label,3}.
{test_heap,3,1}.
{put_tuple,2,{x,1}}.
{put,{atom,badmap}}.
{put,{x,0}}.
{move,{x,1},{x,0}}.
{line,[{location,"aa.erl",12}]}.
{call_ext,1,{extfunc,erlang,error,1}}.
{function, bb, 1, 5}.
{label,4}.
{line,[{location,"aa.erl",13}]}.
{func_info,{atom,aa},{atom,bb},1}.
{label,5}.
{move,{atom,a},{x,1}}.
{move,{x,0},{x,2}}.
{move,{atom,aa},{x,0}}.
{line,[{location,"aa.erl",13}]}.
{call_ext_only,3,{extfunc,maps,put,3}}.
{function, new1, 0, 7}.
{label,6}.
{line,[{location,"aa.erl",15}]}.
{func_info,{atom,aa},{atom,new1},0}.
{label,7}.
{move,{literal,#{}},{x,0}}.
return.
{function, new2, 0, 9}.
{label,8}.
{line,[{location,"aa.erl",16}]}.
{func_info,{atom,aa},{atom,new2},0}.
{label,9}.
{line,[{location,"aa.erl",16}]}.
{call_ext_only,0,{extfunc,maps,new,0}}.
{function, get1, 2, 11}.
{label,10}.
{line,[{location,"aa.erl",18}]}.
{func_info,{atom,aa},{atom,get1},2}.
{label,11}.
{test,is_map,{f,12},[{x,0}]}.
{get_map_elements,{f,12},{x,0},{list,[{x,1},{x,2}]}}.
{move,{x,2},{x,0}}.
return.
{label,12}.
{line,[{location,"aa.erl",19}]}.
{badmatch,{x,0}}.
{function, get2, 2, 14}.
{label,13}.
{line,[{location,"aa.erl",21}]}.
{func_info,{atom,aa},{atom,get2},2}.
{label,14}.
{move,{x,1},{x,2}}.
{move,{x,0},{x,1}}.
{move,{x,2},{x,0}}.
{line,[{location,"aa.erl",22}]}.
{call_ext_only,2,{extfunc,maps,get,2}}.
{function, module_info, 0, 16}.
{label,15}.
{line,[]}.
{func_info,{atom,aa},{atom,module_info},0}.
{label,16}.
{move,{atom,aa},{x,0}}.
{line,[]}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 18}.
{label,17}.
{line,[]}.
{func_info,{atom,aa},{atom,module_info},1}.
{label,18}.
{move,{x,0},{x,1}}.
{move,{atom,aa},{x,0}}.
{line,[]}.
{call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment