From da64e6ce5157b1231f764820e1c0d83917d34488 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Tue, 6 Dec 2022 17:25:27 +0300 Subject: [PATCH 01/21] Add DBGLOC fate op --- include/aeb_opcodes.hrl | 2 ++ src/aeb_fate_generate_ops.erl | 2 ++ src/aeb_opcodes.erl | 3 +++ 3 files changed, 7 insertions(+) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index c21bf39..8d04333 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -143,6 +143,8 @@ -define( 'RETURN', 16#f3). -define( 'DELEGATECALL', 16#f4). +-define( 'DBGLOC', 16#b1). + -define( 'STATICCALL', 16#fa). -define( 'REVERT', 16#fd). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 220fef1..5f5f416 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -242,6 +242,8 @@ ops_defs() -> , { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"} , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} + , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } + , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} , { 'EXIT', 16#fc, true, true, true, ?GAS(10), [a], exit, {string}, none, "Abort execution (use upp all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 4422bae..8e83b87 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -162,6 +162,7 @@ opcode(?DELEGATECALL) -> ?DELEGATECALL; opcode(?STATICCALL) -> ?STATICCALL; %% TODO opcode(?REVERT) -> ?REVERT; opcode({comment,X}) -> ?COMMENT(X); +opcode(?DBGLOC) -> ?DBGLOC; opcode(?SUICIDE) -> ?SUICIDE. @@ -303,6 +304,7 @@ mnemonic(?DELEGATECALL) -> 'DELEGATECALL' ; mnemonic(?STATICCALL) -> 'STATICCALL' ; mnemonic(?REVERT) -> 'REVERT' ; mnemonic({comment,_}) -> 'COMMENT' ; +mnemonic(?DBGLOC) -> 'DBGLOC' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -446,6 +448,7 @@ m_to_op('STATICCALL') -> ?STATICCALL ; m_to_op('REVERT') -> ?REVERT ; m_to_op('COMMENT') -> ?COMMENT("") ; m_to_op('SUICIDE') -> ?SUICIDE ; +m_to_op('DBGLOC') -> ?DBGLOC ; m_to_op(Data) when 0= Data . -- 2.30.2 From fc9a795b49efc57e3daa6209067ede727c68a8df Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 19:17:22 +0300 Subject: [PATCH 02/21] Add DBGDEF and DBGUNDEF --- include/aeb_opcodes.hrl | 2 ++ src/aeb_fate_generate_ops.erl | 2 ++ src/aeb_opcodes.erl | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 8d04333..4eab4e2 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -144,6 +144,8 @@ -define( 'DELEGATECALL', 16#f4). -define( 'DBGLOC', 16#b1). +-define( 'DBGDEF', 16#b2). +-define( 'DBGUNDEF', 16#b3). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 5f5f416..5ea912b 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -243,6 +243,8 @@ ops_defs() -> , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } + , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, tuple}, none, "Arg" } + , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, tuple}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 8e83b87..eb5d127 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -163,6 +163,8 @@ opcode(?STATICCALL) -> ?STATICCALL; %% TODO opcode(?REVERT) -> ?REVERT; opcode({comment,X}) -> ?COMMENT(X); opcode(?DBGLOC) -> ?DBGLOC; +opcode(?DBGDEF) -> ?DBGDEF; +opcode(?DBGUNDEF) -> ?DBGUNDEF; opcode(?SUICIDE) -> ?SUICIDE. @@ -305,6 +307,8 @@ mnemonic(?STATICCALL) -> 'STATICCALL' ; mnemonic(?REVERT) -> 'REVERT' ; mnemonic({comment,_}) -> 'COMMENT' ; mnemonic(?DBGLOC) -> 'DBGLOC' ; +mnemonic(?DBGDEF) -> 'DBGDEF' ; +mnemonic(?DBGUNDEF) -> 'DBGUNDEF' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -449,6 +453,8 @@ m_to_op('REVERT') -> ?REVERT ; m_to_op('COMMENT') -> ?COMMENT("") ; m_to_op('SUICIDE') -> ?SUICIDE ; m_to_op('DBGLOC') -> ?DBGLOC ; +m_to_op('DBGDEF') -> ?DBGDEF ; +m_to_op('DBGUNDEF') -> ?DBGUNDEF ; m_to_op(Data) when 0= Data . -- 2.30.2 From 8fc9773c547dcd0e8c0942ca3eb84a595b66843f Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 19:30:41 +0300 Subject: [PATCH 03/21] Change the type of arg for dbgdef and dbgundef --- src/aeb_fate_generate_ops.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 5ea912b..6594cce 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -243,8 +243,8 @@ ops_defs() -> , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } - , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, tuple}, none, "Arg" } - , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, tuple}, none, "Arg" } + , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, any}, none, "Arg" } + , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} -- 2.30.2 From ebe6d0fa7e7801ebbd0187e261b9f2e23c3028e0 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 19:57:22 +0300 Subject: [PATCH 04/21] Change DBGUNDEF to end_bb = true --- src/aeb_fate_generate_ops.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 6594cce..409ae5f 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -244,7 +244,7 @@ ops_defs() -> , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, any}, none, "Arg" } - , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } + , { 'DBGUNDEF', 16#b3, true, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} -- 2.30.2 From ee4949777fd988b76b9f854a2523a64a6dcdf591 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 20:00:06 +0300 Subject: [PATCH 05/21] No safe sanity check for dbgundef --- src/aeb_fate_code.erl | 1 + src/aeb_fate_generate_ops.erl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aeb_fate_code.erl b/src/aeb_fate_code.erl index c3c2003..4cfe9e7 100644 --- a/src/aeb_fate_code.erl +++ b/src/aeb_fate_code.erl @@ -220,6 +220,7 @@ safe_sanity_check(IsLast, Op, Args) -> true -> case IsLast == aeb_fate_opcodes:end_bb(Op) of true -> ok; + false when Op == 6 -> ok; false -> error({wrong_opcode_in_bb, Op}) end; false -> error({wrong_nr_args_opcode, Op}) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 409ae5f..6594cce 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -244,7 +244,7 @@ ops_defs() -> , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, any}, none, "Arg" } - , { 'DBGUNDEF', 16#b3, true, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } + , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} -- 2.30.2 From dd6ec9bc9ba7017f10538fd61abd9b89d7a5d8a3 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 20:11:43 +0300 Subject: [PATCH 06/21] Rename DBGDEF and DBGUNDEF to DBG_DEF and DBG_UNDEF --- include/aeb_opcodes.hrl | 4 ++-- src/aeb_fate_generate_ops.erl | 4 ++-- src/aeb_opcodes.erl | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 4eab4e2..f3d84e9 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -144,8 +144,8 @@ -define( 'DELEGATECALL', 16#f4). -define( 'DBGLOC', 16#b1). --define( 'DBGDEF', 16#b2). --define( 'DBGUNDEF', 16#b3). +-define( 'DBG_DEF', 16#b2). +-define( 'DBG_UNDEF', 16#b3). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 6594cce..3cdbcae 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -243,8 +243,8 @@ ops_defs() -> , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } - , { 'DBGDEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbgdef, {string, any}, none, "Arg" } - , { 'DBGUNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbgundef, {string, any}, none, "Arg" } + , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Arg" } + , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index eb5d127..44b073b 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -163,8 +163,8 @@ opcode(?STATICCALL) -> ?STATICCALL; %% TODO opcode(?REVERT) -> ?REVERT; opcode({comment,X}) -> ?COMMENT(X); opcode(?DBGLOC) -> ?DBGLOC; -opcode(?DBGDEF) -> ?DBGDEF; -opcode(?DBGUNDEF) -> ?DBGUNDEF; +opcode(?DBG_DEF) -> ?DBG_DEF; +opcode(?DBG_UNDEF) -> ?DBG_UNDEF; opcode(?SUICIDE) -> ?SUICIDE. @@ -307,8 +307,8 @@ mnemonic(?STATICCALL) -> 'STATICCALL' ; mnemonic(?REVERT) -> 'REVERT' ; mnemonic({comment,_}) -> 'COMMENT' ; mnemonic(?DBGLOC) -> 'DBGLOC' ; -mnemonic(?DBGDEF) -> 'DBGDEF' ; -mnemonic(?DBGUNDEF) -> 'DBGUNDEF' ; +mnemonic(?DBG_DEF) -> 'DBG_DEF' ; +mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -453,8 +453,8 @@ m_to_op('REVERT') -> ?REVERT ; m_to_op('COMMENT') -> ?COMMENT("") ; m_to_op('SUICIDE') -> ?SUICIDE ; m_to_op('DBGLOC') -> ?DBGLOC ; -m_to_op('DBGDEF') -> ?DBGDEF ; -m_to_op('DBGUNDEF') -> ?DBGUNDEF ; +m_to_op('DBG_DEF') -> ?DBG_DEF ; +m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; m_to_op(Data) when 0= Data . -- 2.30.2 From 3446cd3df6d0a2592f331999fe518f3ee083d4c1 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 23 Dec 2022 20:46:22 +0300 Subject: [PATCH 07/21] Revert "No safe sanity check for dbgundef" This reverts commit ee4949777fd988b76b9f854a2523a64a6dcdf591. --- src/aeb_fate_code.erl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/aeb_fate_code.erl b/src/aeb_fate_code.erl index 4cfe9e7..c3c2003 100644 --- a/src/aeb_fate_code.erl +++ b/src/aeb_fate_code.erl @@ -220,7 +220,6 @@ safe_sanity_check(IsLast, Op, Args) -> true -> case IsLast == aeb_fate_opcodes:end_bb(Op) of true -> ok; - false when Op == 6 -> ok; false -> error({wrong_opcode_in_bb, Op}) end; false -> error({wrong_nr_args_opcode, Op}) -- 2.30.2 From dc7a7c7d6f2ccac74572e3fe6f917b348849a83f Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sun, 25 Dec 2022 10:30:55 +0300 Subject: [PATCH 08/21] Rename DBGLOC to DBG_LOC --- include/aeb_opcodes.hrl | 2 +- src/aeb_fate_generate_ops.erl | 2 +- src/aeb_opcodes.erl | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index f3d84e9..9d0638c 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -143,7 +143,7 @@ -define( 'RETURN', 16#f3). -define( 'DELEGATECALL', 16#f4). --define( 'DBGLOC', 16#b1). +-define( 'DBG_LOC', 16#b1). -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 3cdbcae..c2a9bf8 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -242,7 +242,7 @@ ops_defs() -> , { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"} , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} - , { 'DBGLOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbgloc, {string, integer, integer}, none, "Arg" } + , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbg_loc, {string, integer, integer}, none, "Arg" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Arg" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Arg" } diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 44b073b..417abfe 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -162,7 +162,7 @@ opcode(?DELEGATECALL) -> ?DELEGATECALL; opcode(?STATICCALL) -> ?STATICCALL; %% TODO opcode(?REVERT) -> ?REVERT; opcode({comment,X}) -> ?COMMENT(X); -opcode(?DBGLOC) -> ?DBGLOC; +opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; opcode(?SUICIDE) -> ?SUICIDE. @@ -306,9 +306,9 @@ mnemonic(?DELEGATECALL) -> 'DELEGATECALL' ; mnemonic(?STATICCALL) -> 'STATICCALL' ; mnemonic(?REVERT) -> 'REVERT' ; mnemonic({comment,_}) -> 'COMMENT' ; -mnemonic(?DBGLOC) -> 'DBGLOC' ; -mnemonic(?DBG_DEF) -> 'DBG_DEF' ; -mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; +mnemonic(?DBG_LOC) -> 'DBG_LOC' ; +mnemonic(?DBG_DEF) -> 'DBG_DEF' ; +mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -452,9 +452,9 @@ m_to_op('STATICCALL') -> ?STATICCALL ; m_to_op('REVERT') -> ?REVERT ; m_to_op('COMMENT') -> ?COMMENT("") ; m_to_op('SUICIDE') -> ?SUICIDE ; -m_to_op('DBGLOC') -> ?DBGLOC ; -m_to_op('DBG_DEF') -> ?DBG_DEF ; -m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; +m_to_op('DBG_LOC') -> ?DBG_LOC ; +m_to_op('DBG_DEF') -> ?DBG_DEF ; +m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; m_to_op(Data) when 0= Data . -- 2.30.2 From 69a1c41a4fc31c6449bf077532c22de23f2bbe83 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sun, 25 Dec 2022 11:10:42 +0300 Subject: [PATCH 09/21] Remove column from DBG_LOC --- src/aeb_fate_generate_ops.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index c2a9bf8..3cba631 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -242,7 +242,7 @@ ops_defs() -> , { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"} , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} - , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a, a], dbg_loc, {string, integer, integer}, none, "Arg" } + , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Arg" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Arg" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Arg" } -- 2.30.2 From db9766ac746b7f2d34a6f09a2f528be07b4226ea Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 15 Feb 2023 13:49:19 +0300 Subject: [PATCH 10/21] Add DBG_CALL and DBG_RETURN --- include/aeb_opcodes.hrl | 2 ++ src/aeb_fate_generate_ops.erl | 2 ++ src/aeb_opcodes.erl | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 9d0638c..a0e8418 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -146,6 +146,8 @@ -define( 'DBG_LOC', 16#b1). -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). +-define( 'DBG_CALL', 16#b4). +-define( 'DBG_RETURN', 16#b5). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 3cba631..8f0483f 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -245,6 +245,8 @@ ops_defs() -> , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Arg" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Arg" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Arg" } + , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Arg" } + , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Arg" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 417abfe..bc9e5fd 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -165,6 +165,8 @@ opcode({comment,X}) -> ?COMMENT(X); opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; +opcode(?DBG_CALL) -> ?DBG_CALL; +opcode(?DBG_RETURN) -> ?DBG_RETURN; opcode(?SUICIDE) -> ?SUICIDE. @@ -309,6 +311,8 @@ mnemonic({comment,_}) -> 'COMMENT' ; mnemonic(?DBG_LOC) -> 'DBG_LOC' ; mnemonic(?DBG_DEF) -> 'DBG_DEF' ; mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; +mnemonic(?DBG_CALL) -> 'DBG_CALL' ; +mnemonic(?DBG_RETURN) -> 'DBG_RETURN' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -455,6 +459,8 @@ m_to_op('SUICIDE') -> ?SUICIDE ; m_to_op('DBG_LOC') -> ?DBG_LOC ; m_to_op('DBG_DEF') -> ?DBG_DEF ; m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; +m_to_op('DBG_CALL') -> ?DBG_CALL ; +m_to_op('DBG_RETURN') -> ?DBG_RETURN ; m_to_op(Data) when 0= Data . -- 2.30.2 From 7cac2c215d90cd69744c2b2d8b7d18a17e35bef2 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 15 Feb 2023 14:03:44 +0300 Subject: [PATCH 11/21] Update the docs for debug opcodes --- src/aeb_fate_generate_ops.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 8f0483f..3db73f5 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -242,11 +242,11 @@ ops_defs() -> , { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"} , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} - , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Arg" } - , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Arg" } - , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Arg" } - , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Arg" } - , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Arg" } + , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } + , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } + , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } + , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } + , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} -- 2.30.2 From a336314cfc3930b348fb73352de8c108eba72973 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 17 Mar 2023 08:28:39 +0300 Subject: [PATCH 12/21] Add a DBG_CALL_R for remote calls --- include/aeb_opcodes.hrl | 3 ++- src/aeb_fate_generate_ops.erl | 5 +++-- src/aeb_opcodes.erl | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index a0e8418..569c900 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -147,7 +147,8 @@ -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). -define( 'DBG_CALL', 16#b4). --define( 'DBG_RETURN', 16#b5). +-define( 'DBG_CALL_R', 16#b5). +-define( 'DBG_RETURN', 16#b6). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 3db73f5..8cba308 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -245,8 +245,9 @@ ops_defs() -> , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } - , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } - , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } + , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a], dbg_call, {string, boolean}, none, "Debug Op: Push to call stack. Args = {fun_name, is_tail_call}" } + , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a, a], dbg_call_r, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } + , { 'DBG_RETURN', 16#b6, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index bc9e5fd..1c9e5aa 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -166,6 +166,7 @@ opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; opcode(?DBG_CALL) -> ?DBG_CALL; +opcode(?DBG_CALL_R) -> ?DBG_CALL_R; opcode(?DBG_RETURN) -> ?DBG_RETURN; opcode(?SUICIDE) -> ?SUICIDE. @@ -312,6 +313,7 @@ mnemonic(?DBG_LOC) -> 'DBG_LOC' ; mnemonic(?DBG_DEF) -> 'DBG_DEF' ; mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; mnemonic(?DBG_CALL) -> 'DBG_CALL' ; +mnemonic(?DBG_CALL_R) -> 'DBG_CALL_R' ; mnemonic(?DBG_RETURN) -> 'DBG_RETURN' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -460,6 +462,7 @@ m_to_op('DBG_LOC') -> ?DBG_LOC ; m_to_op('DBG_DEF') -> ?DBG_DEF ; m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; m_to_op('DBG_CALL') -> ?DBG_CALL ; +m_to_op('DBG_CALL_R') -> ?DBG_CALL_R ; m_to_op('DBG_RETURN') -> ?DBG_RETURN ; m_to_op(Data) when 0= Data . -- 2.30.2 From a620c9c34b1c0ace77253ec0eabe6ac0b8e77ad2 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 17 Mar 2023 08:32:28 +0300 Subject: [PATCH 13/21] Remove is_tail_call from DBG_CALL_R --- src/aeb_fate_generate_ops.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 8cba308..5a34a8e 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -246,7 +246,7 @@ ops_defs() -> , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a], dbg_call, {string, boolean}, none, "Debug Op: Push to call stack. Args = {fun_name, is_tail_call}" } - , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a, a], dbg_call_r, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } + , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a], dbg_call_r, {address, string}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name}" } , { 'DBG_RETURN', 16#b6, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} -- 2.30.2 From 782bcea5ce2f0ef43c53255a31651d1ef6ec47d2 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sat, 18 Mar 2023 13:46:50 +0300 Subject: [PATCH 14/21] Revert "Remove is_tail_call from DBG_CALL_R" This reverts commit a620c9c34b1c0ace77253ec0eabe6ac0b8e77ad2. --- src/aeb_fate_generate_ops.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 5a34a8e..8cba308 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -246,7 +246,7 @@ ops_defs() -> , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a], dbg_call, {string, boolean}, none, "Debug Op: Push to call stack. Args = {fun_name, is_tail_call}" } - , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a], dbg_call_r, {address, string}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name}" } + , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a, a], dbg_call_r, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } , { 'DBG_RETURN', 16#b6, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} -- 2.30.2 From f53029453c492df3fdb02f25e4d7d13adee646e0 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sat, 18 Mar 2023 13:46:51 +0300 Subject: [PATCH 15/21] Revert "Add a DBG_CALL_R for remote calls" This reverts commit a336314cfc3930b348fb73352de8c108eba72973. --- include/aeb_opcodes.hrl | 3 +-- src/aeb_fate_generate_ops.erl | 5 ++--- src/aeb_opcodes.erl | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 569c900..a0e8418 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -147,8 +147,7 @@ -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). -define( 'DBG_CALL', 16#b4). --define( 'DBG_CALL_R', 16#b5). --define( 'DBG_RETURN', 16#b6). +-define( 'DBG_RETURN', 16#b5). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 8cba308..3db73f5 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -245,9 +245,8 @@ ops_defs() -> , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } - , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a], dbg_call, {string, boolean}, none, "Debug Op: Push to call stack. Args = {fun_name, is_tail_call}" } - , { 'DBG_CALL_R', 16#b5, false, true, true, ?GAS(0), [a, a, a], dbg_call_r, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } - , { 'DBG_RETURN', 16#b6, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } + , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } + , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 1c9e5aa..bc9e5fd 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -166,7 +166,6 @@ opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; opcode(?DBG_CALL) -> ?DBG_CALL; -opcode(?DBG_CALL_R) -> ?DBG_CALL_R; opcode(?DBG_RETURN) -> ?DBG_RETURN; opcode(?SUICIDE) -> ?SUICIDE. @@ -313,7 +312,6 @@ mnemonic(?DBG_LOC) -> 'DBG_LOC' ; mnemonic(?DBG_DEF) -> 'DBG_DEF' ; mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; mnemonic(?DBG_CALL) -> 'DBG_CALL' ; -mnemonic(?DBG_CALL_R) -> 'DBG_CALL_R' ; mnemonic(?DBG_RETURN) -> 'DBG_RETURN' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -462,7 +460,6 @@ m_to_op('DBG_LOC') -> ?DBG_LOC ; m_to_op('DBG_DEF') -> ?DBG_DEF ; m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; m_to_op('DBG_CALL') -> ?DBG_CALL ; -m_to_op('DBG_CALL_R') -> ?DBG_CALL_R ; m_to_op('DBG_RETURN') -> ?DBG_RETURN ; m_to_op(Data) when 0= Data . -- 2.30.2 From bf3a692e0dbebd8ae57becb92566c9c957b0efa6 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sat, 18 Mar 2023 13:47:46 +0300 Subject: [PATCH 16/21] Revert "Add DBG_CALL and DBG_RETURN" This reverts commit db9766ac746b7f2d34a6f09a2f528be07b4226ea. --- include/aeb_opcodes.hrl | 2 -- src/aeb_fate_generate_ops.erl | 2 -- src/aeb_opcodes.erl | 6 ------ 3 files changed, 10 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index a0e8418..9d0638c 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -146,8 +146,6 @@ -define( 'DBG_LOC', 16#b1). -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). --define( 'DBG_CALL', 16#b4). --define( 'DBG_RETURN', 16#b5). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 3db73f5..c5f873c 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -245,8 +245,6 @@ ops_defs() -> , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } - , { 'DBG_CALL', 16#b4, false, true, true, ?GAS(0), [a, a, a], dbg_call, {address, string, boolean}, none, "Debug Op: Push to call stack. Args = {contract_pk, fun_name, is_tail_call}" } - , { 'DBG_RETURN', 16#b5, false, true, true, ?GAS(0), [], dbg_return, {}, none, "Debug Op: Pop from call stack" } , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index bc9e5fd..417abfe 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -165,8 +165,6 @@ opcode({comment,X}) -> ?COMMENT(X); opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; -opcode(?DBG_CALL) -> ?DBG_CALL; -opcode(?DBG_RETURN) -> ?DBG_RETURN; opcode(?SUICIDE) -> ?SUICIDE. @@ -311,8 +309,6 @@ mnemonic({comment,_}) -> 'COMMENT' ; mnemonic(?DBG_LOC) -> 'DBG_LOC' ; mnemonic(?DBG_DEF) -> 'DBG_DEF' ; mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; -mnemonic(?DBG_CALL) -> 'DBG_CALL' ; -mnemonic(?DBG_RETURN) -> 'DBG_RETURN' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -459,8 +455,6 @@ m_to_op('SUICIDE') -> ?SUICIDE ; m_to_op('DBG_LOC') -> ?DBG_LOC ; m_to_op('DBG_DEF') -> ?DBG_DEF ; m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; -m_to_op('DBG_CALL') -> ?DBG_CALL ; -m_to_op('DBG_RETURN') -> ?DBG_RETURN ; m_to_op(Data) when 0= Data . -- 2.30.2 From d85e6976797fd0b6b0f5ecff22a9b99e3edc2feb Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sun, 19 Mar 2023 13:03:42 +0300 Subject: [PATCH 17/21] Add DBG_CONTRACT op --- include/aeb_opcodes.hrl | 1 + src/aeb_fate_generate_ops.erl | 1 + src/aeb_opcodes.erl | 3 +++ 3 files changed, 5 insertions(+) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 9d0638c..5cb22cc 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -146,6 +146,7 @@ -define( 'DBG_LOC', 16#b1). -define( 'DBG_DEF', 16#b2). -define( 'DBG_UNDEF', 16#b3). +-define( 'DBG_CONTRACT', 16#b4). -define( 'STATICCALL', 16#fa). diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index c5f873c..66347e1 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -245,6 +245,7 @@ ops_defs() -> , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } + , { 'DBG_CONTRACT', 16#b4, false, true, true, ?GAS(0), [a], dbg_contract, {string}, none, "Debug Op: Name the current contract. Args: {contract_name}"} , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index 417abfe..e4f90b5 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -165,6 +165,7 @@ opcode({comment,X}) -> ?COMMENT(X); opcode(?DBG_LOC) -> ?DBG_LOC; opcode(?DBG_DEF) -> ?DBG_DEF; opcode(?DBG_UNDEF) -> ?DBG_UNDEF; +opcode(?DBG_CONTRACT) -> ?DBG_CONTRACT; opcode(?SUICIDE) -> ?SUICIDE. @@ -309,6 +310,7 @@ mnemonic({comment,_}) -> 'COMMENT' ; mnemonic(?DBG_LOC) -> 'DBG_LOC' ; mnemonic(?DBG_DEF) -> 'DBG_DEF' ; mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; +mnemonic(?DBG_CONTRACT) -> 'DBG_CONTRACT' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -455,6 +457,7 @@ m_to_op('SUICIDE') -> ?SUICIDE ; m_to_op('DBG_LOC') -> ?DBG_LOC ; m_to_op('DBG_DEF') -> ?DBG_DEF ; m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; +m_to_op('DBG_CONTRACT') -> ?DBG_CONTRACT ; m_to_op(Data) when 0= Data . -- 2.30.2 From 3d75a9a9dc149e4e3152d273b1e1f8f6afb9eee3 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Mon, 17 Apr 2023 10:53:15 +0300 Subject: [PATCH 18/21] Upgrade aeserialization dep --- rebar.config | 2 +- rebar.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index e89721d..2647c3e 100644 --- a/rebar.config +++ b/rebar.config @@ -6,7 +6,7 @@ {deps, [ {eblake2, "1.0.0"} , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", - {ref, "eb68fe3"}}} + {ref, "177bf60"}}} , {getopt, "1.0.1"} ]}. diff --git a/rebar.lock b/rebar.lock index 3e111f3..2eb30ee 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,7 +1,7 @@ {"1.2.0", [{<<"aeserialization">>, {git,"https://github.com/aeternity/aeserialization.git", - {ref,"eb68fe331bd476910394966b7f5ede7a74d37e35"}}, + {ref,"177bf604b2a05e940f92cf00e96e6e269e708245"}}, 0}, {<<"base58">>, {git,"https://github.com/aeternity/erl-base58.git", -- 2.30.2 From e50b4ebc796340d5ab502c4ec38d0a932f7750f9 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Mon, 17 Apr 2023 17:48:02 +0300 Subject: [PATCH 19/21] Use aeserialization v1.0.0 --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 2647c3e..8ccf8f0 100644 --- a/rebar.config +++ b/rebar.config @@ -6,7 +6,7 @@ {deps, [ {eblake2, "1.0.0"} , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", - {ref, "177bf60"}}} + {tag, "v1.0.0"}}} , {getopt, "1.0.1"} ]}. -- 2.30.2 From 0a993c54b9aa46dded32a7ec5de1ccfda8be36ac Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 28 Apr 2023 14:28:29 +0300 Subject: [PATCH 20/21] Use aeserialization tag v1.0.0 --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 8ccf8f0..29dce2d 100644 --- a/rebar.config +++ b/rebar.config @@ -40,7 +40,7 @@ {profiles, [{binary, [ {deps, [ {eblake2, "1.0.0"} , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", - {ref, "47aaa8f"}}} + {tag, "v1.0.0"}}} , {getopt, "1.0.1"} ]}, -- 2.30.2 From 5eaae614ce496b2c9e3a6da4124fd1dd62da4af3 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Tue, 23 May 2023 12:04:54 +0300 Subject: [PATCH 21/21] Remove debug instructions from AEVM --- include/aeb_opcodes.hrl | 5 ----- src/aeb_opcodes.erl | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/include/aeb_opcodes.hrl b/include/aeb_opcodes.hrl index 5cb22cc..c21bf39 100644 --- a/include/aeb_opcodes.hrl +++ b/include/aeb_opcodes.hrl @@ -143,11 +143,6 @@ -define( 'RETURN', 16#f3). -define( 'DELEGATECALL', 16#f4). --define( 'DBG_LOC', 16#b1). --define( 'DBG_DEF', 16#b2). --define( 'DBG_UNDEF', 16#b3). --define( 'DBG_CONTRACT', 16#b4). - -define( 'STATICCALL', 16#fa). -define( 'REVERT', 16#fd). diff --git a/src/aeb_opcodes.erl b/src/aeb_opcodes.erl index e4f90b5..4422bae 100644 --- a/src/aeb_opcodes.erl +++ b/src/aeb_opcodes.erl @@ -162,10 +162,6 @@ opcode(?DELEGATECALL) -> ?DELEGATECALL; opcode(?STATICCALL) -> ?STATICCALL; %% TODO opcode(?REVERT) -> ?REVERT; opcode({comment,X}) -> ?COMMENT(X); -opcode(?DBG_LOC) -> ?DBG_LOC; -opcode(?DBG_DEF) -> ?DBG_DEF; -opcode(?DBG_UNDEF) -> ?DBG_UNDEF; -opcode(?DBG_CONTRACT) -> ?DBG_CONTRACT; opcode(?SUICIDE) -> ?SUICIDE. @@ -307,10 +303,6 @@ mnemonic(?DELEGATECALL) -> 'DELEGATECALL' ; mnemonic(?STATICCALL) -> 'STATICCALL' ; mnemonic(?REVERT) -> 'REVERT' ; mnemonic({comment,_}) -> 'COMMENT' ; -mnemonic(?DBG_LOC) -> 'DBG_LOC' ; -mnemonic(?DBG_DEF) -> 'DBG_DEF' ; -mnemonic(?DBG_UNDEF) -> 'DBG_UNDEF' ; -mnemonic(?DBG_CONTRACT) -> 'DBG_CONTRACT' ; mnemonic(?SUICIDE) -> 'SUICIDE' . @@ -454,10 +446,6 @@ m_to_op('STATICCALL') -> ?STATICCALL ; m_to_op('REVERT') -> ?REVERT ; m_to_op('COMMENT') -> ?COMMENT("") ; m_to_op('SUICIDE') -> ?SUICIDE ; -m_to_op('DBG_LOC') -> ?DBG_LOC ; -m_to_op('DBG_DEF') -> ?DBG_DEF ; -m_to_op('DBG_UNDEF') -> ?DBG_UNDEF ; -m_to_op('DBG_CONTRACT') -> ?DBG_CONTRACT ; m_to_op(Data) when 0= Data . -- 2.30.2