Remove typespec from element op. #137
@ -322,21 +322,6 @@ deserialize(<<>>, #{ function := {F, Sig}
|
|||||||
, code => #{}
|
, code => #{}
|
||||||
, functions => Funs#{F => {Sig, FunctionCode}}}.
|
, functions => Funs#{F => {Sig, FunctionCode}}}.
|
||||||
|
|
||||||
deserialize_op(?ELEMENT, Rest, Code) ->
|
|
||||||
{Type, Rest2} = deserialize_type(Rest),
|
|
||||||
<<ArgType:8, Rest3/binary>> = Rest2,
|
|
||||||
{Arg0, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg1, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg2, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
{Rest6, [{ aeb_fate_opcodes:mnemonic(?ELEMENT)
|
|
||||||
, Type
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}}
|
|
||||||
| Code]};
|
|
||||||
deserialize_op(?SWITCH_VN, Rest, Code) ->
|
deserialize_op(?SWITCH_VN, Rest, Code) ->
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
<<ArgType:8, Rest2/binary>> = Rest,
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
||||||
@ -689,12 +674,6 @@ serialize_code([ {Arg0Type, Arg0} | Rest]) ->
|
|||||||
[ArgSpec
|
[ArgSpec
|
||||||
, serialize_data(Arg0Type, Arg0)
|
, serialize_data(Arg0Type, Arg0)
|
||||||
| serialize_code(Rest)];
|
| serialize_code(Rest)];
|
||||||
serialize_code([ ?ELEMENT
|
|
||||||
, ResType
|
|
||||||
| Rest]) ->
|
|
||||||
[?ELEMENT,
|
|
||||||
serialize_type(ResType)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ ?SWITCH_VN
|
serialize_code([ ?SWITCH_VN
|
||||||
, {Arg0Type, Arg0}
|
, {Arg0Type, Arg0}
|
||||||
, {immediate, L}
|
, {immediate, L}
|
||||||
@ -790,10 +769,6 @@ to_bytecode([{function,_line, 'FUNCTION'}|Rest], Address, Env, Code, Opts) ->
|
|||||||
Env2 = insert_fun(Address, Code, Env),
|
Env2 = insert_fun(Address, Code, Env),
|
||||||
{Fun, Rest2} = to_fun_def(Rest),
|
{Fun, Rest2} = to_fun_def(Rest),
|
||||||
to_bytecode(Rest2, Fun, Env2, [], Opts);
|
to_bytecode(Rest2, Fun, Env2, [], Opts);
|
||||||
to_bytecode([{mnemonic,_line, 'ELEMENT'}|Rest], Address, Env, Code, Opts) ->
|
|
||||||
OpCode = aeb_fate_opcodes:m_to_op('ELEMENT'),
|
|
||||||
{RetType, Rest2} = to_type(Rest),
|
|
||||||
to_bytecode(Rest2, Address, Env, [RetType, OpCode|Code], Opts);
|
|
||||||
to_bytecode([{mnemonic,_line, Op}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{mnemonic,_line, Op}|Rest], Address, Env, Code, Opts) ->
|
||||||
OpCode = aeb_fate_opcodes:m_to_op(Op),
|
OpCode = aeb_fate_opcodes:m_to_op(Op),
|
||||||
to_bytecode(Rest, Address, Env, [OpCode|Code], Opts);
|
to_bytecode(Rest, Address, Env, [OpCode|Code], Opts);
|
||||||
|
@ -62,7 +62,7 @@ ops_defs() ->
|
|||||||
, { 'OR', 16#27, 3, false, 3, [a,a,a], or_op, "Arg0 := Arg1 or Arg2."}
|
, { 'OR', 16#27, 3, false, 3, [a,a,a], or_op, "Arg0 := Arg1 or Arg2."}
|
||||||
, { 'NOT', 16#28, 2, false, 3, [a,a], not_op, "Arg0 := not Arg1."}
|
, { 'NOT', 16#28, 2, false, 3, [a,a], not_op, "Arg0 := not Arg1."}
|
||||||
, { 'TUPLE', 16#29, 1, false, 3, [ii], tuple, "Create a tuple of size = Arg0. Elements on stack."}
|
, { 'TUPLE', 16#29, 1, false, 3, [ii], tuple, "Create a tuple of size = Arg0. Elements on stack."}
|
||||||
, { 'ELEMENT', 16#2a, 4, false, 3, [t,a,a,a], element_op, "Arg1 := element(Arg2, Arg3). The element should be of type Arg1"}
|
, { 'ELEMENT', 16#2a, 3, false, 3, [a,a,a], element_op, "Arg1 := element(Arg2, Arg3)."}
|
||||||
, { 'MAP_EMPTY', 16#2b, 1, false, 3, [a], map_empty, "Arg0 := #{}."}
|
, { 'MAP_EMPTY', 16#2b, 1, false, 3, [a], map_empty, "Arg0 := #{}."}
|
||||||
, { 'MAP_LOOKUP', 16#2c, 3, false, 3, [a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1."}
|
, { 'MAP_LOOKUP', 16#2c, 3, false, 3, [a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1."}
|
||||||
, { 'MAP_LOOKUPD', 16#2d, 4, false, 3, [a,a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1 if key exists in map otherwise Arg0 := Arg3."}
|
, { 'MAP_LOOKUPD', 16#2d, 4, false, 3, [a,a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1 if key exists in map otherwise Arg0 := Arg3."}
|
||||||
@ -414,8 +414,6 @@ gen_asm_pp(Module, Path, Ops) ->
|
|||||||
io:format(File, "-module(~w).\n\n", [Module]),
|
io:format(File, "-module(~w).\n\n", [Module]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
"-export([format_op/2]).\n\n"
|
"-export([format_op/2]).\n\n"
|
||||||
"format_arg(t, T) ->\n"
|
|
||||||
" io_lib:format(\"~~p \", [T]);\n"
|
|
||||||
"format_arg(li, {immediate, LI}) ->\n"
|
"format_arg(li, {immediate, LI}) ->\n"
|
||||||
" aeb_fate_data:format(LI);\n"
|
" aeb_fate_data:format(LI);\n"
|
||||||
"format_arg(_, {immediate, I}) ->\n"
|
"format_arg(_, {immediate, I}) ->\n"
|
||||||
@ -653,16 +651,16 @@ generate_documentation(Filename) ->
|
|||||||
|
|
||||||
gen_doc(#{ opname := Name
|
gen_doc(#{ opname := Name
|
||||||
, opcode := OpCode
|
, opcode := OpCode
|
||||||
, args := Args
|
, args := _Args
|
||||||
, end_bb := EndBB
|
, end_bb := _EndBB
|
||||||
, format := FateFormat
|
, format := FateFormat
|
||||||
, macro := Macro
|
, macro := _Macro
|
||||||
, type_name := TypeName
|
, type_name := _TypeName
|
||||||
, doc := Doc
|
, doc := Doc
|
||||||
, gas := Gas
|
, gas := _Gas
|
||||||
, type := Type
|
, type := _Type
|
||||||
, constructor := Constructor
|
, constructor := _Constructor
|
||||||
, constructor_type := ConstructorType
|
, constructor_type := _ConstructorType
|
||||||
}) ->
|
}) ->
|
||||||
Arguments =
|
Arguments =
|
||||||
case FateFormat of
|
case FateFormat of
|
||||||
@ -680,8 +678,8 @@ gen_doc(#{ opname := Name
|
|||||||
, Doc]).
|
, Doc]).
|
||||||
|
|
||||||
format_arg_doc({a, N}) -> io_lib:format("Arg~w", [N]);
|
format_arg_doc({a, N}) -> io_lib:format("Arg~w", [N]);
|
||||||
format_arg_doc({is,N}) -> "Identifier";
|
format_arg_doc({is,_N}) -> "Identifier";
|
||||||
format_arg_doc({ii,N}) -> "Integer";
|
format_arg_doc({ii,_N}) -> "Integer";
|
||||||
format_arg_doc({li,N}) -> "[Integers]";
|
format_arg_doc({li,_N}) -> "[Integers]";
|
||||||
format_arg_doc({t,N}) -> "Type".
|
format_arg_doc({t,_N}) -> "Type".
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
TUPLE 5019186157739257888756115213149493826410
|
TUPLE 5019186157739257888756115213149493826410
|
||||||
|
|
||||||
ELEMENT integer arg148 var25 a219
|
ELEMENT arg148 var25 a219
|
||||||
|
|
||||||
MAP_EMPTY a135
|
MAP_EMPTY a135
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ FUNCTION element1(integer, integer): integer
|
|||||||
PUSH arg0
|
PUSH arg0
|
||||||
PUSH arg1
|
PUSH arg1
|
||||||
TUPLE 2
|
TUPLE 2
|
||||||
ELEMENT integer a 1 a
|
ELEMENT a 1 a
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
FUNCTION element({tuple, [integer, integer]}, integer): integer
|
FUNCTION element({tuple, [integer, integer]}, integer): integer
|
||||||
;; BB : 0
|
;; BB : 0
|
||||||
ELEMENT integer a arg1 arg0
|
ELEMENT a arg1 arg0
|
||||||
RETURN
|
RETURN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user