From ca293f84496751349d7206b88f324c31fd9d184b Mon Sep 17 00:00:00 2001 From: Tobias Lindahl Date: Tue, 28 May 2019 10:52:06 +0200 Subject: [PATCH] Add missing basic instructions * MAP_SIZE * MAP_TO_LIST * STR_LENGTH --- src/aeb_fate_generate_ops.erl | 4 ++++ test/asm_code/all_instructions.fate | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index e1f91c0..424f74f 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -158,6 +158,10 @@ ops_defs() -> , { 'AENS_REVOKE', 16#6d, false, 3, [], aens_revoke, {}, none, "NYI"} , { 'ECVERIFY', 16#6e, false, 3, [], ecverify, {}, none, "NYI"} , { 'BALANCE_OTHER', 16#6f, false, 3, [a,a], balance_other, {address}, integer, "Arg0 := The balance of address Arg1."} + %% TODO: Reorder these before documenting the specification + , { 'MAP_SIZE', 16#70, false, 3, [a,a], map_size, {map}, integer, "Arg0 := The size of the map Arg1."} + , { 'MAP_TO_LIST', 16#71, false, 3, [a,a], map_to_list, {map}, list, "Arg0 := The tuple list representation of the map Arg1."} + , { 'STR_LENGTH', 16#72, false, 3, [a,a], str_length, {string}, integer, "Arg0 := The length of the string Arg1."} , { 'DEACTIVATE', 16#fa, false, 3, [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, 3, [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/test/asm_code/all_instructions.fate b/test/asm_code/all_instructions.fate index 51bb195..32b6b0d 100644 --- a/test/asm_code/all_instructions.fate +++ b/test/asm_code/all_instructions.fate @@ -96,6 +96,10 @@ FUNCTION foo () : {tuple, []} MAP_FROM_LIST () a + MAP_TO_LIST a { true => 4 } + + MAP_SIZE a { true => 42 } + NIL arg91 IS_NIL a var6 @@ -118,6 +122,8 @@ FUNCTION foo () : {tuple, []} STR_REVERSE a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv + STR_LENGTH a "foo" + INT_TO_ADDR arg127 var207 VARIANT a a 0x1f7b72200 a