Merge pull request #95 from aeternity/precalculate-init-id

Avoid unnecessery calls to eblake2
This commit is contained in:
Artur Puzio 2021-03-23 08:57:11 +00:00 committed by GitHub
commit 135a27c992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -82,6 +82,9 @@
-define(FATE_EMPTY_STRING, <<>>).
-define(FATE_STRING(S), S).
-define(FATE_VARIANT(Arity, Tag,T), {variant, Arity, Tag, T}).
% Result of aeb_fate_code:symbol_identifier(<<"init">>).
% Stored here to avoid repeated calls to eblake2
-define(FATE_INIT_ID, <<68,214,68,31>>).
-define(MAKE_FATE_INTEGER(X), X).
-define(MAKE_FATE_LIST(X), X).

View File

@ -95,9 +95,8 @@ insert_annotation(comment =_Type, Line, Comment, FCode) ->
strip_init_function(#fcode{ functions = Funs,
symbols = Syms } = FCode) ->
Id = symbol_identifier(<<"init">>),
Funs1 = maps:remove(Id, Funs),
Syms1 = maps:remove(Id, Syms),
Funs1 = maps:remove(?FATE_INIT_ID, Funs),
Syms1 = maps:remove(?FATE_INIT_ID, Syms),
FCode#fcode{ functions = Funs1, symbols = Syms1 }.
%%%===================================================================