Erlang bytecode
http://mryufeng.iteye.com
yufeng在一篇文章中提到可以从erlang源码生成中间码,下来想想对理解VM的机制是大有帮助的,记一下,在此,对yufeng在Erlang方面的丰功伟绩表示感谢。
-module(tut1). -export([fac/1]). fac(0) -> 1; fac(N) -> N * fac(N-1).
erlc+"'S'"tut1.erl
{module, tut1}. %% version = 0 {exports, [{fac,1},{module_info,0},{module_info,1}]}. {attributes, []}. {labels, 8}. {function, fac, 1, 2}. {label,1}. {func_info,{atom,tut1},{atom,fac},1}. {label,2}. {test,is_eq_exact,{f,3},[{x,0},{integer,0}]}. {move,{integer,1},{x,0}}. return. {label,3}. {allocate_zero,1,1}. {gc_bif,'-',{f,0},1,[{x,0},{integer,1}],{x,1}}. {move,{x,0},{y,0}}. {move,{x,1},{x,0}}. {call,1,{f,2}}. {gc_bif,'*',{f,0},1,[{y,0},{x,0}],{x,0}}. {deallocate,1}. return. {function, module_info, 0, 5}. {label,4}. {func_info,{atom,tut1},{atom,module_info},0}. {label,5}. {move,{atom,tut1},{x,0}}. {call_ext_only,1,{extfunc,erlang,get_module_info,1}}. {function, module_info, 1, 7}. {label,6}. {func_info,{atom,tut1},{atom,module_info},1}. {label,7}. {move,{x,0},{x,1}}. {move,{atom,tut1},{x,0}}. {call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
相关推荐
Yuezhilv 2020-04-25
85221348 2020-02-09
82274551 2020-01-08
ciscoccie00 2019-12-19
hahahd0 2019-03-29
upholdjx 2017-04-05
zhuchenghaoma 2012-02-07
heimeiyingwang 2015-07-28
zhuchenghaoma 2013-08-27
zhujuyu 2019-06-28
永不妥协 2019-06-28
永不妥协 2019-06-27
ciscoccie00 2019-06-27
tenvainvi 2019-06-27
永不妥协 2019-06-27
hahahd0 2019-06-27
Yuezhilv 2019-06-27