Provide info for tracing.
This commit is contained in:
parent
76ae61b66c
commit
5f5444ca9e
@ -39,8 +39,31 @@
|
|||||||
|
|
||||||
-define(HASH_BYTES, 32).
|
-define(HASH_BYTES, 32).
|
||||||
|
|
||||||
|
-type fate_arg_spec() :: {'immediate', aeb_fate_data:fate_type()}
|
||||||
|
| {'arg', integer()}
|
||||||
|
| {'var', integer()}
|
||||||
|
| {'stack', 0}.
|
||||||
|
|
||||||
|
-type fate_instruction() :: atom()
|
||||||
|
| {atom(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec()}.
|
||||||
|
|
||||||
|
|
||||||
-type fcode() :: #fcode{}.
|
-type fcode() :: #fcode{}.
|
||||||
-export_type([fcode/0]).
|
-export_type([fate_arg_spec/0, fate_instruction/0, fcode/0]).
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% API
|
%%% API
|
||||||
|
@ -205,6 +205,7 @@ generate_opcodes_ops(Modulename, HrlFile, SrcDir, Ops) ->
|
|||||||
Args = lists:flatten([gen_args(Op) || Op <- Ops]),
|
Args = lists:flatten([gen_args(Op) || Op <- Ops]),
|
||||||
EndBB = lists:flatten([gen_bb(Op) || Op <- Ops]),
|
EndBB = lists:flatten([gen_bb(Op) || Op <- Ops]),
|
||||||
InAuth = lists:flatten([gen_in_auth(Op) || Op <- Ops]),
|
InAuth = lists:flatten([gen_in_auth(Op) || Op <- Ops]),
|
||||||
|
ResType = lists:flatten([gen_res_type(Op) || Op <- Ops]),
|
||||||
|
|
||||||
io:format(File, "~s", [prelude("Provides opcode primitives.\n")]),
|
io:format(File, "~s", [prelude("Provides opcode primitives.\n")]),
|
||||||
io:format(File, "~s", [ops_exports(Modulename, HrlFile,
|
io:format(File, "~s", [ops_exports(Modulename, HrlFile,
|
||||||
@ -213,6 +214,7 @@ generate_opcodes_ops(Modulename, HrlFile, SrcDir, Ops) ->
|
|||||||
" , in_auth/1\n"
|
" , in_auth/1\n"
|
||||||
" , mnemonic/1\n"
|
" , mnemonic/1\n"
|
||||||
" , m_to_op/1\n"
|
" , m_to_op/1\n"
|
||||||
|
" , result_type/1\n"
|
||||||
])]),
|
])]),
|
||||||
|
|
||||||
io:format(File, "%% FATE mnemonics\n~s", [Mnemonic]),
|
io:format(File, "%% FATE mnemonics\n~s", [Mnemonic]),
|
||||||
@ -230,6 +232,9 @@ generate_opcodes_ops(Modulename, HrlFile, SrcDir, Ops) ->
|
|||||||
io:format(File, "%% Is FATE Op allowed in GA Authentication context?\n~s", [InAuth]),
|
io:format(File, "%% Is FATE Op allowed in GA Authentication context?\n~s", [InAuth]),
|
||||||
io:format(File, "in_auth(_) -> false.\n\n", []),
|
io:format(File, "in_auth(_) -> false.\n\n", []),
|
||||||
|
|
||||||
|
io:format(File, "%% What is the result type.\n~s", [ResType]),
|
||||||
|
io:format(File, "result_type(_) -> none.\n\n", []),
|
||||||
|
|
||||||
file:close(File).
|
file:close(File).
|
||||||
|
|
||||||
generate_code_ops(Modulename, SrcDir, Ops) ->
|
generate_code_ops(Modulename, SrcDir, Ops) ->
|
||||||
@ -369,6 +374,11 @@ gen_in_auth(#{macro := Macro, in_auth := InAuth}) ->
|
|||||||
lists:flatten(io_lib:format("in_auth(~21s) -> ~w ;\n",
|
lists:flatten(io_lib:format("in_auth(~21s) -> ~w ;\n",
|
||||||
[Macro, InAuth])).
|
[Macro, InAuth])).
|
||||||
|
|
||||||
|
gen_res_type(#{macro := Macro, res_type := ResType}) ->
|
||||||
|
lists:flatten(io_lib:format("result_type(~21s) -> ~w ;\n",
|
||||||
|
[Macro, ResType])).
|
||||||
|
|
||||||
|
|
||||||
prelude(Doc) ->
|
prelude(Doc) ->
|
||||||
"%%%-------------------------------------------------------------------\n"
|
"%%%-------------------------------------------------------------------\n"
|
||||||
"%%% @copyright (C) 2019, Aeternity Anstalt\n"
|
"%%% @copyright (C) 2019, Aeternity Anstalt\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user