From 08e169c3b2f3959d263160b13f664628d31d76f1 Mon Sep 17 00:00:00 2001 From: Erik Stenman Date: Fri, 15 Feb 2019 16:14:20 +0100 Subject: [PATCH] New format for functions, signatures and code. --- src/aeb_fate_asm.erl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/aeb_fate_asm.erl b/src/aeb_fate_asm.erl index 3a9b24d..da2b02d 100644 --- a/src/aeb_fate_asm.erl +++ b/src/aeb_fate_asm.erl @@ -153,27 +153,28 @@ deserialize(<>, Env2 = Env#{function => {<>, Sig}}, deserialize(Rest2, Env2); deserialize(<>, - #{ function := F + #{ function := {F, Sig} , bb := BB , current_bb_code := Code , code := Program , functions := Funs} = Env) -> - {Sig, Rest2} = deserialize_signature(Rest), + {NewSig, Rest2} = deserialize_signature(Rest), case Code of [] -> Env2 = Env#{ bb => 0 , current_bb_code => [] - , function => {<>, Sig} + , function => {<>, NewSig} , code => #{} - , functions => Funs#{F => Program}}, + , functions => Funs#{F => {Sig, Program}}}, deserialize(Rest2, Env2); _ -> Env2 = Env#{ bb => 0 , current_bb_code => [] - , function => {<>, Sig} + , function => {<>, NewSig} , code => #{} , functions => - Funs#{F => Program#{ BB => lists:reverse(Code)}}}, + Funs#{F => {Sig, + Program#{ BB => lists:reverse(Code)}}}}, deserialize(Rest2, Env2) end; deserialize(<>, @@ -190,7 +191,7 @@ deserialize(<>, false -> deserialize(Rest2, Env#{ current_bb_code => OpCode}) end; -deserialize(<<>>, #{ function := F +deserialize(<<>>, #{ function := {F, Sig} , bb := BB , current_bb_code := Code , code := Program @@ -204,7 +205,7 @@ deserialize(<<>>, #{ function := F , current_bb_code => [] , function => none , code => #{} - , functions => Funs#{F => FunctionCode}}. + , functions => Funs#{F => {Sig, FunctionCode}}}. deserialize_op(?ELEMENT, Rest, Code) -> {Type, Rest2} = deserialize_type(Rest),