From 1887486d3670a52aa836c233fdd567bcc5c6e246 Mon Sep 17 00:00:00 2001 From: Ulf Norell Date: Tue, 30 Apr 2019 11:48:11 +0200 Subject: [PATCH] Replace STR_EQ by APPEND STR_EQ is not needed, the regular EQ instruction can handle strings as well. Having an instruction for list append is quite handy though (would need two passes to do it tail recursive in FATE assembly) --- src/aeb_fate_generate_ops.erl | 2 +- test/asm_code/all_instructions.fate | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 63659f7..6c08d9a 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -78,7 +78,7 @@ ops_defs() -> , { 'HD', 16#35, 2, false, 3, [a,a], hd, "Arg0 := head of list Arg1."} , { 'TL', 16#36, 2, false, 3, [a,a], tl, "Arg0 := tail of list Arg1."} , { 'LENGTH', 16#37, 2, false, 3, [a,a], length, "Arg0 := length of list Arg1."} - , { 'STR_EQ', 16#38, 3, false, 3, [a,a,a], str_eq, "Arg0 := true iff the strings Arg1 and Arg2 are the same."} + , { 'APPEND', 16#38, 3, false, 3, [a,a,a], append, "Arg0 := Arg1 ++ Arg2."} , { 'STR_JOIN', 16#39, 3, false, 3, [a,a,a], str_join, "Arg0 := string Arg1 followed by string Arg2."} , { 'INT_TO_STR', 16#40, 2, false, 3, [a,a], int_to_str, "Arg0 := turn integer Arg1 into a string."} , { 'ADDR_TO_STR', 16#41, 2, false, 3, [a,a], addr_to_str, "Arg0 := turn address Arg1 into a string."} diff --git a/test/asm_code/all_instructions.fate b/test/asm_code/all_instructions.fate index 1cdfeb0..e8cdb29 100644 --- a/test/asm_code/all_instructions.fate +++ b/test/asm_code/all_instructions.fate @@ -104,7 +104,7 @@ FUNCTION foo () : {tuple, []} LENGTH var216 a143 - STR_EQ { 203961992615221001243597889146034217896 => 0x1f53a1843} 281217554184165828643225535776787296845 a177 + APPEND { 203961992615221001243597889146034217896 => 0x1f53a1843} 281217554184165828643225535776787296845 a177 STR_JOIN a a 7144184027126178769820155907121270843348