Skip to content

Instantly share code, notes, and snippets.

@amtal
Created June 22, 2011 00:51
Show Gist options
  • Save amtal/1039299 to your computer and use it in GitHub Desktop.
Save amtal/1039299 to your computer and use it in GitHub Desktop.
Well dang, I guess -define macros DO have a place!
-module(tst).
-export([go/0]).
a()->1.
b()->two.
c()->"three".
go() -> [a(),b(),c()].
{module, tst}. %% version = 0
{exports, [{go,0},{module_info,0},{module_info,1}]}.
{attributes, []}.
{labels, 13}.
{function, a, 0, 2}.
{label,1}.
{func_info,{atom,tst},{atom,a},0}.
{label,2}.
{move,{integer,1},{x,0}}.
return.
{function, b, 0, 4}.
{label,3}.
{func_info,{atom,tst},{atom,b},0}.
{label,4}.
{move,{atom,two},{x,0}}.
return.
{function, c, 0, 6}.
{label,5}.
{func_info,{atom,tst},{atom,c},0}.
{label,6}.
{move,{literal,"three"},{x,0}}.
return.
{function, go, 0, 8}.
{label,7}.
{func_info,{atom,tst},{atom,go},0}.
{label,8}.
{allocate_zero,2,0}.
{call,0,{f,2}}.
{move,{x,0},{y,1}}.
{call,0,{f,4}}.
{move,{x,0},{y,0}}.
{call,0,{f,6}}.
{test_heap,6,1}.
{put_list,{x,0},nil,{x,0}}.
{put_list,{y,0},{x,0},{x,1}}.
{put_list,{y,1},{x,1},{x,0}}.
{deallocate,2}.
return.
{function, module_info, 0, 10}.
{label,9}.
{func_info,{atom,tst},{atom,module_info},0}.
{label,10}.
{move,{atom,tst},{x,0}}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 12}.
{label,11}.
{func_info,{atom,tst},{atom,module_info},1}.
{label,12}.
{move,{x,0},{x,1}}.
{move,{atom,tst},{x,0}}.
{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