Skip to content

Instantly share code, notes, and snippets.

@nox
Created July 2, 2012 21:53
Show Gist options
  • Save nox/3035956 to your computer and use it in GitHub Desktop.
Save nox/3035956 to your computer and use it in GitHub Desktop.
nox@Shinkirou:~$ cat blah.erl
-module(blah).
-compile(export_all).
-compile({inline, get/2}).
answer() ->
get(answer, [{<<"answer">>, 42}]).
get(Key, List) ->
proplists:get_value(list_to_binary(atom_to_list(Key)), List).
nox@Shinkirou:~$ cat blah.S
{module, blah}. %% version = 0
{exports, [{answer,0},{get,2},{module_info,0},{module_info,1}]}.
{attributes, []}.
{labels, 9}.
{function, answer, 0, 2}.
{label,1}.
{line,[{location,"blah.erl",5}]}.
{func_info,{atom,blah},{atom,answer},0}.
{label,2}.
{move,{literal,[{<<"answer">>,42}]},{x,1}}.
{move,{literal,<<"answer">>},{x,0}}.
{line,[{location,"blah.erl",9}]}.
{call_ext_only,2,{extfunc,proplists,get_value,2}}.
{function, get, 2, 4}.
{label,3}.
{line,[{location,"blah.erl",8}]}.
{func_info,{atom,blah},{atom,get},2}.
{label,4}.
{allocate,1,2}.
{move,{x,1},{y,0}}.
{line,[{location,"blah.erl",9}]}.
{call_ext,1,{extfunc,erlang,atom_to_list,1}}.
{line,[{location,"blah.erl",9}]}.
{call_ext,1,{extfunc,erlang,list_to_binary,1}}.
{move,{y,0},{x,1}}.
{line,[{location,"blah.erl",9}]}.
{call_ext_last,2,{extfunc,proplists,get_value,2},1}.
{function, module_info, 0, 6}.
{label,5}.
{line,[]}.
{func_info,{atom,blah},{atom,module_info},0}.
{label,6}.
{move,{atom,blah},{x,0}}.
{line,[]}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 8}.
{label,7}.
{line,[]}.
{func_info,{atom,blah},{atom,module_info},1}.
{label,8}.
{move,{x,0},{x,1}}.
{move,{atom,blah},{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