Compare commits
155 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e927edc89 | |||
| 0d00cbf772 | |||
| b56d1c83fa | |||
| 93d5df429c | |||
| 5f5444ca9e | |||
| 76ae61b66c | |||
| edea526f38 | |||
| 487e087287 | |||
| c63ac888dd | |||
| 4d12b124f3 | |||
| 35ce283736 | |||
| 677712b0b8 | |||
| 5171b800cc | |||
| bf05e14661 | |||
| e3a00905de | |||
| 59af12bf34 | |||
| f7f0dfde51 | |||
| 33a1d5f4fb | |||
| eeaf646a86 | |||
| 7fdc7a6cee | |||
| f13ba67a2c | |||
| f421c1e361 | |||
| f91c8fabdd | |||
| 9dfc5f4f1d | |||
| 1fda6912da | |||
| cb83224c60 | |||
| 9840b22546 | |||
| e3f843fd91 | |||
| 803ebc0854 | |||
| 7e96e3baef | |||
| 768e0d4fbb | |||
| f92e23c955 | |||
| e321882b98 | |||
| b45509962e | |||
| c1fb3a47c7 | |||
| a0c3a990ed | |||
| 506f9ca72e | |||
| 7dd9c29cc0 | |||
| 242700e084 | |||
| 29b5ee3e68 | |||
| 896290ad3b | |||
| 876e8504c8 | |||
| 53a055b90a | |||
| 409d761b18 | |||
| f15315adb7 | |||
| b8b316aae0 | |||
| 985e5358c9 | |||
| ffebc13d08 | |||
| 3ff4df42ff | |||
| d6fbc73450 | |||
| 3d6ac9df92 | |||
| e8390e52d1 | |||
| 58daf1bb5c | |||
| cb8e2b07a4 | |||
| 46f9d34447 | |||
| 942c7fb069 | |||
| 53130fc638 | |||
| 8bf19dc060 | |||
| a5bfdf63d5 | |||
| 41860b041e | |||
| 25ef7e7fe3 | |||
| bcc409f302 | |||
| 42719e7000 | |||
| 0d6322c0aa | |||
| f7a4c40c50 | |||
| ec0af8046a | |||
| 73c80e1168 | |||
| 45ff418699 | |||
| 032277ae8b | |||
| 0bb4ac0fea | |||
| 4a90e3b2b4 | |||
| 8b7fefc8a9 | |||
| 6f59ef7a7c | |||
| 302c1c211d | |||
| 74791cfe52 | |||
| 453f68fa39 | |||
| aa9d2bf893 | |||
| 23b98f7d65 | |||
| 5d7bd73bcb | |||
| 34b9684b6b | |||
| ccbb0ed6c7 | |||
| f1298870e5 | |||
| 9cfd369c5d | |||
| f115feb16d | |||
| 241a96ebaa | |||
| 880cf573aa | |||
| 89f5ebc84b | |||
| e98298cce4 | |||
| 0d1899b32a | |||
| 3e0e289f2f | |||
| 11a8997ac7 | |||
| 2f4e1888c2 | |||
| a9389e4e69 | |||
| 2d3cede235 | |||
| 08a09b065b | |||
| 5fd076f043 | |||
| 2555868990 | |||
| 7eafbc22ae | |||
| 3ed0fcbe05 | |||
| b6019eb81b | |||
| 6eab9a32c9 | |||
| 91fc56c322 | |||
| 1887486d36 | |||
| bf6741eac4 | |||
| 491489ca7d | |||
| 91c4ab5bea | |||
| 163e805f55 | |||
| d69375e72b | |||
| 2b3603e86f | |||
| 31d188ce81 | |||
| dfca41c98d | |||
| 1526ad3bf0 | |||
| 4e325ff203 | |||
| e8253b0970 | |||
| 230e2187ce | |||
| a6a2686d53 | |||
| 56cf62b487 | |||
| 15628c9a05 | |||
| 431b311ae5 | |||
| 28f6c42647 | |||
| 734c8e8e40 | |||
| 436ba457e9 | |||
| 0261b76314 | |||
| e1e2236a26 | |||
| 04d64dfe9b | |||
| afcc6fd31a | |||
| 6466ddb866 | |||
| 75f3eeffa7 | |||
| a670d1ca6c | |||
| 96c0fab3ab | |||
| 90659342c0 | |||
| f88fe008bf | |||
| f5f007e74d | |||
| 0c01215b6a | |||
| fa64bbb56c | |||
| fe7e3a638a | |||
| d2c70509dd | |||
| 15ee836ddb | |||
| 68e6a2163e | |||
| 9041423906 | |||
| 913abb6c7b | |||
| 2d599df0ea | |||
| 54aace97af | |||
| 7e7f061b34 | |||
| 333bf53537 | |||
| 0528ee1229 | |||
| 8425eb80c5 | |||
| c00c4a5ac3 | |||
| 662b611e6d | |||
| 9abeb21eee | |||
| 34ae94e3e7 | |||
| d4da5e69ad | |||
| 417a34ecd1 | |||
| b35ccb8eb6 | |||
| 04571f757a |
+10
-1
@@ -14,6 +14,15 @@ aeb_fate_asm_scan.xrl
|
|||||||
_build/
|
_build/
|
||||||
aefateasm
|
aefateasm
|
||||||
include/aeb_fate_opcodes.hrl
|
include/aeb_fate_opcodes.hrl
|
||||||
src/aeb_fate_code.erl
|
|
||||||
src/aeb_fate_opcodes.erl
|
src/aeb_fate_opcodes.erl
|
||||||
|
src/aeb_fate_ops.erl
|
||||||
src/aeb_fate_pp.erl
|
src/aeb_fate_pp.erl
|
||||||
|
*.erl~
|
||||||
|
*.hrl~
|
||||||
|
*.aes~
|
||||||
|
doc
|
||||||
|
cover
|
||||||
|
aefate
|
||||||
|
current_counterexample.eqc
|
||||||
|
.rebar3
|
||||||
|
ebin
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
GENERATED_SRC = src/aeb_fate_opcodes.erl src/aeb_fate_code.erl include/aeb_fate_opcodes.hrl src/aeb_fate_asm_scan.xrl src/aeb_fate_pp.erl
|
GENERATED_SRC = src/aeb_fate_opcodes.erl src/aeb_fate_ops.erl include/aeb_fate_opcodes.hrl src/aeb_fate_asm_scan.xrl src/aeb_fate_pp.erl
|
||||||
GENERATOR_DEPS = ebin/aeb_fate_generate_ops.beam src/aeb_fate_asm_scan.template
|
GENERATOR_DEPS = ebin/aeb_fate_generate_ops.beam src/aeb_fate_asm_scan.template
|
||||||
REBAR ?= rebar3
|
REBAR ?= rebar3
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ or start with stack followed by an integer
|
|||||||
`stack1`
|
`stack1`
|
||||||
`a`
|
`a`
|
||||||
|
|
||||||
Immediate values can be of 9 types:
|
Immediate values can be of 10 types:
|
||||||
|
|
||||||
1. Integers as decimals: {Digits} or -{Digits}
|
1. Integers as decimals: {Digits} or -{Digits}
|
||||||
`42`
|
`42`
|
||||||
@@ -57,8 +57,24 @@ Immediate values can be of 9 types:
|
|||||||
And integers as Hexadecimals:: 0x{Hexdigits}
|
And integers as Hexadecimals:: 0x{Hexdigits}
|
||||||
`0x0deadbeef0`
|
`0x0deadbeef0`
|
||||||
|
|
||||||
2. addresses, a base58 encoded string starting with # followed by a number of base58chars
|
2. Chain Objects. These are all addresses to different types of chain objects.
|
||||||
`#nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
Each address is a 256 bits number encoded in base58 with checksum
|
||||||
|
with a prefix of "@" plus a type prefix followed by "_".
|
||||||
|
|
||||||
|
2a. Account Address: a base58c encoded number starting with @ak_ followed by a number of base58chars
|
||||||
|
'@ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
||||||
|
|
||||||
|
2b. Contract address: @ct_{base58char}+
|
||||||
|
`@ct_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
||||||
|
|
||||||
|
2c. Oracle address: @ok_{base58char}+
|
||||||
|
`@ok_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
||||||
|
|
||||||
|
2d. Oracle query: @oq_{base58char}+
|
||||||
|
`@oq_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
||||||
|
|
||||||
|
2e. Channel address: @ch_{base58char}+
|
||||||
|
`@ch_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`
|
||||||
|
|
||||||
3. Boolean true or false
|
3. Boolean true or false
|
||||||
`true`
|
`true`
|
||||||
@@ -85,8 +101,12 @@ Immediate values can be of 9 types:
|
|||||||
`()`
|
`()`
|
||||||
`(1, "foo")`
|
`(1, "foo")`
|
||||||
|
|
||||||
9. Variants: (| Size | Tag | ( Elements ) |)
|
9. Variants: (| [Arities] | Tag | ( Elements ) |)
|
||||||
`(| 42 | 12 | ( "foo", 12) |)`
|
`(| [1,3,5,2] | 3 | ( "foo", 12) |)`
|
||||||
|
|
||||||
|
10. Bytes: #{base64char}+
|
||||||
|
`#AQIDCioLFQ==`
|
||||||
|
|
||||||
|
|
||||||
Where
|
Where
|
||||||
|
|
||||||
@@ -96,6 +116,8 @@ Hexdigits: [0123456789abcdef]
|
|||||||
|
|
||||||
base58char: [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
base58char: [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
||||||
|
|
||||||
|
base64char: [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy0123456789+/=]
|
||||||
|
|
||||||
Characters: any printable ascii character 0..255 (except " no quoting yet)
|
Characters: any printable ascii character 0..255 (except " no quoting yet)
|
||||||
|
|
||||||
Key: any value except for a map
|
Key: any value except for a map
|
||||||
|
|||||||
+49
-25
@@ -1,43 +1,67 @@
|
|||||||
-define(FATE_INTEGER_T, integer()).
|
-define(FATE_INTEGER_T, integer()).
|
||||||
-define(FATE_BYTE_T, 0..255).
|
-define(FATE_BYTE_T, 0..255).
|
||||||
-define(FATE_BOOLEAN_T, true | false).
|
-define(FATE_BOOLEAN_T, true | false).
|
||||||
-define(FATE_NIL_T, []).
|
-define(FATE_NIL_T, []).
|
||||||
-define(FATE_LIST_T, list()).
|
-define(FATE_LIST_T, list()).
|
||||||
-define(FATE_UNIT_T, {tuple, {}}).
|
-define(FATE_UNIT_T, {tuple, {}}).
|
||||||
-define(FATE_MAP_T, #{ fate_type() => fate_type() }).
|
-define(FATE_MAP_T, #{ fate_type() => fate_type() }).
|
||||||
-define(FATE_STRING_T, binary()).
|
-define(FATE_STRING_T, binary()).
|
||||||
-define(FATE_ADDRESS_T, {address, <<_:256>>}).
|
-define(FATE_ADDRESS_T, {address, <<_:256>>}).
|
||||||
-define(FATE_VARIANT_T, {variant, ?FATE_BYTE_T, ?FATE_BYTE_T, tuple()}).
|
-define(FATE_BYTES_T(N), {bytes, binary()}).
|
||||||
-define(FATE_VOID_T, void).
|
-define(FATE_CONTRACT_T, {contract, <<_:256>>}).
|
||||||
-define(FATE_TUPLE_T, {tuple, tuple()}).
|
-define(FATE_ORACLE_T, {oracle, <<_:256>>}).
|
||||||
-define(FATE_BITS_T, {bits, integer()}).
|
-define(FATE_ORACLE_Q_T, {oracle_query, <<_:256>>}).
|
||||||
|
-define(FATE_CHANNEL_T, {channel, <<_:256>>}).
|
||||||
|
-define(FATE_VARIANT_T, {variant, [byte()], ?FATE_BYTE_T, tuple()}).
|
||||||
|
-define(FATE_VOID_T, void).
|
||||||
|
-define(FATE_TUPLE_T, {tuple, tuple()}).
|
||||||
|
-define(FATE_BITS_T, {bits, integer()}).
|
||||||
|
|
||||||
-define(IS_FATE_INTEGER(X), is_integer(X)).
|
-define(IS_FATE_INTEGER(X), (is_integer(X))).
|
||||||
-define(IS_FATE_LIST(X), (is_list(X))).
|
-define(IS_FATE_LIST(X), (is_list(X))).
|
||||||
-define(IS_FATE_STRING(X), (is_binary(X))).
|
-define(IS_FATE_STRING(X), (is_binary(X))).
|
||||||
-define(IS_FATE_MAP(X), (is_map(X))).
|
-define(IS_FATE_MAP(X), (is_map(X))).
|
||||||
-define(IS_FATE_TUPLE(X), (is_tuple(X) andalso (tuple == element(1, X) andalso is_tuple(element(2, X))))).
|
-define(IS_FATE_TUPLE(X), (is_tuple(X) andalso (tuple == element(1, X) andalso is_tuple(element(2, X))))).
|
||||||
-define(IS_FATE_ADDRESS(X), (is_tuple(X) andalso (address == element(1, X) andalso is_binary(element(2, X))))).
|
-define(IS_FATE_ADDRESS(X), (is_tuple(X) andalso (address == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
|
-define(IS_FATE_BYTES(X), (is_tuple(X) andalso (bytes == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
|
-define(IS_FATE_BYTES(N, X), (?IS_FATE_BYTES(X) andalso byte_size(element(2, X)) == (N))).
|
||||||
|
-define(IS_FATE_CONTRACT(X), (is_tuple(X) andalso (contract == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
|
-define(IS_FATE_ORACLE(X), (is_tuple(X) andalso (oracle == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
|
-define(IS_FATE_ORACLE_Q(X), (is_tuple(X) andalso (oracle_query == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
|
-define(IS_FATE_CHANNEL(X), (is_tuple(X) andalso (channel == element(1, X) andalso is_binary(element(2, X))))).
|
||||||
-define(IS_FATE_BITS(X), (is_tuple(X) andalso (bits == element(1, X) andalso is_integer(element(2, X))))).
|
-define(IS_FATE_BITS(X), (is_tuple(X) andalso (bits == element(1, X) andalso is_integer(element(2, X))))).
|
||||||
-define(IS_FATE_VARIANT(X), (is_tuple(X)
|
-define(IS_FATE_VARIANT(X), (is_tuple(X)
|
||||||
andalso
|
andalso
|
||||||
(variant == element(1, X)
|
(variant == element(1, X)
|
||||||
andalso is_integer(element(2, X))
|
andalso is_list(element(2, X))
|
||||||
andalso is_integer(element(3, X))
|
andalso is_integer(element(3, X))
|
||||||
andalso is_tuple(element(4, X))
|
andalso is_tuple(element(4, X))
|
||||||
))).
|
))).
|
||||||
-define(IS_FATE_BOOLEAN(X), is_boolean(X)).
|
-define(IS_FATE_BOOLEAN(X), is_boolean(X)).
|
||||||
|
-define(IS_FATE_TYPEREP(X), (is_tuple(X) andalso tuple_size(X) =:= 2 andalso element(1, X) =:= typerep)).
|
||||||
|
|
||||||
-define(FATE_UNIT, {tuple, {}}).
|
-define(FATE_UNIT, {tuple, {}}).
|
||||||
-define(FATE_TUPLE(T), {tuple, T}).
|
-define(FATE_TUPLE(T), {tuple, T}).
|
||||||
-define(FATE_ADDRESS(A), {address, A}).
|
-define(FATE_ADDRESS(A), {address, A}).
|
||||||
-define(FATE_BITS(B), {bits, B}).
|
-define(FATE_BYTES(X), {bytes, X}).
|
||||||
|
-define(FATE_CONTRACT(X), {contract, X}).
|
||||||
|
-define(FATE_ORACLE(X), {oracle, X}).
|
||||||
|
-define(FATE_ORACLE_Q(X), {oracle_query, X}).
|
||||||
|
-define(FATE_CHANNEL(X), {channel, X}).
|
||||||
|
-define(FATE_BITS(B), {bits, B}).
|
||||||
|
-define(FATE_TYPEREP(T), {typerep, T}).
|
||||||
|
|
||||||
-define(FATE_INTEGER_VALUE(X), (X)).
|
-define(FATE_INTEGER_VALUE(X), (X)).
|
||||||
|
-define(FATE_BOOLEAN_VALUE(X), (X)).
|
||||||
-define(FATE_LIST_VALUE(X), (X)).
|
-define(FATE_LIST_VALUE(X), (X)).
|
||||||
|
-define(FATE_TUPLE_ELEMENTS(X), (tuple_to_list(element(2, X)))).
|
||||||
-define(FATE_STRING_VALUE(X), (X)).
|
-define(FATE_STRING_VALUE(X), (X)).
|
||||||
-define(FATE_ADDRESS_VALUE(X), (element(2, X))).
|
-define(FATE_ADDRESS_VALUE(X), (element(2, X))).
|
||||||
|
-define(FATE_BYTES_VALUE(X), (element(2, X))).
|
||||||
|
-define(FATE_CONTRACT_VALUE(X), (element(2, X))).
|
||||||
|
-define(FATE_ORACLE_VALUE(X), (element(2, X))).
|
||||||
|
-define(FATE_CHANNEL_VALUE(X), (element(2, X))).
|
||||||
|
-define(FATE_BITS_VALUE(X), (element(2, X))).
|
||||||
-define(FATE_MAP_VALUE(X), (X)).
|
-define(FATE_MAP_VALUE(X), (X)).
|
||||||
-define(FATE_MAP_SIZE(X), (map_size(X))).
|
-define(FATE_MAP_SIZE(X), (map_size(X))).
|
||||||
-define(FATE_STRING_SIZE(X), (byte_size(X))).
|
-define(FATE_STRING_SIZE(X), (byte_size(X))).
|
||||||
@@ -47,7 +71,7 @@
|
|||||||
-define(FATE_VOID, void).
|
-define(FATE_VOID, void).
|
||||||
-define(FATE_EMPTY_STRING, <<>>).
|
-define(FATE_EMPTY_STRING, <<>>).
|
||||||
-define(FATE_STRING(S), S).
|
-define(FATE_STRING(S), S).
|
||||||
-define(FATE_VARIANT(Size, Tag,T), {variant, Size, Tag, T}).
|
-define(FATE_VARIANT(Arity, Tag,T), {variant, Arity, Tag, T}).
|
||||||
|
|
||||||
-define(MAKE_FATE_INTEGER(X), X).
|
-define(MAKE_FATE_INTEGER(X), X).
|
||||||
-define(MAKE_FATE_LIST(X), X).
|
-define(MAKE_FATE_LIST(X), X).
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
-record(pmap, {key_t :: aeb_aevm_data:type(),
|
||||||
|
val_t :: aeb_aevm_data:type(),
|
||||||
|
parent :: none | non_neg_integer(),
|
||||||
|
size = 0 :: non_neg_integer(),
|
||||||
|
data :: #{aeb_heap:binary_value() => aeb_heap:binary_value() | tombstone}
|
||||||
|
| stored}).
|
||||||
|
|
||||||
|
-record(maps, { maps = #{} :: #{ non_neg_integer() => #pmap{} }
|
||||||
|
, next_id = 0 :: non_neg_integer() }).
|
||||||
|
|
||||||
|
-record(heap, { maps :: #maps{},
|
||||||
|
offset :: aeb_heap:offset(),
|
||||||
|
heap :: binary() | #{non_neg_integer() => non_neg_integer()} }).
|
||||||
|
|
||||||
+17
-6
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
-define( 'SHA3', 16#20).
|
-define( 'SHA3', 16#20).
|
||||||
|
|
||||||
|
-define( 'CREATOR', 16#2f).
|
||||||
-define( 'ADDRESS', 16#30).
|
-define( 'ADDRESS', 16#30).
|
||||||
-define( 'BALANCE', 16#31).
|
-define( 'BALANCE', 16#31).
|
||||||
-define( 'ORIGIN', 16#32).
|
-define( 'ORIGIN', 16#32).
|
||||||
@@ -165,6 +166,8 @@
|
|||||||
-define(PRIM_CALL_ORACLE_GET_ANSWER, 104).
|
-define(PRIM_CALL_ORACLE_GET_ANSWER, 104).
|
||||||
-define(PRIM_CALL_ORACLE_GET_QUESTION, 105).
|
-define(PRIM_CALL_ORACLE_GET_QUESTION, 105).
|
||||||
-define(PRIM_CALL_ORACLE_QUERY_FEE, 106).
|
-define(PRIM_CALL_ORACLE_QUERY_FEE, 106).
|
||||||
|
-define(PRIM_CALL_ORACLE_CHECK, 110).
|
||||||
|
-define(PRIM_CALL_ORACLE_CHECK_QUERY, 111).
|
||||||
|
|
||||||
-define(PRIM_CALL_IN_AENS_RANGE(__TTYPE__), (((__TTYPE__) > 199) andalso ((__TTYPE__) < 300))).
|
-define(PRIM_CALL_IN_AENS_RANGE(__TTYPE__), (((__TTYPE__) > 199) andalso ((__TTYPE__) < 300))).
|
||||||
-define(PRIM_CALL_AENS_RESOLVE, 200).
|
-define(PRIM_CALL_AENS_RESOLVE, 200).
|
||||||
@@ -183,9 +186,17 @@
|
|||||||
-define(PRIM_CALL_MAP_TOLIST, 305).
|
-define(PRIM_CALL_MAP_TOLIST, 305).
|
||||||
|
|
||||||
-define(PRIM_CALL_IN_CRYPTO_RANGE(__TTYPE__), (((__TTYPE__) > 399) andalso ((__TTYPE__) < 500))).
|
-define(PRIM_CALL_IN_CRYPTO_RANGE(__TTYPE__), (((__TTYPE__) > 399) andalso ((__TTYPE__) < 500))).
|
||||||
-define(PRIM_CALL_CRYPTO_ECVERIFY, 400).
|
-define(PRIM_CALL_CRYPTO_ECVERIFY, 400).
|
||||||
-define(PRIM_CALL_CRYPTO_SHA3, 401).
|
-define(PRIM_CALL_CRYPTO_SHA3, 401).
|
||||||
-define(PRIM_CALL_CRYPTO_SHA256, 402).
|
-define(PRIM_CALL_CRYPTO_SHA256, 402).
|
||||||
-define(PRIM_CALL_CRYPTO_BLAKE2B, 403).
|
-define(PRIM_CALL_CRYPTO_BLAKE2B, 403).
|
||||||
-define(PRIM_CALL_CRYPTO_SHA256_STRING, 404).
|
-define(PRIM_CALL_CRYPTO_SHA256_STRING, 404).
|
||||||
-define(PRIM_CALL_CRYPTO_BLAKE2B_STRING, 405).
|
-define(PRIM_CALL_CRYPTO_BLAKE2B_STRING, 405).
|
||||||
|
-define(PRIM_CALL_CRYPTO_ECVERIFY_SECP256K1, 410).
|
||||||
|
|
||||||
|
-define(PRIM_CALL_IN_AUTH_RANGE(__TTYPE__), (((__TTYPE__) > 499) andalso ((__TTYPE__) < 600))).
|
||||||
|
-define(PRIM_CALL_AUTH_TX_HASH, 500).
|
||||||
|
|
||||||
|
-define(PRIM_CALL_IN_ADDRESS_RANGE(__TTYPE__), (((__TTYPE__) > 599) andalso ((__TTYPE__) < 700))).
|
||||||
|
-define(PRIM_CALL_ADDR_IS_ORACLE, 600).
|
||||||
|
-define(PRIM_CALL_ADDR_IS_CONTRACT, 601).
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
-define(Type(), aeb_aevm_data:type()).
|
||||||
|
|
||||||
|
-define(TYPEREP_WORD_TAG, 0).
|
||||||
|
-define(TYPEREP_STRING_TAG, 1).
|
||||||
|
-define(TYPEREP_LIST_TAG, 2).
|
||||||
|
-define(TYPEREP_TUPLE_TAG, 3).
|
||||||
|
-define(TYPEREP_VARIANT_TAG, 4).
|
||||||
|
-define(TYPEREP_TYPEREP_TAG, 5).
|
||||||
|
-define(TYPEREP_MAP_TAG, 6).
|
||||||
|
-define(TYPEREP_FUN_TAG, 7).
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Allow to run QuickCheck tests as eunit tests
|
||||||
|
%%% `rebar3 as eqc eunit --cover`
|
||||||
|
%%% or `rebar3 as eqc eunit --module=aeb_fate_code`
|
||||||
|
%%% Note that for obtainign cover file, one needs `rebar3 as eqc cover
|
||||||
|
%%%
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts <thomas@SpaceGrey.lan>
|
||||||
|
|
||||||
|
-module(aeb_fate_code_tests).
|
||||||
|
|
||||||
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
|
-define(EQC_EUNIT(Module, PropName, Ms),
|
||||||
|
{ atom_to_list(PropName),
|
||||||
|
{timeout, (Ms * 10) div 1000, ?_assert(eqc:quickcheck(eqc:testing_time(Ms / 1000, Module:PropName())))}}).
|
||||||
|
|
||||||
|
quickcheck_test_() ->
|
||||||
|
{setup, fun() -> eqc:start() end,
|
||||||
|
[ ?EQC_EUNIT(aefate_code_eqc, prop_opcodes, 200),
|
||||||
|
?EQC_EUNIT(aefate_code_eqc, prop_serializes, 3000),
|
||||||
|
?EQC_EUNIT(aefate_code_eqc, prop_fail_serializes, 3000),
|
||||||
|
?EQC_EUNIT(aefate_code_eqc, prop_fuzz, 3000)
|
||||||
|
]}.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Allow to run QuickCheck tests as eunit tests
|
||||||
|
%%% `rebar3 as eqc eunit --cover`
|
||||||
|
%%% or `rebar3 as eqc eunit --module=aeb_fate_data`
|
||||||
|
%%% Note that for obtainign cover file, one needs `rebar3 as eqc cover
|
||||||
|
%%%
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts <thomas@SpaceGrey.lan>
|
||||||
|
|
||||||
|
-module(aeb_fate_data_tests).
|
||||||
|
|
||||||
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
|
-define(EQC_EUNIT(Module, PropName, Ms),
|
||||||
|
{ atom_to_list(PropName),
|
||||||
|
{timeout, (Ms * 3) / 1000, ?_assert(eqc:quickcheck(eqc:testing_time(Ms / 1000, Module:PropName())))}}).
|
||||||
|
|
||||||
|
quickcheck_test_() ->
|
||||||
|
{setup, fun() -> eqc:start() end,
|
||||||
|
[ ?EQC_EUNIT(aefate_eqc, prop_roundtrip, 500),
|
||||||
|
?EQC_EUNIT(aefate_eqc, prop_format_scan, 2000),
|
||||||
|
?EQC_EUNIT(aefate_eqc, prop_order, 2000),
|
||||||
|
?EQC_EUNIT(aefate_eqc, prop_fuzz, 2000)
|
||||||
|
]}.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Allow to run QuickCheck tests as eunit tests
|
||||||
|
%%% `rebar3 as eqc eunit --cover`
|
||||||
|
%%% or `rebar3 as eqc eunit --module=aeb_fate_encoding`
|
||||||
|
%%% Note that for obtaining cover file, one needs `rebar3 as eqc cover
|
||||||
|
%%%
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts
|
||||||
|
|
||||||
|
-module(aeb_fate_encoding_tests).
|
||||||
|
|
||||||
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
|
-define(EQC_EUNIT(Module, PropName, Ms),
|
||||||
|
{ atom_to_list(PropName),
|
||||||
|
{timeout, (Ms * 3) / 1000, ?_assert(eqc:quickcheck(eqc:testing_time(Ms / 1000, Module:PropName())))}}).
|
||||||
|
|
||||||
|
quickcheck_test_() ->
|
||||||
|
{setup, fun() -> eqc:start() end,
|
||||||
|
[ ?EQC_EUNIT(aefate_type_eqc, prop_roundtrip, 1000),
|
||||||
|
?EQC_EUNIT(aefate_eqc, prop_serializes, 1000),
|
||||||
|
?EQC_EUNIT(aefate_eqc, prop_idempotent, 1000)
|
||||||
|
]}.
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Use `rebar3 as eqc shell` to run properties in the shell
|
||||||
|
%%%
|
||||||
|
%%% We want to be sure that we can deserialize all FATE assembler that is accepted on chain.
|
||||||
|
%%%
|
||||||
|
%%% We test something slightly weaker here,
|
||||||
|
%%% viz. All FATE assembler we serialize, we can deserialize
|
||||||
|
%%%
|
||||||
|
%%% Negative testing modelled:
|
||||||
|
%%% Failure 1: function names differ from 4 bytes
|
||||||
|
%%% Failure 2: pointer to empty code block
|
||||||
|
%%% Failure 3: end_BB operation as not ending block or not at end of block
|
||||||
|
%%% - empty code blocks
|
||||||
|
%%% - blocks that are not of the form (not end_bb)* end_bb.
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts <thomas@SpaceGrey.lan>
|
||||||
|
|
||||||
|
-module(aefate_code_eqc).
|
||||||
|
|
||||||
|
-include_lib("eqc/include/eqc.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
%%-define(Failure(Failures, Number), case lists:member(Number, Failures) of true -> 1; false -> 0 end)
|
||||||
|
|
||||||
|
|
||||||
|
prop_serializes() ->
|
||||||
|
in_parallel(
|
||||||
|
?FORALL(FateCode, fate_code(0),
|
||||||
|
begin
|
||||||
|
{T0, Binary} = timer:tc(fun() -> aeb_fate_code:serialize(FateCode) end),
|
||||||
|
?WHENFAIL(eqc:format("serialized:\n ~120p~n", [Binary]),
|
||||||
|
begin
|
||||||
|
{T1, Decoded} = timer:tc(fun() -> aeb_fate_code:deserialize(Binary) end),
|
||||||
|
measure(binary_size, size(Binary),
|
||||||
|
measure(serialize, T0 / 1000,
|
||||||
|
measure(deserialize, T1 / 1000,
|
||||||
|
conjunction([{equal, equals(Decoded, FateCode)},
|
||||||
|
{serialize_time, T0 / 1000 < 500},
|
||||||
|
{deserialize_time, T1 / 1000 < 500}]))))
|
||||||
|
end)
|
||||||
|
end)).
|
||||||
|
|
||||||
|
prop_fail_serializes() ->
|
||||||
|
conjunction([{Failure, eqc:counterexample(
|
||||||
|
?FORALL(FateCode, fate_code(Failure),
|
||||||
|
?FORALL(Binary, catch aeb_fate_code:serialize(FateCode),
|
||||||
|
is_binary(Binary))))
|
||||||
|
=/= true} || Failure <- [1, 2, 3, 4, 5] ]).
|
||||||
|
|
||||||
|
prop_fuzz() ->
|
||||||
|
in_parallel(
|
||||||
|
?FORALL(Binary, ?LET(FateCode, fate_code(0), aeb_fate_code:serialize(FateCode)),
|
||||||
|
?FORALL(FuzzedBin, fuzz(Binary),
|
||||||
|
try aeb_fate_code:deserialize(FuzzedBin) of
|
||||||
|
Code ->
|
||||||
|
?WHENFAIL(eqc:format("Code:\n ~p\n", [Code]),
|
||||||
|
begin
|
||||||
|
Bin1 = aeb_fate_code:serialize(Code),
|
||||||
|
Code1 = aeb_fate_code:deserialize(Bin1),
|
||||||
|
?WHENFAIL(eqc:format("Reserialized\n ~120p\n", [Bin1]),
|
||||||
|
equals(Code, Code1))
|
||||||
|
end)
|
||||||
|
catch _:_ -> true
|
||||||
|
end))).
|
||||||
|
|
||||||
|
prop_opcodes() ->
|
||||||
|
?FORALL(Opcode, choose(0, 16#ff),
|
||||||
|
try M = aeb_fate_opcodes:mnemonic(Opcode),
|
||||||
|
?WHENFAIL(eqc:format("opcode ~p -> ~p", [Opcode, M]),
|
||||||
|
conjunction([{valid, lists:member(Opcode, valid_opcodes())},
|
||||||
|
{eq, equals(aeb_fate_opcodes:m_to_op(M), Opcode)}]))
|
||||||
|
catch
|
||||||
|
_:_ ->
|
||||||
|
not lists:member(Opcode, valid_opcodes())
|
||||||
|
end).
|
||||||
|
|
||||||
|
|
||||||
|
valid_opcodes() ->
|
||||||
|
lists:seq(0, 16#75) ++ lists:seq(16#fa, 16#fd).
|
||||||
|
|
||||||
|
|
||||||
|
fate_code(Failure) ->
|
||||||
|
?SIZED(Size,
|
||||||
|
?LET({FMap, SMap, AMap},
|
||||||
|
{non_empty(map(if Failure == 1 -> binary(1);
|
||||||
|
true -> binary(4) end,
|
||||||
|
{{list(aefate_type_eqc:fate_type(Size div 3)), aefate_type_eqc:fate_type(Size div 3)}, bbs_code(Failure)})),
|
||||||
|
small_map(small_fate_data_key(5), small_fate_data(4)),
|
||||||
|
small_map(small_fate_data_key(5), small_fate_data(4))},
|
||||||
|
aeb_fate_code:update_annotations(
|
||||||
|
aeb_fate_code:update_symbols(
|
||||||
|
aeb_fate_code:update_functions(
|
||||||
|
aeb_fate_code:new(), FMap), SMap), AMap))).
|
||||||
|
|
||||||
|
short_list(Max, Gen) ->
|
||||||
|
?LET(N, choose(0, Max), eqc_gen:list(N, Gen)).
|
||||||
|
|
||||||
|
small_map(KeyGen, ValGen) ->
|
||||||
|
?LET(KeyVals, short_list(6, {KeyGen, ValGen}),
|
||||||
|
return(maps:from_list(KeyVals))).
|
||||||
|
|
||||||
|
bbs_code(Failure) ->
|
||||||
|
frequency([{if Failure == 2 -> 5; true -> 0 end, #{0 => []}},
|
||||||
|
{10, ?LET(BBs, short_list(6, bb_code(Failure)),
|
||||||
|
maps:from_list(
|
||||||
|
lists:zip(lists:seq(0, length(BBs)-1), BBs)))}]).
|
||||||
|
|
||||||
|
bb_code(Failure) ->
|
||||||
|
EndBB = [ Op || Op <- valid_opcodes(), aeb_fate_opcodes:end_bb(Op) ],
|
||||||
|
NonEndBB = valid_opcodes() -- EndBB,
|
||||||
|
frequency(
|
||||||
|
[{if Failure == 3 -> 5; true -> 0 end, ?LET(Ops, non_empty(short_list(6, elements(NonEndBB))), bblock(Failure, Ops))},
|
||||||
|
{if Failure == 4 -> 5; true -> 0 end, ?LET({Ops, Op}, {short_list(6, elements(valid_opcodes())), elements(EndBB)}, bblock(Failure, Ops ++ [Op]))},
|
||||||
|
{10, ?LET({Ops, Op}, {short_list(6, elements(NonEndBB)), elements(EndBB)},
|
||||||
|
bblock(Failure, Ops ++ [Op]))}]).
|
||||||
|
|
||||||
|
bblock(Failure, Ops) ->
|
||||||
|
[ begin
|
||||||
|
Mnemonic = aeb_fate_opcodes:mnemonic(Op),
|
||||||
|
Arity = aeb_fate_opcodes:args(Op),
|
||||||
|
case Arity of
|
||||||
|
0 -> Mnemonic;
|
||||||
|
_ -> list_to_tuple([Mnemonic |
|
||||||
|
[ frequency([{if Failure == 5 -> 5; true -> 0 end, {stack, nat()}},
|
||||||
|
{5, {stack, 0}},
|
||||||
|
{5, {arg, nat()}},
|
||||||
|
{5, {var, nat()}},
|
||||||
|
{5, {immediate, small_fate_data(4)}}]) ||
|
||||||
|
_ <- lists:seq(1, Arity) ]])
|
||||||
|
end
|
||||||
|
end || Op <- Ops ].
|
||||||
|
|
||||||
|
fuzz(Binary) ->
|
||||||
|
?LET({N, Inj}, {choose(0, byte_size(Binary) - 1), choose(0, 255)},
|
||||||
|
begin
|
||||||
|
M = N * 8,
|
||||||
|
<<X:M, _:8, Z/binary>> = Binary,
|
||||||
|
<<X:M, Inj:8, Z/binary>>
|
||||||
|
end).
|
||||||
|
|
||||||
|
prop_small() ->
|
||||||
|
?FORALL(Value, small_fate_data(4),
|
||||||
|
begin
|
||||||
|
Bin = aeb_fate_encoding:serialize(Value),
|
||||||
|
Size = byte_size(Bin),
|
||||||
|
measure(size, Size,
|
||||||
|
?WHENFAIL(eqc:format("Size: ~p\n", [Size]),
|
||||||
|
Size < 1000))
|
||||||
|
end).
|
||||||
|
|
||||||
|
prop_small_type() ->
|
||||||
|
?FORALL(Type, ?SIZED(Size, aefate_type_eqc:fate_type(Size div 3)),
|
||||||
|
begin
|
||||||
|
Bin = iolist_to_binary(aeb_fate_encoding:serialize_type(Type)),
|
||||||
|
Size = byte_size(Bin),
|
||||||
|
measure(size, Size,
|
||||||
|
?WHENFAIL(eqc:format("Size: ~p\n", [Size]),
|
||||||
|
Size < 1000))
|
||||||
|
end).
|
||||||
|
|
||||||
|
small_fate_data(N) ->
|
||||||
|
?SIZED(Size, resize(Size div N, aefate_eqc:fate_data())).
|
||||||
|
|
||||||
|
small_fate_data_key(N) ->
|
||||||
|
?SIZED(Size, ?LET(Data, aefate_eqc:fate_data(Size div N, []), eqc_symbolic:eval(Data))).
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Use `rebar3 as eqc shell` to run properties in the shell
|
||||||
|
%%%
|
||||||
|
%%% We need to be able to generate data that serializes with ?LONG_LIST, ?LONG_TUPLE etc.
|
||||||
|
%%% In other words make some rather broad terms as well as some deep terms
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts <thomas@SpaceGrey.lan>
|
||||||
|
|
||||||
|
-module(aefate_eqc).
|
||||||
|
|
||||||
|
-include_lib("eqc/include/eqc.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
|
prop_roundtrip() ->
|
||||||
|
?FORALL(FateData, fate_data(),
|
||||||
|
measure(bytes, size(term_to_binary(FateData)),
|
||||||
|
begin
|
||||||
|
Serialized = aeb_fate_encoding:serialize(FateData),
|
||||||
|
?WHENFAIL(eqc:format("Serialized ~p to ~p~n", [FateData, Serialized]),
|
||||||
|
equals(aeb_fate_encoding:deserialize(Serialized), FateData))
|
||||||
|
end)).
|
||||||
|
|
||||||
|
prop_format_scan() ->
|
||||||
|
?FORALL(FateData, fate_data(),
|
||||||
|
?WHENFAIL(eqc:format("Trying to format ~p failed~n", [FateData]),
|
||||||
|
begin
|
||||||
|
String = aeb_fate_data:format(FateData),
|
||||||
|
{ok, _Scanned, _} = aeb_fate_asm_scan:scan(unicode:characters_to_list(String)),
|
||||||
|
true
|
||||||
|
end)).
|
||||||
|
|
||||||
|
prop_serializes() ->
|
||||||
|
?FORALL({Data, Garbage}, {fate_data(), binary()},
|
||||||
|
?WHENFAIL(eqc:format("Trying to serialize/deserialize ~p failed~n", [Data]),
|
||||||
|
begin
|
||||||
|
Binary = <<(aeb_fate_encoding:serialize(Data))/binary, Garbage/binary>>,
|
||||||
|
{FateData, Rest} = aeb_fate_encoding:deserialize_one(Binary),
|
||||||
|
measure(binary_size, size(Binary),
|
||||||
|
conjunction([{equal, equals(Data, FateData)},
|
||||||
|
{rest, equals(Garbage, Rest)},
|
||||||
|
{size, size(Binary) < 500000}]))
|
||||||
|
end)).
|
||||||
|
|
||||||
|
prop_fuzz() ->
|
||||||
|
in_parallel(
|
||||||
|
?FORALL(Binary, ?LET(FateData, ?SIZED(Size, resize(Size div 4, fate_data())), aeb_fate_encoding:serialize(FateData)),
|
||||||
|
?FORALL(InjectedBin, injection(Binary),
|
||||||
|
try Org = aeb_fate_encoding:deserialize(InjectedBin),
|
||||||
|
NewBin = aeb_fate_encoding:serialize(Org),
|
||||||
|
NewOrg = aeb_fate_encoding:deserialize(NewBin),
|
||||||
|
measure(success, 1,
|
||||||
|
?WHENFAIL(eqc:format("Deserialize ~p gives\n~p\nSerializes to ~p\n", [InjectedBin, Org, NewOrg]),
|
||||||
|
equals(NewBin, InjectedBin)))
|
||||||
|
catch _:_ ->
|
||||||
|
true
|
||||||
|
end))).
|
||||||
|
|
||||||
|
|
||||||
|
prop_order() ->
|
||||||
|
?FORALL(Items, vector(3, fate_data()),
|
||||||
|
begin
|
||||||
|
%% Use lt to take minimum
|
||||||
|
Min = lt_min(Items),
|
||||||
|
Max = lt_max(Items),
|
||||||
|
conjunction([ {minimum, is_empty([ {Min, '>', I} || I<-Items, aeb_fate_data:lt(I, Min)])},
|
||||||
|
{maximum, is_empty([ {Max, '<', I} || I<-Items, aeb_fate_data:lt(Max, I)])}])
|
||||||
|
end).
|
||||||
|
|
||||||
|
lt_min([X, Y | Rest]) ->
|
||||||
|
case aeb_fate_data:lt(X, Y) of
|
||||||
|
true -> lt_min([X | Rest]);
|
||||||
|
false -> lt_min([Y| Rest])
|
||||||
|
end;
|
||||||
|
lt_min([X]) -> X.
|
||||||
|
|
||||||
|
lt_max([X, Y | Rest]) ->
|
||||||
|
case aeb_fate_data:lt(X, Y) of
|
||||||
|
true -> lt_max([Y | Rest]);
|
||||||
|
false -> lt_max([X| Rest])
|
||||||
|
end;
|
||||||
|
lt_max([X]) -> X.
|
||||||
|
|
||||||
|
prop_idempotent() ->
|
||||||
|
?FORALL(Items, list({fate_data_key(), fate_data()}),
|
||||||
|
equals(aeb_fate_encoding:sort(Items),
|
||||||
|
aeb_fate_encoding:sort(aeb_fate_encoding:sort(Items)))).
|
||||||
|
|
||||||
|
|
||||||
|
fate_data() ->
|
||||||
|
?SIZED(Size, ?LET(Data, fate_data(Size, [map, variant]), eqc_symbolic:eval(Data))).
|
||||||
|
|
||||||
|
fate_data_key() ->
|
||||||
|
?SIZED(Size, ?LET(Data, fate_data(Size div 4, [variant]), eqc_symbolic:eval(Data))).
|
||||||
|
|
||||||
|
fate_data(0, _Options) ->
|
||||||
|
?LAZY(
|
||||||
|
frequency(
|
||||||
|
[{5, oneof([fate_integer(), fate_boolean(), fate_nil(), fate_unit()])},
|
||||||
|
{1, oneof([fate_string(), fate_address(), fate_bytes(), fate_contract(),
|
||||||
|
fate_oracle(), fate_oracle_q(), fate_bits(), fate_channel()])}]));
|
||||||
|
fate_data(Size, Options) ->
|
||||||
|
?LAZY(
|
||||||
|
oneof([fate_data(0, Options),
|
||||||
|
fate_list(Size, Options),
|
||||||
|
fate_tuple(Size, Options)] ++
|
||||||
|
[fate_variant(Size, Options)
|
||||||
|
|| lists:member(variant, Options)] ++
|
||||||
|
[fate_map(Size, Options)
|
||||||
|
|| lists:member(map, Options)])).
|
||||||
|
|
||||||
|
|
||||||
|
fate_integer() -> ?LET(X, oneof([int(), largeint()]), return(aeb_fate_data:make_integer(X))).
|
||||||
|
fate_bits() -> ?LET(X, oneof([int(), largeint()]), return(aeb_fate_data:make_bits(X))).
|
||||||
|
fate_boolean() -> ?LET(X, elements([true, false]), return(aeb_fate_data:make_boolean(X))).
|
||||||
|
fate_nil() -> aeb_fate_data:make_list([]).
|
||||||
|
fate_unit() -> aeb_fate_data:make_unit().
|
||||||
|
fate_string() -> ?LET(X, frequency([{10, non_quote_string()}, {2, list(non_quote_string())},
|
||||||
|
{1, ?LET(N, choose(64-3, 64+3), vector(N, $a))}]),
|
||||||
|
return(aeb_fate_data:make_string(X))).
|
||||||
|
fate_address() -> ?LET(X, binary(256 div 8), return(aeb_fate_data:make_address(X))).
|
||||||
|
fate_bytes() -> ?LET(X, non_empty(binary()), return(aeb_fate_data:make_bytes(X))).
|
||||||
|
fate_contract() -> ?LET(X, binary(256 div 8), return(aeb_fate_data:make_contract(X))).
|
||||||
|
fate_oracle() -> ?LET(X, binary(256 div 8), return(aeb_fate_data:make_oracle(X))).
|
||||||
|
fate_oracle_q() -> ?LET(X, binary(256 div 8), return(aeb_fate_data:make_oracle_query(X))).
|
||||||
|
fate_channel() -> ?LET(X, binary(256 div 8), return(aeb_fate_data:make_channel(X))).
|
||||||
|
|
||||||
|
fate_values(Size, N, Options) ->
|
||||||
|
eqc_gen:list(N, fate_data(Size div max(1, N), Options)).
|
||||||
|
|
||||||
|
%% May shrink to fate_unit
|
||||||
|
fate_tuple(Size, Options) ->
|
||||||
|
?LET(N, choose(0, 6),
|
||||||
|
?LETSHRINK(Elements, fate_values(Size, N, Options),
|
||||||
|
return(aeb_fate_data:make_tuple(list_to_tuple(Elements))))).
|
||||||
|
|
||||||
|
fate_variant(Size, Options) ->
|
||||||
|
?LET({L1, L2, {tuple, Args}}, {list(choose(0, 255)), list(choose(0,255)), fate_tuple(Size, Options)},
|
||||||
|
return(aeb_fate_data:make_variant(L1 ++ [tuple_size(Args)] ++ L2,
|
||||||
|
length(L1), Args))).
|
||||||
|
|
||||||
|
fate_list(Size, Options) ->
|
||||||
|
?LET(N, frequency([{20, choose(0, 6)}, {1, choose(64 - 3, 64 + 3)}]),
|
||||||
|
?LETSHRINK(Vs, fate_values(Size, N, Options),
|
||||||
|
return(aeb_fate_data:make_list(Vs)))).
|
||||||
|
|
||||||
|
fate_map(Size, Options) ->
|
||||||
|
?LET(N, choose(0, 6),
|
||||||
|
?LETSHRINK(Values, fate_values(Size, N, Options),
|
||||||
|
?LET(Keys, vector(length(Values), fate_data(Size div max(1, N * 2), Options -- [map])),
|
||||||
|
return(aeb_fate_data:make_map(maps:from_list(lists:zip(Keys, Values))))))).
|
||||||
|
|
||||||
|
non_quote_string() ->
|
||||||
|
?SUCHTHAT(S, utf8(), [ quote || <<34>> <= S ] == []).
|
||||||
|
|
||||||
|
char() ->
|
||||||
|
choose(1, 255).
|
||||||
|
|
||||||
|
injection(Binary) ->
|
||||||
|
?LET({N, Inj}, {choose(0, byte_size(Binary) - 1), choose(0,255)},
|
||||||
|
begin
|
||||||
|
M = N * 8,
|
||||||
|
<<X:M, _:8, Z/binary>> = Binary,
|
||||||
|
<<X:M, Inj:8, Z/binary>>
|
||||||
|
end).
|
||||||
|
|
||||||
|
is_empty(L) ->
|
||||||
|
?WHENFAIL(eqc:format("~p\n", [L]), L == []).
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
%%% @author Thomas Arts
|
||||||
|
%%% @doc Use `rebar3 as eqc shell` to run properties in the shell
|
||||||
|
%%% Properties for testing Fate type representations
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 13 Dec 2018 by Thomas Arts <thomas@SpaceGrey.lan>
|
||||||
|
|
||||||
|
-module(aefate_type_eqc).
|
||||||
|
|
||||||
|
-include_lib("eqc/include/eqc.hrl").
|
||||||
|
|
||||||
|
-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
|
kind(X) when is_atom(X) -> X;
|
||||||
|
kind(T) when is_tuple(T) -> element(1, T).
|
||||||
|
|
||||||
|
prop_roundtrip() ->
|
||||||
|
?FORALL(FateType, fate_type(),
|
||||||
|
collect(kind(FateType),
|
||||||
|
begin
|
||||||
|
Serialized = aeb_fate_encoding:serialize_type(FateType),
|
||||||
|
BinSerialized = list_to_binary(Serialized),
|
||||||
|
?WHENFAIL(eqc:format("Serialized ~p to ~p (~p)~n", [FateType, Serialized, BinSerialized]),
|
||||||
|
begin
|
||||||
|
{Type, <<>>} = aeb_fate_encoding:deserialize_type(BinSerialized),
|
||||||
|
equals(Type, FateType)
|
||||||
|
end)
|
||||||
|
end)).
|
||||||
|
|
||||||
|
|
||||||
|
fate_type() ->
|
||||||
|
?SIZED(Size, fate_type(Size)).
|
||||||
|
|
||||||
|
fate_type(0) ->
|
||||||
|
oneof([integer,
|
||||||
|
boolean,
|
||||||
|
address,
|
||||||
|
{bytes, nat()},
|
||||||
|
contract,
|
||||||
|
oracle,
|
||||||
|
channel,
|
||||||
|
bits,
|
||||||
|
string]);
|
||||||
|
fate_type(Size) ->
|
||||||
|
?LAZY(
|
||||||
|
oneof([fate_type(0),
|
||||||
|
{list, fate_type(Size div 2)},
|
||||||
|
?LETSHRINK(Ts, fate_types(Size), {tuple, Ts}),
|
||||||
|
?LETSHRINK(Ts, fate_types(Size), {variant, Ts}),
|
||||||
|
?LETSHRINK([T1, T2], vector(2, fate_type(Size div 2)),
|
||||||
|
{map, T1, T2})])).
|
||||||
|
|
||||||
|
fate_types(Size) ->
|
||||||
|
?LET(N, choose(0, 6),
|
||||||
|
eqc_gen:list(N, fate_type(Size div max(2, N)))).
|
||||||
|
|
||||||
+4
-2
@@ -1,10 +1,12 @@
|
|||||||
|
%% -*- mode: erlang; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
{minimum_otp_vsn, "20.1"}.
|
{minimum_otp_vsn, "20.1"}.
|
||||||
|
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
|
|
||||||
{deps, [ {eblake2, "1.0.0"}
|
{deps, [ {eblake2, "1.0.0"}
|
||||||
, {aeserialization, {git, "https://github.com/aeternity/aeserialization.git",
|
, {aeserialization, {git, "https://github.com/aeternity/aeserialization.git",
|
||||||
{ref, "b55c372"}}}
|
{ref, "816bf99"}}}
|
||||||
, {getopt, "1.0.1"}
|
, {getopt, "1.0.1"}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@
|
|||||||
"/njs /njh /nfl /ndl & exit /b 0"} % silence things
|
"/njs /njh /nfl /ndl & exit /b 0"} % silence things
|
||||||
]}
|
]}
|
||||||
]},
|
]},
|
||||||
{eqc, [{erl_opts, [{parse_transform, eqc_cover}]},
|
{eqc, [{erl_opts, [{parse_transform, eqc_cover}, {d, 'EQC'}]},
|
||||||
{extra_src_dirs, ["quickcheck"]} %% May not be called eqc!
|
{extra_src_dirs, ["quickcheck"]} %% May not be called eqc!
|
||||||
]}
|
]}
|
||||||
]}.
|
]}.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{"1.1.0",
|
{"1.1.0",
|
||||||
[{<<"aeserialization">>,
|
[{<<"aeserialization">>,
|
||||||
{git,"https://github.com/aeternity/aeserialization.git",
|
{git,"https://github.com/aeternity/aeserialization.git",
|
||||||
{ref,"b55c3726f4a21063721c68d6fa7fda39121edf11"}},
|
{ref,"816bf994ffb5cee218c3f22dc5fea296c9e0882e"}},
|
||||||
0},
|
0},
|
||||||
{<<"base58">>,
|
{<<"base58">>,
|
||||||
{git,"https://github.com/aeternity/erl-base58.git",
|
{git,"https://github.com/aeternity/erl-base58.git",
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% @copyright (C) 2017, Aeternity Anstalt
|
||||||
|
%%% @doc
|
||||||
|
%%% Encode and decode data and function calls according to
|
||||||
|
%%% Sophia-AEVM-ABI
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 25 Jan 2018
|
||||||
|
%%%
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
-module(aeb_aevm_abi).
|
||||||
|
-define(HASH_SIZE, 32).
|
||||||
|
|
||||||
|
-export([ create_calldata/4
|
||||||
|
, check_calldata/2
|
||||||
|
, function_type_info/3
|
||||||
|
, function_type_hash/3
|
||||||
|
, arg_typerep_from_function/2
|
||||||
|
, type_hash_from_function_name/2
|
||||||
|
, typereps_from_type_hash/2
|
||||||
|
, function_name_from_type_hash/2
|
||||||
|
, get_function_hash_from_calldata/1
|
||||||
|
]).
|
||||||
|
|
||||||
|
-type hash() :: <<_:256>>. %% 256 = ?HASH_SIZE * 8.
|
||||||
|
-type function_name() :: binary(). %% String
|
||||||
|
-type typerep() :: aeb_aevm_data:type().
|
||||||
|
-type function_type_info() :: { FunctionHash :: hash()
|
||||||
|
, FunctionName :: function_name()
|
||||||
|
, ArgType :: binary() %% binary typerep
|
||||||
|
, OutType :: binary() %% binary typerep
|
||||||
|
}.
|
||||||
|
-type type_info() :: [function_type_info()].
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% API
|
||||||
|
%%%===================================================================
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% Handle calldata
|
||||||
|
|
||||||
|
create_calldata(FunName, Args, ArgTypes0, RetType) ->
|
||||||
|
ArgTypes = {tuple, ArgTypes0},
|
||||||
|
<<TypeHashInt:?HASH_SIZE/unit:8>> =
|
||||||
|
function_type_hash(list_to_binary(FunName), ArgTypes, RetType),
|
||||||
|
Data = aeb_heap:to_binary({TypeHashInt, list_to_tuple(Args)}),
|
||||||
|
{ok, Data}.
|
||||||
|
|
||||||
|
-spec check_calldata(binary(), type_info()) ->
|
||||||
|
{'ok', typerep(), typerep()} | {'error', atom()}.
|
||||||
|
check_calldata(CallData, TypeInfo) ->
|
||||||
|
%% The first element of the CallData should be the function name
|
||||||
|
case get_function_hash_from_calldata(CallData) of
|
||||||
|
{ok, Hash} ->
|
||||||
|
case typereps_from_type_hash(Hash, TypeInfo) of
|
||||||
|
{ok, ArgType, OutType} ->
|
||||||
|
try aeb_heap:from_binary({tuple, [word, ArgType]}, CallData) of
|
||||||
|
{ok, _Something} ->
|
||||||
|
{ok, {tuple, [word, ArgType]}, OutType};
|
||||||
|
{error, _} ->
|
||||||
|
{error, bad_call_data}
|
||||||
|
catch
|
||||||
|
_T:_E ->
|
||||||
|
{error, bad_call_data}
|
||||||
|
end;
|
||||||
|
{error, _} ->
|
||||||
|
{error, unknown_function}
|
||||||
|
end;
|
||||||
|
{error, _What} ->
|
||||||
|
{error, bad_call_data}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec get_function_hash_from_calldata(CallData::binary()) ->
|
||||||
|
{ok, binary()} | {error, term()}.
|
||||||
|
get_function_hash_from_calldata(CallData) ->
|
||||||
|
case aeb_heap:from_binary({tuple, [word]}, CallData) of
|
||||||
|
{ok, {HashInt}} -> {ok, <<HashInt:?HASH_SIZE/unit:8>>};
|
||||||
|
{error, _} = Error -> Error
|
||||||
|
end.
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% Handle type info from contract meta data
|
||||||
|
|
||||||
|
-spec function_type_info(function_name(), [typerep()], typerep()) ->
|
||||||
|
function_type_info().
|
||||||
|
function_type_info(Name, ArgTypes, OutType) ->
|
||||||
|
ArgType = {tuple, ArgTypes},
|
||||||
|
{ function_type_hash(Name, ArgType, OutType)
|
||||||
|
, Name
|
||||||
|
, aeb_heap:to_binary(ArgType)
|
||||||
|
, aeb_heap:to_binary(OutType)
|
||||||
|
}.
|
||||||
|
|
||||||
|
-spec function_type_hash(function_name(), typerep(), typerep()) -> hash().
|
||||||
|
function_type_hash(Name, ArgType, OutType) when is_binary(Name) ->
|
||||||
|
Bin = iolist_to_binary([ Name
|
||||||
|
, aeb_heap:to_binary(ArgType)
|
||||||
|
, aeb_heap:to_binary(OutType)
|
||||||
|
]),
|
||||||
|
%% Calculate a 256 bit digest BLAKE2b hash value of a binary
|
||||||
|
{ok, Hash} = eblake2:blake2b(?HASH_SIZE, Bin),
|
||||||
|
Hash.
|
||||||
|
|
||||||
|
-spec arg_typerep_from_function(function_name(), type_info()) ->
|
||||||
|
{'ok', typerep()} | {'error', 'bad_type_data' | 'unknown_function'}.
|
||||||
|
arg_typerep_from_function(Function, TypeInfo) ->
|
||||||
|
case lists:keyfind(Function, 2, TypeInfo) of
|
||||||
|
{_TypeHash, Function, ArgTypeBin,_OutTypeBin} ->
|
||||||
|
case aeb_heap:from_binary(typerep, ArgTypeBin) of
|
||||||
|
{ok, ArgType} -> {ok, ArgType};
|
||||||
|
{error,_} -> {error, bad_type_data}
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
{error, unknown_function}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec typereps_from_type_hash(hash(), type_info()) ->
|
||||||
|
{'ok', typerep(), typerep()} | {'error', 'bad_type_data' | 'unknown_function'}.
|
||||||
|
typereps_from_type_hash(TypeHash, TypeInfo) ->
|
||||||
|
case lists:keyfind(TypeHash, 1, TypeInfo) of
|
||||||
|
{TypeHash,_Function, ArgTypeBin, OutTypeBin} ->
|
||||||
|
case {aeb_heap:from_binary(typerep, ArgTypeBin),
|
||||||
|
aeb_heap:from_binary(typerep, OutTypeBin)} of
|
||||||
|
{{ok, ArgType}, {ok, OutType}} -> {ok, ArgType, OutType};
|
||||||
|
{_, _} -> {error, bad_type_data}
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
{error, unknown_function}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec function_name_from_type_hash(hash(), type_info()) ->
|
||||||
|
{'ok', function_name()}
|
||||||
|
| {'error', 'unknown_function'}.
|
||||||
|
function_name_from_type_hash(TypeHash, TypeInfo) ->
|
||||||
|
case lists:keyfind(TypeHash, 1, TypeInfo) of
|
||||||
|
{TypeHash, Function,_ArgTypeBin,_OutTypeBin} ->
|
||||||
|
{ok, Function};
|
||||||
|
false ->
|
||||||
|
{error, unknown_function}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec type_hash_from_function_name(function_name(), type_info()) ->
|
||||||
|
{'ok', hash()}
|
||||||
|
| {'error', 'unknown_function'}.
|
||||||
|
type_hash_from_function_name(Name, TypeInfo) ->
|
||||||
|
case lists:keyfind(Name, 2, TypeInfo) of
|
||||||
|
{TypeHash, Name,_ArgTypeBin,_OutTypeBin} ->
|
||||||
|
{ok, TypeHash};
|
||||||
|
false ->
|
||||||
|
{error, unknown_function}
|
||||||
|
end.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-module(aeb_aevm_data).
|
||||||
|
|
||||||
|
-export_type([data/0,
|
||||||
|
type/0,
|
||||||
|
heap/0]).
|
||||||
|
|
||||||
|
-type type() :: word | signed_word | string | typerep | function
|
||||||
|
| {list, type()}
|
||||||
|
| {option, type()}
|
||||||
|
| {tuple, [type()]}
|
||||||
|
| {variant, [[type()]]}.
|
||||||
|
|
||||||
|
|
||||||
|
-type data() :: none
|
||||||
|
| {some, data()}
|
||||||
|
| {option, data()}
|
||||||
|
| word
|
||||||
|
| string
|
||||||
|
| {list, data()}
|
||||||
|
| {tuple, [data()]}
|
||||||
|
| {variant, integer(), [data()]}
|
||||||
|
| integer()
|
||||||
|
| binary()
|
||||||
|
| [data()]
|
||||||
|
| {}
|
||||||
|
| {data()}
|
||||||
|
| {data(), data()}.
|
||||||
|
|
||||||
|
-type heap() :: binary().
|
||||||
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% @copyright (C) 2019, Aeternity Anstalt
|
||||||
|
%%% @doc
|
||||||
|
%%% Encode and decode data and function calls according to
|
||||||
|
%%% Sophia-FATE-ABI
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 11 Jun 2019
|
||||||
|
%%%
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
-module(aeb_fate_abi).
|
||||||
|
|
||||||
|
-export([ create_calldata/2
|
||||||
|
, decode_calldata/2
|
||||||
|
, get_function_hash_from_calldata/1
|
||||||
|
, get_function_name_from_function_hash/2
|
||||||
|
, get_function_type_from_function_hash/2 ]).
|
||||||
|
|
||||||
|
-include("../include/aeb_fate_data.hrl").
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% API
|
||||||
|
%%%===================================================================
|
||||||
|
|
||||||
|
-spec create_calldata(list(), [term()]) -> {ok, binary()}.
|
||||||
|
create_calldata(FunName, Args) ->
|
||||||
|
FunctionId = aeb_fate_code:symbol_identifier(list_to_binary(FunName)),
|
||||||
|
{ok, aeb_fate_encoding:serialize(
|
||||||
|
aeb_fate_data:make_tuple({FunctionId,
|
||||||
|
aeb_fate_data:make_tuple(list_to_tuple(Args))}))}.
|
||||||
|
|
||||||
|
-spec decode_calldata(list(), binary()) -> {ok, term()} | {error, term()}.
|
||||||
|
decode_calldata(FunName, Calldata) ->
|
||||||
|
FunctionId = aeb_fate_code:symbol_identifier(list_to_binary(FunName)),
|
||||||
|
case ?FATE_TUPLE_ELEMENTS(aeb_fate_encoding:deserialize(Calldata)) of
|
||||||
|
[FunctionId, FateArgs] -> {ok, ?FATE_TUPLE_ELEMENTS(FateArgs)};
|
||||||
|
_ -> {error, decode_error}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec get_function_name_from_function_hash(binary(), aeb_fate_code:fcode()) ->
|
||||||
|
{ok, term()} | {error, term()}.
|
||||||
|
get_function_name_from_function_hash(<<SymbolHash:4/binary, _:28/binary>>, FateCode) ->
|
||||||
|
get_function_name_from_function_hash(SymbolHash, FateCode);
|
||||||
|
get_function_name_from_function_hash(SymbolHash = <<_:4/binary>>, FateCode) ->
|
||||||
|
Symbols = aeb_fate_code:symbols(FateCode),
|
||||||
|
case maps:get(SymbolHash, Symbols, undefined) of
|
||||||
|
undefined -> {error, no_function_matching_function_hash};
|
||||||
|
Function -> {ok, Function}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec get_function_hash_from_calldata(binary()) ->
|
||||||
|
{ok, binary()} | {error, term()}.
|
||||||
|
get_function_hash_from_calldata(CallData) ->
|
||||||
|
try ?FATE_TUPLE_ELEMENTS(aeb_fate_encoding:deserialize(CallData)) of
|
||||||
|
[FunHash, _Args] -> {ok, FunHash};
|
||||||
|
_ -> {error, bad_calldata}
|
||||||
|
catch _:_ ->
|
||||||
|
{error, bad_calldata}
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec get_function_type_from_function_hash(binary(), aeb_fate_code:fcode()) ->
|
||||||
|
{ok, term(), term()} | {error, term()}.
|
||||||
|
get_function_type_from_function_hash(<<SymbolHash:4/binary, _:28/binary>>, FateCode) ->
|
||||||
|
get_function_type_from_function_hash(SymbolHash, FateCode);
|
||||||
|
get_function_type_from_function_hash(SymbolHash, FateCode) ->
|
||||||
|
Functions = aeb_fate_code:functions(FateCode),
|
||||||
|
case maps:get(SymbolHash, Functions, undefined) of
|
||||||
|
undefined ->
|
||||||
|
{error, no_function_matching_function_hash};
|
||||||
|
{{ArgTypes, RetType}, _Code} ->
|
||||||
|
{ok, ArgTypes, RetType}
|
||||||
|
end.
|
||||||
+138
-672
@@ -1,6 +1,7 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
%%% @copyright (C) 2019, Aeternity Anstalt
|
%%% @copyright (C) 2019, Aeternity Anstalt
|
||||||
%%% @doc Assembler for Fate machine code.
|
%%% @doc Assembler for Fate machine code.
|
||||||
|
%%% @end
|
||||||
%%%
|
%%%
|
||||||
%%% Fate code exists in 3 formats:
|
%%% Fate code exists in 3 formats:
|
||||||
%%%
|
%%%
|
||||||
@@ -29,20 +30,20 @@
|
|||||||
%%% arg0
|
%%% arg0
|
||||||
%%% References to variables/registers start with var followed by an integer
|
%%% References to variables/registers start with var followed by an integer
|
||||||
%%% var0
|
%%% var0
|
||||||
%%% References to stack postions is either a (for stack 0)
|
%%% References to the top of the stack is the letter a (for accumulator)
|
||||||
%%% or start with stack followed by an integer
|
|
||||||
%%% stack1
|
|
||||||
%%% a
|
%%% a
|
||||||
%%%
|
%%%
|
||||||
%%% Immediate values can be of 9 types:
|
%%% Immediate values can be of 10 types:
|
||||||
%%% 1a. Integers as decimals: {Digits} or -{Digits}
|
%%% 1a. Integers as decimals: {Digits} or -{Digits}
|
||||||
%%% 42
|
%%% 42
|
||||||
%%% -2374683271468723648732648736498712634876147
|
%%% -2374683271468723648732648736498712634876147
|
||||||
%%% 1b. Integers as Hexadecimals:: 0x{Hexdigits}
|
%%% 1b. Integers as Hexadecimals:: 0x{Hexdigits}
|
||||||
%%% 0x0deadbeef0
|
%%% 0x0deadbeef0
|
||||||
%%% 2. addresses, a base58 encoded string starting with #{base58char}
|
%%% 2a. account addresses, a base58c encoded string prefixed with @ak_
|
||||||
%%% followed by up to 64 hex chars
|
%%% 2b. contract address: @ct_{base58char}+
|
||||||
%%% #00000deadbeef
|
%%% 2c. oracle address: @ok_{base58char}+
|
||||||
|
%%% 2d. oracle query id: @oq_{base58char}+
|
||||||
|
%%% 2e. channel address: @ch_{base58char}+
|
||||||
%%% 3. Boolean true or false
|
%%% 3. Boolean true or false
|
||||||
%%% true
|
%%% true
|
||||||
%%% false
|
%%% false
|
||||||
@@ -62,20 +63,23 @@
|
|||||||
%%% 8. Tuples ( Elements )
|
%%% 8. Tuples ( Elements )
|
||||||
%%% ()
|
%%% ()
|
||||||
%%% (1, "foo")
|
%%% (1, "foo")
|
||||||
%%% 9. Variants: (| Size | Tag | ( Elements ) |)
|
%%% 9. Variants: (| [Arities] | Tag | ( Elements ) |)
|
||||||
%%% (| 42 | 12 | ( "foo", 12) |)
|
%%% (| [0,1,2] | 2 | ( "foo", 12) |)
|
||||||
|
%%% 10. Bytes: #{base64char}+
|
||||||
|
%%% #AQIDCioLFQ==
|
||||||
%%%
|
%%%
|
||||||
%%% Where Digits: [0123456789]
|
%%% Where Digits: [0123456789]
|
||||||
%%% Hexdigits: [0123456789abcdef]
|
%%% Hexdigits: [0123456789abcdef]
|
||||||
%%% base58char: [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
%%% base58char: [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
||||||
%%% Characters any printable ascii character 0..255 (except " no quoting yet)
|
%%% base64char: [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy0123456789+/=]
|
||||||
|
%%% Characters: as a code literal - any printable ascii character 0..255 (except " no quoting yet)
|
||||||
|
%%% the type supports an array of bytes (all values 0..255).
|
||||||
%%% Key: any value except for a map
|
%%% Key: any value except for a map
|
||||||
%%% Bits: 01 or space
|
%%% Bits: 01 or space
|
||||||
%%% Elements: Nothing or Value , Elements
|
%%% Elements: Nothing or Value , Elements
|
||||||
%%% Size: Digits
|
%%% Size: Digits
|
||||||
%%% Tag: Digits
|
%%% Tag: Digits
|
||||||
%%%
|
%%%
|
||||||
%%% @end
|
|
||||||
%%% Created : 21 Dec 2017
|
%%% Created : 21 Dec 2017
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -83,13 +87,11 @@
|
|||||||
|
|
||||||
-export([ assemble_file/3
|
-export([ assemble_file/3
|
||||||
, asm_to_bytecode/2
|
, asm_to_bytecode/2
|
||||||
, bytecode_to_fate_code/2
|
|
||||||
, function_call/1
|
, function_call/1
|
||||||
, pp/1
|
, pp/1
|
||||||
, read_file/1
|
, read_file/1
|
||||||
, strip/1
|
, strip/1
|
||||||
, to_asm/1
|
, to_asm/1
|
||||||
, to_hexstring/1
|
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include_lib("aebytecode/include/aeb_fate_opcodes.hrl").
|
-include_lib("aebytecode/include/aeb_fate_opcodes.hrl").
|
||||||
@@ -126,9 +128,10 @@ pp(FateCode) ->
|
|||||||
io_lib:format("~ts~n",[Listing]).
|
io_lib:format("~ts~n",[Listing]).
|
||||||
|
|
||||||
|
|
||||||
to_asm(#{ functions := Functions
|
to_asm(FateCode) ->
|
||||||
, symbols := Symbols
|
Functions = aeb_fate_code:functions(FateCode),
|
||||||
, annotations := Annotations} = _FateCode) ->
|
Symbols = aeb_fate_code:symbols(FateCode),
|
||||||
|
Annotations = aeb_fate_code:annotations(FateCode),
|
||||||
insert_comments(get_comments(Annotations), 1,
|
insert_comments(get_comments(Annotations), 1,
|
||||||
lists:flatten(
|
lists:flatten(
|
||||||
io_lib:format("~s",
|
io_lib:format("~s",
|
||||||
@@ -144,12 +147,6 @@ insert_comments([],_,[]) -> [];
|
|||||||
insert_comments([{L,C}|Rest], _, []) ->
|
insert_comments([{L,C}|Rest], _, []) ->
|
||||||
";; " ++ C ++ "\n" ++ insert_comments(Rest, L + 1, []).
|
";; " ++ C ++ "\n" ++ insert_comments(Rest, L + 1, []).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
format_functions(Functions, Symbols) ->
|
format_functions(Functions, Symbols) ->
|
||||||
[format(lookup(Name, Symbols),
|
[format(lookup(Name, Symbols),
|
||||||
Sig,
|
Sig,
|
||||||
@@ -212,575 +209,22 @@ asm_to_bytecode(AssemblerCode, Options) ->
|
|||||||
none ->
|
none ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
|
Env = #{ fate_code => aeb_fate_code:new()
|
||||||
|
, functions => #{}
|
||||||
|
},
|
||||||
|
|
||||||
Env = to_bytecode(Tokens, none, #{ functions => #{}
|
Env1 = to_bytecode(Tokens, none, Env, [], Options),
|
||||||
, symbols => #{}
|
FateCode = maps:get(fate_code, Env1),
|
||||||
, annotations => #{}
|
FunctionsMap = maps:get(functions, Env1),
|
||||||
}, [], Options),
|
Functions = [X || {_, X} <- lists:sort(maps:to_list(FunctionsMap))],
|
||||||
|
FunctionsBin = iolist_to_binary(Functions),
|
||||||
ByteList = serialize(Env),
|
ByteCode = aeb_fate_code:serialize(FateCode, FunctionsBin, Options),
|
||||||
Signatures = serialize_sigs(Env),
|
|
||||||
SymbolTable = serialize_symbol_table(Env),
|
|
||||||
Annotatations = serialize_annotations(Env),
|
|
||||||
ByteCode = << (aeser_rlp:encode(list_to_binary(ByteList)))/binary,
|
|
||||||
(aeser_rlp:encode(list_to_binary(Signatures)))/binary,
|
|
||||||
(aeser_rlp:encode(SymbolTable))/binary,
|
|
||||||
(aeser_rlp:encode(Annotatations))/binary
|
|
||||||
>>,
|
|
||||||
|
|
||||||
case proplists:lookup(pp_hex_string, Options) of
|
|
||||||
{pp_hex_string, true} ->
|
|
||||||
io:format("Code: ~s~n",[to_hexstring(ByteList)]);
|
|
||||||
none ->
|
|
||||||
ok
|
|
||||||
end,
|
|
||||||
|
|
||||||
{Env, ByteCode}.
|
{Env, ByteCode}.
|
||||||
|
|
||||||
strip(ByteCode) ->
|
strip(ByteCode) ->
|
||||||
{Code, _Rest} = aeser_rlp:decode_one(ByteCode),
|
{Code, _Rest} = aeser_rlp:decode_one(ByteCode),
|
||||||
Code.
|
Code.
|
||||||
|
|
||||||
bytecode_to_fate_code(Bytes, _Options) ->
|
|
||||||
{ByteCode, Rest1} = aeser_rlp:decode_one(Bytes),
|
|
||||||
{Signatures, Rest2} = aeser_rlp:decode_one(Rest1),
|
|
||||||
{SymbolTable, Rest3} = aeser_rlp:decode_one(Rest2),
|
|
||||||
{Annotations, <<>>} = aeser_rlp:decode_one(Rest3),
|
|
||||||
|
|
||||||
Env1 = deserialize(ByteCode, #{ function => none
|
|
||||||
, bb => 0
|
|
||||||
, current_bb_code => []
|
|
||||||
, functions => #{}
|
|
||||||
, code => #{}
|
|
||||||
}),
|
|
||||||
Env2 = deserialize_signatures(Signatures, Env1),
|
|
||||||
Env3 = deserialize_symbols(SymbolTable, Env2),
|
|
||||||
Env4 = deserialize_annotations(Annotations, Env3),
|
|
||||||
Env4.
|
|
||||||
|
|
||||||
|
|
||||||
deserialize(<<?FUNCTION:8, A, B, C, D, Rest/binary>>,
|
|
||||||
#{ function := none
|
|
||||||
, bb := 0
|
|
||||||
, current_bb_code := []
|
|
||||||
} = Env) ->
|
|
||||||
{Sig, Rest2} = deserialize_signature(Rest),
|
|
||||||
Env2 = Env#{function => {<<A,B,C,D>>, Sig}},
|
|
||||||
deserialize(Rest2, Env2);
|
|
||||||
deserialize(<<?FUNCTION:8, A, B, C, D, Rest/binary>>,
|
|
||||||
#{ function := {F, Sig}
|
|
||||||
, bb := BB
|
|
||||||
, current_bb_code := Code
|
|
||||||
, code := Program
|
|
||||||
, functions := Funs} = Env) ->
|
|
||||||
{NewSig, Rest2} = deserialize_signature(Rest),
|
|
||||||
case Code of
|
|
||||||
[] ->
|
|
||||||
Env2 = Env#{ bb => 0
|
|
||||||
, current_bb_code => []
|
|
||||||
, function => {<<A,B,C,D>>, NewSig}
|
|
||||||
, code => #{}
|
|
||||||
, functions => Funs#{F => {Sig, Program}}},
|
|
||||||
deserialize(Rest2, Env2);
|
|
||||||
_ ->
|
|
||||||
Env2 = Env#{ bb => 0
|
|
||||||
, current_bb_code => []
|
|
||||||
, function => {<<A,B,C,D>>, NewSig}
|
|
||||||
, code => #{}
|
|
||||||
, functions =>
|
|
||||||
Funs#{F => {Sig,
|
|
||||||
Program#{ BB => lists:reverse(Code)}}}},
|
|
||||||
deserialize(Rest2, Env2)
|
|
||||||
end;
|
|
||||||
deserialize(<<Op:8, Rest/binary>>,
|
|
||||||
#{ bb := BB
|
|
||||||
, current_bb_code := Code
|
|
||||||
, code := Program} = Env) ->
|
|
||||||
{Rest2, OpCode} = deserialize_op(Op, Rest, Code),
|
|
||||||
case aeb_fate_opcodes:end_bb(Op) of
|
|
||||||
true ->
|
|
||||||
deserialize(Rest2, Env#{ bb => BB+1
|
|
||||||
, current_bb_code => []
|
|
||||||
, code => Program#{BB =>
|
|
||||||
lists:reverse(OpCode)}});
|
|
||||||
false ->
|
|
||||||
deserialize(Rest2, Env#{ current_bb_code => OpCode})
|
|
||||||
end;
|
|
||||||
deserialize(<<>>, #{ function := {F, Sig}
|
|
||||||
, bb := BB
|
|
||||||
, current_bb_code := Code
|
|
||||||
, code := Program
|
|
||||||
, functions := Funs} = Env) ->
|
|
||||||
FunctionCode =
|
|
||||||
case Code of
|
|
||||||
[] -> Program;
|
|
||||||
_ -> Program#{ BB => lists:reverse(Code)}
|
|
||||||
end,
|
|
||||||
Env#{ bb => 0
|
|
||||||
, current_bb_code => []
|
|
||||||
, function => none
|
|
||||||
, code => #{}
|
|
||||||
, functions => Funs#{F => {Sig, FunctionCode}}}.
|
|
||||||
|
|
||||||
deserialize_op(?ELEMENT, Rest, Code) ->
|
|
||||||
{Type, Rest2} = deserialize_type(Rest),
|
|
||||||
<<ArgType:8, Rest3/binary>> = Rest2,
|
|
||||||
{Arg0, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg1, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg2, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
{Rest6, [{ aeb_fate_opcodes:mnemonic(?ELEMENT)
|
|
||||||
, Type
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}}
|
|
||||||
| Code]};
|
|
||||||
deserialize_op(?SWITCH_VN, Rest, Code) ->
|
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
case aeb_fate_encoding:deserialize_one(Rest3) of
|
|
||||||
{L, Rest4} when is_list(L) ->
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
immediate = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
{Rest4, [{aeb_fate_opcodes:mnemonic(?SWITCH_VN)
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {immediate, L}
|
|
||||||
}
|
|
||||||
| Code]};
|
|
||||||
_ -> exit(bad_argument_to_switch_vn)
|
|
||||||
end;
|
|
||||||
deserialize_op(Op, Rest, Code) ->
|
|
||||||
OpName = aeb_fate_opcodes:mnemonic(Op),
|
|
||||||
case aeb_fate_opcodes:args(Op) of
|
|
||||||
0 -> {Rest, [OpName | Code]};
|
|
||||||
1 ->
|
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
Modifier = bits_to_modifier(ArgType),
|
|
||||||
{Rest3, [{OpName, {Modifier, Arg}} | Code]};
|
|
||||||
2 ->
|
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
{Rest4, [{OpName, {Modifier0, Arg0},
|
|
||||||
{Modifier1, Arg1}} | Code]};
|
|
||||||
3 ->
|
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
{Rest5, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}}
|
|
||||||
| Code]};
|
|
||||||
4 ->
|
|
||||||
<<ArgType:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg3, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
Modifier3 = bits_to_modifier((ArgType bsr 6) band 2#11),
|
|
||||||
{Rest6, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}
|
|
||||||
, {Modifier3, Arg3}}
|
|
||||||
| Code]};
|
|
||||||
5 ->
|
|
||||||
<<ArgType:8, ArgType2:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg3, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
{Arg4, Rest7} = aeb_fate_encoding:deserialize_one(Rest6),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
Modifier3 = bits_to_modifier((ArgType bsr 6) band 2#11),
|
|
||||||
Modifier4 = bits_to_modifier(ArgType2 band 2#11),
|
|
||||||
{Rest7, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}
|
|
||||||
, {Modifier3, Arg3}
|
|
||||||
, {Modifier4, Arg4}
|
|
||||||
}
|
|
||||||
| Code]};
|
|
||||||
6 ->
|
|
||||||
<<ArgType:8, ArgType2:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg3, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
{Arg4, Rest7} = aeb_fate_encoding:deserialize_one(Rest6),
|
|
||||||
{Arg5, Rest8} = aeb_fate_encoding:deserialize_one(Rest7),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
Modifier3 = bits_to_modifier((ArgType bsr 6) band 2#11),
|
|
||||||
Modifier4 = bits_to_modifier(ArgType2 band 2#11),
|
|
||||||
Modifier5 = bits_to_modifier((ArgType2 bsr 2) band 2#11),
|
|
||||||
{Rest8, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}
|
|
||||||
, {Modifier3, Arg3}
|
|
||||||
, {Modifier4, Arg4}
|
|
||||||
, {Modifier5, Arg5}
|
|
||||||
}
|
|
||||||
| Code]};
|
|
||||||
7 ->
|
|
||||||
<<ArgType:8, ArgType2:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg3, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
{Arg4, Rest7} = aeb_fate_encoding:deserialize_one(Rest6),
|
|
||||||
{Arg5, Rest8} = aeb_fate_encoding:deserialize_one(Rest7),
|
|
||||||
{Arg6, Rest9} = aeb_fate_encoding:deserialize_one(Rest8),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
Modifier3 = bits_to_modifier((ArgType bsr 6) band 2#11),
|
|
||||||
Modifier4 = bits_to_modifier(ArgType2 band 2#11),
|
|
||||||
Modifier5 = bits_to_modifier((ArgType2 bsr 2) band 2#11),
|
|
||||||
Modifier6 = bits_to_modifier((ArgType2 bsr 4) band 2#11),
|
|
||||||
{Rest9, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}
|
|
||||||
, {Modifier3, Arg3}
|
|
||||||
, {Modifier4, Arg4}
|
|
||||||
, {Modifier5, Arg5}
|
|
||||||
, {Modifier6, Arg6}
|
|
||||||
}
|
|
||||||
| Code]};
|
|
||||||
8 ->
|
|
||||||
<<ArgType:8, ArgType2:8, Rest2/binary>> = Rest,
|
|
||||||
{Arg0, Rest3} = aeb_fate_encoding:deserialize_one(Rest2),
|
|
||||||
{Arg1, Rest4} = aeb_fate_encoding:deserialize_one(Rest3),
|
|
||||||
{Arg2, Rest5} = aeb_fate_encoding:deserialize_one(Rest4),
|
|
||||||
{Arg3, Rest6} = aeb_fate_encoding:deserialize_one(Rest5),
|
|
||||||
{Arg4, Rest7} = aeb_fate_encoding:deserialize_one(Rest6),
|
|
||||||
{Arg5, Rest8} = aeb_fate_encoding:deserialize_one(Rest7),
|
|
||||||
{Arg6, Rest9} = aeb_fate_encoding:deserialize_one(Rest8),
|
|
||||||
{Arg7, Rest10} = aeb_fate_encoding:deserialize_one(Rest9),
|
|
||||||
Modifier0 = bits_to_modifier(ArgType band 2#11),
|
|
||||||
Modifier1 = bits_to_modifier((ArgType bsr 2) band 2#11),
|
|
||||||
Modifier2 = bits_to_modifier((ArgType bsr 4) band 2#11),
|
|
||||||
Modifier3 = bits_to_modifier((ArgType bsr 6) band 2#11),
|
|
||||||
Modifier4 = bits_to_modifier(ArgType2 band 2#11),
|
|
||||||
Modifier5 = bits_to_modifier((ArgType2 bsr 2) band 2#11),
|
|
||||||
Modifier6 = bits_to_modifier((ArgType2 bsr 4) band 2#11),
|
|
||||||
Modifier7 = bits_to_modifier((ArgType2 bsr 6) band 2#11),
|
|
||||||
{Rest10, [{ OpName
|
|
||||||
, {Modifier0, Arg0}
|
|
||||||
, {Modifier1, Arg1}
|
|
||||||
, {Modifier2, Arg2}
|
|
||||||
, {Modifier3, Arg3}
|
|
||||||
, {Modifier4, Arg4}
|
|
||||||
, {Modifier5, Arg5}
|
|
||||||
, {Modifier6, Arg6}
|
|
||||||
, {Modifier7, Arg7}
|
|
||||||
}
|
|
||||||
| Code]}
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deserialize_signatures(_Signatures, Env) -> Env.
|
|
||||||
|
|
||||||
deserialize_symbols(Table, Env) ->
|
|
||||||
?FATE_MAP_VALUE(SymbolTable) = aeb_fate_encoding:deserialize(Table),
|
|
||||||
Env#{symbols => SymbolTable}.
|
|
||||||
|
|
||||||
deserialize_annotations(AnnotationsBin, Env) ->
|
|
||||||
?FATE_MAP_VALUE(Annotations) = aeb_fate_encoding:deserialize(AnnotationsBin),
|
|
||||||
Env#{annotations => Annotations}.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
serialize_sigs(_Env) -> [].
|
|
||||||
|
|
||||||
serialize_symbol_table(#{ symbols := Symbols }) ->
|
|
||||||
aeb_fate_encoding:serialize(aeb_fate_data:make_map(Symbols)).
|
|
||||||
|
|
||||||
serialize_annotations(#{ annotations := Annotations}) ->
|
|
||||||
aeb_fate_encoding:serialize(aeb_fate_data:make_map(Annotations)).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
serialize(#{functions := Functions} =_Env) ->
|
|
||||||
%% Sort the functions oon name to get a canonical serialisation.
|
|
||||||
Code = [[?FUNCTION, Name, serialize_signature(Sig), C] ||
|
|
||||||
{Name, {Sig, C}} <- lists:sort(maps:to_list(Functions))],
|
|
||||||
serialize_code(lists:flatten(Code)).
|
|
||||||
|
|
||||||
|
|
||||||
%% Argument encoding
|
|
||||||
%% Agument Specification Byte
|
|
||||||
%% bitpos: 6 4 2 0
|
|
||||||
%% xx xx xx xx
|
|
||||||
%% Arg3 Arg2 Arg1 Arg0
|
|
||||||
%% For 5-8 args another Argument Spec Byte is used
|
|
||||||
%% Bit pattern
|
|
||||||
%% 00 : stack/unused (depending on instruction)
|
|
||||||
%% 01 : argN
|
|
||||||
%% 10 : varN
|
|
||||||
%% 11 : immediate
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
, {Arg3Type, Arg3}
|
|
||||||
, {Arg4Type, Arg4}
|
|
||||||
, {Arg5Type, Arg5}
|
|
||||||
, {Arg6Type, Arg6}
|
|
||||||
, {Arg7Type, Arg7}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec1 =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg3Type) bsl 6),
|
|
||||||
ArgSpec2 =
|
|
||||||
modifier_bits(Arg4Type) bor
|
|
||||||
(modifier_bits(Arg5Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg6Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg7Type) bsl 6),
|
|
||||||
[ ArgSpec1
|
|
||||||
, ArgSpec2
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
, serialize_data(Arg3Type, Arg3)
|
|
||||||
, serialize_data(Arg4Type, Arg4)
|
|
||||||
, serialize_data(Arg5Type, Arg5)
|
|
||||||
, serialize_data(Arg6Type, Arg6)
|
|
||||||
, serialize_data(Arg7Type, Arg7)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
, {Arg3Type, Arg3}
|
|
||||||
, {Arg4Type, Arg4}
|
|
||||||
, {Arg5Type, Arg5}
|
|
||||||
, {Arg6Type, Arg6}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec1 =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg3Type) bsl 6),
|
|
||||||
ArgSpec2 =
|
|
||||||
modifier_bits(Arg4Type) bor
|
|
||||||
(modifier_bits(Arg5Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg6Type) bsl 4),
|
|
||||||
[ ArgSpec1
|
|
||||||
, ArgSpec2
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
, serialize_data(Arg3Type, Arg3)
|
|
||||||
, serialize_data(Arg4Type, Arg4)
|
|
||||||
, serialize_data(Arg5Type, Arg5)
|
|
||||||
, serialize_data(Arg6Type, Arg6)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
, {Arg3Type, Arg3}
|
|
||||||
, {Arg4Type, Arg4}
|
|
||||||
, {Arg5Type, Arg5}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec1 =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg3Type) bsl 6),
|
|
||||||
ArgSpec2 =
|
|
||||||
modifier_bits(Arg4Type) bor
|
|
||||||
(modifier_bits(Arg5Type) bsl 2),
|
|
||||||
[ ArgSpec1
|
|
||||||
, ArgSpec2
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
, serialize_data(Arg3Type, Arg3)
|
|
||||||
, serialize_data(Arg4Type, Arg4)
|
|
||||||
, serialize_data(Arg5Type, Arg5)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
, {Arg3Type, Arg3}
|
|
||||||
, {Arg4Type, Arg4}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec1 =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg3Type) bsl 6),
|
|
||||||
ArgSpec2 =
|
|
||||||
modifier_bits(Arg4Type),
|
|
||||||
[ ArgSpec1
|
|
||||||
, ArgSpec2
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
, serialize_data(Arg3Type, Arg3)
|
|
||||||
, serialize_data(Arg4Type, Arg4)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
, {Arg3Type, Arg3}| Rest]) ->
|
|
||||||
ArgSpec =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4) bor
|
|
||||||
(modifier_bits(Arg3Type) bsl 6),
|
|
||||||
[ ArgSpec
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
, serialize_data(Arg3Type, Arg3)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
, {Arg2Type, Arg2}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2) bor
|
|
||||||
(modifier_bits(Arg2Type) bsl 4),
|
|
||||||
[ArgSpec
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
, serialize_data(Arg2Type, Arg2)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0}
|
|
||||||
, {Arg1Type, Arg1}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(Arg1Type) bsl 2),
|
|
||||||
[ArgSpec
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(Arg1Type, Arg1)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ {Arg0Type, Arg0} | Rest]) ->
|
|
||||||
ArgSpec =
|
|
||||||
modifier_bits(Arg0Type),
|
|
||||||
[ArgSpec
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ ?ELEMENT
|
|
||||||
, ResType
|
|
||||||
| Rest]) ->
|
|
||||||
[?ELEMENT,
|
|
||||||
serialize_type(ResType)
|
|
||||||
| serialize_code(Rest)];
|
|
||||||
serialize_code([ ?SWITCH_VN
|
|
||||||
, {Arg0Type, Arg0}
|
|
||||||
, {immediate, L}
|
|
||||||
| Rest]) ->
|
|
||||||
ArgSpec =
|
|
||||||
modifier_bits(Arg0Type) bor
|
|
||||||
(modifier_bits(immediate) bsl 2),
|
|
||||||
[?SWITCH_VN
|
|
||||||
, ArgSpec
|
|
||||||
, serialize_data(Arg0Type, Arg0)
|
|
||||||
, serialize_data(immediate, L)] ++ serialize_code(Rest);
|
|
||||||
serialize_code([B|Rest]) ->
|
|
||||||
[B | serialize_code(Rest)];
|
|
||||||
serialize_code([]) -> [].
|
|
||||||
|
|
||||||
|
|
||||||
%% 00 : stack/unused (depending on instruction)
|
|
||||||
%% 01 : argN
|
|
||||||
%% 10 : varN
|
|
||||||
%% 11 : immediate
|
|
||||||
modifier_bits(immediate) -> 2#11;
|
|
||||||
modifier_bits(var) -> 2#10;
|
|
||||||
modifier_bits(arg) -> 2#01;
|
|
||||||
modifier_bits(stack) -> 2#00.
|
|
||||||
|
|
||||||
bits_to_modifier(2#11) -> immediate;
|
|
||||||
bits_to_modifier(2#10) -> var;
|
|
||||||
bits_to_modifier(2#01) -> arg;
|
|
||||||
bits_to_modifier(2#00) -> stack.
|
|
||||||
|
|
||||||
serialize_data(_, Data) ->
|
|
||||||
aeb_fate_encoding:serialize(Data).
|
|
||||||
|
|
||||||
serialize_signature({Args, RetType}) ->
|
|
||||||
[serialize_type({tuple, Args}) |
|
|
||||||
serialize_type(RetType)].
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deserialize_signature(Binary) ->
|
|
||||||
{{tuple, Args}, Rest} = deserialize_type(Binary),
|
|
||||||
{RetType, Rest2} = deserialize_type(Rest),
|
|
||||||
{{Args, RetType}, Rest2}.
|
|
||||||
|
|
||||||
deserialize_type(<<0, Rest/binary>>) -> {integer, Rest};
|
|
||||||
deserialize_type(<<1, Rest/binary>>) -> {boolean, Rest};
|
|
||||||
deserialize_type(<<2, Rest/binary>>) ->
|
|
||||||
{T, Rest2} = deserialize_type(Rest),
|
|
||||||
{{list, T}, Rest2};
|
|
||||||
deserialize_type(<<3, N, Rest/binary>>) ->
|
|
||||||
{Ts, Rest2} = deserialize_types(N, Rest, []),
|
|
||||||
{{tuple, Ts}, Rest2};
|
|
||||||
deserialize_type(<<4, Rest/binary>>) -> {address, Rest};
|
|
||||||
deserialize_type(<<5, Rest/binary>>) -> {bits, Rest};
|
|
||||||
deserialize_type(<<6, Rest/binary>>) ->
|
|
||||||
{K, Rest2} = deserialize_type(Rest),
|
|
||||||
{V, Rest3} = deserialize_type(Rest2),
|
|
||||||
{{map, K, V}, Rest3};
|
|
||||||
deserialize_type(<<7, Rest/binary>>) ->
|
|
||||||
{string, Rest};
|
|
||||||
deserialize_type(<<8, Size, Rest/binary>>) ->
|
|
||||||
{Variants, Rest2} = deserialize_variants(Size, Rest, []),
|
|
||||||
{{variant, Variants}, Rest2}.
|
|
||||||
|
|
||||||
deserialize_variants(0, Rest, Variants) ->
|
|
||||||
{lists:reverse(Variants), Rest};
|
|
||||||
deserialize_variants(N, Rest, Variants) ->
|
|
||||||
{T, Rest2} = deserialize_type(Rest),
|
|
||||||
deserialize_variants(N-1, Rest2, [T|Variants]).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deserialize_types(0, Binary, Acc) ->
|
|
||||||
{lists:reverse(Acc), Binary};
|
|
||||||
deserialize_types(N, Binary, Acc) ->
|
|
||||||
{T, Rest} = deserialize_type(Binary),
|
|
||||||
deserialize_types(N-1, Rest, [T | Acc]).
|
|
||||||
|
|
||||||
|
|
||||||
to_hexstring(ByteList) ->
|
|
||||||
"0x" ++ lists:flatten(
|
|
||||||
[io_lib:format("~2.16.0b", [X])
|
|
||||||
|| X <- ByteList]).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
%% Parser
|
%% Parser
|
||||||
%% Asm tokens -> Fate code env
|
%% Asm tokens -> Fate code env
|
||||||
@@ -790,10 +234,6 @@ to_bytecode([{function,_line, 'FUNCTION'}|Rest], Address, Env, Code, Opts) ->
|
|||||||
Env2 = insert_fun(Address, Code, Env),
|
Env2 = insert_fun(Address, Code, Env),
|
||||||
{Fun, Rest2} = to_fun_def(Rest),
|
{Fun, Rest2} = to_fun_def(Rest),
|
||||||
to_bytecode(Rest2, Fun, Env2, [], Opts);
|
to_bytecode(Rest2, Fun, Env2, [], Opts);
|
||||||
to_bytecode([{mnemonic,_line, 'ELEMENT'}|Rest], Address, Env, Code, Opts) ->
|
|
||||||
OpCode = aeb_fate_opcodes:m_to_op('ELEMENT'),
|
|
||||||
{RetType, Rest2} = to_type(Rest),
|
|
||||||
to_bytecode(Rest2, Address, Env, [RetType, OpCode|Code], Opts);
|
|
||||||
to_bytecode([{mnemonic,_line, Op}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{mnemonic,_line, Op}|Rest], Address, Env, Code, Opts) ->
|
||||||
OpCode = aeb_fate_opcodes:m_to_op(Op),
|
OpCode = aeb_fate_opcodes:m_to_op(Op),
|
||||||
to_bytecode(Rest, Address, Env, [OpCode|Code], Opts);
|
to_bytecode(Rest, Address, Env, [OpCode|Code], Opts);
|
||||||
@@ -801,8 +241,8 @@ to_bytecode([{arg,_line, N}|Rest], Address, Env, Code, Opts) ->
|
|||||||
to_bytecode(Rest, Address, Env, [{arg, N}|Code], Opts);
|
to_bytecode(Rest, Address, Env, [{arg, N}|Code], Opts);
|
||||||
to_bytecode([{var,_line, N}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{var,_line, N}|Rest], Address, Env, Code, Opts) ->
|
||||||
to_bytecode(Rest, Address, Env, [{var, N}|Code], Opts);
|
to_bytecode(Rest, Address, Env, [{var, N}|Code], Opts);
|
||||||
to_bytecode([{stack,_line, N}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{stack,_line}|Rest], Address, Env, Code, Opts) ->
|
||||||
to_bytecode(Rest, Address, Env, [{stack, N}|Code], Opts);
|
to_bytecode(Rest, Address, Env, [{stack, 0}|Code], Opts);
|
||||||
to_bytecode([{int,_line, Int}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{int,_line, Int}|Rest], Address, Env, Code, Opts) ->
|
||||||
to_bytecode(Rest, Address, Env, [{immediate, Int}|Code], Opts);
|
to_bytecode(Rest, Address, Env, [{immediate, Int}|Code], Opts);
|
||||||
to_bytecode([{boolean,_line, Bool}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{boolean,_line, Bool}|Rest], Address, Env, Code, Opts) ->
|
||||||
@@ -811,13 +251,39 @@ to_bytecode([{string,_line, String}|Rest], Address, Env, Code, Opts) ->
|
|||||||
to_bytecode(Rest, Address, Env,
|
to_bytecode(Rest, Address, Env,
|
||||||
[{immediate, aeb_fate_data:make_string(String)}|Code],
|
[{immediate, aeb_fate_data:make_string(String)}|Code],
|
||||||
Opts);
|
Opts);
|
||||||
to_bytecode([{address,_line, Value}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{object,_line, {address, Value}}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
to_bytecode(Rest, Address, Env,
|
to_bytecode(Rest, Address, Env,
|
||||||
[{immediate, aeb_fate_data:make_address(Value)}|Code],
|
[{immediate, aeb_fate_data:make_address(Value)}|Code],
|
||||||
Opts);
|
Opts);
|
||||||
|
to_bytecode([{object,_line, {contract, Value}}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
|
to_bytecode(Rest, Address, Env,
|
||||||
|
[{immediate, aeb_fate_data:make_contract(Value)}|Code],
|
||||||
|
Opts);
|
||||||
|
to_bytecode([{object,_line, {oracle, Value}}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
|
to_bytecode(Rest, Address, Env,
|
||||||
|
[{immediate, aeb_fate_data:make_oracle(Value)}|Code],
|
||||||
|
Opts);
|
||||||
|
to_bytecode([{object,_line, {oracle_query, Value}}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
|
to_bytecode(Rest, Address, Env,
|
||||||
|
[{immediate, aeb_fate_data:make_oracle_query(Value)}|Code],
|
||||||
|
Opts);
|
||||||
|
to_bytecode([{object,_line, {channel, Value}}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
|
to_bytecode(Rest, Address, Env,
|
||||||
|
[{immediate, aeb_fate_data:make_contract(Value)}|Code],
|
||||||
|
Opts);
|
||||||
|
to_bytecode([{bytes,_line, Value}|Rest],
|
||||||
|
Address, Env, Code, Opts) ->
|
||||||
|
to_bytecode(Rest, Address, Env,
|
||||||
|
[{immediate, aeb_fate_data:make_bytes(Value)}|Code],
|
||||||
|
Opts);
|
||||||
to_bytecode([{id,_line, ID}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{id,_line, ID}|Rest], Address, Env, Code, Opts) ->
|
||||||
{Hash, Env2} = insert_symbol(ID, Env),
|
{Env2, Id} = insert_symbol(list_to_binary(ID), Env),
|
||||||
to_bytecode(Rest, Address, Env2, [{immediate, Hash}|Code], Opts);
|
to_bytecode(Rest, Address, Env2, [{immediate, Id}|Code], Opts);
|
||||||
to_bytecode([{'{',_line}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{'{',_line}|Rest], Address, Env, Code, Opts) ->
|
||||||
{Map, Rest2} = parse_map(Rest),
|
{Map, Rest2} = parse_map(Rest),
|
||||||
to_bytecode(Rest2, Address, Env, [{immediate, Map}|Code], Opts);
|
to_bytecode(Rest2, Address, Env, [{immediate, Map}|Code], Opts);
|
||||||
@@ -829,9 +295,13 @@ to_bytecode([{'(',_line}|Rest], Address, Env, Code, Opts) ->
|
|||||||
Tuple = aeb_fate_data:make_tuple(list_to_tuple(Elements)),
|
Tuple = aeb_fate_data:make_tuple(list_to_tuple(Elements)),
|
||||||
to_bytecode(Rest2, Address, Env, [{immediate, Tuple}|Code], Opts);
|
to_bytecode(Rest2, Address, Env, [{immediate, Tuple}|Code], Opts);
|
||||||
to_bytecode([{start_variant,_line}|_] = Tokens, Address, Env, Code, Opts) ->
|
to_bytecode([{start_variant,_line}|_] = Tokens, Address, Env, Code, Opts) ->
|
||||||
{Size, Tag, Values, Rest} = parse_variant(Tokens),
|
{Arities, Tag, Values, Rest} = parse_variant(Tokens),
|
||||||
Variant = aeb_fate_data:make_variant(Size, Tag, Values),
|
Variant = aeb_fate_data:make_variant(Arities, Tag, Values),
|
||||||
to_bytecode(Rest, Address, Env, [{immediate, Variant}|Code], Opts);
|
to_bytecode(Rest, Address, Env, [{immediate, Variant}|Code], Opts);
|
||||||
|
to_bytecode([{typerep,_line}|Rest], Address, Env, Code, Opts) ->
|
||||||
|
{Type, Rest1} = to_type(Rest),
|
||||||
|
TypeRep = aeb_fate_data:make_typerep(Type),
|
||||||
|
to_bytecode(Rest1, Address, Env, [{immediate, TypeRep}|Code], Opts);
|
||||||
to_bytecode([{bits,_line, Bits}|Rest], Address, Env, Code, Opts) ->
|
to_bytecode([{bits,_line, Bits}|Rest], Address, Env, Code, Opts) ->
|
||||||
to_bytecode(Rest, Address, Env,
|
to_bytecode(Rest, Address, Env,
|
||||||
[{immediate, aeb_fate_data:make_bits(Bits)}|Code], Opts);
|
[{immediate, aeb_fate_data:make_bits(Bits)}|Code], Opts);
|
||||||
@@ -840,17 +310,8 @@ to_bytecode([{comment, Line, Comment}|Rest], Address, Env, Code, Opts) ->
|
|||||||
Env2 = insert_annotation(comment, Line, Comment, Env),
|
Env2 = insert_annotation(comment, Line, Comment, Env),
|
||||||
to_bytecode(Rest, Address, Env2, Code, Opts);
|
to_bytecode(Rest, Address, Env2, Code, Opts);
|
||||||
|
|
||||||
to_bytecode([], Address, Env, Code, Opts) ->
|
to_bytecode([], Address, Env, Code,_Opts) ->
|
||||||
Env2 = insert_fun(Address, Code, Env),
|
insert_fun(Address, Code, Env).
|
||||||
#{functions := Funs} = Env2,
|
|
||||||
case proplists:lookup(pp_opcodes, Opts) of
|
|
||||||
{pp_opcodes, true} ->
|
|
||||||
Ops = [C || {_Name, {_Sig, C}} <- maps:to_list(Funs)],
|
|
||||||
io:format("opcodes ~p~n", [Ops]);
|
|
||||||
none ->
|
|
||||||
ok
|
|
||||||
end,
|
|
||||||
Env2.
|
|
||||||
|
|
||||||
parse_map([{'}',_line}|Rest]) ->
|
parse_map([{'}',_line}|Rest]) ->
|
||||||
{#{}, Rest};
|
{#{}, Rest};
|
||||||
@@ -891,19 +352,29 @@ parse_tuple(Tokens) ->
|
|||||||
|
|
||||||
|
|
||||||
parse_variant([{start_variant,_line}
|
parse_variant([{start_variant,_line}
|
||||||
, {int,_line, Size}
|
, {'[', _line}
|
||||||
, {'|',_}
|
| Rest]) ->
|
||||||
, {int,_line, Tag}
|
{Arities, Rest2} = parse_list(Rest),
|
||||||
, {'|',_}
|
%% Make sure Arities is a list of bytes.
|
||||||
, {'(',_}
|
Arities = [A || A <- Arities,
|
||||||
| Rest]) when (Size > 0), (Tag < Size) ->
|
is_integer(A), A < 256],
|
||||||
{Elements , [{end_variant, _} | Rest2]} = parse_tuple(Rest),
|
|
||||||
{Size, Tag, list_to_tuple(Elements), Rest2}.
|
[{'|',_}
|
||||||
|
, {int,_line, Tag}
|
||||||
|
, {'|',_}
|
||||||
|
, {'(',_} | Rest3] = Rest2,
|
||||||
|
{Elements , [{end_variant, _} | Rest4]} = parse_tuple(Rest3),
|
||||||
|
Size = length(Arities),
|
||||||
|
if 0 =< Tag, Tag < Size ->
|
||||||
|
Arity = lists:nth(Tag+1, Arities),
|
||||||
|
if length(Elements) =:= Arity ->
|
||||||
|
{Arities, Tag, list_to_tuple(Elements), Rest4}
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
parse_value([{int,_line, Int} | Rest]) -> {Int, Rest};
|
parse_value([{int,_line, Int} | Rest]) -> {Int, Rest};
|
||||||
parse_value([{boolean,_line, Bool} | Rest]) -> {Bool, Rest};
|
parse_value([{boolean,_line, Bool} | Rest]) -> {Bool, Rest};
|
||||||
parse_value([{hash,_line, Hash} | Rest]) -> {Hash, Rest};
|
|
||||||
parse_value([{'{',_line} | Rest]) -> parse_map(Rest);
|
parse_value([{'{',_line} | Rest]) -> parse_map(Rest);
|
||||||
parse_value([{'[',_line} | Rest]) -> parse_list(Rest);
|
parse_value([{'[',_line} | Rest]) -> parse_list(Rest);
|
||||||
parse_value([{'(',_line} | Rest]) ->
|
parse_value([{'(',_line} | Rest]) ->
|
||||||
@@ -912,13 +383,27 @@ parse_value([{'(',_line} | Rest]) ->
|
|||||||
parse_value([{bits,_line, Bits} | Rest]) ->
|
parse_value([{bits,_line, Bits} | Rest]) ->
|
||||||
{aeb_fate_data:make_bits(Bits), Rest};
|
{aeb_fate_data:make_bits(Bits), Rest};
|
||||||
parse_value([{start_variant,_line}|_] = Tokens) ->
|
parse_value([{start_variant,_line}|_] = Tokens) ->
|
||||||
{Size, Tag, Values, Rest} = parse_variant(Tokens),
|
{Arities, Tag, Values, Rest} = parse_variant(Tokens),
|
||||||
Variant = aeb_fate_data:make_variant(Size, Tag, Values),
|
Variant = aeb_fate_data:make_variant(Arities, Tag, Values),
|
||||||
{Variant, Rest};
|
{Variant, Rest};
|
||||||
parse_value([{string,_line, String} | Rest]) ->
|
parse_value([{string,_line, String} | Rest]) ->
|
||||||
{aeb_fate_data:make_string(String), Rest};
|
{aeb_fate_data:make_string(String), Rest};
|
||||||
parse_value([{address,_line, Address} | Rest]) ->
|
parse_value([{object,_line, {address, Address}} | Rest]) ->
|
||||||
{aeb_fate_data:make_address(Address), Rest}.
|
{aeb_fate_data:make_address(Address), Rest};
|
||||||
|
parse_value([{object,_line, {contract, Address}} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_contract(Address), Rest};
|
||||||
|
parse_value([{object,_line, {oracle, Address}} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_oracle(Address), Rest};
|
||||||
|
parse_value([{object,_line, {oracle_query, Address}} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_oracle_query(Address), Rest};
|
||||||
|
parse_value([{object,_line, {channel, Address}} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_channel(Address), Rest};
|
||||||
|
parse_value([{hash,_line, Hash} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_hash(Hash), Rest};
|
||||||
|
parse_value([{signature,_line, Hash} | Rest]) ->
|
||||||
|
{aeb_fate_data:make_signature(Hash), Rest};
|
||||||
|
parse_value([{typerep,_line} | Rest]) ->
|
||||||
|
to_type(Rest).
|
||||||
|
|
||||||
to_fun_def([{id, _, Name}, {'(', _} | Rest]) ->
|
to_fun_def([{id, _, Name}, {'(', _} | Rest]) ->
|
||||||
{ArgsType, [{'to', _} | Rest2]} = to_arg_types(Rest),
|
{ArgsType, [{'to', _} | Rest2]} = to_arg_types(Rest),
|
||||||
@@ -938,11 +423,18 @@ to_arg_types(Tokens) ->
|
|||||||
|
|
||||||
%% Type handling
|
%% Type handling
|
||||||
|
|
||||||
to_type([{id, _, "integer"} | Rest]) -> {integer, Rest};
|
to_type([{id, _, "integer"} | Rest]) -> {integer, Rest};
|
||||||
to_type([{id, _, "boolean"} | Rest]) -> {boolean, Rest};
|
to_type([{id, _, "boolean"} | Rest]) -> {boolean, Rest};
|
||||||
to_type([{id, _, "string"} | Rest]) -> {string, Rest};
|
to_type([{id, _, "string"} | Rest]) -> {string, Rest};
|
||||||
to_type([{id, _, "address"} | Rest]) -> {address, Rest};
|
to_type([{id, _, "address"} | Rest]) -> {address, Rest};
|
||||||
to_type([{id, _, "bits"} | Rest]) -> {bits, Rest};
|
to_type([{id, _, "contract"} | Rest]) -> {contract, Rest};
|
||||||
|
to_type([{id, _, "oracle"} | Rest]) -> {oracle, Rest};
|
||||||
|
to_type([{id, _, "oracle_query"} | Rest]) -> {oracle_query, Rest};
|
||||||
|
to_type([{id, _, "name"} | Rest]) -> {name, Rest};
|
||||||
|
to_type([{id, _, "channel"} | Rest]) -> {channel, Rest};
|
||||||
|
to_type([{id, _, "hash"} | Rest]) -> {hash, Rest};
|
||||||
|
to_type([{id, _, "signature"} | Rest]) -> {signature, Rest};
|
||||||
|
to_type([{id, _, "bits"} | Rest]) -> {bits, Rest};
|
||||||
to_type([{'{', _}, {id, _, "list"}, {',', _} | Rest]) ->
|
to_type([{'{', _}, {id, _, "list"}, {',', _} | Rest]) ->
|
||||||
%% TODO: Error handling
|
%% TODO: Error handling
|
||||||
{ListType, [{'}', _}| Rest2]} = to_type(Rest),
|
{ListType, [{'}', _}| Rest2]} = to_type(Rest),
|
||||||
@@ -956,12 +448,14 @@ to_type([{'{', _}, {id, _, "map"}, {',', _} | Rest]) ->
|
|||||||
{KeyType, [{',', _}| Rest2]} = to_type(Rest),
|
{KeyType, [{',', _}| Rest2]} = to_type(Rest),
|
||||||
{ValueType, [{'}', _}| Rest3]} = to_type(Rest2),
|
{ValueType, [{'}', _}| Rest3]} = to_type(Rest2),
|
||||||
{{map, KeyType, ValueType}, Rest3};
|
{{map, KeyType, ValueType}, Rest3};
|
||||||
|
to_type([{'{', _}, {id, _, "bytes"}, {',', _}, {int, _, Size}, {'}', _} | Rest]) ->
|
||||||
|
%% TODO: Error handling
|
||||||
|
{{bytes, Size}, Rest};
|
||||||
to_type([{'{', _}
|
to_type([{'{', _}
|
||||||
, {id, _, "variant"}
|
, {id, _, "variant"}
|
||||||
, {',', _}
|
, {',', _}
|
||||||
, {'[', _}
|
, {'[', _}
|
||||||
| Rest]) ->
|
| Rest]) ->
|
||||||
%% TODO: Error handling
|
|
||||||
{ElementTypes, [{'}', _}| Rest2]} = to_list_of_types(Rest),
|
{ElementTypes, [{'}', _}| Rest2]} = to_list_of_types(Rest),
|
||||||
{{variant, ElementTypes}, Rest2}.
|
{{variant, ElementTypes}, Rest2}.
|
||||||
|
|
||||||
@@ -976,25 +470,6 @@ to_list_of_types(Tokens) ->
|
|||||||
{[Type], Rest}
|
{[Type], Rest}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec serialize_type(aeb_fate_data:fate_type_type()) -> [byte()].
|
|
||||||
serialize_type(integer) -> [0];
|
|
||||||
serialize_type(boolean) -> [1];
|
|
||||||
serialize_type({list, T}) -> [2 | serialize_type(T)];
|
|
||||||
serialize_type({tuple, Ts}) ->
|
|
||||||
case length(Ts) of
|
|
||||||
N when N =< 255 ->
|
|
||||||
[3, N | [serialize_type(T) || T <- Ts]]
|
|
||||||
end;
|
|
||||||
serialize_type(address) -> [4];
|
|
||||||
serialize_type(bits) -> [5];
|
|
||||||
serialize_type({map, K, V}) -> [6 | serialize_type(K) ++ serialize_type(V)];
|
|
||||||
serialize_type(string) -> [7];
|
|
||||||
serialize_type({variant, ListOfVariants}) ->
|
|
||||||
Size = length(ListOfVariants),
|
|
||||||
if Size < 256 ->
|
|
||||||
[8, Size | [serialize_type(T) || T <- ListOfVariants]]
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
%% Helper functions
|
%% Helper functions
|
||||||
@@ -1003,11 +478,24 @@ serialize_type({variant, ListOfVariants}) ->
|
|||||||
%% State handling
|
%% State handling
|
||||||
|
|
||||||
insert_fun(none, [], Env) -> Env;
|
insert_fun(none, [], Env) -> Env;
|
||||||
insert_fun({Name, Type, RetType}, Code, #{functions := Functions} = Env) ->
|
insert_fun({NameString, ArgType, RetType}, Code, #{ fate_code := FateCode
|
||||||
{Hash, Env2} = insert_symbol(Name, Env),
|
, functions := Funs} = Env) ->
|
||||||
Env2#{
|
Name = list_to_binary(NameString),
|
||||||
functions => Functions#{Hash => {{Type, RetType}, lists:reverse(Code)}}
|
{FateCode1, Id} = aeb_fate_code:insert_symbol(Name, FateCode),
|
||||||
}.
|
BodyByteCode = aeb_fate_code:serialize_code(lists:reverse(Code)),
|
||||||
|
SigByteCode = aeb_fate_code:serialize_signature({ArgType, RetType}),
|
||||||
|
FunByteCode = [?FUNCTION, Id, SigByteCode, BodyByteCode],
|
||||||
|
Env#{ functions => Funs#{ Id => FunByteCode }
|
||||||
|
, fate_code => FateCode1}.
|
||||||
|
|
||||||
|
insert_symbol(Name, #{ fate_code := FateCode } = Env) ->
|
||||||
|
{FateCode1, Id} = aeb_fate_code:insert_symbol(Name, FateCode),
|
||||||
|
{ Env#{ fate_code => FateCode1 }
|
||||||
|
, Id}.
|
||||||
|
|
||||||
|
insert_annotation(comment, Line, Comment, #{ fate_code := FateCode } = Env) ->
|
||||||
|
FateCode1 = aeb_fate_code:insert_annotation(comment, Line, Comment, FateCode),
|
||||||
|
Env#{ fate_code => FateCode1}.
|
||||||
|
|
||||||
mk_hash(Id) ->
|
mk_hash(Id) ->
|
||||||
%% Use first 4 bytes of blake hash
|
%% Use first 4 bytes of blake hash
|
||||||
@@ -1016,33 +504,11 @@ mk_hash(Id) ->
|
|||||||
|
|
||||||
%% Handle annotations
|
%% Handle annotations
|
||||||
|
|
||||||
insert_annotation(comment, Line, Comment, #{annotations := A} = Env) ->
|
|
||||||
Key = aeb_fate_data:make_tuple({aeb_fate_data:make_string("comment"), Line}),
|
|
||||||
Value = aeb_fate_data:make_string(Comment),
|
|
||||||
Env#{annotations => A#{ Key => Value}}.
|
|
||||||
|
|
||||||
get_comments(Annotations) ->
|
get_comments(Annotations) ->
|
||||||
[ {Line, Comment} ||
|
[ {Line, Comment} ||
|
||||||
{?FATE_TUPLE({?FATE_STRING_VALUE("comment"), Line}),
|
{?FATE_TUPLE({?FATE_STRING_VALUE("comment"), Line}),
|
||||||
?FATE_STRING_VALUE(Comment)} <- maps:to_list(Annotations)].
|
?FATE_STRING_VALUE(Comment)} <- maps:to_list(Annotations)].
|
||||||
|
|
||||||
%% Symbols handling
|
|
||||||
|
|
||||||
insert_symbol(Id, Env) ->
|
|
||||||
Hash = mk_hash(Id),
|
|
||||||
insert_symbol(Id, Hash, Env).
|
|
||||||
|
|
||||||
insert_symbol(Id, Hash, #{symbols := Symbols} = Env) ->
|
|
||||||
case maps:find(Hash, Symbols) of
|
|
||||||
{ok, Id} -> {Hash, Env};
|
|
||||||
{ok, Id2} ->
|
|
||||||
%% Very unlikely...
|
|
||||||
exit({two_symbols_with_same_hash, Id, Id2});
|
|
||||||
error ->
|
|
||||||
{Hash, Env#{symbols => Symbols#{ Id => Hash
|
|
||||||
, Hash => Id}}}
|
|
||||||
end.
|
|
||||||
|
|
||||||
%% Symbol table handling
|
%% Symbol table handling
|
||||||
|
|
||||||
lookup(Name, Symbols) ->
|
lookup(Name, Symbols) ->
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
%%% @doc
|
%%% @doc
|
||||||
%%% Handling FATE code.
|
%%% Handling FATE code.
|
||||||
%%% @end
|
%%% @end
|
||||||
###REPLACEWITHNOTE###
|
%%% ###REPLACEWITHNOTE###
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
Definitions.
|
Definitions.
|
||||||
@@ -13,9 +13,11 @@ HEXDIGIT = [0-9a-fA-F]
|
|||||||
LOWER = [a-z_]
|
LOWER = [a-z_]
|
||||||
UPPER = [A-Z]
|
UPPER = [A-Z]
|
||||||
BASE58 = [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
BASE58 = [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]
|
||||||
|
BASE64 = [A-Za-z0-9+/=]
|
||||||
INT = {DIGIT}+
|
INT = {DIGIT}+
|
||||||
HEX = 0x{HEXDIGIT}+
|
HEX = 0x{HEXDIGIT}+
|
||||||
HASH = #{BASE58}+
|
OBJECT = @[a-z][a-z]_{BASE58}+
|
||||||
|
BYTES = #{BASE64}+
|
||||||
WS = [\000-\s]
|
WS = [\000-\s]
|
||||||
ID = {LOWER}[a-zA-Z0-9_]*
|
ID = {LOWER}[a-zA-Z0-9_]*
|
||||||
STRING = "[^"]*"
|
STRING = "[^"]*"
|
||||||
@@ -24,16 +26,19 @@ BITS = (\!)?\<[\s01]*\>
|
|||||||
Rules.
|
Rules.
|
||||||
arg{INT} : {token, {arg, TokenLine, parse_arg(TokenChars)}}.
|
arg{INT} : {token, {arg, TokenLine, parse_arg(TokenChars)}}.
|
||||||
var{INT} : {token, {var, TokenLine, parse_var(TokenChars)}}.
|
var{INT} : {token, {var, TokenLine, parse_var(TokenChars)}}.
|
||||||
a : {token, {stack, TokenLine, 0}}.
|
a : {token, {stack, TokenLine}}.
|
||||||
a{INT} : {token, {stack, TokenLine, parse_acc(TokenChars)}}.
|
|
||||||
|
|
||||||
true : {token, {boolean, TokenLine, true}}.
|
true : {token, {boolean, TokenLine, true}}.
|
||||||
false : {token, {boolean, TokenLine, false}}.
|
false : {token, {boolean, TokenLine, false}}.
|
||||||
|
|
||||||
###REPLACEWITHOPTOKENS###
|
%% ###REPLACEWITHOPTOKENS###
|
||||||
|
|
||||||
FUNCTION : {token, {function, TokenLine, 'FUNCTION' }}.
|
FUNCTION : {token, {function, TokenLine, 'FUNCTION' }}.
|
||||||
|
|
||||||
|
{BYTES} :
|
||||||
|
{token, {bytes, TokenLine, parse_hash(TokenChars)}}.
|
||||||
|
{OBJECT} :
|
||||||
|
{token, {object, TokenLine, parse_object(TokenChars)}}.
|
||||||
{ID} :
|
{ID} :
|
||||||
{token, {id, TokenLine, TokenChars}}.
|
{token, {id, TokenLine, TokenChars}}.
|
||||||
{HEX} :
|
{HEX} :
|
||||||
@@ -42,10 +47,11 @@ FUNCTION : {token, {function, TokenLine, 'FUNCTION' }}.
|
|||||||
{token, {int, TokenLine, parse_int(TokenChars)}}.
|
{token, {int, TokenLine, parse_int(TokenChars)}}.
|
||||||
-{INT} :
|
-{INT} :
|
||||||
{token, {int, TokenLine, parse_int(TokenChars)}}.
|
{token, {int, TokenLine, parse_int(TokenChars)}}.
|
||||||
{HASH} :
|
|
||||||
{token, {address, TokenLine, parse_hash(TokenChars)}}.
|
%% Due to the definition of STRING the tokens start and end with a quote ".
|
||||||
{STRING} :
|
{STRING} :
|
||||||
{token, {string, TokenLine, list_to_binary(TokenChars)}}.
|
{token, {string, TokenLine, unicode:characters_to_binary(
|
||||||
|
lists:sublist(TokenChars, 2, length(TokenChars) - 2))}}.
|
||||||
{BITS} :
|
{BITS} :
|
||||||
{token, {bits, TokenLine, bits(TokenChars)}}.
|
{token, {bits, TokenLine, bits(TokenChars)}}.
|
||||||
|
|
||||||
@@ -66,6 +72,7 @@ FUNCTION : {token, {function, TokenLine, 'FUNCTION' }}.
|
|||||||
\{ : {token, {'{', TokenLine}}.
|
\{ : {token, {'{', TokenLine}}.
|
||||||
\} : {token, {'}', TokenLine}}.
|
\} : {token, {'}', TokenLine}}.
|
||||||
\| : {token, {'|', TokenLine}}.
|
\| : {token, {'|', TokenLine}}.
|
||||||
|
\' : {token, {typerep, TokenLine}}.
|
||||||
|
|
||||||
;;.* :
|
;;.* :
|
||||||
{token, {comment, TokenLine, drop_prefix($;, TokenChars)}}.
|
{token, {comment, TokenLine, drop_prefix($;, TokenChars)}}.
|
||||||
@@ -98,11 +105,21 @@ parse_int(Chars) -> list_to_integer(Chars).
|
|||||||
|
|
||||||
parse_arg("arg" ++ N) -> list_to_integer(N).
|
parse_arg("arg" ++ N) -> list_to_integer(N).
|
||||||
parse_var("var" ++ N) -> list_to_integer(N).
|
parse_var("var" ++ N) -> list_to_integer(N).
|
||||||
parse_acc("a" ++ N) -> list_to_integer(N).
|
|
||||||
|
|
||||||
|
|
||||||
parse_hash("#" ++ Chars) ->
|
parse_hash("#" ++ Chars) ->
|
||||||
base58_to_address(Chars).
|
base64:decode(Chars).
|
||||||
|
|
||||||
|
parse_object([_|Chars]) ->
|
||||||
|
case aeser_api_encoder:decode(unicode:characters_to_binary(Chars)) of
|
||||||
|
{account_pubkey, Bin} -> {address, Bin};
|
||||||
|
{contract_pubkey, Bin} -> {contract, Bin};
|
||||||
|
{oracle_pubkey, Bin} -> {oracle, Bin};
|
||||||
|
{oracle_query_id, Bin} -> {oracle_query, Bin};
|
||||||
|
{channel, Bin} -> {channel, Bin};
|
||||||
|
{signature, Bin} -> {signature, Bin}
|
||||||
|
end.
|
||||||
|
|
||||||
scan(S) ->
|
scan(S) ->
|
||||||
string(S).
|
string(S).
|
||||||
@@ -120,23 +137,3 @@ bits([$> |_Rest], Acc) -> Acc;
|
|||||||
bits([$0 | Rest], Acc) -> bits(Rest, Acc bsl 1);
|
bits([$0 | Rest], Acc) -> bits(Rest, Acc bsl 1);
|
||||||
bits([$1 | Rest], Acc) -> bits(Rest, (Acc bsl 1) bor 1);
|
bits([$1 | Rest], Acc) -> bits(Rest, (Acc bsl 1) bor 1);
|
||||||
bits([$ | Rest], Acc) -> bits(Rest, Acc).
|
bits([$ | Rest], Acc) -> bits(Rest, Acc).
|
||||||
|
|
||||||
char_to_base58(C) ->
|
|
||||||
binary:at(<<0,1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,9,10,11,12,13,14,15,16,0,17,
|
|
||||||
18,19,20,21,0,22,23,24,25,26,27,28,29,30,31,32,0,0,0,0,0,0,
|
|
||||||
33,34,35,36,37,38,39,40,41,42,43,0,44,45,46,47,48,49,50,51,
|
|
||||||
52,53,54,55,56,57>>, C-$1).
|
|
||||||
|
|
||||||
base58_to_integer(C, []) -> C;
|
|
||||||
base58_to_integer(C, [X | Xs]) ->
|
|
||||||
base58_to_integer(C * 58 + char_to_base58(X), Xs).
|
|
||||||
|
|
||||||
base58_to_integer([]) -> error;
|
|
||||||
base58_to_integer([Char]) -> char_to_base58(Char);
|
|
||||||
base58_to_integer([Char | Str]) ->
|
|
||||||
base58_to_integer(char_to_base58(Char), Str).
|
|
||||||
|
|
||||||
base58_to_address(Base58) ->
|
|
||||||
I = base58_to_integer(Base58),
|
|
||||||
Bin = <<I:256>>,
|
|
||||||
Bin.
|
|
||||||
@@ -0,0 +1,443 @@
|
|||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% @copyright (C) 2019, Aeternity Anstalt
|
||||||
|
%%% @doc
|
||||||
|
%%% ADT for fate byte code/fate code
|
||||||
|
%%% @end
|
||||||
|
%%%
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
-module(aeb_fate_code).
|
||||||
|
|
||||||
|
-export([ annotations/1
|
||||||
|
, deserialize/1
|
||||||
|
, functions/1
|
||||||
|
, insert_annotation/4
|
||||||
|
, insert_fun/4
|
||||||
|
, insert_symbol/2
|
||||||
|
, new/0
|
||||||
|
, serialize/1
|
||||||
|
, serialize/2
|
||||||
|
, serialize/3
|
||||||
|
, serialize_code/1
|
||||||
|
, serialize_signature/1
|
||||||
|
, symbol_identifier/1
|
||||||
|
, symbols/1
|
||||||
|
]).
|
||||||
|
|
||||||
|
-include("../include/aeb_fate_opcodes.hrl").
|
||||||
|
-include("../include/aeb_fate_data.hrl").
|
||||||
|
|
||||||
|
-ifdef(EQC).
|
||||||
|
-export([ update_annotations/2
|
||||||
|
, update_functions/2
|
||||||
|
, update_symbols/2]).
|
||||||
|
-endif.
|
||||||
|
|
||||||
|
-record(fcode, { functions = #{} :: map()
|
||||||
|
, symbols = #{} :: map()
|
||||||
|
, annotations = #{} :: map()
|
||||||
|
}).
|
||||||
|
|
||||||
|
-define(HASH_BYTES, 32).
|
||||||
|
|
||||||
|
-type fate_arg_spec() :: {'immediate', aeb_fate_data:fate_type()}
|
||||||
|
| {'arg', integer()}
|
||||||
|
| {'var', integer()}
|
||||||
|
| {'stack', 0}.
|
||||||
|
|
||||||
|
-type fate_instruction() :: atom()
|
||||||
|
| {atom(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec()}
|
||||||
|
| {atom(), fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec(), fate_arg_spec(),
|
||||||
|
fate_arg_spec(), fate_arg_spec()}.
|
||||||
|
|
||||||
|
|
||||||
|
-type fcode() :: #fcode{}.
|
||||||
|
-export_type([fate_arg_spec/0, fate_instruction/0, fcode/0]).
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% API
|
||||||
|
%%%===================================================================
|
||||||
|
|
||||||
|
new() ->
|
||||||
|
#fcode{}.
|
||||||
|
|
||||||
|
annotations(#fcode{ annotations = As }) ->
|
||||||
|
As.
|
||||||
|
|
||||||
|
functions(#fcode{ functions = Fs }) ->
|
||||||
|
Fs.
|
||||||
|
|
||||||
|
symbols(#fcode{ symbols = Ss}) ->
|
||||||
|
Ss.
|
||||||
|
|
||||||
|
update_annotations(#fcode{ annotations = As } = FCode, Anns) ->
|
||||||
|
FCode#fcode{ annotations = maps:merge(As, Anns) }.
|
||||||
|
|
||||||
|
update_functions(#fcode{ functions = Fs } = FCode, Funs) ->
|
||||||
|
FCode#fcode{ functions = maps:merge(Fs, Funs) }.
|
||||||
|
|
||||||
|
update_symbols(#fcode{ symbols = Ss } = FCode, Symbs) ->
|
||||||
|
FCode#fcode{ symbols = maps:merge(Ss, Symbs) }.
|
||||||
|
|
||||||
|
symbol_identifier(Bin) ->
|
||||||
|
%% First 4 bytes of blake hash
|
||||||
|
{ok, <<X:4/binary,_/binary>> } = eblake2:blake2b(?HASH_BYTES, Bin),
|
||||||
|
X.
|
||||||
|
|
||||||
|
insert_fun(Name, {ArgType, RetType}, #{} = BBs, FCode) ->
|
||||||
|
{F1, ID} = insert_symbol(Name, FCode),
|
||||||
|
update_functions(F1, #{ID => {{ArgType, RetType}, BBs}}).
|
||||||
|
|
||||||
|
insert_symbol(Name, #fcode{ symbols = Syms } = F) ->
|
||||||
|
ID = symbol_identifier(Name),
|
||||||
|
case maps:find(ID, Syms) of
|
||||||
|
{ok, Name} ->
|
||||||
|
{F, ID};
|
||||||
|
{ok, X} ->
|
||||||
|
error({two_symbols_with_same_hash, Name, X});
|
||||||
|
error ->
|
||||||
|
{update_symbols(F, #{ID => Name}), ID}
|
||||||
|
end.
|
||||||
|
|
||||||
|
insert_annotation(comment =_Type, Line, Comment, FCode) ->
|
||||||
|
Key = aeb_fate_data:make_tuple({aeb_fate_data:make_string("comment"), Line}),
|
||||||
|
Value = aeb_fate_data:make_string(Comment),
|
||||||
|
update_annotations(FCode, #{ Key => Value }).
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% Serialization
|
||||||
|
%%%===================================================================
|
||||||
|
|
||||||
|
serialize(#fcode{} = F) ->
|
||||||
|
serialize(F, []).
|
||||||
|
|
||||||
|
serialize(#fcode{} = F, Options) ->
|
||||||
|
sanity_check(F),
|
||||||
|
serialize(F, serialize_functions(F), Options).
|
||||||
|
|
||||||
|
serialize(#fcode{} = F, Functions, Options) ->
|
||||||
|
SymbolTable = serialize_symbol_table(F),
|
||||||
|
Annotatations = serialize_annotations(F),
|
||||||
|
ByteCode = << (aeser_rlp:encode(Functions))/binary,
|
||||||
|
(aeser_rlp:encode(SymbolTable))/binary,
|
||||||
|
(aeser_rlp:encode(Annotatations))/binary
|
||||||
|
>>,
|
||||||
|
|
||||||
|
case proplists:lookup(pp_hex_string, Options) of
|
||||||
|
{pp_hex_string, true} ->
|
||||||
|
io:format("Code: ~s~n",[to_hexstring(Functions)]);
|
||||||
|
none ->
|
||||||
|
ok
|
||||||
|
end,
|
||||||
|
ByteCode.
|
||||||
|
|
||||||
|
to_hexstring(ByteList) ->
|
||||||
|
"0x" ++ lists:flatten(
|
||||||
|
[io_lib:format("~2.16.0b", [X])
|
||||||
|
|| X <- ByteList]).
|
||||||
|
|
||||||
|
|
||||||
|
serialize_functions(#fcode{ functions = Functions }) ->
|
||||||
|
%% Sort the functions on name to get a canonical serialisation.
|
||||||
|
iolist_to_binary(
|
||||||
|
lists:foldr(fun({Id, {Sig, C}}, Acc) ->
|
||||||
|
[[?FUNCTION, Id, serialize_signature(Sig), serialize_bbs(C)] | Acc]
|
||||||
|
end, [], lists:sort(maps:to_list(Functions)))).
|
||||||
|
|
||||||
|
serialize_signature({Args, RetType}) ->
|
||||||
|
[aeb_fate_encoding:serialize_type({tuple, Args}) |
|
||||||
|
aeb_fate_encoding:serialize_type(RetType)].
|
||||||
|
|
||||||
|
serialize_symbol_table(#fcode{ symbols = Symbols }) ->
|
||||||
|
aeb_fate_encoding:serialize(aeb_fate_data:make_map(Symbols)).
|
||||||
|
|
||||||
|
serialize_annotations(#fcode{ annotations = Annotations}) ->
|
||||||
|
aeb_fate_encoding:serialize(aeb_fate_data:make_map(Annotations)).
|
||||||
|
|
||||||
|
serialize_bbs(#{} = BBs) ->
|
||||||
|
serialize_bbs(BBs, 0, []).
|
||||||
|
|
||||||
|
serialize_bbs(BBs, N, Acc) ->
|
||||||
|
case maps:get(N, BBs, none) of
|
||||||
|
none -> lists:reverse(Acc);
|
||||||
|
BB -> serialize_bbs(BBs, N + 1, [serialize_bb(BB, [])|Acc])
|
||||||
|
end.
|
||||||
|
|
||||||
|
serialize_bb([Op], Acc) ->
|
||||||
|
lists:reverse([serialize_op(Op)|Acc]);
|
||||||
|
serialize_bb([Op|Rest], Acc) ->
|
||||||
|
serialize_bb(Rest, [serialize_op(Op)|Acc]).
|
||||||
|
|
||||||
|
serialize_op(Op) ->
|
||||||
|
[Mnemonic|Args] =
|
||||||
|
case is_tuple(Op) of
|
||||||
|
true -> tuple_to_list(Op);
|
||||||
|
false -> [Op]
|
||||||
|
end,
|
||||||
|
[aeb_fate_opcodes:m_to_op(Mnemonic) | serialize_code(Args)].
|
||||||
|
|
||||||
|
sanity_check(#fcode{ functions = Funs }) ->
|
||||||
|
_ = [ case Def of
|
||||||
|
{_, BBs} when byte_size(Id) == 4 -> sanity_check_bbs(BBs);
|
||||||
|
_ -> error({illegal_function_id, Id})
|
||||||
|
end || {Id, Def} <- maps:to_list(Funs) ],
|
||||||
|
ok.
|
||||||
|
|
||||||
|
sanity_check_bbs(#{} = BBs) ->
|
||||||
|
sanity_check_bbs(BBs, 0).
|
||||||
|
|
||||||
|
sanity_check_bbs(BBs, N) ->
|
||||||
|
case maps:get(N, BBs, none) of
|
||||||
|
none ->
|
||||||
|
%% Assert that the BBs were contiguous
|
||||||
|
case maps:size(BBs) =:= N of
|
||||||
|
true -> ok;
|
||||||
|
false -> error({not_contiguous_labels, lists:sort(maps:keys(BBs))})
|
||||||
|
end;
|
||||||
|
[] ->
|
||||||
|
error({empty_code_block, N});
|
||||||
|
BB ->
|
||||||
|
sanity_check_bb(BB),
|
||||||
|
sanity_check_bbs(BBs, N + 1)
|
||||||
|
end.
|
||||||
|
|
||||||
|
sanity_check_bb([Op]) ->
|
||||||
|
sanity_check_op(true, Op);
|
||||||
|
sanity_check_bb([Op|Rest]) ->
|
||||||
|
sanity_check_op(false, Op),
|
||||||
|
sanity_check_bb(Rest).
|
||||||
|
|
||||||
|
sanity_check_op(IsLast, Op) ->
|
||||||
|
[Mnemonic|Args] =
|
||||||
|
case is_tuple(Op) of
|
||||||
|
true -> tuple_to_list(Op);
|
||||||
|
false -> [Op]
|
||||||
|
end,
|
||||||
|
safe_sanity_check(IsLast, aeb_fate_opcodes:m_to_op(Mnemonic), Args).
|
||||||
|
|
||||||
|
safe_sanity_check(IsLast, Op, Args) ->
|
||||||
|
case length(Args) == aeb_fate_opcodes:args(Op) of
|
||||||
|
true ->
|
||||||
|
case IsLast == aeb_fate_opcodes:end_bb(Op) of
|
||||||
|
true -> ok;
|
||||||
|
false -> error({wrong_opcode_in_bb, Op})
|
||||||
|
end;
|
||||||
|
false -> error({wrong_nr_args_opcode, Op})
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
%% Argument encoding
|
||||||
|
%% Argument Specification Byte
|
||||||
|
%% bitpos: 6 4 2 0
|
||||||
|
%% xx xx xx xx
|
||||||
|
%% Arg3 Arg2 Arg1 Arg0
|
||||||
|
%% For 5-8 args another Argument Spec Byte is used
|
||||||
|
%% bitpos: 6 4 2 0 | 6 4 2 0
|
||||||
|
%% xx xx xx xx | xx xx xx xx
|
||||||
|
%% Arg7 Arg6 Arg5 Arg4 | Arg3 Arg2 Arg1 Arg0
|
||||||
|
%% Bit pattern
|
||||||
|
%% 00 : stack/unused (depending on instruction)
|
||||||
|
%% 01 : argN
|
||||||
|
%% 10 : varN
|
||||||
|
%% 11 : immediate
|
||||||
|
|
||||||
|
serialize_code([{_,_}|_] = List ) ->
|
||||||
|
%% Take out the full argument list.
|
||||||
|
{Args, Rest} = lists:splitwith(fun({_, _}) -> true; (_) -> false end, List),
|
||||||
|
%% Create the appropriate number of modifier bytes.
|
||||||
|
Mods = << <<(modifier_bits(Type, X)):2>> || {Type, X} <- pad_args(lists:reverse(Args)) >>,
|
||||||
|
case Mods of
|
||||||
|
<<M1:8, M2:8>> ->
|
||||||
|
[M1, M2 | [serialize_data(Type, Arg) || {Type, Arg} <- Args, Type =/= stack]] ++
|
||||||
|
serialize_code(Rest);
|
||||||
|
<<M1:8>> ->
|
||||||
|
[M1 | [serialize_data(Type, Arg) || {Type, Arg} <- Args, Type =/= stack]] ++
|
||||||
|
serialize_code(Rest)
|
||||||
|
end;
|
||||||
|
serialize_code([Op|Rest]) ->
|
||||||
|
[Op|serialize_code(Rest)];
|
||||||
|
serialize_code([]) ->
|
||||||
|
[].
|
||||||
|
|
||||||
|
pad_args(List) ->
|
||||||
|
case length(List) of
|
||||||
|
0 -> List;
|
||||||
|
N when N =< 4 ->
|
||||||
|
lists:duplicate(4 - N, {stack, 0}) ++ List;
|
||||||
|
N when N =< 8 ->
|
||||||
|
lists:duplicate(8 - N, {stack, 0}) ++ List
|
||||||
|
end.
|
||||||
|
|
||||||
|
serialize_data(_, Data) ->
|
||||||
|
aeb_fate_encoding:serialize(Data).
|
||||||
|
|
||||||
|
%% 00 : stack/unused (depending on instruction)
|
||||||
|
%% 01 : argN
|
||||||
|
%% 10 : varN
|
||||||
|
%% 11 : immediate
|
||||||
|
modifier_bits(immediate, _) -> 2#11;
|
||||||
|
modifier_bits(var, _) -> 2#10;
|
||||||
|
modifier_bits(arg, _) -> 2#01;
|
||||||
|
modifier_bits(stack, 0) -> 2#00;
|
||||||
|
modifier_bits(Type, X) -> error({illegal_argument, Type, X}).
|
||||||
|
|
||||||
|
bits_to_modifier(2#11) -> immediate;
|
||||||
|
bits_to_modifier(2#10) -> var;
|
||||||
|
bits_to_modifier(2#01) -> arg;
|
||||||
|
bits_to_modifier(2#00) -> stack.
|
||||||
|
|
||||||
|
%%%===================================================================
|
||||||
|
%%% Deserialization
|
||||||
|
%%%===================================================================
|
||||||
|
|
||||||
|
deserialize(Bytes) ->
|
||||||
|
{ByteCode, Rest1} = aeser_rlp:decode_one(Bytes),
|
||||||
|
{SymbolTable, Rest2} = aeser_rlp:decode_one(Rest1),
|
||||||
|
{Annotations, <<>>} = aeser_rlp:decode_one(Rest2),
|
||||||
|
|
||||||
|
Env = #{ function => none
|
||||||
|
, bb => 0
|
||||||
|
, current_bb_code => []
|
||||||
|
, functions => #{}
|
||||||
|
, code => #{}
|
||||||
|
},
|
||||||
|
Fcode =
|
||||||
|
#fcode{ functions = deserialize_functions(ByteCode, Env)
|
||||||
|
, annotations = deserialize_annotations(Annotations)
|
||||||
|
, symbols = deserialize_symbols(SymbolTable)
|
||||||
|
},
|
||||||
|
sanity_check(Fcode),
|
||||||
|
Fcode.
|
||||||
|
|
||||||
|
|
||||||
|
deserialize_functions(<<?FUNCTION:8, A, B, C, D, Rest/binary>>,
|
||||||
|
#{ function := none
|
||||||
|
, bb := 0
|
||||||
|
, current_bb_code := []
|
||||||
|
} = Env) ->
|
||||||
|
{Sig, Rest2} = deserialize_signature(Rest),
|
||||||
|
Env2 = Env#{function => {<<A,B,C,D>>, Sig}},
|
||||||
|
deserialize_functions(Rest2, Env2);
|
||||||
|
deserialize_functions(<<?FUNCTION:8, A, B, C, D, Rest/binary>>,
|
||||||
|
#{ function := {F, Sig}
|
||||||
|
, bb := BB
|
||||||
|
, current_bb_code := Code
|
||||||
|
, code := Program
|
||||||
|
, functions := Funs} = Env) ->
|
||||||
|
{NewSig, Rest2} = deserialize_signature(Rest),
|
||||||
|
case Code of
|
||||||
|
[] ->
|
||||||
|
Env2 = Env#{ bb => 0
|
||||||
|
, current_bb_code => []
|
||||||
|
, function => {<<A,B,C,D>>, NewSig}
|
||||||
|
, code => #{}
|
||||||
|
, functions => Funs#{F => {Sig, Program}}},
|
||||||
|
deserialize_functions(Rest2, Env2);
|
||||||
|
_ ->
|
||||||
|
Env2 = Env#{ bb => 0
|
||||||
|
, current_bb_code => []
|
||||||
|
, function => {<<A,B,C,D>>, NewSig}
|
||||||
|
, code => #{}
|
||||||
|
, functions =>
|
||||||
|
Funs#{F => {Sig,
|
||||||
|
Program#{ BB => lists:reverse(Code)}}}},
|
||||||
|
deserialize_functions(Rest2, Env2)
|
||||||
|
end;
|
||||||
|
deserialize_functions(<<_Op:8, _Rest/binary>>,
|
||||||
|
#{ function := none }) ->
|
||||||
|
error({code_without_function});
|
||||||
|
deserialize_functions(<<Op:8, Rest/binary>>,
|
||||||
|
#{ bb := BB
|
||||||
|
, current_bb_code := Code
|
||||||
|
, code := Program} = Env) ->
|
||||||
|
{Rest2, OpCode} = deserialize_op(Op, Rest, Code),
|
||||||
|
case aeb_fate_opcodes:end_bb(Op) of
|
||||||
|
true ->
|
||||||
|
deserialize_functions(Rest2, Env#{ bb => BB+1
|
||||||
|
, current_bb_code => []
|
||||||
|
, code => Program#{BB =>
|
||||||
|
lists:reverse(OpCode)}});
|
||||||
|
false ->
|
||||||
|
deserialize_functions(Rest2, Env#{ current_bb_code => OpCode})
|
||||||
|
end;
|
||||||
|
deserialize_functions(<<>>, #{ function := none
|
||||||
|
, functions := Funs}) ->
|
||||||
|
Funs;
|
||||||
|
deserialize_functions(<<>>, #{ function := {F, Sig}
|
||||||
|
, bb := BB
|
||||||
|
, current_bb_code := Code
|
||||||
|
, code := Program
|
||||||
|
, functions := Funs}) ->
|
||||||
|
FunctionCode =
|
||||||
|
case Code of
|
||||||
|
[] -> Program;
|
||||||
|
_ -> Program#{ BB => lists:reverse(Code)}
|
||||||
|
end,
|
||||||
|
Funs#{F => {Sig, FunctionCode}}.
|
||||||
|
|
||||||
|
deserialize_op(Op, Rest, Code) ->
|
||||||
|
OpName = aeb_fate_opcodes:mnemonic(Op),
|
||||||
|
case aeb_fate_opcodes:args(Op) of
|
||||||
|
0 ->
|
||||||
|
{Rest, [OpName | Code]};
|
||||||
|
N ->
|
||||||
|
{Args, Rest1} = deserialize_n_args(N, Rest),
|
||||||
|
{Rest1, [list_to_tuple([OpName|Args])|Code]}
|
||||||
|
end.
|
||||||
|
|
||||||
|
deserialize_n_args(N, <<M3:2, M2:2, M1:2, M0:2, Rest/binary>>) when N =< 4 ->
|
||||||
|
{ArgMods, Zeros} = lists:split(N, [M0, M1, M2, M3]),
|
||||||
|
assert_zero(Zeros),
|
||||||
|
lists:mapfoldl(fun(M, Acc) ->
|
||||||
|
case bits_to_modifier(M) of
|
||||||
|
stack ->
|
||||||
|
{{stack, 0}, Acc};
|
||||||
|
Modifier ->
|
||||||
|
{Arg, Acc2} = aeb_fate_encoding:deserialize_one(Acc),
|
||||||
|
{{Modifier, Arg}, Acc2}
|
||||||
|
end
|
||||||
|
end, Rest, ArgMods);
|
||||||
|
deserialize_n_args(N, <<M7:2, M6:2, M5:2, M4:2, M3:2, M2:2, M1:2, M0:2,
|
||||||
|
Rest/binary>>) when N =< 8 ->
|
||||||
|
{ArgMods, Zeros} = lists:split(N, [M0, M1, M2, M3, M4, M5, M6, M7]),
|
||||||
|
assert_zero(Zeros),
|
||||||
|
lists:mapfoldl(fun(M, Acc) ->
|
||||||
|
case bits_to_modifier(M) of
|
||||||
|
stack ->
|
||||||
|
{{stack, 0}, Acc};
|
||||||
|
Modifier ->
|
||||||
|
{Arg, Acc2} = aeb_fate_encoding:deserialize_one(Acc),
|
||||||
|
{{Modifier, Arg}, Acc2}
|
||||||
|
end
|
||||||
|
end, Rest, ArgMods).
|
||||||
|
|
||||||
|
deserialize_signature(Binary) ->
|
||||||
|
{{tuple, Args}, Rest} = aeb_fate_encoding:deserialize_type(Binary),
|
||||||
|
{RetType, Rest2} = aeb_fate_encoding:deserialize_type(Rest),
|
||||||
|
{{Args, RetType}, Rest2}.
|
||||||
|
|
||||||
|
deserialize_symbols(Table) ->
|
||||||
|
?FATE_MAP_VALUE(SymbolTable) = aeb_fate_encoding:deserialize(Table),
|
||||||
|
SymbolTable.
|
||||||
|
|
||||||
|
deserialize_annotations(AnnotationsBin) ->
|
||||||
|
?FATE_MAP_VALUE(Annotations) = aeb_fate_encoding:deserialize(AnnotationsBin),
|
||||||
|
Annotations.
|
||||||
|
|
||||||
|
assert_zero([]) ->
|
||||||
|
true;
|
||||||
|
assert_zero([0|Rest]) ->
|
||||||
|
assert_zero(Rest);
|
||||||
|
assert_zero([_|_]) ->
|
||||||
|
error(argument_defined_outside_range).
|
||||||
+260
-107
@@ -4,27 +4,37 @@
|
|||||||
|
|
||||||
-module(aeb_fate_data).
|
-module(aeb_fate_data).
|
||||||
|
|
||||||
-type fate_integer() :: ?FATE_INTEGER_T.
|
-type fate_integer() :: ?FATE_INTEGER_T.
|
||||||
-type fate_boolean() :: ?FATE_BOOLEAN_T.
|
-type fate_boolean() :: ?FATE_BOOLEAN_T.
|
||||||
-type fate_nil() :: ?FATE_NIL_T.
|
-type fate_nil() :: ?FATE_NIL_T.
|
||||||
-type fate_list() :: ?FATE_LIST_T.
|
-type fate_list() :: ?FATE_LIST_T.
|
||||||
-type fate_unit() :: ?FATE_UNIT_T.
|
-type fate_unit() :: ?FATE_UNIT_T.
|
||||||
-type fate_map() :: ?FATE_MAP_T.
|
-type fate_map() :: ?FATE_MAP_T.
|
||||||
-type fate_string() :: ?FATE_STRING_T.
|
-type fate_string() :: ?FATE_STRING_T.
|
||||||
-type fate_address() :: ?FATE_ADDRESS_T.
|
-type fate_address() :: ?FATE_ADDRESS_T.
|
||||||
|
-type fate_hash() :: ?FATE_BYTES_T(32).
|
||||||
-type fate_variant() :: ?FATE_VARIANT_T.
|
-type fate_signature() :: ?FATE_BYTES_T(64).
|
||||||
|
-type fate_contract() :: ?FATE_CONTRACT_T.
|
||||||
-type fate_tuple() :: ?FATE_TUPLE_T.
|
-type fate_oracle() :: ?FATE_ORACLE_T.
|
||||||
|
-type fate_channel() :: ?FATE_CHANNEL_T.
|
||||||
|
-type fate_variant() :: ?FATE_VARIANT_T.
|
||||||
|
-type fate_tuple() :: ?FATE_TUPLE_T.
|
||||||
|
-type fate_bits() :: ?FATE_BITS_T.
|
||||||
|
|
||||||
-type fate_type_type() :: integer
|
-type fate_type_type() :: integer
|
||||||
| boolean
|
| boolean
|
||||||
| {list, fate_type()}
|
| {list, fate_type_type()}
|
||||||
| {map, fate_type(), fate_type()}
|
| {map, fate_type_type(), fate_type_type()}
|
||||||
| {tuple, [fate_type()]}
|
| {tuple, [fate_type_type()]}
|
||||||
| address
|
| address
|
||||||
|
| hash
|
||||||
|
| signature
|
||||||
|
| contract
|
||||||
|
| oracle
|
||||||
|
| channel
|
||||||
| bits
|
| bits
|
||||||
| {variant, integer()}.
|
| string
|
||||||
|
| {variant, [fate_type_type()]}.
|
||||||
|
|
||||||
|
|
||||||
-type fate_type() ::
|
-type fate_type() ::
|
||||||
@@ -36,9 +46,14 @@
|
|||||||
| fate_tuple()
|
| fate_tuple()
|
||||||
| fate_string()
|
| fate_string()
|
||||||
| fate_address()
|
| fate_address()
|
||||||
|
| fate_hash()
|
||||||
|
| fate_signature()
|
||||||
|
| fate_contract()
|
||||||
|
| fate_oracle()
|
||||||
|
| fate_channel()
|
||||||
| fate_variant()
|
| fate_variant()
|
||||||
| fate_map()
|
| fate_map()
|
||||||
| fate_type_type().
|
| fate_bits().
|
||||||
|
|
||||||
-export_type([fate_type/0
|
-export_type([fate_type/0
|
||||||
, fate_boolean/0
|
, fate_boolean/0
|
||||||
@@ -49,8 +64,14 @@
|
|||||||
, fate_tuple/0
|
, fate_tuple/0
|
||||||
, fate_string/0
|
, fate_string/0
|
||||||
, fate_address/0
|
, fate_address/0
|
||||||
|
, fate_hash/0
|
||||||
|
, fate_signature/0
|
||||||
|
, fate_contract/0
|
||||||
|
, fate_oracle/0
|
||||||
|
, fate_channel/0
|
||||||
, fate_variant/0
|
, fate_variant/0
|
||||||
, fate_map/0
|
, fate_map/0
|
||||||
|
, fate_bits/0
|
||||||
, fate_type_type/0
|
, fate_type_type/0
|
||||||
]).
|
]).
|
||||||
|
|
||||||
@@ -62,71 +83,64 @@
|
|||||||
, make_string/1
|
, make_string/1
|
||||||
, make_map/1
|
, make_map/1
|
||||||
, make_address/1
|
, make_address/1
|
||||||
|
, make_bytes/1
|
||||||
|
, make_hash/1
|
||||||
|
, make_signature/1
|
||||||
|
, make_contract/1
|
||||||
|
, make_oracle/1
|
||||||
|
, make_oracle_query/1
|
||||||
|
, make_channel/1
|
||||||
, make_bits/1
|
, make_bits/1
|
||||||
, make_unit/0
|
, make_unit/0
|
||||||
, tuple_to_list/1
|
, make_typerep/1
|
||||||
, decode/1
|
|
||||||
, encode/1
|
|
||||||
]).
|
]).
|
||||||
-export([format/1]).
|
-export([
|
||||||
|
elt/2
|
||||||
|
, lt/2
|
||||||
|
, format/1
|
||||||
|
, ordinal/1]).
|
||||||
|
|
||||||
|
|
||||||
make_integer(I) when is_integer(I) -> ?MAKE_FATE_INTEGER(I).
|
|
||||||
make_boolean(true) -> ?FATE_TRUE;
|
make_boolean(true) -> ?FATE_TRUE;
|
||||||
make_boolean(false) -> ?FATE_FALSE.
|
make_boolean(false) -> ?FATE_FALSE.
|
||||||
make_list([]) -> ?FATE_NIL;
|
make_list([]) -> ?FATE_NIL;
|
||||||
make_list(L) -> ?MAKE_FATE_LIST(L).
|
make_list(L) -> ?MAKE_FATE_LIST(L).
|
||||||
make_string(S) when is_list(S) ->
|
make_unit() -> ?FATE_UNIT.
|
||||||
?FATE_STRING(list_to_binary(lists:flatten(S)));
|
make_tuple(T) -> ?FATE_TUPLE(T).
|
||||||
make_string(S) when is_binary(S) -> ?FATE_STRING(S).
|
make_map(M) -> ?MAKE_FATE_MAP(M).
|
||||||
make_unit() -> ?FATE_UNIT.
|
make_address(X) -> ?FATE_ADDRESS(X).
|
||||||
make_tuple(T) -> ?FATE_TUPLE(T).
|
make_bytes(X) -> ?FATE_BYTES(X).
|
||||||
make_map(M) -> ?MAKE_FATE_MAP(M).
|
make_hash(X) -> make_bytes(X).
|
||||||
make_address(A) -> ?FATE_ADDRESS(A).
|
make_signature(X) -> make_bytes(X).
|
||||||
make_bits(I) when is_integer(I) -> ?FATE_BITS(I).
|
make_contract(X) -> ?FATE_CONTRACT(X).
|
||||||
|
make_oracle(X) -> ?FATE_ORACLE(X).
|
||||||
|
make_oracle_query(X) -> ?FATE_ORACLE_Q(X).
|
||||||
|
make_channel(X) -> ?FATE_CHANNEL(X).
|
||||||
|
make_integer(I) when is_integer(I) -> ?MAKE_FATE_INTEGER(I).
|
||||||
|
make_bits(I) when is_integer(I) -> ?FATE_BITS(I).
|
||||||
|
make_string(S) when is_list(S) ->
|
||||||
|
?FATE_STRING(iolist_to_binary(S));
|
||||||
|
make_string(S) when is_binary(S) -> ?FATE_STRING(S).
|
||||||
|
make_typerep(T) -> ?FATE_TYPEREP(T).
|
||||||
|
|
||||||
make_variant(Size, Tag, Values) when is_integer(Size), is_integer(Tag)
|
%% Tag points to the selected variant (zero based)
|
||||||
, 0 =< Size
|
%% The arity of this variant is read from the list of provided arities
|
||||||
, 0 =< Tag
|
%% and should match the size of the given tuple.
|
||||||
, Tag < Size
|
make_variant(Arities, Tag, Values) ->
|
||||||
, is_tuple(Values) ->
|
Arities = [A || A <- Arities, is_integer(A), A < 256],
|
||||||
?FATE_VARIANT(Size, Tag, Values).
|
Size = length(Arities),
|
||||||
|
if is_integer(Tag)
|
||||||
tuple_to_list(?FATE_TUPLE(T)) -> erlang:tuple_to_list(T).
|
, 0 =< Tag
|
||||||
|
, Tag < Size
|
||||||
%% Encode is a convinience function for testing, encoding an Erlang term
|
, is_tuple(Values) ->
|
||||||
%% to a Fate term, but it can not distinguish between e.g. 32-byte strings
|
Arity = lists:nth(Tag+1, Arities),
|
||||||
%% and addresses. Therfore an extra tuple layer on the erlang side for
|
if size(Values) =:= Arity ->
|
||||||
%% addresses and bits.
|
?FATE_VARIANT(Arities, Tag, Values)
|
||||||
encode({bits, Term}) when is_integer(Term) -> make_bits(Term);
|
end
|
||||||
%% TODO: check that each byte is in base58
|
end.
|
||||||
encode({address, B}) when is_binary(B) -> make_address(B);
|
|
||||||
encode({address, I}) when is_integer(I) -> B = <<I:256>>, make_address(B);
|
|
||||||
encode({address, S}) when is_list(S) -> make_address(base58_to_address(S));
|
|
||||||
encode({variant, Size, Tag, Values}) -> make_variant(Size, Tag, Values);
|
|
||||||
encode(Term) when is_integer(Term) -> make_integer(Term);
|
|
||||||
encode(Term) when is_boolean(Term) -> make_boolean(Term);
|
|
||||||
encode(Term) when is_list(Term) -> make_list([encode(E) || E <- Term]);
|
|
||||||
encode(Term) when is_tuple(Term) ->
|
|
||||||
make_tuple(list_to_tuple([encode(E) || E <- erlang:tuple_to_list(Term)]));
|
|
||||||
encode(Term) when is_map(Term) ->
|
|
||||||
make_map(maps:from_list([{encode(K), encode(V)} || {K,V} <- maps:to_list(Term)]));
|
|
||||||
encode(Term) when is_binary(Term) -> make_string(Term).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
decode(I) when ?IS_FATE_INTEGER(I) -> I;
|
|
||||||
decode(?FATE_TRUE) -> true;
|
|
||||||
decode(?FATE_FALSE) -> false;
|
|
||||||
decode(L) when ?IS_FATE_LIST(L) -> [decode(E) || E <- L];
|
|
||||||
decode(?FATE_ADDRESS(<<Address:256>>)) -> {address, Address};
|
|
||||||
decode(?FATE_BITS(Bits)) -> {bits, Bits};
|
|
||||||
decode(?FATE_TUPLE(T)) -> erlang:list_to_tuple([decode(E) || E <- T]);
|
|
||||||
decode(?FATE_VARIANT(Size, Tag, Values)) -> {variant, Size, Tag, Values};
|
|
||||||
decode(S) when ?IS_FATE_STRING(S) -> binary_to_list(S);
|
|
||||||
decode(M) when ?IS_FATE_MAP(M) ->
|
|
||||||
maps:from_list([{decode(K), decode(V)} || {K, V} <- maps:to_list(M)]).
|
|
||||||
|
|
||||||
-spec format(fate_type()) -> iolist().
|
-spec format(fate_type()) -> iolist().
|
||||||
format(I) when ?IS_FATE_INTEGER(I) -> integer_to_list(?MAKE_FATE_INTEGER(I));
|
format(I) when ?IS_FATE_INTEGER(I) -> integer_to_list(?MAKE_FATE_INTEGER(I));
|
||||||
format(?FATE_TRUE) -> "true";
|
format(?FATE_TRUE) -> "true";
|
||||||
@@ -136,19 +150,33 @@ format(L) when ?IS_FATE_LIST(L) -> format_list(?FATE_LIST_VALUE(L));
|
|||||||
format(?FATE_UNIT) -> "()";
|
format(?FATE_UNIT) -> "()";
|
||||||
format(?FATE_TUPLE(T)) ->
|
format(?FATE_TUPLE(T)) ->
|
||||||
["( ", lists:join(", ", [ format(E) || E <- erlang:tuple_to_list(T)]), " )"];
|
["( ", lists:join(", ", [ format(E) || E <- erlang:tuple_to_list(T)]), " )"];
|
||||||
format(S) when ?IS_FATE_STRING(S) -> [S];
|
format(S) when ?IS_FATE_STRING(S) -> ["\"", S, "\""];
|
||||||
format(?FATE_BITS(B)) when B >= 0 ->
|
format(?FATE_BITS(B)) when B >= 0 ->
|
||||||
["<", format_bits(B, "") , ">"];
|
["<", format_bits(B, "") , ">"];
|
||||||
format(?FATE_BITS(B)) when B < 0 ->
|
format(?FATE_BITS(B)) when B < 0 ->
|
||||||
["!< ", format_nbits(-B-1, "") , " >"];
|
["!< ", format_nbits(-B-1, "") , " >"];
|
||||||
format(?FATE_VARIANT(Size, Tag, T)) ->
|
format(?FATE_VARIANT(Arities, Tag, T)) ->
|
||||||
["(| ",
|
["(| ",
|
||||||
lists:join("| ", [integer_to_list(Size), integer_to_list(Tag) |
|
lists:join("| ",
|
||||||
[format(make_tuple(T))]]),
|
[format_arities(Arities),
|
||||||
|
integer_to_list(Tag) |
|
||||||
|
[format(make_tuple(T))]]),
|
||||||
" |)"];
|
" |)"];
|
||||||
format(M) when ?IS_FATE_MAP(M) ->
|
format(M) when ?IS_FATE_MAP(M) ->
|
||||||
["{ ", format_kvs(maps:to_list(?FATE_MAP_VALUE(M))), " }"];
|
["{ ", format_kvs(maps:to_list(?FATE_MAP_VALUE(M))), " }"];
|
||||||
format(?FATE_ADDRESS(Address)) -> ["#", address_to_base58(Address)];
|
format(?FATE_BYTES(X)) -> ["#", base64:encode(X)];
|
||||||
|
format(?FATE_ADDRESS(X)) ->
|
||||||
|
["@", aeser_api_encoder:encode(account_pubkey, X)];
|
||||||
|
format(?FATE_CONTRACT(X)) ->
|
||||||
|
["@", aeser_api_encoder:encode(contract_pubkey, X)];
|
||||||
|
format(?FATE_ORACLE(X)) ->
|
||||||
|
["@", aeser_api_encoder:encode(oracle_pubkey, X)];
|
||||||
|
format(?FATE_ORACLE_Q(X)) ->
|
||||||
|
["@", aeser_api_encoder:encode(oracle_query_id, X)];
|
||||||
|
format(?FATE_CHANNEL(X)) ->
|
||||||
|
["@", aeser_api_encoder:encode(channel, X)];
|
||||||
|
format(?FATE_TYPEREP(X)) ->
|
||||||
|
["'", io_lib:format("~p", [X])];
|
||||||
format(V) -> exit({not_a_fate_type, V}).
|
format(V) -> exit({not_a_fate_type, V}).
|
||||||
|
|
||||||
format_bits(0, Acc) -> Acc;
|
format_bits(0, Acc) -> Acc;
|
||||||
@@ -161,6 +189,9 @@ format_nbits(N, Acc) ->
|
|||||||
Bit = $1 - (N band 1),
|
Bit = $1 - (N band 1),
|
||||||
format_nbits(N bsr 1, [Bit|Acc]).
|
format_nbits(N bsr 1, [Bit|Acc]).
|
||||||
|
|
||||||
|
format_arities(Arities) ->
|
||||||
|
["[ ", lists:join(", ", [integer_to_list(E) || E <- Arities]), " ]"].
|
||||||
|
|
||||||
format_list(List) ->
|
format_list(List) ->
|
||||||
["[ ", lists:join(", ", [format(E) || E <- List]), " ]"].
|
["[ ", lists:join(", ", [format(E) || E <- List]), " ]"].
|
||||||
|
|
||||||
@@ -168,41 +199,163 @@ format_kvs(List) ->
|
|||||||
lists:join(", ", [ [format(K), " => ", format(V)] || {K, V} <- List]).
|
lists:join(", ", [ [format(K), " => ", format(V)] || {K, V} <- List]).
|
||||||
|
|
||||||
|
|
||||||
%% -- Local base 58 library
|
%% Total order of FATE terms.
|
||||||
|
%% Integers < Booleans < Address < Channel < Contract < Oracle
|
||||||
|
%% < Hash < Signature < Bits < String < Tuple < Map < List < Variant
|
||||||
|
-define(ORD_INTEGER , 0).
|
||||||
|
-define(ORD_BOOLEAN , 1).
|
||||||
|
-define(ORD_ADDRESS , 2).
|
||||||
|
-define(ORD_CHANNEL , 3).
|
||||||
|
-define(ORD_CONTRACT , 4).
|
||||||
|
-define(ORD_ORACLE , 5).
|
||||||
|
-define(ORD_BYTES , 6).
|
||||||
|
-define(ORD_BITS , 7).
|
||||||
|
-define(ORD_STRING , 8).
|
||||||
|
-define(ORD_TUPLE , 9).
|
||||||
|
-define(ORD_MAP , 10).
|
||||||
|
-define(ORD_LIST , 11).
|
||||||
|
-define(ORD_VARIANT , 12).
|
||||||
|
-define(ORD_ORACLE_Q , 13).
|
||||||
|
|
||||||
base58char(Char) ->
|
-spec ordinal(fate_type()) -> integer().
|
||||||
binary:at(<<"123456789ABCDEFGHJKLMNPQRSTUVWXYZ"
|
ordinal(T) when ?IS_FATE_INTEGER(T) -> ?ORD_INTEGER;
|
||||||
"abcdefghijkmnopqrstuvwxyz">>, Char).
|
ordinal(T) when ?IS_FATE_BOOLEAN(T) -> ?ORD_BOOLEAN;
|
||||||
char_to_base58(C) ->
|
ordinal(T) when ?IS_FATE_ADDRESS(T) -> ?ORD_ADDRESS;
|
||||||
binary:at(<<0,1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,9,10,11,12,13,14,15,16,0,17,
|
ordinal(T) when ?IS_FATE_CHANNEL(T) -> ?ORD_CHANNEL;
|
||||||
18,19,20,21,0,22,23,24,25,26,27,28,29,30,31,32,0,0,0,0,0,0,
|
ordinal(T) when ?IS_FATE_CONTRACT(T) -> ?ORD_CONTRACT;
|
||||||
33,34,35,36,37,38,39,40,41,42,43,0,44,45,46,47,48,49,50,51,
|
ordinal(T) when ?IS_FATE_ORACLE(T) -> ?ORD_ORACLE;
|
||||||
52,53,54,55,56,57>>, C-$1).
|
ordinal(T) when ?IS_FATE_BYTES(T) -> ?ORD_BYTES;
|
||||||
|
ordinal(T) when ?IS_FATE_BITS(T) -> ?ORD_BITS;
|
||||||
|
ordinal(T) when ?IS_FATE_STRING(T) -> ?ORD_STRING;
|
||||||
|
ordinal(T) when ?IS_FATE_TUPLE(T) -> ?ORD_TUPLE;
|
||||||
|
ordinal(T) when ?IS_FATE_MAP(T) -> ?ORD_MAP;
|
||||||
|
ordinal(T) when ?IS_FATE_LIST(T) -> ?ORD_LIST;
|
||||||
|
ordinal(T) when ?IS_FATE_VARIANT(T) -> ?ORD_VARIANT;
|
||||||
|
ordinal(T) when ?IS_FATE_ORACLE_Q(T) -> ?ORD_ORACLE_Q.
|
||||||
|
|
||||||
base58_to_integer(C, []) -> C;
|
|
||||||
base58_to_integer(C, [X | Xs]) ->
|
|
||||||
base58_to_integer(C * 58 + char_to_base58(X), Xs).
|
|
||||||
|
|
||||||
base58_to_integer([]) -> error;
|
-spec lt(fate_type(), fate_type()) -> boolean().
|
||||||
base58_to_integer([Char]) -> char_to_base58(Char);
|
lt(A, B) ->
|
||||||
base58_to_integer([Char | Str]) ->
|
O1 = ordinal(A),
|
||||||
base58_to_integer(char_to_base58(Char), Str).
|
O2 = ordinal(B),
|
||||||
|
if O1 == O2 -> lt(O1, A, B);
|
||||||
|
true -> O1 < O2
|
||||||
|
end.
|
||||||
|
|
||||||
base58_to_address(Base58) ->
|
%% Integers are ordered as usual.
|
||||||
I = base58_to_integer(Base58),
|
lt(?ORD_INTEGER, A, B) when ?IS_FATE_INTEGER(A), ?IS_FATE_INTEGER(B) ->
|
||||||
Bin = <<I:256>>,
|
?FATE_INTEGER_VALUE(A) < ?FATE_INTEGER_VALUE(B);
|
||||||
Bin.
|
%% false is smaller than true (true also for erlang booleans).
|
||||||
|
lt(?ORD_BOOLEAN, A, B) when ?IS_FATE_BOOLEAN(A), ?IS_FATE_BOOLEAN(B) ->
|
||||||
|
?FATE_BOOLEAN_VALUE(A) < ?FATE_BOOLEAN_VALUE(B);
|
||||||
|
lt(?ORD_BITS, A, B) when ?IS_FATE_BITS(A), ?IS_FATE_BITS(B) ->
|
||||||
|
BitsA = ?FATE_BITS_VALUE(A),
|
||||||
|
BitsB = ?FATE_BITS_VALUE(B),
|
||||||
|
if BitsA < 0 ->
|
||||||
|
if BitsB < 0 -> BitsA < BitsB;
|
||||||
|
true -> false
|
||||||
|
end;
|
||||||
|
BitsB < 0 ->
|
||||||
|
true;
|
||||||
|
true -> BitsA < BitsB
|
||||||
|
end;
|
||||||
|
lt(?ORD_STRING,?FATE_STRING(A), ?FATE_STRING(B)) ->
|
||||||
|
SizeA = size(A),
|
||||||
|
SizeB = size(B),
|
||||||
|
case SizeA - SizeB of
|
||||||
|
0 -> A < B;
|
||||||
|
N -> N < 0
|
||||||
|
end;
|
||||||
|
|
||||||
address_to_base58(<<A:256>>) ->
|
lt(?ORD_TUPLE,?FATE_TUPLE(A), ?FATE_TUPLE(B)) ->
|
||||||
integer_to_base58(A).
|
SizeA = size(A),
|
||||||
|
SizeB = size(B),
|
||||||
|
case SizeA - SizeB of
|
||||||
|
0 -> tuple_elements_lt(0, A, B, SizeA);
|
||||||
|
N -> N < 0
|
||||||
|
end;
|
||||||
|
lt(?ORD_MAP, ?FATE_MAP_VALUE(A), ?FATE_MAP_VALUE(B)) ->
|
||||||
|
SizeA = maps:size(A),
|
||||||
|
SizeB = maps:size(B),
|
||||||
|
case SizeA - SizeB of
|
||||||
|
0 -> maps_lt(A, B);
|
||||||
|
N -> N < 0
|
||||||
|
end;
|
||||||
|
lt(?ORD_LIST, ?FATE_LIST_VALUE(_), ?FATE_LIST_VALUE([])) -> false;
|
||||||
|
lt(?ORD_LIST, ?FATE_LIST_VALUE([]), ?FATE_LIST_VALUE(_)) -> true;
|
||||||
|
lt(?ORD_LIST, ?FATE_LIST_VALUE([A|RA]), ?FATE_LIST_VALUE([B|RB])) ->
|
||||||
|
O1 = ordinal(A),
|
||||||
|
O2 = ordinal(B),
|
||||||
|
if O1 == O2 ->
|
||||||
|
if A == B -> lt(RA, RB);
|
||||||
|
true -> A < B
|
||||||
|
end;
|
||||||
|
true -> O1 < O2
|
||||||
|
end;
|
||||||
|
lt(?ORD_VARIANT, ?FATE_VARIANT(AritiesA, TagA, TA),
|
||||||
|
?FATE_VARIANT(AritiesB, TagB, TB)) ->
|
||||||
|
if length(AritiesA) < length(AritiesB) -> true;
|
||||||
|
length(AritiesA) > length(AritiesB) -> false;
|
||||||
|
true ->
|
||||||
|
if AritiesA < AritiesB -> true;
|
||||||
|
AritiesA > AritiesB -> false;
|
||||||
|
true ->
|
||||||
|
if TagA < TagB -> true;
|
||||||
|
TagA > TagB -> false;
|
||||||
|
true -> lt(make_tuple(TA), make_tuple(TB))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
lt(_, A, B) -> A < B.
|
||||||
|
|
||||||
integer_to_base58(0) -> <<"1">>;
|
tuple_elements_lt(N,_A,_B, N) ->
|
||||||
integer_to_base58(Integer) ->
|
false;
|
||||||
Base58String = integer_to_base58(Integer, []),
|
tuple_elements_lt(N, A, B, Size) ->
|
||||||
list_to_binary(Base58String).
|
E = N + 1,
|
||||||
|
EA = element(E, A),
|
||||||
|
EB = element(E, B),
|
||||||
|
if EA =:= EB -> tuple_elements_lt(E, A, B, Size);
|
||||||
|
true -> lt(EA, EB)
|
||||||
|
end.
|
||||||
|
|
||||||
|
maps_lt(A, B) ->
|
||||||
|
IA = maps_iterator(A),
|
||||||
|
IB = maps_iterator(B),
|
||||||
|
maps_i_lt(IA, IB).
|
||||||
|
|
||||||
|
maps_i_lt(IA, IB) ->
|
||||||
|
case {maps_next(IA), maps_next(IB)} of
|
||||||
|
{none, none} -> false;
|
||||||
|
{_, none} -> false;
|
||||||
|
{none, _} -> true;
|
||||||
|
{{KA1, VA1, IA2}, {KB1, VB1, IB2}} ->
|
||||||
|
case lt(KA1, KB1) of
|
||||||
|
true -> true;
|
||||||
|
false ->
|
||||||
|
case lt(KB1, KA1) of
|
||||||
|
true -> false;
|
||||||
|
false ->
|
||||||
|
case lt(VA1, VB1) of
|
||||||
|
true -> true;
|
||||||
|
false ->
|
||||||
|
case lt(VB1, VA1) of
|
||||||
|
true -> false;
|
||||||
|
false ->
|
||||||
|
maps_i_lt(IA2, IB2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
|
maps_iterator(M) -> lists:sort(fun ({K1,_}, {K2,_}) -> lt(K1, K2) end, maps:to_list(M)).
|
||||||
|
maps_next([]) -> none;
|
||||||
|
maps_next([{K,V}|Rest]) -> {K, V, Rest}.
|
||||||
|
|
||||||
|
|
||||||
|
-spec elt(fate_type(), fate_type()) -> boolean().
|
||||||
|
elt(A, A) -> true;
|
||||||
|
elt(A, B) ->
|
||||||
|
R = lt(A, B),
|
||||||
|
R.
|
||||||
|
|
||||||
integer_to_base58(0, Acc) -> Acc;
|
|
||||||
integer_to_base58(Integer, Acc) ->
|
|
||||||
Quot = Integer div 58,
|
|
||||||
Rem = Integer rem 58,
|
|
||||||
integer_to_base58(Quot, [base58char(Rem)|Acc]).
|
|
||||||
|
|||||||
+313
-89
@@ -1,21 +1,29 @@
|
|||||||
%% Fate data (and instruction) serialization.
|
%% Fate data (and instruction) serialization.
|
||||||
%%
|
%%
|
||||||
%% The FATE serialization has to fullfill the following properties:
|
%% Assuming
|
||||||
%% * There has to be 1 and only 1 byte sequence
|
%% S is seralize/1 (fate_type() -> binary())
|
||||||
%% representing each unique value in FATE.
|
%% D is deserialize/1 (binary) -> fate_type())
|
||||||
%% * A valid byte sequence has to be deserializable to a FATE value.
|
%% V, V1, V2 are of the type fate_type()
|
||||||
%% * A valid byte sequence must not contain any trailing bytes.
|
%% B is of the type binary()
|
||||||
%% * A serialization is a sequence of 8-bit bytes.
|
%% Then
|
||||||
%%
|
%% The FATE serialization has to fullfill the following properties:
|
||||||
%% The serialization function should fullfill the following:
|
%% * For each value (V) in FATE there has to be a bytecode sequence (B)
|
||||||
%% * A valid FATE value should be serialized to a byte sequence.
|
%% representing that value.
|
||||||
%% * Any other argument, not representing a valid FATE value should
|
%% * A valid byte sequence has to be deserializable to a FATE value.
|
||||||
|
%% * A valid byte sequence must not contain any trailing bytes.
|
||||||
|
%% * A serialization is a sequence of 8-bit bytes.
|
||||||
|
%% The serialization function (S) should fullfill the following:
|
||||||
|
%% * A valid FATE value should be serialized to a byte sequence.
|
||||||
|
%% * Any other argument, not representing a valid FATE value should
|
||||||
%% throw an exception
|
%% throw an exception
|
||||||
%%
|
%% The deserialization function (D) should fullfill the following:
|
||||||
%% The deserialization function should fullfill the following:
|
%% * A valid byte sequence should be deserialized to a valid FATE value.
|
||||||
%% * A valid byte sequence should be deserialized to a valid FATE value.
|
%% * Any other argument, not representing a valid byte sequence should
|
||||||
%% * Any other argument, not representing a valid byte sequence should
|
|
||||||
%% throw an exception
|
%% throw an exception
|
||||||
|
%% The following equalities should hold:
|
||||||
|
%% * D(S(V)) == V
|
||||||
|
%% * if V1 == V2 then S(V1) == S(V2)
|
||||||
|
%%
|
||||||
%%
|
%%
|
||||||
%% History
|
%% History
|
||||||
%% * First draft of FATE serialization encoding/decoding.
|
%% * First draft of FATE serialization encoding/decoding.
|
||||||
@@ -28,8 +36,6 @@
|
|||||||
%% TODO:
|
%% TODO:
|
||||||
%% * Make the code production ready.
|
%% * Make the code production ready.
|
||||||
%% (add tests, document exported functions).
|
%% (add tests, document exported functions).
|
||||||
%% * Handle Variant types better.
|
|
||||||
%% * Handle type representations.
|
|
||||||
%% * Handle instructions.
|
%% * Handle instructions.
|
||||||
%%
|
%%
|
||||||
%% ------------------------------------------------------------------------
|
%% ------------------------------------------------------------------------
|
||||||
@@ -37,9 +43,15 @@
|
|||||||
|
|
||||||
-export([ deserialize/1
|
-export([ deserialize/1
|
||||||
, deserialize_one/1
|
, deserialize_one/1
|
||||||
|
, deserialize_type/1
|
||||||
, serialize/1
|
, serialize/1
|
||||||
|
, serialize_type/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-ifdef(EQC).
|
||||||
|
-export([sort/1]).
|
||||||
|
-endif.
|
||||||
|
|
||||||
-include("aeb_fate_data.hrl").
|
-include("aeb_fate_data.hrl").
|
||||||
|
|
||||||
%% Definition of tag scheme.
|
%% Definition of tag scheme.
|
||||||
@@ -47,38 +59,72 @@
|
|||||||
|
|
||||||
-define(SMALL_INT , 2#0). %% sxxxxxx 0 - 6 bit integer with sign bit
|
-define(SMALL_INT , 2#0). %% sxxxxxx 0 - 6 bit integer with sign bit
|
||||||
%% 1 Set below
|
%% 1 Set below
|
||||||
-define(LONG_STRING , 2#00000001). %% 000000 01 - RLP encoded array, size >= 64
|
-define(LONG_STRING , 2#00000001). %% 000000 01 | RLP encoded array - when size >= 64
|
||||||
-define(SHORT_STRING , 2#01). %% xxxxxx 01 - [bytes], 0 < xxxxxx:size < 64
|
-define(SHORT_STRING , 2#01). %% xxxxxx 01 | [bytes] - when 0 < xxxxxx:size < 64
|
||||||
%% 11 Set below
|
%% 11 Set below
|
||||||
-define(SHORT_LIST , 2#0011). %% xxxx 0011 - [encoded elements], 0 < length < 16
|
-define(SHORT_LIST , 2#0011). %% xxxx 0011 | [encoded elements] when 0 < length < 16
|
||||||
%% xxxx 0111 - FREE (For typedefs in future)
|
%% xxxx 0111
|
||||||
-define(LONG_TUPLE , 2#00001011). %% 0000 1011 - RLP encoded (size - 16) + [encoded elements],
|
-define(TYPE_INTEGER , 2#00000111). %% 0000 0111 - Integer typedef
|
||||||
-define(SHORT_TUPLE , 2#1011). %% xxxx 1011 - [encoded elements], 0 < size < 16
|
-define(TYPE_BOOLEAN , 2#00010111). %% 0001 0111 - Boolean typedef
|
||||||
|
-define(TYPE_LIST , 2#00100111). %% 0010 0111 | Type
|
||||||
|
-define(TYPE_TUPLE , 2#00110111). %% 0011 0111 | Size | [Element Types]
|
||||||
|
-define(TYPE_OBJECT , 2#01000111). %% 0100 0111 | ObjectType
|
||||||
|
-define(TYPE_BITS , 2#01010111). %% 0101 0111 - Bits typedef
|
||||||
|
-define(TYPE_MAP , 2#01100111). %% 0110 0111 | Type | Type
|
||||||
|
-define(TYPE_STRING , 2#01110111). %% 0111 0111 - string typedef
|
||||||
|
-define(TYPE_VARIANT , 2#10000111). %% 1000 0111 | [Arities] | [Type]
|
||||||
|
-define(TYPE_BYTES , 2#10010111). %% 1001 0111 - Bytes typedef
|
||||||
|
%% 1010 0111
|
||||||
|
%% 1011 0111
|
||||||
|
%% 1100 0111
|
||||||
|
%% 1101 0111
|
||||||
|
-define(TYPE_VAR , 2#11100111). %% 1110 0111 | Id when 0 =< Id < 256 (type variable)
|
||||||
|
-define(TYPE_ANY , 2#11110111). %% 1111 0111 - Any typedef
|
||||||
|
-define(LONG_TUPLE , 2#00001011). %% 0000 1011 | RLP encoded (size - 16) | [encoded elements],
|
||||||
|
-define(SHORT_TUPLE , 2#1011). %% xxxx 1011 | [encoded elements] when 0 < size < 16
|
||||||
%% 1111 Set below
|
%% 1111 Set below
|
||||||
-define(LONG_LIST , 2#00011111). %% 0001 1111 - RLP encoded (length - 16) + [Elements]
|
-define(LONG_LIST , 2#00011111). %% 0001 1111 | RLP encoded (length - 16) | [encoded lements]
|
||||||
-define(MAP , 2#00101111). %% 0010 1111 - RLP encoded size + [encoded key, encoded value]
|
-define(MAP , 2#00101111). %% 0010 1111 | RLP encoded size | [encoded key, encoded value]
|
||||||
-define(EMPTY_TUPLE , 2#00111111). %% 0011 1111
|
-define(EMPTY_TUPLE , 2#00111111). %% 0011 1111
|
||||||
-define(POS_BITS , 2#01001111). %% 0100 1111 - RLP encoded integer (to be interpreted as bitfield)
|
-define(POS_BITS , 2#01001111). %% 0100 1111 | RLP encoded integer (to be interpreted as bitfield)
|
||||||
-define(EMPTY_STRING , 2#01011111). %% 0101 1111
|
-define(EMPTY_STRING , 2#01011111). %% 0101 1111
|
||||||
-define(POS_BIG_INT , 2#01101111). %% 0110 1111 - RLP encoded (integer - 64)
|
-define(POS_BIG_INT , 2#01101111). %% 0110 1111 | RLP encoded (integer - 64)
|
||||||
-define(FALSE , 2#01111111). %% 0111 1111
|
-define(FALSE , 2#01111111). %% 0111 1111
|
||||||
%% %% 1000 1111 - FREE (Possibly for bytecode in the future.)
|
%% %% 1000 1111 - FREE (Possibly for bytecode in the future.)
|
||||||
-define(ADDRESS , 2#10011111). %% 1001 1111 - [32 bytes]
|
-define(OBJECT , 2#10011111). %% 1001 1111 | ObjectType | RLP encoded Array
|
||||||
-define(VARIANT , 2#10101111). %% 1010 1111 - encoded size + encoded tag + encoded values
|
-define(VARIANT , 2#10101111). %% 1010 1111 | [encoded arities] | encoded tag | [encoded values]
|
||||||
-define(NIL , 2#10111111). %% 1011 1111 - Empty list
|
-define(NEG_BITS , 2#11001111). %% 1100 1111 | RLP encoded integer (infinite 1:s bitfield)
|
||||||
-define(NEG_BITS , 2#11001111). %% 1100 1111 - RLP encoded integer (infinite 1:s bitfield)
|
|
||||||
-define(EMPTY_MAP , 2#11011111). %% 1101 1111
|
-define(EMPTY_MAP , 2#11011111). %% 1101 1111
|
||||||
-define(NEG_BIG_INT , 2#11101111). %% 1110 1111 - RLP encoded (integer - 64)
|
-define(NEG_BIG_INT , 2#11101111). %% 1110 1111 | RLP encoded (integer - 64)
|
||||||
-define(TRUE , 2#11111111). %% 1111 1111
|
-define(TRUE , 2#11111111). %% 1111 1111
|
||||||
|
|
||||||
-define(SHORT_TUPLE_SIZE, 16).
|
-define(SHORT_TUPLE_SIZE, 16).
|
||||||
-define(SHORT_LIST_SIZE , 16).
|
-define(SHORT_LIST_SIZE, 16).
|
||||||
-define(SMALL_INT_SIZE , 64).
|
-define(SMALL_INT_SIZE, 64).
|
||||||
-define(SHORT_STRING_SIZE, 64).
|
-define(SHORT_STRING_SIZE, 64).
|
||||||
|
|
||||||
-define(POS_SIGN, 0).
|
-define(POS_SIGN, 0).
|
||||||
-define(NEG_SIGN, 1).
|
-define(NEG_SIGN, 1).
|
||||||
|
|
||||||
|
%% Object types
|
||||||
|
-define(OTYPE_ADDRESS, 0).
|
||||||
|
-define(OTYPE_BYTES, 1).
|
||||||
|
-define(OTYPE_CONTRACT, 2).
|
||||||
|
-define(OTYPE_ORACLE, 3).
|
||||||
|
-define(OTYPE_ORACLE_Q, 4).
|
||||||
|
-define(OTYPE_CHANNEL, 5).
|
||||||
|
|
||||||
|
-define(IS_TYPE_TAG(X), (X =:= ?TYPE_INTEGER orelse
|
||||||
|
X =:= ?TYPE_BOOLEAN orelse
|
||||||
|
X =:= ?TYPE_ANY orelse
|
||||||
|
X =:= ?TYPE_VAR orelse
|
||||||
|
X =:= ?TYPE_LIST orelse
|
||||||
|
X =:= ?TYPE_TUPLE orelse
|
||||||
|
X =:= ?TYPE_OBJECT orelse
|
||||||
|
X =:= ?TYPE_BITS orelse
|
||||||
|
X =:= ?TYPE_MAP orelse
|
||||||
|
X =:= ?TYPE_STRING orelse
|
||||||
|
X =:= ?TYPE_VARIANT)).
|
||||||
|
|
||||||
%% --------------------------------------------------
|
%% --------------------------------------------------
|
||||||
%% Serialize
|
%% Serialize
|
||||||
@@ -88,9 +134,7 @@
|
|||||||
-spec serialize(aeb_fate_data:fate_type()) -> binary().
|
-spec serialize(aeb_fate_data:fate_type()) -> binary().
|
||||||
serialize(?FATE_TRUE) -> <<?TRUE>>;
|
serialize(?FATE_TRUE) -> <<?TRUE>>;
|
||||||
serialize(?FATE_FALSE) -> <<?FALSE>>;
|
serialize(?FATE_FALSE) -> <<?FALSE>>;
|
||||||
serialize(?FATE_NIL) -> <<?NIL>>; %% ! Untyped
|
|
||||||
serialize(?FATE_UNIT) -> <<?EMPTY_TUPLE>>; %% ! Untyped
|
serialize(?FATE_UNIT) -> <<?EMPTY_TUPLE>>; %% ! Untyped
|
||||||
serialize(M) when ?IS_FATE_MAP(M), ?FATE_MAP_SIZE(M) =:= 0 -> <<?EMPTY_MAP>>; %% ! Untyped
|
|
||||||
serialize(?FATE_EMPTY_STRING) -> <<?EMPTY_STRING>>;
|
serialize(?FATE_EMPTY_STRING) -> <<?EMPTY_STRING>>;
|
||||||
serialize(I) when ?IS_FATE_INTEGER(I) -> serialize_integer(I);
|
serialize(I) when ?IS_FATE_INTEGER(I) -> serialize_integer(I);
|
||||||
serialize(?FATE_BITS(Bits)) when is_integer(Bits) -> serialize_bits(Bits);
|
serialize(?FATE_BITS(Bits)) when is_integer(Bits) -> serialize_bits(Bits);
|
||||||
@@ -104,9 +148,21 @@ serialize(String) when ?IS_FATE_STRING(String),
|
|||||||
?FATE_STRING_SIZE(String) > 0,
|
?FATE_STRING_SIZE(String) > 0,
|
||||||
?FATE_STRING_SIZE(String) >= ?SHORT_STRING_SIZE ->
|
?FATE_STRING_SIZE(String) >= ?SHORT_STRING_SIZE ->
|
||||||
Bytes = ?FATE_STRING_VALUE(String),
|
Bytes = ?FATE_STRING_VALUE(String),
|
||||||
<<?LONG_STRING, (aeser_rlp:encode(Bytes))/binary>>;
|
<<?LONG_STRING,
|
||||||
|
(serialize_integer(?FATE_STRING_SIZE(String) - ?SHORT_STRING_SIZE))/binary
|
||||||
|
, Bytes/binary>>;
|
||||||
|
serialize(?FATE_BYTES(Bytes)) when is_binary(Bytes) ->
|
||||||
|
<<?OBJECT, ?OTYPE_BYTES, (serialize(?FATE_STRING(Bytes)))/binary>>;
|
||||||
serialize(?FATE_ADDRESS(Address)) when is_binary(Address) ->
|
serialize(?FATE_ADDRESS(Address)) when is_binary(Address) ->
|
||||||
<<?ADDRESS, (aeser_rlp:encode(Address))/binary>>;
|
<<?OBJECT, ?OTYPE_ADDRESS, (aeser_rlp:encode(Address))/binary>>;
|
||||||
|
serialize(?FATE_CONTRACT(Address)) when is_binary(Address) ->
|
||||||
|
<<?OBJECT, ?OTYPE_CONTRACT, (aeser_rlp:encode(Address))/binary>>;
|
||||||
|
serialize(?FATE_ORACLE(Address)) when is_binary(Address) ->
|
||||||
|
<<?OBJECT, ?OTYPE_ORACLE, (aeser_rlp:encode(Address))/binary>>;
|
||||||
|
serialize(?FATE_ORACLE_Q(Address)) when is_binary(Address) ->
|
||||||
|
<<?OBJECT, ?OTYPE_ORACLE_Q, (aeser_rlp:encode(Address))/binary>>;
|
||||||
|
serialize(?FATE_CHANNEL(Address)) when is_binary(Address) ->
|
||||||
|
<<?OBJECT, ?OTYPE_CHANNEL, (aeser_rlp:encode(Address))/binary>>;
|
||||||
serialize(?FATE_TUPLE(T)) when size(T) > 0 ->
|
serialize(?FATE_TUPLE(T)) when size(T) > 0 ->
|
||||||
S = size(T),
|
S = size(T),
|
||||||
L = tuple_to_list(T),
|
L = tuple_to_list(T),
|
||||||
@@ -114,40 +170,149 @@ serialize(?FATE_TUPLE(T)) when size(T) > 0 ->
|
|||||||
if S < ?SHORT_TUPLE_SIZE ->
|
if S < ?SHORT_TUPLE_SIZE ->
|
||||||
<<S:4, ?SHORT_TUPLE:4, Rest/binary>>;
|
<<S:4, ?SHORT_TUPLE:4, Rest/binary>>;
|
||||||
true ->
|
true ->
|
||||||
Size = rlp_integer(S - ?SHORT_TUPLE_SIZE),
|
Size = rlp_encode_int(S - ?SHORT_TUPLE_SIZE),
|
||||||
<<?LONG_TUPLE:8, Size/binary, Rest/binary>>
|
<<?LONG_TUPLE:8, Size/binary, Rest/binary>>
|
||||||
end;
|
end;
|
||||||
serialize(L) when ?IS_FATE_LIST(L) ->
|
serialize(L) when ?IS_FATE_LIST(L) ->
|
||||||
[_E|_] = List = ?FATE_LIST_VALUE(L),
|
List = ?FATE_LIST_VALUE(L),
|
||||||
S = length(List),
|
S = length(List),
|
||||||
Rest = << <<(serialize(El))/binary>> || El <- List >>,
|
Rest = << <<(serialize(El))/binary>> || El <- List >>,
|
||||||
if S < ?SHORT_LIST_SIZE ->
|
if S < ?SHORT_LIST_SIZE ->
|
||||||
<<S:4, ?SHORT_LIST:4, Rest/binary>>;
|
<<S:4, ?SHORT_LIST:4, Rest/binary>>;
|
||||||
true ->
|
true ->
|
||||||
Val = rlp_integer(S - ?SHORT_LIST_SIZE),
|
Val = rlp_encode_int(S - ?SHORT_LIST_SIZE),
|
||||||
<<?LONG_LIST, Val/binary, Rest/binary>>
|
<<?LONG_LIST, Val/binary, Rest/binary>>
|
||||||
end;
|
end;
|
||||||
serialize(Map) when ?IS_FATE_MAP(Map) ->
|
serialize(Map) when ?IS_FATE_MAP(Map) ->
|
||||||
L = [{_K,_V}|_] = lists:sort(maps:to_list(?FATE_MAP_VALUE(Map))),
|
L = maps:to_list(?FATE_MAP_VALUE(Map)),
|
||||||
Size = length(L),
|
Size = length(L),
|
||||||
%% TODO: check all K same type, and all V same type
|
%% TODO: check all K same type, and all V same type
|
||||||
%% check K =/= map
|
%% check K =/= map
|
||||||
Elements = << <<(serialize(K1))/binary, (serialize(V1))/binary>> || {K1,V1} <- L >>,
|
Elements =
|
||||||
|
list_to_binary([ <<(serialize(K))/binary, (serialize(V))/binary>> || {K, V} <- sort_and_check(L) ]),
|
||||||
<<?MAP,
|
<<?MAP,
|
||||||
(rlp_integer(Size))/binary,
|
(rlp_encode_int(Size))/binary,
|
||||||
(Elements)/binary>>;
|
(Elements)/binary>>;
|
||||||
serialize(?FATE_VARIANT(Size, Tag, Values)) when 0 < Size, Size < 256,
|
serialize(?FATE_VARIANT(Arities, Tag, Values)) ->
|
||||||
0 =< Tag, Tag < Size ->
|
Arities = [A || A <- Arities, is_integer(A), A < 256],
|
||||||
<<?VARIANT, Size:8, Tag:8,
|
Size = length(Arities),
|
||||||
(serialize(?FATE_TUPLE(Values)))/binary
|
if is_integer(Tag)
|
||||||
>>.
|
, 0 =< Tag
|
||||||
|
, Tag < Size
|
||||||
|
, is_tuple(Values) ->
|
||||||
|
Arity = lists:nth(Tag+1, Arities),
|
||||||
|
if size(Values) =:= Arity ->
|
||||||
|
EncodedArities = aeser_rlp:encode(list_to_binary(Arities)),
|
||||||
|
<<?VARIANT,
|
||||||
|
EncodedArities/binary,
|
||||||
|
Tag:8,
|
||||||
|
(serialize(?FATE_TUPLE(Values)))/binary
|
||||||
|
>>
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
serialize(?FATE_TYPEREP(T)) ->
|
||||||
|
iolist_to_binary(serialize_type(T)).
|
||||||
|
|
||||||
|
|
||||||
%% -----------------------------------------------------
|
%% -----------------------------------------------------
|
||||||
|
|
||||||
rlp_integer(S) when S >= 0 ->
|
-spec serialize_type(aeb_fate_data:fate_type_type()) -> [byte()].
|
||||||
|
serialize_type(integer) -> [?TYPE_INTEGER];
|
||||||
|
serialize_type(boolean) -> [?TYPE_BOOLEAN];
|
||||||
|
serialize_type(any) -> [?TYPE_ANY];
|
||||||
|
serialize_type({tvar, N}) when 0 =< N, N =< 255 -> [?TYPE_VAR, N];
|
||||||
|
serialize_type({list, T}) -> [?TYPE_LIST | serialize_type(T)];
|
||||||
|
serialize_type({tuple, Ts}) ->
|
||||||
|
case length(Ts) of
|
||||||
|
N when N =< 255 ->
|
||||||
|
[?TYPE_TUPLE, N | [serialize_type(T) || T <- Ts]]
|
||||||
|
end;
|
||||||
|
serialize_type({bytes, N}) when 0 =< N ->
|
||||||
|
[?TYPE_BYTES | binary_to_list(serialize_integer(N))];
|
||||||
|
serialize_type(address) -> [?TYPE_OBJECT, ?OTYPE_ADDRESS];
|
||||||
|
serialize_type(contract) -> [?TYPE_OBJECT, ?OTYPE_CONTRACT];
|
||||||
|
serialize_type(oracle) -> [?TYPE_OBJECT, ?OTYPE_ORACLE];
|
||||||
|
serialize_type(oracle_query)-> [?TYPE_OBJECT, ?OTYPE_ORACLE_Q];
|
||||||
|
serialize_type(channel) -> [?TYPE_OBJECT, ?OTYPE_CHANNEL];
|
||||||
|
serialize_type(bits) -> [?TYPE_BITS];
|
||||||
|
serialize_type({map, K, V}) -> [?TYPE_MAP
|
||||||
|
| serialize_type(K) ++ serialize_type(V)];
|
||||||
|
serialize_type(string) -> [?TYPE_STRING];
|
||||||
|
serialize_type({variant, ListOfVariants}) ->
|
||||||
|
Size = length(ListOfVariants),
|
||||||
|
if Size < 256 ->
|
||||||
|
[?TYPE_VARIANT, Size | [serialize_type(T) || T <- ListOfVariants]]
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
-spec deserialize_type(binary()) -> {aeb_fate_data:fate_type_type(), binary()}.
|
||||||
|
deserialize_type(<<?TYPE_INTEGER, Rest/binary>>) -> {integer, Rest};
|
||||||
|
deserialize_type(<<?TYPE_BOOLEAN, Rest/binary>>) -> {boolean, Rest};
|
||||||
|
deserialize_type(<<?TYPE_ANY, Rest/binary>>) -> {any, Rest};
|
||||||
|
deserialize_type(<<?TYPE_VAR, Id, Rest/binary>>) -> {{tvar, Id}, Rest};
|
||||||
|
deserialize_type(<<?TYPE_LIST, Rest/binary>>) ->
|
||||||
|
{T, Rest2} = deserialize_type(Rest),
|
||||||
|
{{list, T}, Rest2};
|
||||||
|
deserialize_type(<<?TYPE_TUPLE, N, Rest/binary>>) ->
|
||||||
|
{Ts, Rest2} = deserialize_types(N, Rest, []),
|
||||||
|
{{tuple, Ts}, Rest2};
|
||||||
|
deserialize_type(<<?TYPE_BYTES, Rest/binary>>) ->
|
||||||
|
{N, Rest2} = deserialize_one(Rest),
|
||||||
|
true = is_integer(N) andalso N >= 0,
|
||||||
|
{{bytes, N}, Rest2};
|
||||||
|
deserialize_type(<<?TYPE_OBJECT, ObjectType, Rest/binary>>) ->
|
||||||
|
case ObjectType of
|
||||||
|
?OTYPE_ADDRESS -> {address, Rest};
|
||||||
|
?OTYPE_CONTRACT -> {contract, Rest};
|
||||||
|
?OTYPE_ORACLE -> {oracle, Rest};
|
||||||
|
?OTYPE_ORACLE_Q -> {oracle_query, Rest};
|
||||||
|
?OTYPE_CHANNEL -> {channel, Rest}
|
||||||
|
end;
|
||||||
|
deserialize_type(<<?TYPE_BITS, Rest/binary>>) -> {bits, Rest};
|
||||||
|
deserialize_type(<<?TYPE_MAP, Rest/binary>>) ->
|
||||||
|
{K, Rest2} = deserialize_type(Rest),
|
||||||
|
{V, Rest3} = deserialize_type(Rest2),
|
||||||
|
{{map, K, V}, Rest3};
|
||||||
|
deserialize_type(<<?TYPE_STRING, Rest/binary>>) ->
|
||||||
|
{string, Rest};
|
||||||
|
deserialize_type(<<?TYPE_VARIANT, Size, Rest/binary>>) ->
|
||||||
|
{Variants, Rest2} = deserialize_variants(Size, Rest, []),
|
||||||
|
{{variant, Variants}, Rest2}.
|
||||||
|
|
||||||
|
deserialize_variants(0, Rest, Variants) ->
|
||||||
|
{lists:reverse(Variants), Rest};
|
||||||
|
deserialize_variants(N, Rest, Variants) ->
|
||||||
|
{T, Rest2} = deserialize_type(Rest),
|
||||||
|
deserialize_variants(N-1, Rest2, [T|Variants]).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deserialize_types(0, Binary, Acc) ->
|
||||||
|
{lists:reverse(Acc), Binary};
|
||||||
|
deserialize_types(N, Binary, Acc) ->
|
||||||
|
{T, Rest} = deserialize_type(Binary),
|
||||||
|
deserialize_types(N-1, Rest, [T | Acc]).
|
||||||
|
|
||||||
|
|
||||||
|
%% -----------------------------------------------------
|
||||||
|
|
||||||
|
rlp_encode_int(S) when S >= 0 ->
|
||||||
aeser_rlp:encode(binary:encode_unsigned(S)).
|
aeser_rlp:encode(binary:encode_unsigned(S)).
|
||||||
|
|
||||||
|
|
||||||
|
%% first byte of the binary gives the number of bytes we need <<129>> is 1, <<130>> = 2,
|
||||||
|
%% so <<129, 0>> is <<0>> and <<130, 0, 0>> is <<0, 0>>
|
||||||
|
rlp_decode_int(Binary) ->
|
||||||
|
{Bin1, Rest} = aeser_rlp:decode_one(Binary),
|
||||||
|
Int = binary:decode_unsigned(Bin1),
|
||||||
|
ReEncode = rlp_encode_int(Int),
|
||||||
|
case <<ReEncode/binary, Rest/binary>> == Binary of
|
||||||
|
true ->
|
||||||
|
{Int, Rest};
|
||||||
|
false ->
|
||||||
|
error({none_unique_encoding, Bin1, ReEncode})
|
||||||
|
end.
|
||||||
|
|
||||||
serialize_integer(I) when ?IS_FATE_INTEGER(I) ->
|
serialize_integer(I) when ?IS_FATE_INTEGER(I) ->
|
||||||
V = ?FATE_INTEGER_VALUE(I),
|
V = ?FATE_INTEGER_VALUE(I),
|
||||||
Abs = abs(V),
|
Abs = abs(V),
|
||||||
@@ -157,20 +322,16 @@ serialize_integer(I) when ?IS_FATE_INTEGER(I) ->
|
|||||||
end,
|
end,
|
||||||
if Abs < ?SMALL_INT_SIZE -> <<Sign:1, Abs:6, ?SMALL_INT:1>>;
|
if Abs < ?SMALL_INT_SIZE -> <<Sign:1, Abs:6, ?SMALL_INT:1>>;
|
||||||
Sign =:= ?NEG_SIGN -> <<?NEG_BIG_INT,
|
Sign =:= ?NEG_SIGN -> <<?NEG_BIG_INT,
|
||||||
(rlp_integer(Abs - ?SMALL_INT_SIZE))/binary>>;
|
(rlp_encode_int(Abs - ?SMALL_INT_SIZE))/binary>>;
|
||||||
Sign =:= ?POS_SIGN -> <<?POS_BIG_INT,
|
Sign =:= ?POS_SIGN -> <<?POS_BIG_INT,
|
||||||
(rlp_integer(Abs - ?SMALL_INT_SIZE))/binary>>
|
(rlp_encode_int(Abs - ?SMALL_INT_SIZE))/binary>>
|
||||||
end.
|
end.
|
||||||
|
|
||||||
serialize_bits(B) when is_integer(B) ->
|
serialize_bits(B) when is_integer(B) ->
|
||||||
Abs = abs(B),
|
Abs = abs(B),
|
||||||
Sign = case B < 0 of
|
|
||||||
true -> ?NEG_SIGN;
|
|
||||||
false -> ?POS_SIGN
|
|
||||||
end,
|
|
||||||
if
|
if
|
||||||
Sign =:= ?NEG_SIGN -> <<?NEG_BITS, (rlp_integer(Abs))/binary>>;
|
B < 0 -> <<?NEG_BITS, (rlp_encode_int(Abs))/binary>>;
|
||||||
Sign =:= ?POS_SIGN -> <<?POS_BITS, (rlp_integer(Abs))/binary>>
|
B >= 0 -> <<?POS_BITS, (rlp_encode_int(Abs))/binary>>
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec deserialize(binary()) -> aeb_fate_data:fate_type().
|
-spec deserialize(binary()) -> aeb_fate_data:fate_type().
|
||||||
@@ -183,74 +344,109 @@ deserialize_one(B) -> deserialize2(B).
|
|||||||
deserialize2(<<?POS_SIGN:1, I:6, ?SMALL_INT:1, Rest/binary>>) ->
|
deserialize2(<<?POS_SIGN:1, I:6, ?SMALL_INT:1, Rest/binary>>) ->
|
||||||
{?MAKE_FATE_INTEGER(I), Rest};
|
{?MAKE_FATE_INTEGER(I), Rest};
|
||||||
deserialize2(<<?NEG_SIGN:1, I:6, ?SMALL_INT:1, Rest/binary>>) ->
|
deserialize2(<<?NEG_SIGN:1, I:6, ?SMALL_INT:1, Rest/binary>>) ->
|
||||||
{?MAKE_FATE_INTEGER(-I), Rest};
|
if I =/= 0 -> {?MAKE_FATE_INTEGER(-I), Rest};
|
||||||
|
I == 0 -> error({illegal_sign, I})
|
||||||
|
end;
|
||||||
deserialize2(<<?NEG_BIG_INT, Rest/binary>>) ->
|
deserialize2(<<?NEG_BIG_INT, Rest/binary>>) ->
|
||||||
{Bint, Rest2} = aeser_rlp:decode_one(Rest),
|
{Bint, Rest2} = rlp_decode_int(Rest),
|
||||||
{?MAKE_FATE_INTEGER(-binary:decode_unsigned(Bint) - ?SMALL_INT_SIZE),
|
{?MAKE_FATE_INTEGER(-Bint - ?SMALL_INT_SIZE),
|
||||||
Rest2};
|
Rest2};
|
||||||
deserialize2(<<?POS_BIG_INT, Rest/binary>>) ->
|
deserialize2(<<?POS_BIG_INT, Rest/binary>>) ->
|
||||||
{Bint, Rest2} = aeser_rlp:decode_one(Rest),
|
{Bint, Rest2} = rlp_decode_int(Rest),
|
||||||
{?MAKE_FATE_INTEGER(binary:decode_unsigned(Bint) + ?SMALL_INT_SIZE),
|
{?MAKE_FATE_INTEGER(Bint + ?SMALL_INT_SIZE),
|
||||||
Rest2};
|
Rest2};
|
||||||
deserialize2(<<?NEG_BITS, Rest/binary>>) ->
|
deserialize2(<<?NEG_BITS, Rest/binary>>) ->
|
||||||
{Bint, Rest2} = aeser_rlp:decode_one(Rest),
|
case rlp_decode_int(Rest) of
|
||||||
{?FATE_BITS(-binary:decode_unsigned(Bint)), Rest2};
|
{Pos, Rest2} when Pos > 0 ->
|
||||||
|
{?FATE_BITS(-Pos), Rest2};
|
||||||
|
{N, _} ->
|
||||||
|
error({illegal_parameter, neg_bits, N})
|
||||||
|
end;
|
||||||
deserialize2(<<?POS_BITS, Rest/binary>>) ->
|
deserialize2(<<?POS_BITS, Rest/binary>>) ->
|
||||||
{Bint, Rest2} = aeser_rlp:decode_one(Rest),
|
{Bint, Rest2} = rlp_decode_int(Rest),
|
||||||
{?FATE_BITS(binary:decode_unsigned(Bint)), Rest2};
|
{?FATE_BITS(Bint), Rest2};
|
||||||
deserialize2(<<?LONG_STRING, Rest/binary>>) ->
|
deserialize2(<<?LONG_STRING, Rest/binary>>) ->
|
||||||
{String, Rest2} = aeser_rlp:decode_one(Rest),
|
{S, Rest2} = deserialize_one(Rest),
|
||||||
{?MAKE_FATE_STRING(String), Rest2};
|
true = is_integer(S) andalso S >= 0,
|
||||||
|
Size = S + ?SHORT_STRING_SIZE,
|
||||||
|
String = binary:part(Rest2, 0, Size),
|
||||||
|
Rest3 = binary:part(Rest2, byte_size(Rest2), - (byte_size(Rest2) - Size)),
|
||||||
|
{?MAKE_FATE_STRING(String), Rest3};
|
||||||
deserialize2(<<S:6, ?SHORT_STRING:2, Rest/binary>>) ->
|
deserialize2(<<S:6, ?SHORT_STRING:2, Rest/binary>>) ->
|
||||||
String = binary:part(Rest, 0, S),
|
String = binary:part(Rest, 0, S),
|
||||||
Rest2 = binary:part(Rest, byte_size(Rest), - (byte_size(Rest) - S)),
|
Rest2 = binary:part(Rest, byte_size(Rest), - (byte_size(Rest) - S)),
|
||||||
{?MAKE_FATE_STRING(String), Rest2};
|
{?MAKE_FATE_STRING(String), Rest2};
|
||||||
deserialize2(<<?ADDRESS, Rest/binary>>) ->
|
deserialize2(<<?OBJECT, ?OTYPE_BYTES, Rest/binary>>) ->
|
||||||
|
{String, Rest2} = deserialize_one(Rest),
|
||||||
|
true = ?IS_FATE_STRING(String),
|
||||||
|
{?FATE_BYTES(?FATE_STRING_VALUE(String)), Rest2};
|
||||||
|
deserialize2(<<?OBJECT, ObjectType, Rest/binary>>) ->
|
||||||
{A, Rest2} = aeser_rlp:decode_one(Rest),
|
{A, Rest2} = aeser_rlp:decode_one(Rest),
|
||||||
{?FATE_ADDRESS(A), Rest2};
|
Val =
|
||||||
|
case ObjectType of
|
||||||
|
?OTYPE_ADDRESS -> ?FATE_ADDRESS(A);
|
||||||
|
?OTYPE_CONTRACT -> ?FATE_CONTRACT(A);
|
||||||
|
?OTYPE_ORACLE -> ?FATE_ORACLE(A);
|
||||||
|
?OTYPE_ORACLE_Q -> ?FATE_ORACLE_Q(A);
|
||||||
|
?OTYPE_CHANNEL -> ?FATE_CHANNEL(A)
|
||||||
|
end,
|
||||||
|
{Val, Rest2};
|
||||||
deserialize2(<<?TRUE, Rest/binary>>) ->
|
deserialize2(<<?TRUE, Rest/binary>>) ->
|
||||||
{?FATE_TRUE, Rest};
|
{?FATE_TRUE, Rest};
|
||||||
deserialize2(<<?FALSE, Rest/binary>>) ->
|
deserialize2(<<?FALSE, Rest/binary>>) ->
|
||||||
{?FATE_FALSE, Rest};
|
{?FATE_FALSE, Rest};
|
||||||
deserialize2(<<?NIL, Rest/binary>>) ->
|
|
||||||
{?FATE_NIL, Rest};
|
|
||||||
deserialize2(<<?EMPTY_TUPLE, Rest/binary>>) ->
|
deserialize2(<<?EMPTY_TUPLE, Rest/binary>>) ->
|
||||||
{?FATE_UNIT, Rest};
|
{?FATE_UNIT, Rest};
|
||||||
deserialize2(<<?EMPTY_MAP, Rest/binary>>) ->
|
|
||||||
{?MAKE_FATE_MAP(#{}), Rest};
|
|
||||||
deserialize2(<<?EMPTY_STRING, Rest/binary>>) ->
|
deserialize2(<<?EMPTY_STRING, Rest/binary>>) ->
|
||||||
{?FATE_EMPTY_STRING, Rest};
|
{?FATE_EMPTY_STRING, Rest};
|
||||||
deserialize2(<<?LONG_TUPLE, Rest/binary>>) ->
|
deserialize2(<<?LONG_TUPLE, Rest/binary>>) ->
|
||||||
{BSize, Rest1} = aeser_rlp:decode_one(Rest),
|
{Size, Rest1} = rlp_decode_int(Rest),
|
||||||
N = binary:decode_unsigned(BSize) + ?SHORT_TUPLE_SIZE,
|
N = Size + ?SHORT_TUPLE_SIZE,
|
||||||
{List, Rest2} = deserialize_elements(N, Rest1),
|
{List, Rest2} = deserialize_elements(N, Rest1),
|
||||||
{?FATE_TUPLE(list_to_tuple(List)), Rest2};
|
{?FATE_TUPLE(list_to_tuple(List)), Rest2};
|
||||||
deserialize2(<<S:4, ?SHORT_TUPLE:4, Rest/binary>>) ->
|
deserialize2(<<S:4, ?SHORT_TUPLE:4, Rest/binary>>) ->
|
||||||
{List, Rest1} = deserialize_elements(S, Rest),
|
{List, Rest1} = deserialize_elements(S, Rest),
|
||||||
{?FATE_TUPLE(list_to_tuple(List)), Rest1};
|
{?FATE_TUPLE(list_to_tuple(List)), Rest1};
|
||||||
deserialize2(<<?LONG_LIST, Rest/binary>>) ->
|
deserialize2(<<?LONG_LIST, Rest/binary>>) ->
|
||||||
{BLength, Rest1} = aeser_rlp:decode_one(Rest),
|
{Size, Rest1} = rlp_decode_int(Rest),
|
||||||
Length = binary:decode_unsigned(BLength) + ?SHORT_LIST_SIZE,
|
Length = Size + ?SHORT_LIST_SIZE,
|
||||||
{List, Rest2} = deserialize_elements(Length, Rest1),
|
{List, Rest2} = deserialize_elements(Length, Rest1),
|
||||||
{?MAKE_FATE_LIST(List), Rest2};
|
{?MAKE_FATE_LIST(List), Rest2};
|
||||||
deserialize2(<<S:4, ?SHORT_LIST:4, Rest/binary>>) ->
|
deserialize2(<<S:4, ?SHORT_LIST:4, Rest/binary>>) ->
|
||||||
{List, Rest1} = deserialize_elements(S, Rest),
|
{List, Rest1} = deserialize_elements(S, Rest),
|
||||||
{?MAKE_FATE_LIST(List), Rest1};
|
{?MAKE_FATE_LIST(List), Rest1};
|
||||||
deserialize2(<<?MAP, Rest/binary>>) ->
|
deserialize2(<<?MAP, Rest/binary>>) ->
|
||||||
{BSize, Rest1} = aeser_rlp:decode_one(Rest),
|
{Size, Rest1} = rlp_decode_int(Rest),
|
||||||
Size = binary:decode_unsigned(BSize),
|
|
||||||
{List, Rest2} = deserialize_elements(2*Size, Rest1),
|
{List, Rest2} = deserialize_elements(2*Size, Rest1),
|
||||||
Map = insert_kv(List, #{}),
|
KVList = insert_kv(List),
|
||||||
{?MAKE_FATE_MAP(Map), Rest2};
|
case sort_and_check(KVList) == KVList of
|
||||||
deserialize2(<<?VARIANT, Size:8, Tag:8, Rest/binary>>) ->
|
true ->
|
||||||
|
Map = maps:from_list(KVList),
|
||||||
|
{?MAKE_FATE_MAP(Map), Rest2};
|
||||||
|
false ->
|
||||||
|
error({unknown_map_serialization_format, KVList})
|
||||||
|
end;
|
||||||
|
deserialize2(<<?VARIANT, Rest/binary>>) ->
|
||||||
|
{AritiesBin, <<Tag:8, Rest2/binary>>} = aeser_rlp:decode_one(Rest),
|
||||||
|
Arities = binary_to_list(AritiesBin),
|
||||||
|
Size = length(Arities),
|
||||||
if Tag > Size -> exit({too_large_tag_in_variant, Tag, Size});
|
if Tag > Size -> exit({too_large_tag_in_variant, Tag, Size});
|
||||||
true ->
|
true ->
|
||||||
{?FATE_TUPLE(T), Rest2} = deserialize2(Rest),
|
{?FATE_TUPLE(T), Rest3} = deserialize2(Rest2),
|
||||||
{?FATE_VARIANT(Size, Tag, T), Rest2}
|
Arity = lists:nth(Tag+1, Arities),
|
||||||
end.
|
NumElements = size(T),
|
||||||
|
if NumElements =/= Arity ->
|
||||||
|
exit({tag_does_not_match_type_in_variant, Tag, Arity});
|
||||||
|
true ->
|
||||||
|
{?FATE_VARIANT(Arities, Tag, T), Rest3}
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
deserialize2(<<TypeTag, _/binary>> = Bin) when ?IS_TYPE_TAG(TypeTag) ->
|
||||||
|
{Type, Rest} = deserialize_type(Bin),
|
||||||
|
{?FATE_TYPEREP(Type), Rest}.
|
||||||
|
|
||||||
insert_kv([], M) -> M;
|
insert_kv([]) -> [];
|
||||||
insert_kv([K,V|R], M) -> insert_kv(R, maps:put(K, V, M)).
|
insert_kv([K, V | R]) -> [{K, V} | insert_kv(R)].
|
||||||
|
|
||||||
deserialize_elements(0, Rest) ->
|
deserialize_elements(0, Rest) ->
|
||||||
{[], Rest};
|
{[], Rest};
|
||||||
@@ -258,3 +454,31 @@ deserialize_elements(N, Es) ->
|
|||||||
{E, Rest} = deserialize2(Es),
|
{E, Rest} = deserialize2(Es),
|
||||||
{Tail, Rest2} = deserialize_elements(N-1, Rest),
|
{Tail, Rest2} = deserialize_elements(N-1, Rest),
|
||||||
{[E|Tail], Rest2}.
|
{[E|Tail], Rest2}.
|
||||||
|
|
||||||
|
|
||||||
|
%% It is important to remove duplicated keys.
|
||||||
|
%% For deserialize this check is needed to observe illegal duplicates.
|
||||||
|
sort_and_check(List) ->
|
||||||
|
UniqKeyList =
|
||||||
|
lists:foldr(fun({K, V}, Acc) ->
|
||||||
|
case valid_key_type(K) andalso not lists:keymember(K, 1, Acc) of
|
||||||
|
true -> [{K,V}|Acc];
|
||||||
|
false -> Acc
|
||||||
|
end
|
||||||
|
end, [], List),
|
||||||
|
sort(UniqKeyList).
|
||||||
|
|
||||||
|
%% Sorting is used to get a unique result.
|
||||||
|
%% Deserialization is checking whether the provided key-value pairs are sorted
|
||||||
|
%% and raises an exception if not.
|
||||||
|
|
||||||
|
sort(KVList) ->
|
||||||
|
SortFun = fun({K1, _}, {K2, _}) ->
|
||||||
|
aeb_fate_data:elt(K1, K2)
|
||||||
|
end,
|
||||||
|
lists:sort(SortFun, KVList).
|
||||||
|
|
||||||
|
valid_key_type(K) when ?IS_FATE_MAP(K) ->
|
||||||
|
error({map_as_key_in_map, K});
|
||||||
|
valid_key_type(_K) ->
|
||||||
|
true.
|
||||||
|
|||||||
+236
-168
@@ -3,6 +3,7 @@
|
|||||||
-export([ gen_and_halt/1
|
-export([ gen_and_halt/1
|
||||||
, generate/0
|
, generate/0
|
||||||
, generate_documentation/1
|
, generate_documentation/1
|
||||||
|
, get_ops/0
|
||||||
, test_asm_generator/1]).
|
, test_asm_generator/1]).
|
||||||
|
|
||||||
gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
||||||
@@ -10,142 +11,178 @@ gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
|||||||
atom_to_list(IncludeDirArg)),
|
atom_to_list(IncludeDirArg)),
|
||||||
halt().
|
halt().
|
||||||
|
|
||||||
generate() ->
|
generate() -> generate("src/", "include/").
|
||||||
generate("src/", "include/").
|
|
||||||
|
get_ops() -> gen(ops_defs()).
|
||||||
|
|
||||||
generate(Src, Include) ->
|
generate(Src, Include) ->
|
||||||
Ops = gen(ops_defs()),
|
check_defs(ops_defs()),
|
||||||
|
Ops = get_ops(),
|
||||||
%% io:format("ops: ~p\n", [Ops]),
|
%% io:format("ops: ~p\n", [Ops]),
|
||||||
HrlFile = Include ++ "aeb_fate_opcodes.hrl",
|
HrlFile = Include ++ "aeb_fate_opcodes.hrl",
|
||||||
generate_header_file(HrlFile, Ops),
|
generate_header_file(HrlFile, Ops),
|
||||||
generate_opcodes_ops(aeb_fate_opcodes, HrlFile, Src, Ops),
|
generate_opcodes_ops(aeb_fate_opcodes, HrlFile, Src, Ops),
|
||||||
generate_code_ops(aeb_fate_code, Src, Ops),
|
generate_code_ops(aeb_fate_ops, Src, Ops),
|
||||||
generate_scanner("aeb_fate_asm_scan.template", "aeb_fate_asm_scan.xrl", Src, Ops),
|
generate_scanner("aeb_fate_asm_scan.template", "aeb_fate_asm_scan.xrl", Src, Ops),
|
||||||
gen_asm_pp(aeb_fate_pp, Src, Ops).
|
gen_asm_pp(aeb_fate_pp, Src, Ops).
|
||||||
|
|
||||||
|
check_defs(List) ->
|
||||||
|
true = check_numbering(0, lists:keysort(2, List)).
|
||||||
|
|
||||||
|
check_numbering(N, [T|Rest]) ->
|
||||||
|
OpCode = element(2, T),
|
||||||
|
case OpCode of
|
||||||
|
N -> check_numbering(N+1, Rest);
|
||||||
|
16#fa -> check_numbering(16#fa+1, Rest);
|
||||||
|
_ when OpCode < N -> {duplicate_opcode, OpCode};
|
||||||
|
_ when OpCode > N -> {missing_opcode, N}
|
||||||
|
end;
|
||||||
|
check_numbering(_, []) -> true.
|
||||||
|
|
||||||
|
|
||||||
%% TODO: Some real gas numbers...
|
%% TODO: Some real gas numbers...
|
||||||
ops_defs() ->
|
ops_defs() ->
|
||||||
%% Opname, Opcode, args, end_bb, gas, format, Constructor, Documentation
|
%% Opname, Opcode, end_bb, in_auth, gas, format, Constructor, ArgType, ResType, Documentation
|
||||||
[ { 'RETURN', 16#00, 0, true, 2, atomic, return, "Return from function call pop stack to arg0. The type of the retun value has to match the return type of the function."}
|
[ { 'RETURN', 16#00, true, true, 2, [], return, {}, any, "Return from function call, top of stack is return value . The type of the retun value has to match the return type of the function."}
|
||||||
, { 'RETURNR', 16#01, 1, true, 2, [a], returnr, "Return from function call copy Arg0 to arg0. The type of the retun value has to match the return type of the function."}
|
, { 'RETURNR', 16#01, true, true, 2, [a], returnr, {any}, any, "Push Arg0 and return from function. The type of the retun value has to match the return type of the function."}
|
||||||
, { 'CALL', 16#02, 1, true, 4, [is], call, "Call given function with args on stack. The types of the arguments has to match the argument typs of the function."}
|
, { 'CALL', 16#02, true, true, 4, [a], call, {string}, any, "Call the function Arg0 with args on stack. The types of the arguments has to match the argument typs of the function."}
|
||||||
, { 'CALL_R', 16#03, 2, true, 8, [a,is], call_r, "Remote call to given contract and function. The types of the arguments has to match the argument typs of the function."}
|
, { 'CALL_R', 16#03, true, false, 8, [a,is,a], call_r, {contract, string, integer}, any, "Remote call to contract Arg0 and function Arg1 with value Arg2. The types of the arguments has to match the argument typs of the function."}
|
||||||
, { 'CALL_T', 16#04, 1, true, 4, [is], call_t, "Tail call to given function. The types of the arguments has to match the argument typs of the function. And the return type of the called function has to match the type of the current function."}
|
, { 'CALL_T', 16#04, true, true, 4, [a], call_t, {string}, any, "Tail call to function Arg0. The types of the arguments has to match the argument typs of the function. And the return type of the called function has to match the type of the current function."}
|
||||||
, { 'CALL_TR', 16#05, 2, true, 8, [a,is], call_tr, "Remote tail call to given contract and function. The types of the arguments has to match the argument typs of the function. And the return type of the called function has to match the type of the current function."}
|
, { 'CALL_TR', 16#05, true, false, 8, [a,is,a], call_tr, {contract, string, integer}, any, "Remote tail call to contract Arg0 and function Arg1 with value Arg2. The types of the arguments has to match the argument typs of the function. And the return type of the called function has to match the type of the current function."}
|
||||||
, { 'JUMP', 16#06, 1, true, 3, [ii], jump, "Jump to a basic block. The basic block has to exist in the current function."}
|
, { 'CALL_GR', 16#06, true, false, 8, [a,is,a,a], call_gr, {contract, string, integer, integer}, any, "Remote call with gas cap in Arg3. Otherwise as CALL_R."}
|
||||||
, { 'JUMPIF', 16#07, 2, true, 4, [a,ii], jumpif, "Conditional jump to a basic block. If Arg0 then jump to Arg1."}
|
, { 'CALL_GTR', 16#07, true, false, 8, [a,is,a,a], call_gtr, {contract, string, integer, integer}, any, "Remote tail call with gas cap in Arg3. Otherwise as CALL_TR."}
|
||||||
, { 'SWITCH_V2', 16#08, 3, true, 4, [a,ii,ii], switch, "Conditional jump to a basic block on variant tag."}
|
, { 'JUMP', 16#08, true, true, 3, [ii], jump, {integer}, none, "Jump to a basic block. The basic block has to exist in the current function."}
|
||||||
, { 'SWITCH_V3', 16#09, 4, true, 4, [a,ii,ii,ii], switch, "Conditional jump to a basic block on variant tag."}
|
, { 'JUMPIF', 16#09, true, true, 4, [a,ii], jumpif, {boolean, integer}, none, "Conditional jump to a basic block. If Arg0 then jump to Arg1."}
|
||||||
, { 'SWITCH_VN', 16#0a, 2, true, 4, [a, li], switch, "Conditional jump to a basic block on variant tag."}
|
, { 'SWITCH_V2', 16#0a, true, true, 4, [a,ii,ii], switch, {variant, integer, ingeger}, none, "Conditional jump to a basic block on variant tag."}
|
||||||
, { 'PUSH', 16#0b, 1, false, 2, [a], push, "Push argument to stack."}
|
, { 'SWITCH_V3', 16#0b, true, true, 4, [a,ii,ii,ii], switch, {variant, integer, integer, ingeger}, none, "Conditional jump to a basic block on variant tag."}
|
||||||
, { 'DUPA', 16#0c, 0, false, 3, atomic, dup, "push copy of accumulator on stack."}
|
, { 'SWITCH_VN', 16#0c, true, true, 4, [a, li], switch, {variant, {list, integer}}, none, "Conditional jump to a basic block on variant tag."}
|
||||||
, { 'DUP', 16#0d, 1, false, 3, [a], dup, "push Arg0 stack pos on top of stack."}
|
, { 'CALL_VALUE', 16#0d, false, true, 3, [a], call_value, {}, integer, "The value sent in the current remote call."}
|
||||||
, { 'POP', 16#0e, 1, false, 3, [a], pop, "Arg0 := top of stack."}
|
, { 'PUSH', 16#0e, false, true, 13, [a], push, {any}, any, "Push argument to stack."}
|
||||||
, { 'STORE', 16#0f, 2, false, 3, [a,a], store, "Arg0 := Arg1."}
|
, { 'DUPA', 16#0f, false, true, 8, [], dup, {any}, any, "Duplicate top of stack."}
|
||||||
, { 'INCA', 16#10, 0, false, 2, atomic, inc, "Increment accumulator."}
|
, { 'DUP', 16#10, false, true, 11, [a], dup, {any}, any, "push Arg0 stack pos on top of stack."}
|
||||||
, { 'INC', 16#11, 1, false, 2, [a], inc, "Increment argument."}
|
, { 'POP', 16#11, false, true, 15, [a], pop, {integer}, integer, "Arg0 := top of stack."}
|
||||||
, { 'DECA', 16#12, 0, false, 2, atomic, dec, "Decrement accumulator."}
|
, { 'INCA', 16#12, false, true, 14, [], inc, {integer}, integer, "Increment accumulator."}
|
||||||
, { 'DEC', 16#13, 1, false, 2, [a], dec, "Decrement argument."}
|
, { 'INC', 16#13, false, true, 15, [a], inc, {integer}, integer, "Increment argument."}
|
||||||
, { 'ADD', 16#14, 3, false, 3, [a,a,a], add, "Arg0 := Arg1 + Arg2."}
|
, { 'DECA', 16#14, false, true, 13, [], dec, {integer}, integer, "Decrement accumulator."}
|
||||||
, { 'SUB', 16#15, 3, false, 3, [a,a,a], sub, "Arg0 := Arg1 - Arg2."}
|
, { 'DEC', 16#15, false, true, 14, [a], dec, {integer}, integer, "Decrement argument."}
|
||||||
, { 'MUL', 16#16, 3, false, 3, [a,a,a], mul, "Arg0 := Arg1 * Arg2."}
|
, { 'ADD', 16#16, false, true, 18, [a,a,a], add, {integer, integer}, integer, "Arg0 := Arg1 + Arg2."}
|
||||||
, { 'DIV', 16#17, 3, false, 3, [a,a,a], divide, "Arg0 := Arg1 / Arg2."}
|
, { 'SUB', 16#17, false, true, 18, [a,a,a], sub, {integer, integer}, integer, "Arg0 := Arg1 - Arg2."}
|
||||||
, { 'MOD', 16#18, 3, false, 3, [a,a,a], modulo, "Arg0 := Arg1 mod Arg2."}
|
, { 'MUL', 16#18, false, true, 16, [a,a,a], mul, {integer, integer}, integer, "Arg0 := Arg1 * Arg2."}
|
||||||
, { 'POW', 16#19, 3, false, 3, [a,a,a], pow, "Arg0 := Arg1 ^ Arg2."}
|
, { 'DIV', 16#19, false, true, 16, [a,a,a], divide, {integer, integer}, integer, "Arg0 := Arg1 / Arg2."}
|
||||||
, { 'LT', 16#20, 3, false, 3, [a,a,a], lt, "Arg0 := Arg1 < Arg2."}
|
, { 'MOD', 16#1a, false, true, 17, [a,a,a], modulo, {integer, integer}, integer, "Arg0 := Arg1 mod Arg2."}
|
||||||
, { 'GT', 16#21, 3, false, 3, [a,a,a], gt, "Arg0 := Arg1 > Arg2."}
|
, { 'POW', 16#1b, false, true, 18, [a,a,a], pow, {integer, integer}, integer, "Arg0 := Arg1 ^ Arg2."}
|
||||||
, { 'EQ', 16#22, 3, false, 3, [a,a,a], eq, "Arg0 := Arg1 = Arg2."}
|
, { 'STORE', 16#1c, false, true, 20, [a,a], store, {any}, any, "Arg0 := Arg1."}
|
||||||
, { 'ELT', 16#23, 3, false, 3, [a,a,a], elt, "Arg0 := Arg1 =< Arg2."}
|
, { 'SHA3', 16#1d, false, true, 45, [a,a], sha3, {any}, hash, "Arg0 := sha3(Arg1)."}
|
||||||
, { 'EGT', 16#24, 3, false, 3, [a,a,a], egt, "Arg0 := Arg1 >= Arg2."}
|
, { 'SHA256', 16#1e, false, true, 43, [a,a], sha256, {any}, hash, "Arg0 := sha256(Arg1)."}
|
||||||
, { 'NEQ', 16#25, 3, false, 3, [a,a,a], neq, "Arg0 := Arg1 /= Arg2."}
|
, { 'BLAKE2B', 16#1f, false, true, 40, [a,a], blake2b, {any}, hash, "Arg0 := blake2b(Arg1)."}
|
||||||
, { 'AND', 16#26, 3, false, 3, [a,a,a], and_op, "Arg0 := Arg1 and Arg2."}
|
, { 'LT', 16#20, false, true, 15, [a,a,a], lt, {integer, integer}, boolean, "Arg0 := Arg1 < Arg2."}
|
||||||
, { 'OR', 16#27, 3, false, 3, [a,a,a], or_op, "Arg0 := Arg1 or Arg2."}
|
, { 'GT', 16#21, false, true, 15, [a,a,a], gt, {integer, integer}, boolean, "Arg0 := Arg1 > Arg2."}
|
||||||
, { 'NOT', 16#28, 2, false, 3, [a,a], not_op, "Arg0 := not Arg1."}
|
, { 'EQ', 16#22, false, true, 15, [a,a,a], eq, {integer, integer}, boolean, "Arg0 := Arg1 = Arg2."}
|
||||||
, { 'TUPLE', 16#29, 1, false, 3, [ii], tuple, "Create a tuple of size = Arg0. Elements on stack."}
|
, { 'ELT', 16#23, false, true, 16, [a,a,a], elt, {integer, integer}, boolean, "Arg0 := Arg1 =< Arg2."}
|
||||||
, { 'ELEMENT', 16#2a, 4, false, 3, [t,a,a,a], element_op, "Arg1 := element(Arg2, Arg3). The element should be of type Arg1"}
|
, { 'EGT', 16#24, false, true, 15, [a,a,a], egt, {integer, integer}, boolean, "Arg0 := Arg1 >= Arg2."}
|
||||||
, { 'MAP_EMPTY', 16#2b, 1, false, 3, [a], map_empty, "Arg0 := #{}."}
|
, { 'NEQ', 16#25, false, true, 16, [a,a,a], neq, {integer, integer}, boolean, "Arg0 := Arg1 /= Arg2."}
|
||||||
, { 'MAP_LOOKUP', 16#2c, 3, false, 3, [a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1."}
|
, { 'AND', 16#26, false, true, 16, [a,a,a], and_op, {boolean, boolean}, boolean, "Arg0 := Arg1 and Arg2."}
|
||||||
, { 'MAP_LOOKUPD', 16#2d, 4, false, 3, [a,a,a,a], map_lookup, "Arg0 := lookup key Arg2 in map Arg1 if key exists in map otherwise Arg0 := Arg3."}
|
, { 'OR', 16#27, false, true, 16, [a,a,a], or_op, {boolean, boolean}, boolean, "Arg0 := Arg1 or Arg2."}
|
||||||
, { 'MAP_UPDATE', 16#2e, 4, false, 3, [a,a,a,a], map_update, "Arg0 := update key Arg2 in map Arg1 with value Arg3."}
|
, { 'NOT', 16#28, false, true, 13, [a,a], not_op, {boolean}, boolean, "Arg0 := not Arg1."}
|
||||||
, { 'MAP_DELETE', 16#2f, 3, false, 3, [a,a,a], map_delete, "Arg0 := delete key Arg2 from map Arg1."}
|
, { 'TUPLE', 16#29, false, true, 15, [a,ii], tuple, {integer}, tuple, "Arg0 := tuple of size = Arg1. Elements on stack."}
|
||||||
, { 'MAP_MEMBER', 16#30, 3, false, 3, [a,a,a], map_member, "Arg0 := true if key Arg2 is in map Arg1."}
|
, { 'ELEMENT', 16#2a, false, true, 3, [a,a,a], element_op, {integer, tuple}, any, "Arg1 := element(Arg2, Arg3)."}
|
||||||
, { 'MAP_FROM_LIST',16#31, 2, false, 3, [a,a], map_from_list, "Arg0 := make a map from (key, value) list in Arg1."}
|
, { 'SETELEMENT', 16#2b, false, true, 3, [a,a,a,a], setelement, {integer, tuple, any}, tuple, "Arg0 := a new tuple similar to Arg2, but with element number Arg1 replaced by Arg3."}
|
||||||
, { 'NIL', 16#32, 1, false, 3, [a], nil, "Arg0 := []."}
|
, { 'MAP_EMPTY', 16#2c, false, true, 3, [a], map_empty, {}, map, "Arg0 := #{}."}
|
||||||
, { 'IS_NIL', 16#33, 2, false, 3, [a,a], is_nil, "Arg0 := true if Arg1 == []."}
|
, { 'MAP_LOOKUP', 16#2d, false, true, 3, [a,a,a], map_lookup, {map, any}, any, "Arg0 := lookup key Arg2 in map Arg1."}
|
||||||
, { 'CONS', 16#34, 3, false, 3, [a,a,a], cons, "Arg0 := [Arg1|Arg2]."}
|
, { 'MAP_LOOKUPD', 16#2e, false, true, 3, [a,a,a,a], map_lookup, {map, any, any}, any, "Arg0 := lookup key Arg2 in map Arg1 if key exists in map otherwise Arg0 := Arg3."}
|
||||||
, { 'HD', 16#35, 2, false, 3, [a,a], hd, "Arg0 := head of list Arg1."}
|
, { 'MAP_UPDATE', 16#2f, false, true, 3, [a,a,a,a], map_update, {map, any, any}, map, "Arg0 := update key Arg2 in map Arg1 with value Arg3."}
|
||||||
, { 'TL', 16#36, 2, false, 3, [a,a], tl, "Arg0 := tail of list Arg1."}
|
, { 'MAP_DELETE', 16#30, false, true, 3, [a,a,a], map_delete, {map, any}, map, "Arg0 := delete key Arg2 from map Arg1."}
|
||||||
, { 'LENGTH', 16#37, 2, false, 3, [a,a], length, "Arg0 := length of list Arg1."}
|
, { 'MAP_MEMBER', 16#31, false, true, 3, [a,a,a], map_member, {map, any}, boolean, "Arg0 := true if key Arg2 is in map Arg1."}
|
||||||
, { 'STR_EQ', 16#38, 3, false, 3, [a,a,a], str_eq, "Arg0 := true iff the strings Arg1 and Arg2 are the same."}
|
, { 'MAP_FROM_LIST', 16#32, false, true, 3, [a,a], map_from_list, {{list, {tuple, [any, any]}}}, map, "Arg0 := make a map from (key, value) list in Arg1."}
|
||||||
, { 'STR_JOIN', 16#39, 3, false, 3, [a,a,a], str_join, "Arg0 := string Arg1 followed by string Arg2."}
|
, { 'IS_NIL', 16#33, false, true, 3, [a,a], is_nil, {list}, boolean, "Arg0 := true if Arg1 == []."}
|
||||||
, { 'INT_TO_STR', 16#40, 2, false, 3, [a,a], int_to_str, "Arg0 := turn integer Arg1 into a string."}
|
, { 'CONS', 16#34, false, true, 3, [a,a,a], cons, {any, list}, list, "Arg0 := [Arg1|Arg2]."}
|
||||||
, { 'ADDR_TO_STR', 16#41, 2, false, 3, [a,a], addr_to_str, "Arg0 := turn address Arg1 into a string."}
|
, { 'HD', 16#35, false, true, 3, [a,a], hd, {list}, any, "Arg0 := head of list Arg1."}
|
||||||
, { 'STR_REVERSE', 16#42, 2, false, 3, [a,a], str_reverse, "Arg0 := the reverse of string Arg1."}
|
, { 'TL', 16#36, false, true, 3, [a,a], tl, {list}, list, "Arg0 := tail of list Arg1."}
|
||||||
, { 'INT_TO_ADDR', 16#43, 2, false, 3, [a,a], int_to_addr, "Arg0 := turn integer Arg1 into an address."}
|
, { 'LENGTH', 16#37, false, true, 3, [a,a], length, {list}, integer, "Arg0 := length of list Arg1."}
|
||||||
, { 'VARIANT', 16#44, 4, false, 3, [a,a,a,a], variant, "Arg0 := create a variant of size Arg1 with the tag Arg2 (Arg2 < Arg1) and take Arg3 elements from the stack."}
|
, { 'NIL', 16#38, false, true, 3, [a], nil, {}, list, "Arg0 := []."}
|
||||||
, { 'VARIANT_TEST', 16#45, 3, false, 3, [a,a,a], variant_test, "Arg0 := true if variant Arg1 has the tag Arg2."}
|
, { 'STR_JOIN', 16#39, false, true, 3, [a,a,a], str_join, {string, string}, string, "Arg0 := string Arg1 followed by string Arg2."}
|
||||||
, { 'VARIANT_ELEMENT',16#46, 3, false, 3, [a,a,a], variant_element, "Arg0 := element number Arg2 from variant Arg1."}
|
, { 'INT_TO_STR', 16#3a, false, true, 3, [a,a], int_to_str, {integer}, string, "Arg0 := turn integer Arg1 into a string."}
|
||||||
, { 'BITS_NONEA', 16#47, 0, false, 3, atomic, bits_none, "accumulator := empty bitmap."}
|
, { 'ADDR_TO_STR', 16#3b, false, true, 3, [a,a], addr_to_str, {address}, string, "Arg0 := turn address Arg1 into a string."}
|
||||||
, { 'BITS_NONE', 16#48, 1, false, 3, [a], bits_none, "Arg0 := empty bitmap."}
|
, { 'STR_REVERSE', 16#3c, false, true, 3, [a,a], str_reverse, {string}, string, "Arg0 := the reverse of string Arg1."}
|
||||||
, { 'BITS_ALLA', 16#49, 0, false, 3, atomic, bits_all, "accumulator := full bitmap."}
|
, { 'APPEND', 16#3d, false, true, 3, [a,a,a], append, {list, list}, list, "Arg0 := Arg1 ++ Arg2."}
|
||||||
, { 'BITS_ALL', 16#50, 1, false, 3, [a], bits_all, "Arg0 := full bitmap."}
|
, { 'INT_TO_ADDR', 16#3e, false, true, 3, [a,a], int_to_addr, {integer}, address, "Arg0 := turn integer Arg1 into an address."}
|
||||||
, { 'BITS_ALL_N', 16#51, 2, false, 3, [a,a], bits_all_n, "Arg0 := bitmap with Arg1 bits set."}
|
, { 'VARIANT', 16#3f, false, true, 3, [a,a,a,a], variant, {integer, integer, integer}, variant, "Arg0 := create a variant of size Arg1 with the tag Arg2 (Arg2 < Arg1) and take Arg3 elements from the stack."}
|
||||||
, { 'BITS_SET', 16#52, 3, false, 3, [a,a,a], bits_set, "Arg0 := set bit Arg2 of bitmap Arg1."}
|
, { 'VARIANT_TEST', 16#40, false, true, 3, [a,a,a], variant_test, {variant, integer}, boolean, "Arg0 := true if variant Arg1 has the tag Arg2."}
|
||||||
, { 'BITS_CLEAR', 16#53, 3, false, 3, [a,a,a], bits_clear, "Arg0 := clear bit Arg2 of bitmap Arg1."}
|
, { 'VARIANT_ELEMENT', 16#41, false, true, 3, [a,a,a], variant_element, {variant, integer}, any, "Arg0 := element number Arg2 from variant Arg1."}
|
||||||
, { 'BITS_TEST', 16#54, 3, false, 3, [a,a,a], bits_test, "Arg0 := true if bit Arg2 of bitmap Arg1 is set."}
|
, { 'BITS_NONEA', 16#42, false, true, 3, [], bits_none, {}, bits, "push an empty bitmap on the stack."}
|
||||||
, { 'BITS_SUM', 16#55, 2, false, 3, [a,a], bits_sum, "Arg0 := sum of set bits in bitmap Arg1. Exception if infinit bitmap."}
|
, { 'BITS_NONE', 16#43, false, true, 3, [a], bits_none, {}, bits, "Arg0 := empty bitmap."}
|
||||||
, { 'BITS_OR', 16#56, 3, false, 3, [a,a,a], bits_or, "Arg0 := Arg1 v Arg2."}
|
, { 'BITS_ALLA', 16#44, false, true, 3, [], bits_all, {}, bits, "push a full bitmap on the stack."}
|
||||||
, { 'BITS_AND', 16#57, 3, false, 3, [a,a,a], bits_and, "Arg0 := Arg1 ^ Arg2."}
|
, { 'BITS_ALL', 16#45, false, true, 3, [a], bits_all, {}, bits, "Arg0 := full bitmap."}
|
||||||
, { 'BITS_DIFF', 16#58, 3, false, 3, [a,a,a], bits_diff, "Arg0 := Arg1 - Arg2."}
|
, { 'BITS_ALL_N', 16#46, false, true, 3, [a,a], bits_all_n, {integer}, bits, "Arg0 := bitmap with Arg1 bits set."}
|
||||||
, { 'ADDRESS', 16#59, 1, false, 3, [a], address, "Arg0 := The current contract address."}
|
, { 'BITS_SET', 16#47, false, true, 3, [a,a,a], bits_set, {bits, integer}, bits, "Arg0 := set bit Arg2 of bitmap Arg1."}
|
||||||
, { 'BALANCE', 16#5a, 1, false, 3, [a], balance, "Arg0 := The current contract address."}
|
, { 'BITS_CLEAR', 16#48, false, true, 3, [a,a,a], bits_clear, {bits, integer}, bits, "Arg0 := clear bit Arg2 of bitmap Arg1."}
|
||||||
, { 'ORIGIN', 16#5b, 1, false, 3, [a], origin, "Arg0 := Address of contract called by the call transaction."}
|
, { 'BITS_TEST', 16#49, false, true, 3, [a,a,a], bits_test, {bits, integer}, boolean, "Arg0 := true if bit Arg2 of bitmap Arg1 is set."}
|
||||||
, { 'CALLER', 16#5c, 1, false, 3, [a], caller, "Arg0 := The address that signed the call transaction."}
|
, { 'BITS_SUM', 16#4a, false, true, 3, [a,a], bits_sum, {bits}, integer, "Arg0 := sum of set bits in bitmap Arg1. Exception if infinit bitmap."}
|
||||||
, { 'GASPRICE', 16#5d, 1, false, 3, [a], gasprice, "Arg0 := The current gas price."}
|
, { 'BITS_OR', 16#4b, false, true, 3, [a,a,a], bits_or, {bits, bits}, bits, "Arg0 := Arg1 v Arg2."}
|
||||||
, { 'BLOCKHASH', 16#5e, 1, false, 3, [a], blockhash, "Arg0 := The current blockhash."} %% TODO: Do we support has at height?
|
, { 'BITS_AND', 16#4c, false, true, 3, [a,a,a], bits_and, {bits, bits}, bits, "Arg0 := Arg1 ^ Arg2."}
|
||||||
, { 'BENEFICIARY', 16#5f, 1, false, 3, [a], beneficiary, "Arg0 := The address of the current beneficiary."}
|
, { 'BITS_DIFF', 16#4d, false, true, 3, [a,a,a], bits_diff, {bits, bits}, bits, "Arg0 := Arg1 - Arg2."}
|
||||||
, { 'TIMESTAMP', 16#60, 1, false, 3, [a], timestamp, "Arg0 := The current timestamp. Unrelaiable, don't use for anything."}
|
, { 'BALANCE', 16#4e, false, true, 3, [a], balance, {}, integer, "Arg0 := The current contract balance."}
|
||||||
, { 'GENERATION', 16#61, 1, false, 3, [a], generation, "Arg0 := The block height of the cureent generation."}
|
, { 'ORIGIN', 16#4f, false, true, 3, [a], origin, {}, address, "Arg0 := Address of contract called by the call transaction."}
|
||||||
, { 'MICROBLOCK', 16#62, 1, false, 3, [a], microblock, "Arg0 := The current micro block number."}
|
, { 'CALLER', 16#50, false, true, 3, [a], caller, {}, address, "Arg0 := The address that signed the call transaction."}
|
||||||
, { 'DIFFICULTY', 16#63, 1, false, 3, [a], difficulty, "Arg0 := The current difficulty."}
|
, { 'GASPRICE', 16#51, false, true, 3, [a], gasprice, {}, integer, "Arg0 := The current gas price."}
|
||||||
, { 'GASLIMIT', 16#64, 1, false, 3, [a], gaslimit, "Arg0 := The current gaslimit."}
|
, { 'BLOCKHASH', 16#52, false, true, 3, [a,a], blockhash, {integer}, hash, "Arg0 := The blockhash at height Arg1."}
|
||||||
, { 'GAS', 16#65, 1, false, 3, [a], gas, "Arg0 := The amount of gas left."}
|
, { 'BENEFICIARY', 16#53, false, true, 3, [a], beneficiary, {}, address, "Arg0 := The address of the current beneficiary."}
|
||||||
|
, { 'TIMESTAMP', 16#54, false, true, 3, [a], timestamp, {}, integer, "Arg0 := The current timestamp. Unrelaiable, don't use for anything."}
|
||||||
|
, { 'GENERATION', 16#55, false, true, 3, [a], generation, {}, integer, "Arg0 := The block height of the cureent generation."}
|
||||||
|
, { 'MICROBLOCK', 16#56, false, true, 3, [a], microblock, {}, integer, "Arg0 := The current micro block number."}
|
||||||
|
, { 'DIFFICULTY', 16#57, false, true, 3, [a], difficulty, {}, integer, "Arg0 := The current difficulty."}
|
||||||
|
, { 'GASLIMIT', 16#58, false, true, 3, [a], gaslimit, {}, integer, "Arg0 := The current gaslimit."}
|
||||||
|
, { 'GAS', 16#59, false, true, 3, [a], gas, {}, integer, "Arg0 := The amount of gas left."}
|
||||||
|
, { 'ADDRESS', 16#5a, false, true, 3, [a], address, {}, address, "Arg0 := The current contract address."}
|
||||||
|
|
||||||
, { 'LOG0', 16#66, 2, false, 3, [a,a], log, "Create a log message in the call object."}
|
, { 'LOG0', 16#5b, false, true, 3, [a], log, {string}, none, "Create a log message in the call object."}
|
||||||
, { 'LOG1', 16#67, 3, false, 3, [a,a,a], log, "Create a log message with one topic in the call object."}
|
, { 'LOG1', 16#5c, false, true, 3, [a,a], log, {integer, string}, none, "Create a log message with one topic in the call object."}
|
||||||
, { 'LOG2', 16#68, 4, false, 3, [a,a,a,a], log, "Create a log message with two topics in the call object."}
|
, { 'LOG2', 16#5d, false, true, 3, [a,a,a], log, {integer, integer, string}, none, "Create a log message with two topics in the call object."}
|
||||||
, { 'LOG3', 16#69, 5, false, 3, [a,a,a,a,a], log, "Create a log message with three topics in the call object."}
|
, { 'LOG3', 16#5e, false, true, 3, [a,a,a,a], log, {integer, integer, integer, string}, none, "Create a log message with three topics in the call object."}
|
||||||
, { 'LOG4', 16#6a, 6, false, 3, [a,a,a,a,a,a], log, "Create a log message with four topics in the call object."}
|
, { 'LOG4', 16#5f, false, true, 3, [a,a,a,a,a], log, {integer, integer, integer, integer, string}, none, "Create a log message with four topics in the call object."}
|
||||||
, { 'DEACTIVATE', 16#6b, 0, false, 3, atomic, deactivate, "Mark the current contract for deactication."}
|
|
||||||
%% Transaction ops
|
%% Transaction ops
|
||||||
, { 'SPEND', 16#6c, 2, false,3, [a,a], spend, "Transfer Arg0 tokens to account Arg1. (If the contract account has at least that many tokens."}
|
, { 'SPEND', 16#60, false, false, 3, [a,a], spend, {address, integer}, none, "Transfer Arg1 tokens to account Arg0. (If the contract account has at least that many tokens."}
|
||||||
, { 'ORACLE_REGISTER', 16#6d, 6, false,3, [a,a,a,a,a,a], oracle_register, "Mark the current contract for deactication."}
|
, { 'ORACLE_REGISTER', 16#61, false, false, 3, [a,a,a,a,a,a,a], oracle_register, {signature, address, integer, variant, typerep, typerep}, oracle, "Arg0 := New oracle with address Arg2, query fee Arg3, TTL Arg4, query type Arg5 and response type Arg6. Arg0 contains delegation signature."}
|
||||||
%% TODO:
|
, { 'ORACLE_QUERY', 16#62, false, false, 3, [a,a,a,a,a,a,a,a], oracle_query, {oracle, any, integer, variant, variant, typerep, typerep}, oracle_query, "Arg0 := New oracle query for oracle Arg1, question in Arg2, query fee in Arg3, query TTL in Arg4, response TTL in Arg5. Typereps for checking oracle type is in Arg6 and Arg7."}
|
||||||
, { 'ORACLE_QUERY', 16#6e, 0, false,3, atomic, oracle_query, ""}
|
, { 'ORACLE_RESPOND', 16#63, false, false, 3, [a,a,a,a,a,a], oracle_respond, {signature, oracle, oracle_query,any, typerep, typerep}, none, "Respond as oracle Arg1 to query in Arg2 with response Arg3. Arg0 contains delegation signature. Typereps for checking oracle type is in Arg4 and Arg5."}
|
||||||
, { 'ORACLE_RESPOND', 16#6f, 0, false,3, atomic, oracle_respond, ""}
|
, { 'ORACLE_EXTEND', 16#64, false, false, 3, [a,a,a], oracle_extend, {signature, oracle, variant}, none, "Extend oracle in Arg1 with TTL in Arg2. Arg0 contains delegation signature."}
|
||||||
, { 'ORACLE_EXTEND', 16#70, 0, false,3, atomic, oracle_extend, ""}
|
, { 'ORACLE_GET_ANSWER', 16#65, false, false, 3, [a,a,a,a,a], oracle_get_answer, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := option variant with answer (if any) from oracle query in Arg1 given by oracle Arg0. Typereps for checking oracle type is in Arg3 and Arg4."}
|
||||||
, { 'ORACLE_GET_ANSWER', 16#71, 0, false,3, atomic, oracle_get_answer, ""}
|
, { 'ORACLE_GET_QUESTION', 16#66, false, false, 3, [a,a,a,a,a], oracle_get_question, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := question in oracle query Arg2 given to oracle Arg1. Typereps for checking oracle type is in Arg3 and Arg4."}
|
||||||
, { 'ORACLE_GET_QUESTION', 16#72, 0, false,3, atomic,oracle_get_question, ""}
|
, { 'ORACLE_QUERY_FEE', 16#67, false, false, 3, [a,a], oracle_query_fee, {oracle}, integer, "Arg0 := query fee for oracle Arg1"}
|
||||||
, { 'ORACLE_QUERY_FEE', 16#73, 0, false,3, atomic, oracle_query_fee, ""}
|
, { 'AENS_RESOLVE', 16#68, false, false, 3, [a,a,a,a], aens_resolve, {string, string, typerep}, variant, "Resolve name in Arg0 with tag Arg1. Arg2 describes the type parameter of the resolved name."}
|
||||||
, { 'AENS_RESOLVE', 16#74, 0, false,3, atomic, aens_resolve, ""}
|
, { 'AENS_PRECLAIM', 16#69, false, false, 3, [a,a,a], aens_preclaim, {signature, address, hash}, none, "Preclaim the hash in Arg2 for address in Arg1. Arg0 contains delegation signature."}
|
||||||
, { 'AENS_PRECLAIM', 16#75, 0, false,3, atomic, aens_preclaim, ""}
|
, { 'AENS_CLAIM', 16#6a, false, false, 3, [a,a,a,a], aens_claim, {signature, address, string, integer}, none, "Claim the name in Arg2 for address in Arg1. Arg3 contains the salt used to hash the preclaim. Arg0 contains delegation signature."}
|
||||||
, { 'AENS_CLAIM', 16#76, 0, false,3, atomic, aens_claim, ""}
|
, { 'AENS_UPDATE', 16#6b, false, false, 3, [], aens_update, {}, none, "NYI"}
|
||||||
, { 'AENS_UPDATE', 16#77, 0, false,3, atomic, aend_update, ""}
|
, { 'AENS_TRANSFER', 16#6c, false, false, 3, [a,a,a,a], aens_transfer,{signature, address, address, string}, none, "Transfer ownership of name Arg3 from account Arg1 to Arg2. Arg0 contains delegation signature."}
|
||||||
, { 'AENS_TRANSFER', 16#78, 0, false,3, atomic, aens_transfer, ""}
|
, { 'AENS_REVOKE', 16#6d, false, false, 3, [a,a,a], aens_revoke, {signature, address, string}, none, "Revoke the name in Arg2 from owner Arg1. Arg0 contains delegation signature."}
|
||||||
, { 'AENS_REVOKE', 16#79, 0, false,3, atomic, aens_revoke, ""}
|
, { 'BALANCE_OTHER', 16#6e, false, true, 3, [a,a], balance_other, {address}, integer, "Arg0 := The balance of address Arg1."}
|
||||||
, { 'ECVERIFY', 16#7a, 0, false,3, atomic, ecverify, ""}
|
%% TODO: Reorder these before documenting the specification
|
||||||
, { 'SHA3', 16#7b, 0, false,3, atomic, sha3, ""}
|
, { 'MAP_SIZE', 16#6f, false, true, 3, [a,a], map_size_, {map}, integer, "Arg0 := The size of the map Arg1."}
|
||||||
, { 'SHA256', 16#7c, 0, false,3, atomic, sha256, ""}
|
, { 'MAP_TO_LIST', 16#70, false, true, 3, [a,a], map_to_list, {map}, list, "Arg0 := The tuple list representation of the map Arg1."}
|
||||||
, { 'BLAKE2B', 16#7d, 0, false,3, atomic, blake2b, ""}
|
, { 'STR_LENGTH', 16#71, false, true, 3, [a,a], str_length, {string}, integer, "Arg0 := The length of the string Arg1."}
|
||||||
|
|
||||||
|
, { 'ECVERIFY', 16#72, false, true, 1300, [a,a,a,a], ecverify, {bytes, address, bytes}, boolean, "Arg0 := ecverify(Hash, PubKey, Signature)"}
|
||||||
|
, { 'ECVERIFY_SECP256K1', 16#73, false, true, 1300, [a,a,a,a], ecverify_secp256k1, {bytes, bytes, bytes}, boolean, "Arg0 := ecverify_secp256k1(Hash, PubKey, Signature)"}
|
||||||
|
|
||||||
, { 'DUMMY7ARG', 16#f9, 7, false,3, [a,a,a,a,a,a,a], dummyarg, "Temporary dummy instruction to test 7 args."}
|
, { 'CONTRACT_TO_ADDRESS', 16#74, false, true, 3, [a,a], contract_to_address, {contract}, address, "Arg0 := Arg1 - A no-op type conversion"}
|
||||||
, { 'DUMMY8ARG', 16#fa, 8, false,3, [a,a,a,a,a,a,a,a],dummyarg, "Temporary dummy instruction to test 8 args."}
|
, { 'AUTH_TX_HASH', 16#75, false, true, 3, [a], auth_tx_hash, {}, variant, "If in GA authentication context return Some(TxHash) otherwise None."}
|
||||||
, { 'ABORT', 16#fb, 1, false, 3, [a], abort, "Abort execution (dont use all gas) with error message in Arg0."}
|
|
||||||
, { 'EXIT', 16#fc, 1, false, 3, [a], exit, "Abort execution (use upp all gas) with error message in Arg0."}
|
, { 'BYTES_TO_INT', 16#76, false, true, 3, [a,a], bytes_to_int, {bytes}, integer, "Arg0 := bytes_to_int(Arg1)"}
|
||||||
, { 'NOP', 16#fd, 0, false, 1, atomic, nop, "The no op. does nothing."}
|
, { 'BYTES_TO_STR', 16#77, false, true, 3, [a,a], bytes_to_str, {bytes}, string, "Arg0 := bytes_to_str(Arg1)"}
|
||||||
%% FUNCTION 16#fe "Function declaration and entrypoint."
|
|
||||||
%% EXTEND 16#ff "Reserved for future extensions beyond one byte opcodes."
|
, { 'ORACLE_CHECK', 16#78, false, false, 3, [a,a,a,a], oracle_check, {oracle, typerep, typerep}, bool, "Arg0 := is Arg1 an oracle with the given query (Arg2) and response (Arg3) types"}
|
||||||
|
, { 'ORACLE_CHECK_QUERY', 16#79, false, false, 3, [a,a,a,a,a], oracle_check_query, {oracle, oracle_query, typerep, typerep}, bool, "Arg0 := is Arg2 a query for the oracle Arg1 with the given types (Arg3, Arg4)"}
|
||||||
|
|
||||||
|
, { 'IS_ORACLE', 16#7a, false, false, 3, [a,a], is_oracle, {address}, bool, "Arg0 := is Arg1 an oracle"}
|
||||||
|
, { 'IS_CONTRACT', 16#7b, false, false, 3, [a,a], is_contract, {address}, bool, "Arg0 := is Arg1 a contract"}
|
||||||
|
, { 'CREATOR', 16#7c, false, true, 3, [a], contract_creator, {}, address, "Arg0 := contract creator"}
|
||||||
|
|
||||||
|
, { 'DEACTIVATE', 16#fa, false, true, 3, [], deactivate, {}, none, "Mark the current contract for deactivation."}
|
||||||
|
, { 'ABORT', 16#fb, true, true, 3, [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."}
|
||||||
|
, { 'EXIT', 16#fc, true, true, 3, [a], exit, {string}, none, "Abort execution (use upp all gas) with error message in Arg0."}
|
||||||
|
, { 'NOP', 16#fd, false, true, 1, [], nop, {}, none, "The no op. does nothing."}
|
||||||
|
%% FUNCTION 16#fe "Function declaration and entrypoint."
|
||||||
|
%% EXTEND 16#ff "Reserved for future extensions beyond one byte opcodes."
|
||||||
].
|
].
|
||||||
|
|
||||||
|
|
||||||
@@ -167,13 +204,17 @@ generate_opcodes_ops(Modulename, HrlFile, SrcDir, Ops) ->
|
|||||||
ToOp = lists:flatten([gen_m_to_op(Op) || Op <- Ops]),
|
ToOp = lists:flatten([gen_m_to_op(Op) || Op <- Ops]),
|
||||||
Args = lists:flatten([gen_args(Op) || Op <- Ops]),
|
Args = lists:flatten([gen_args(Op) || Op <- Ops]),
|
||||||
EndBB = lists:flatten([gen_bb(Op) || Op <- Ops]),
|
EndBB = lists:flatten([gen_bb(Op) || Op <- Ops]),
|
||||||
|
InAuth = lists:flatten([gen_in_auth(Op) || Op <- Ops]),
|
||||||
|
ResType = lists:flatten([gen_res_type(Op) || Op <- Ops]),
|
||||||
|
|
||||||
io:format(File, "~s", [prelude("Provides opcode primitives.\n")]),
|
io:format(File, "~s", [prelude("Provides opcode primitives.\n")]),
|
||||||
io:format(File, "~s", [ops_exports(Modulename, HrlFile,
|
io:format(File, "~s", [ops_exports(Modulename, HrlFile,
|
||||||
["args/1\n"
|
["args/1\n"
|
||||||
" , end_bb/1\n"
|
" , end_bb/1\n"
|
||||||
|
" , in_auth/1\n"
|
||||||
" , mnemonic/1\n"
|
" , mnemonic/1\n"
|
||||||
" , m_to_op/1\n"
|
" , m_to_op/1\n"
|
||||||
|
" , result_type/1\n"
|
||||||
])]),
|
])]),
|
||||||
|
|
||||||
io:format(File, "%% FATE mnemonics\n~s", [Mnemonic]),
|
io:format(File, "%% FATE mnemonics\n~s", [Mnemonic]),
|
||||||
@@ -188,6 +229,12 @@ generate_opcodes_ops(Modulename, HrlFile, SrcDir, Ops) ->
|
|||||||
io:format(File, "%% Does FATE Op end a Basic Block?\n~s", [EndBB]),
|
io:format(File, "%% Does FATE Op end a Basic Block?\n~s", [EndBB]),
|
||||||
io:format(File, "end_bb(_) -> false.\n\n", []),
|
io:format(File, "end_bb(_) -> false.\n\n", []),
|
||||||
|
|
||||||
|
io:format(File, "%% Is FATE Op allowed in GA Authentication context?\n~s", [InAuth]),
|
||||||
|
io:format(File, "in_auth(_) -> false.\n\n", []),
|
||||||
|
|
||||||
|
io:format(File, "%% What is the result type.\n~s", [ResType]),
|
||||||
|
io:format(File, "result_type(_) -> none.\n\n", []),
|
||||||
|
|
||||||
file:close(File).
|
file:close(File).
|
||||||
|
|
||||||
generate_code_ops(Modulename, SrcDir, Ops) ->
|
generate_code_ops(Modulename, SrcDir, Ops) ->
|
||||||
@@ -211,7 +258,7 @@ generate_code_ops(Modulename, SrcDir, Ops) ->
|
|||||||
"-type fate_arg_immediate(T) :: {immediate, T}.\n"
|
"-type fate_arg_immediate(T) :: {immediate, T}.\n"
|
||||||
"-type fate_arg_var() :: {var, integer()}.\n"
|
"-type fate_arg_var() :: {var, integer()}.\n"
|
||||||
"-type fate_arg_arg() :: {arg, integer()}.\n"
|
"-type fate_arg_arg() :: {arg, integer()}.\n"
|
||||||
"-type fate_arg_stack() :: {stack, integer()}.\n"
|
"-type fate_arg_stack() :: {stack, 0}.\n"
|
||||||
"-type fate_arg() :: fate_arg_immediate()\n"
|
"-type fate_arg() :: fate_arg_immediate()\n"
|
||||||
" | fate_arg_var()\n"
|
" | fate_arg_var()\n"
|
||||||
" | fate_arg_arg()\n"
|
" | fate_arg_arg()\n"
|
||||||
@@ -242,7 +289,7 @@ gen_type_exports(#{type_name := TypeName}) ->
|
|||||||
gen_constructor_exports(#{constructor_type := Function}) ->
|
gen_constructor_exports(#{constructor_type := Function}) ->
|
||||||
lists:flatten(io_lib:format(" , ~s\n", [Function])).
|
lists:flatten(io_lib:format(" , ~s\n", [Function])).
|
||||||
|
|
||||||
gen_constructors(#{constructor := Function, format := atomic,
|
gen_constructors(#{constructor := Function, format := [],
|
||||||
type_name := Type, opname := Name}) ->
|
type_name := Type, opname := Name}) ->
|
||||||
lists:flatten(io_lib:format("-spec ~s() -> ~s.\n"
|
lists:flatten(io_lib:format("-spec ~s() -> ~s.\n"
|
||||||
"~s() ->\n"
|
"~s() ->\n"
|
||||||
@@ -283,7 +330,7 @@ gen_arg_uses(_, []) ->
|
|||||||
gen_arg_uses(N, [a]) -> io_lib:format("Arg~w", [N]);
|
gen_arg_uses(N, [a]) -> io_lib:format("Arg~w", [N]);
|
||||||
gen_arg_uses(N, [is]) -> io_lib:format("{immediate, Arg~w}", [N]);
|
gen_arg_uses(N, [is]) -> io_lib:format("{immediate, Arg~w}", [N]);
|
||||||
gen_arg_uses(N, [ii]) -> io_lib:format("{immediate, Arg~w}", [N]);
|
gen_arg_uses(N, [ii]) -> io_lib:format("{immediate, Arg~w}", [N]);
|
||||||
gen_arg_uses(N, [li]) -> io_lib:format("[{immediate, I} || I <- Arg~w]", [N]);
|
gen_arg_uses(N, [li]) -> io_lib:format("{immediate, Arg~w}", [N]);
|
||||||
gen_arg_uses(N, [t]) -> io_lib:format("Arg~w", [N]);
|
gen_arg_uses(N, [t]) -> io_lib:format("Arg~w", [N]);
|
||||||
gen_arg_uses(N, [a | Args]) ->
|
gen_arg_uses(N, [a | Args]) ->
|
||||||
io_lib:format("Arg~w, ", [N]) ++ gen_arg_uses(N+1, Args);
|
io_lib:format("Arg~w, ", [N]) ++ gen_arg_uses(N+1, Args);
|
||||||
@@ -311,19 +358,26 @@ gen_mnemonic(#{opname := Name, macro := Macro}) ->
|
|||||||
lists:flatten(io_lib:format("mnemonic(~21s) -> ~21w ;\n",
|
lists:flatten(io_lib:format("mnemonic(~21s) -> ~21w ;\n",
|
||||||
[Macro, Name])).
|
[Macro, Name])).
|
||||||
|
|
||||||
|
|
||||||
gen_m_to_op(#{opname := Name, macro := Macro}) ->
|
gen_m_to_op(#{opname := Name, macro := Macro}) ->
|
||||||
lists:flatten(io_lib:format("m_to_op(~21w) -> ~21s ;\n",
|
lists:flatten(io_lib:format("m_to_op(~21w) -> ~21s ;\n",
|
||||||
[Name, Macro])).
|
[Name, Macro])).
|
||||||
|
|
||||||
gen_args(#{macro := Macro, args := Args}) ->
|
gen_args(#{macro := Macro, arity := Arity}) ->
|
||||||
lists:flatten(io_lib:format("args(~21s) -> ~2w ;\n",
|
lists:flatten(io_lib:format("args(~21s) -> ~2w ;\n",
|
||||||
[Macro, Args])).
|
[Macro, Arity])).
|
||||||
|
|
||||||
gen_bb(#{macro := Macro, end_bb := EndBB}) ->
|
gen_bb(#{macro := Macro, end_bb := EndBB}) ->
|
||||||
lists:flatten(io_lib:format("end_bb(~21s) -> ~w ;\n",
|
lists:flatten(io_lib:format("end_bb(~21s) -> ~w ;\n",
|
||||||
[Macro, EndBB])).
|
[Macro, EndBB])).
|
||||||
|
|
||||||
|
gen_in_auth(#{macro := Macro, in_auth := InAuth}) ->
|
||||||
|
lists:flatten(io_lib:format("in_auth(~21s) -> ~w ;\n",
|
||||||
|
[Macro, InAuth])).
|
||||||
|
|
||||||
|
gen_res_type(#{macro := Macro, res_type := ResType}) ->
|
||||||
|
lists:flatten(io_lib:format("result_type(~21s) -> ~w ;\n",
|
||||||
|
[Macro, ResType])).
|
||||||
|
|
||||||
|
|
||||||
prelude(Doc) ->
|
prelude(Doc) ->
|
||||||
"%%%-------------------------------------------------------------------\n"
|
"%%%-------------------------------------------------------------------\n"
|
||||||
@@ -343,22 +397,24 @@ gen_defines(#{opname := Name, opcode := OpCode}) ->
|
|||||||
|
|
||||||
gen([]) ->
|
gen([]) ->
|
||||||
[];
|
[];
|
||||||
gen([{OpName, OpCode, Args, EndBB, Gas, FateFormat, Constructor, Doc} | Rest]) ->
|
gen([{OpName, OpCode, EndBB, InAuth, Gas, FateFormat, Constructor, ArgTypes, ResType, Doc} | Rest]) ->
|
||||||
|
Arity = length(FateFormat),
|
||||||
Name = atom_to_list(OpName),
|
Name = atom_to_list(OpName),
|
||||||
LowerName = string:to_lower(Name),
|
LowerName = string:to_lower(Name),
|
||||||
TypeName = "fate_" ++ LowerName ++ "()",
|
TypeName = "fate_" ++ LowerName ++ "()",
|
||||||
Macro = "?" ++ Name,
|
Macro = "?" ++ Name,
|
||||||
Type = case FateFormat of
|
Type = case FateFormat of
|
||||||
atomic -> io_lib:format("~w", [OpName]);
|
[] -> io_lib:format("~w", [OpName]);
|
||||||
ArgTypes ->
|
Args ->
|
||||||
io_lib:format("{~w, ~s}", [OpName, expand_types(ArgTypes)])
|
io_lib:format("{~w, ~s}", [OpName, expand_types(Args)])
|
||||||
end,
|
end,
|
||||||
ConstructorType = atom_to_list(Constructor) ++ "/" ++ io_lib:format("~w", [Args]),
|
ConstructorType = atom_to_list(Constructor) ++ "/" ++ io_lib:format("~w", [Arity]),
|
||||||
|
|
||||||
[#{ opname => OpName
|
[#{ opname => OpName
|
||||||
, opcode => OpCode
|
, opcode => OpCode
|
||||||
, args => Args
|
, arity => Arity
|
||||||
, end_bb => EndBB
|
, end_bb => EndBB
|
||||||
|
, in_auth => InAuth
|
||||||
, format => FateFormat
|
, format => FateFormat
|
||||||
, macro => Macro
|
, macro => Macro
|
||||||
, type_name => TypeName
|
, type_name => TypeName
|
||||||
@@ -367,6 +423,8 @@ gen([{OpName, OpCode, Args, EndBB, Gas, FateFormat, Constructor, Doc} | Rest]) -
|
|||||||
, type => Type
|
, type => Type
|
||||||
, constructor => Constructor
|
, constructor => Constructor
|
||||||
, constructor_type => ConstructorType
|
, constructor_type => ConstructorType
|
||||||
|
, arg_types => ArgTypes
|
||||||
|
, res_type => ResType
|
||||||
}| gen(Rest)].
|
}| gen(Rest)].
|
||||||
|
|
||||||
|
|
||||||
@@ -377,7 +435,7 @@ expand_types([T|Ts]) ->expand_type(T) ++ ", " ++ expand_types(Ts).
|
|||||||
expand_type(a) -> "fate_arg()";
|
expand_type(a) -> "fate_arg()";
|
||||||
expand_type(is) -> "fate_arg_immediate(aeb_fate_data:fate_string())";
|
expand_type(is) -> "fate_arg_immediate(aeb_fate_data:fate_string())";
|
||||||
expand_type(ii) -> "fate_arg_immediate(aeb_fate_data:fate_integer())";
|
expand_type(ii) -> "fate_arg_immediate(aeb_fate_data:fate_integer())";
|
||||||
expand_type(li) -> "[fate_arg_immediate(aeb_fate_data:fate_integer())]";
|
expand_type(li) -> "fate_arg_immediate([aeb_fate_data:fate_integer()])";
|
||||||
expand_type(t) -> "aeb_fate_data:fate_type_type()".
|
expand_type(t) -> "aeb_fate_data:fate_type_type()".
|
||||||
|
|
||||||
generate_scanner(TemplateFile, Outfile, Path, Ops) ->
|
generate_scanner(TemplateFile, Outfile, Path, Ops) ->
|
||||||
@@ -391,9 +449,9 @@ gen_token(#{opname := OpName}) ->
|
|||||||
io_lib:format("~-28s: {token, {mnemonic, TokenLine, ~w}}.\n",
|
io_lib:format("~-28s: {token, {mnemonic, TokenLine, ~w}}.\n",
|
||||||
[Name, OpName]).
|
[Name, OpName]).
|
||||||
|
|
||||||
insert_tokens_in_template(<<"###REPLACEWITHOPTOKENS###", Rest/binary >>, Tokens) ->
|
insert_tokens_in_template(<<"%% ###REPLACEWITHOPTOKENS###", Rest/binary >>, Tokens) ->
|
||||||
[Tokens, Rest];
|
[Tokens, Rest];
|
||||||
insert_tokens_in_template(<<"###REPLACEWITHNOTE###", Rest/binary >>, Tokens) ->
|
insert_tokens_in_template(<<"%%% ###REPLACEWITHNOTE###", Rest/binary >>, Tokens) ->
|
||||||
[
|
[
|
||||||
"%%%\n"
|
"%%%\n"
|
||||||
"%%% === === N O T E : This file is generated do not edit. === ===\n"
|
"%%% === === N O T E : This file is generated do not edit. === ===\n"
|
||||||
@@ -414,35 +472,45 @@ gen_asm_pp(Module, Path, Ops) ->
|
|||||||
io:format(File, "-module(~w).\n\n", [Module]),
|
io:format(File, "-module(~w).\n\n", [Module]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
"-export([format_op/2]).\n\n"
|
"-export([format_op/2]).\n\n"
|
||||||
"format_arg(t, T) ->\n"
|
|
||||||
" io_lib:format(\"~~p \", [T]);\n"
|
|
||||||
"format_arg(li, {immediate, LI}) ->\n"
|
"format_arg(li, {immediate, LI}) ->\n"
|
||||||
" aeb_fate_data:format(LI);\n"
|
" aeb_fate_data:format(LI);\n"
|
||||||
"format_arg(_, {immediate, I}) ->\n"
|
"format_arg(_, {immediate, I}) ->\n"
|
||||||
" aeb_fate_data:format(I);\n"
|
" aeb_fate_data:format(I);\n"
|
||||||
"format_arg(a, {arg, N}) -> io_lib:format(\"arg~~p\", [N]);\n"
|
"format_arg(a, {arg, N}) -> io_lib:format(\"arg~~p\", [N]);\n"
|
||||||
|
"format_arg(a, {var, N}) when N < 0 -> io_lib:format(\"store~~p\", [-N]);\n"
|
||||||
"format_arg(a, {var, N}) -> io_lib:format(\"var~~p\", [N]);\n"
|
"format_arg(a, {var, N}) -> io_lib:format(\"var~~p\", [N]);\n"
|
||||||
"format_arg(a, {stack, 0}) -> \"a\";\n"
|
"format_arg(a, {stack, 0}) -> \"a\".\n\n"
|
||||||
"format_arg(a, {stack, N}) -> io_lib:format(\"a~~p\", [N]).\n\n"
|
|
||||||
"lookup(Name, Symbols) ->\n"
|
"lookup(Name, Symbols) ->\n"
|
||||||
" maps:get(Name, Symbols, io_lib:format(\"~~w\",[Name])).\n\n"
|
" maps:get(Name, Symbols, io_lib:format(\"~~p\",[Name])).\n\n"
|
||||||
"~s"
|
"~s"
|
||||||
, [Formats]),
|
, [Formats]),
|
||||||
|
|
||||||
io:format(File, "format_op(Op, _Symbols) -> io_lib:format(\";; Bad Op: ~~w\\n\", [Op]).\n", []),
|
io:format(File, "format_op(Op, _Symbols) -> io_lib:format(\";; Bad Op: ~~w\\n\", [Op]).\n", []),
|
||||||
file:close(File).
|
file:close(File).
|
||||||
|
|
||||||
gen_format(#{opname := Name}) when ('CALL' =:= Name) or (Name =:= 'CALL_T') ->
|
|
||||||
io_lib:format("format_op({~w, {immediate, Function}}, Symbols) ->\n"
|
|
||||||
"[\"~s \", lookup(Function, Symbols)];",
|
|
||||||
[Name, atom_to_list(Name)]);
|
|
||||||
gen_format(#{opname := Name}) when (Name =:= 'CALL_R') or (Name =:= 'CALL_TR') ->
|
gen_format(#{opname := Name}) when (Name =:= 'CALL_R') or (Name =:= 'CALL_TR') ->
|
||||||
io_lib:format("format_op({~w, {immediate, Contract}, {immediate, Function}}, Symbols) ->\n"
|
io_lib:format("format_op({~w, {immediate, Contract}, {immediate, Function}, Value}, Symbols) ->\n"
|
||||||
"[\"~s \", lookup(Contract, Symbols), \".\", lookup(Function, Symbols)];\n"
|
" [\"~s \", lookup(Contract, Symbols), \".\", "
|
||||||
"format_op({~w, Contract, {immediate, Function}}, Symbols) ->\n"
|
"lookup(Function, Symbols), \" \", "
|
||||||
"[\"~s \", format_arg(a, Contract), \".\", lookup(Function, Symbols)];",
|
"format_arg(a, Value)];\n"
|
||||||
|
"format_op({~w, Contract, {immediate, Function}, Value}, Symbols) ->\n"
|
||||||
|
"[\"~s \", format_arg(a, Contract), \".\", "
|
||||||
|
"lookup(Function, Symbols), \" \", "
|
||||||
|
"format_arg(a, Value)];\n",
|
||||||
[Name, atom_to_list(Name), Name, atom_to_list(Name)]);
|
[Name, atom_to_list(Name), Name, atom_to_list(Name)]);
|
||||||
gen_format(#{opname := Name, format := atomic}) ->
|
gen_format(#{opname := Name}) when (Name =:= 'CALL_GR') or (Name =:= 'CALL_GTR') ->
|
||||||
|
io_lib:format("format_op({~w, {immediate, Contract}, {immediate, Function}, Value, Gas}, Symbols) ->\n"
|
||||||
|
" [\"~s \", lookup(Contract, Symbols), \".\", "
|
||||||
|
"lookup(Function, Symbols), \" \", "
|
||||||
|
"format_arg(a, Value), \" \", "
|
||||||
|
"format_arg(a, Gas)];\n"
|
||||||
|
"format_op({~w, Contract, {immediate, Function}, Value, Gas}, Symbols) ->\n"
|
||||||
|
"[\"~s \", format_arg(a, Contract), \".\", "
|
||||||
|
"lookup(Function, Symbols), \" \", "
|
||||||
|
"format_arg(a, Value), \" \", "
|
||||||
|
"format_arg(a, Gas)];\n",
|
||||||
|
[Name, atom_to_list(Name), Name, atom_to_list(Name)]);
|
||||||
|
gen_format(#{opname := Name, format := []}) ->
|
||||||
io_lib:format("format_op(~w, _) -> [\"~s\"];", [Name, atom_to_list(Name)]);
|
io_lib:format("format_op(~w, _) -> [\"~s\"];", [Name, atom_to_list(Name)]);
|
||||||
gen_format(#{opname := Name, format := Args}) ->
|
gen_format(#{opname := Name, format := Args}) ->
|
||||||
NameAsString = atom_to_list(Name),
|
NameAsString = atom_to_list(Name),
|
||||||
@@ -519,7 +587,7 @@ gen_format(#{opname := Name, format := Args}) ->
|
|||||||
|
|
||||||
test_asm_generator(Filename) ->
|
test_asm_generator(Filename) ->
|
||||||
{ok, File} = file:open(Filename, [write]),
|
{ok, File} = file:open(Filename, [write]),
|
||||||
Instructions = lists:flatten([gen_instruction(Op)++"\n" || Op <- gen(ops_defs())]),
|
Instructions = lists:flatten([gen_instruction(Op)++"\n" || Op <- get_ops()]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
";; CONTRACT all_instructions\n\n"
|
";; CONTRACT all_instructions\n\n"
|
||||||
";; Dont expect this contract to typecheck or run.\n"
|
";; Dont expect this contract to typecheck or run.\n"
|
||||||
@@ -531,7 +599,7 @@ test_asm_generator(Filename) ->
|
|||||||
file:close(File).
|
file:close(File).
|
||||||
|
|
||||||
|
|
||||||
gen_instruction(#{opname := Name, format := atomic}) ->
|
gen_instruction(#{opname := Name, format := []}) ->
|
||||||
io_lib:format(" ~s\n", [Name]);
|
io_lib:format(" ~s\n", [Name]);
|
||||||
gen_instruction(#{opname := Name, format := ArgTypes}) ->
|
gen_instruction(#{opname := Name, format := ArgTypes}) ->
|
||||||
Args = lists:flatten(lists:join(" ", [gen_arg(A) || A <- ArgTypes])),
|
Args = lists:flatten(lists:join(" ", [gen_arg(A) || A <- ArgTypes])),
|
||||||
@@ -547,7 +615,7 @@ gen_arg(t) -> "integer".
|
|||||||
|
|
||||||
any_arg() ->
|
any_arg() ->
|
||||||
element(rand:uniform(5), {"a", stack_arg(), var_arg(), arg_arg(), imm_arg()}).
|
element(rand:uniform(5), {"a", stack_arg(), var_arg(), arg_arg(), imm_arg()}).
|
||||||
stack_arg() -> "a" ++ integer_to_list(rand:uniform(255)-1).
|
stack_arg() -> "a".
|
||||||
arg_arg() -> "arg" ++ integer_to_list(rand:uniform(256)-1).
|
arg_arg() -> "arg" ++ integer_to_list(rand:uniform(256)-1).
|
||||||
var_arg() -> "var" ++ integer_to_list(rand:uniform(256)-1).
|
var_arg() -> "var" ++ integer_to_list(rand:uniform(256)-1).
|
||||||
imm_arg() ->
|
imm_arg() ->
|
||||||
@@ -638,10 +706,10 @@ gen_variant() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
%% TODO: add gas cost.
|
%% TODO: add gas cost and end_bb/in_auth?
|
||||||
generate_documentation(Filename) ->
|
generate_documentation(Filename) ->
|
||||||
{ok, File} = file:open(Filename, [write]),
|
{ok, File} = file:open(Filename, [write]),
|
||||||
Instructions = lists:flatten([gen_doc(Op)++"\n" || Op <- gen(ops_defs())]),
|
Instructions = lists:flatten([gen_doc(Op)++"\n" || Op <- get_ops()]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
"### Operations\n\n"
|
"### Operations\n\n"
|
||||||
"| OpCode | Name | Args | Description |\n"
|
"| OpCode | Name | Args | Description |\n"
|
||||||
@@ -653,20 +721,20 @@ generate_documentation(Filename) ->
|
|||||||
|
|
||||||
gen_doc(#{ opname := Name
|
gen_doc(#{ opname := Name
|
||||||
, opcode := OpCode
|
, opcode := OpCode
|
||||||
, args := Args
|
, arity := _Arity
|
||||||
, end_bb := EndBB
|
, end_bb := _EndBB
|
||||||
, format := FateFormat
|
, format := FateFormat
|
||||||
, macro := Macro
|
, macro := _Macro
|
||||||
, type_name := TypeName
|
, type_name := _TypeName
|
||||||
, doc := Doc
|
, doc := Doc
|
||||||
, gas := Gas
|
, gas := _Gas
|
||||||
, type := Type
|
, type := _Type
|
||||||
, constructor := Constructor
|
, constructor := _Constructor
|
||||||
, constructor_type := ConstructorType
|
, constructor_type := _ConstructorType
|
||||||
}) ->
|
}) ->
|
||||||
Arguments =
|
Arguments =
|
||||||
case FateFormat of
|
case FateFormat of
|
||||||
atomic -> "";
|
[] -> "";
|
||||||
_ -> lists:join(" ",
|
_ -> lists:join(" ",
|
||||||
[format_arg_doc(A) ||
|
[format_arg_doc(A) ||
|
||||||
A <-
|
A <-
|
||||||
@@ -680,8 +748,8 @@ gen_doc(#{ opname := Name
|
|||||||
, Doc]).
|
, Doc]).
|
||||||
|
|
||||||
format_arg_doc({a, N}) -> io_lib:format("Arg~w", [N]);
|
format_arg_doc({a, N}) -> io_lib:format("Arg~w", [N]);
|
||||||
format_arg_doc({is,N}) -> "Identifier";
|
format_arg_doc({is,_N}) -> "Identifier";
|
||||||
format_arg_doc({ii,N}) -> "Integer";
|
format_arg_doc({ii,_N}) -> "Integer";
|
||||||
format_arg_doc({li,N}) -> "[Integers]";
|
format_arg_doc({li,_N}) -> "[Integers]";
|
||||||
format_arg_doc({t,N}) -> "Type".
|
format_arg_doc({t,_N}) -> "Type".
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,301 @@
|
|||||||
|
-module(aeb_heap).
|
||||||
|
|
||||||
|
-export([ to_binary/1
|
||||||
|
, to_binary/2
|
||||||
|
, from_heap/3
|
||||||
|
, from_binary/2
|
||||||
|
, from_binary/3
|
||||||
|
, maps_with_next_id/1
|
||||||
|
, set_next_id/2
|
||||||
|
, heap_fragment/3
|
||||||
|
, heap_value/3
|
||||||
|
, heap_value/4
|
||||||
|
, heap_value_pointer/1
|
||||||
|
, heap_value_maps/1
|
||||||
|
, heap_value_offset/1
|
||||||
|
, heap_value_heap/1
|
||||||
|
, heap_fragment_maps/1
|
||||||
|
, heap_fragment_offset/1
|
||||||
|
, heap_fragment_heap/1
|
||||||
|
]).
|
||||||
|
|
||||||
|
-export_type([binary_value/0, heap_value/0, offset/0, heap_fragment/0]).
|
||||||
|
|
||||||
|
-include_lib("aebytecode/include/aeb_typerep_def.hrl").
|
||||||
|
-include_lib("aebytecode/include/aeb_heap.hrl").
|
||||||
|
|
||||||
|
-type word() :: non_neg_integer().
|
||||||
|
-type pointer() :: word().
|
||||||
|
-opaque heap_fragment() :: #heap{}.
|
||||||
|
-type offset() :: non_neg_integer().
|
||||||
|
-type binary_value() :: binary().
|
||||||
|
-type heap_value() :: {pointer(), heap_fragment()}.
|
||||||
|
|
||||||
|
|
||||||
|
-spec maps_with_next_id(heap_fragment()) -> #maps{}.
|
||||||
|
%% Create just a maps value, don't keep rest of Heap
|
||||||
|
maps_with_next_id(#heap{maps = #maps{next_id = N}}) ->
|
||||||
|
#maps{ next_id = N }.
|
||||||
|
|
||||||
|
-spec set_next_id(heap_fragment(), non_neg_integer()) -> heap_fragment().
|
||||||
|
set_next_id(Heap, N) ->
|
||||||
|
Heap#heap{ maps = Heap#heap.maps#maps{ next_id = N } }.
|
||||||
|
|
||||||
|
%% -- data type heap_fragment
|
||||||
|
|
||||||
|
-spec heap_fragment(binary() | #{non_neg_integer() => non_neg_integer()}) -> heap_fragment().
|
||||||
|
heap_fragment(Heap) ->
|
||||||
|
heap_fragment(#maps{ next_id = 0 }, 0, Heap).
|
||||||
|
|
||||||
|
-spec heap_fragment(#maps{}, offset(),
|
||||||
|
binary() | #{non_neg_integer() => non_neg_integer()}) -> heap_fragment().
|
||||||
|
heap_fragment(Maps, Offset, Heap) ->
|
||||||
|
#heap{maps = Maps, offset = Offset, heap = Heap}.
|
||||||
|
|
||||||
|
-spec heap_fragment_maps(heap_fragment()) -> #maps{}.
|
||||||
|
heap_fragment_maps(#heap{maps = Maps}) ->
|
||||||
|
Maps.
|
||||||
|
|
||||||
|
-spec heap_fragment_offset(heap_fragment()) -> offset().
|
||||||
|
heap_fragment_offset(#heap{offset = Offs}) ->
|
||||||
|
Offs.
|
||||||
|
|
||||||
|
-spec heap_fragment_heap(heap_fragment()) -> binary() | #{non_neg_integer() => non_neg_integer()}.
|
||||||
|
heap_fragment_heap(#heap{heap = Heap}) ->
|
||||||
|
Heap.
|
||||||
|
|
||||||
|
|
||||||
|
%% -- data type heap_value
|
||||||
|
|
||||||
|
-spec heap_value(#maps{}, pointer(),
|
||||||
|
binary() | #{non_neg_integer() => non_neg_integer()}) -> heap_value().
|
||||||
|
heap_value(Maps, Ptr, Heap) ->
|
||||||
|
heap_value(Maps, Ptr, Heap, 0).
|
||||||
|
|
||||||
|
-spec heap_value(#maps{}, pointer(),
|
||||||
|
binary() | #{non_neg_integer() => non_neg_integer()}, offset()) -> heap_value().
|
||||||
|
heap_value(Maps, Ptr, Heap, Offs) ->
|
||||||
|
{Ptr, heap_fragment(Maps, Offs, Heap)}.
|
||||||
|
|
||||||
|
-spec heap_value_pointer(heap_value()) -> pointer().
|
||||||
|
heap_value_pointer({Ptr, _}) -> Ptr.
|
||||||
|
|
||||||
|
-spec heap_value_maps(heap_value()) -> #maps{}.
|
||||||
|
heap_value_maps({_, Heap}) -> Heap#heap.maps.
|
||||||
|
|
||||||
|
-spec heap_value_offset(heap_value()) -> offset().
|
||||||
|
heap_value_offset({_, Heap}) -> Heap#heap.offset.
|
||||||
|
|
||||||
|
-spec heap_value_heap(heap_value()) ->
|
||||||
|
binary() | #{non_neg_integer() => non_neg_integer()}.
|
||||||
|
heap_value_heap({_, Heap}) -> Heap#heap.heap.
|
||||||
|
|
||||||
|
%% -- Value to binary --------------------------------------------------------
|
||||||
|
|
||||||
|
-spec to_binary(aeb_aevm_data:data()) -> aeb_aevm_data:heap().
|
||||||
|
%% Encode the data as a heap where the first word is the value (for unboxed
|
||||||
|
%% types) or a pointer to the value (for boxed types).
|
||||||
|
to_binary(Data) ->
|
||||||
|
to_binary(Data, 0).
|
||||||
|
|
||||||
|
to_binary(Data, BaseAddress) ->
|
||||||
|
{Address, Memory} = to_binary1(Data, BaseAddress + 32),
|
||||||
|
R = <<Address:256, Memory/binary>>,
|
||||||
|
R.
|
||||||
|
|
||||||
|
|
||||||
|
%% Allocate the data in memory, from the given address. Return a pair
|
||||||
|
%% of memory contents from that address and the value representing the
|
||||||
|
%% data.
|
||||||
|
to_binary1(Data,_Address) when is_integer(Data) ->
|
||||||
|
{Data,<<>>};
|
||||||
|
to_binary1(Data, Address) when is_binary(Data) ->
|
||||||
|
%% a string
|
||||||
|
Words = aeb_memory:binary_to_words(Data),
|
||||||
|
{Address,<<(size(Data)):256, << <<W:256>> || W <- Words>>/binary>>};
|
||||||
|
to_binary1(none, Address) -> to_binary1({variant, 0, []}, Address);
|
||||||
|
to_binary1({some, Value}, Address) -> to_binary1({variant, 1, [Value]}, Address);
|
||||||
|
to_binary1(word, Address) -> to_binary1({?TYPEREP_WORD_TAG}, Address);
|
||||||
|
to_binary1(string, Address) -> to_binary1({?TYPEREP_STRING_TAG}, Address);
|
||||||
|
to_binary1(typerep, Address) -> to_binary1({?TYPEREP_TYPEREP_TAG}, Address);
|
||||||
|
to_binary1(function, Address) -> to_binary1({?TYPEREP_FUN_TAG}, Address);
|
||||||
|
to_binary1({list, T}, Address) -> to_binary1({?TYPEREP_LIST_TAG, T}, Address);
|
||||||
|
to_binary1({option, T}, Address) -> to_binary1({variant, [[], [T]]}, Address);
|
||||||
|
to_binary1({tuple, Ts}, Address) -> to_binary1({?TYPEREP_TUPLE_TAG, Ts}, Address);
|
||||||
|
to_binary1({variant, Cons}, Address) -> to_binary1({?TYPEREP_VARIANT_TAG, Cons}, Address);
|
||||||
|
to_binary1({map, K, V}, Address) -> to_binary1({?TYPEREP_MAP_TAG, K, V}, Address);
|
||||||
|
to_binary1({variant, Tag, Args}, Address) ->
|
||||||
|
to_binary1(list_to_tuple([Tag | Args]), Address);
|
||||||
|
to_binary1(Map, Address) when is_map(Map) ->
|
||||||
|
Size = maps:size(Map),
|
||||||
|
%% Sort according to binary ordering
|
||||||
|
KVs = lists:sort([ {to_binary(K), to_binary(V)} || {K, V} <- maps:to_list(Map) ]),
|
||||||
|
{Address, <<Size:256, << <<(byte_size(K)):256, K/binary,
|
||||||
|
(byte_size(V)):256, V/binary>> || {K, V} <- KVs >>/binary >>};
|
||||||
|
to_binary1({}, _Address) ->
|
||||||
|
{0, <<>>};
|
||||||
|
to_binary1(Data, Address) when is_tuple(Data) ->
|
||||||
|
{Elems,Memory} = to_binaries(tuple_to_list(Data),Address+32*size(Data)),
|
||||||
|
ElemsBin = << <<W:256>> || W <- Elems>>,
|
||||||
|
{Address,<< ElemsBin/binary, Memory/binary >>};
|
||||||
|
to_binary1([],_Address) ->
|
||||||
|
<<Nil:256>> = <<(-1):256>>,
|
||||||
|
{Nil,<<>>};
|
||||||
|
to_binary1([H|T],Address) ->
|
||||||
|
to_binary1({H,T},Address).
|
||||||
|
|
||||||
|
|
||||||
|
to_binaries([],_Address) ->
|
||||||
|
{[],<<>>};
|
||||||
|
to_binaries([H|T],Address) ->
|
||||||
|
{HRep,HMem} = to_binary1(H,Address),
|
||||||
|
{TRep,TMem} = to_binaries(T,Address+size(HMem)),
|
||||||
|
{[HRep|TRep],<<HMem/binary, TMem/binary>>}.
|
||||||
|
|
||||||
|
%% Interpret a return value (a binary) using a type rep.
|
||||||
|
|
||||||
|
-spec from_heap(Type :: ?Type(), Heap :: binary(), Ptr :: integer()) ->
|
||||||
|
{ok, term()} | {error, term()}.
|
||||||
|
from_heap(Type, Heap, Ptr) ->
|
||||||
|
try {ok, from_binary(#{}, Type, Heap, Ptr)}
|
||||||
|
catch _:Err ->
|
||||||
|
%% io:format("** Error: from_heap failed with ~p\n ~p\n", [Err, erlang:get_stacktrace()]),
|
||||||
|
{error, Err}
|
||||||
|
end.
|
||||||
|
|
||||||
|
%% Base address is the address of the first word of the given heap.
|
||||||
|
-spec from_binary(T :: ?Type(),
|
||||||
|
Heap :: binary(),
|
||||||
|
BaseAddr :: non_neg_integer()) ->
|
||||||
|
{ok, term()} | {error, term()}.
|
||||||
|
from_binary(T, Heap = <<V:256, _/binary>>, BaseAddr) ->
|
||||||
|
from_heap(T, <<0:BaseAddr/unit:8, Heap/binary>>, V);
|
||||||
|
from_binary(_, Bin, _BaseAddr) ->
|
||||||
|
{error, {binary_too_short, Bin}}.
|
||||||
|
|
||||||
|
-spec from_binary(?Type(), binary()) -> {ok, term()} | {error, term()}.
|
||||||
|
from_binary(T, Heap) ->
|
||||||
|
from_binary(T, Heap, 0).
|
||||||
|
|
||||||
|
from_binary(_, word, _, V) ->
|
||||||
|
V;
|
||||||
|
from_binary(_, signed_word, _, V) ->
|
||||||
|
<<N:256/signed>> = <<V:256>>,
|
||||||
|
N;
|
||||||
|
from_binary(_, bool, _, V) ->
|
||||||
|
case V of
|
||||||
|
0 -> false;
|
||||||
|
1 -> true
|
||||||
|
end;
|
||||||
|
from_binary(_, string, Heap, V) ->
|
||||||
|
StringSize = heap_word(Heap,V),
|
||||||
|
BitAddr = 8*(V+32),
|
||||||
|
<<_:BitAddr,Bytes:StringSize/binary,_/binary>> = Heap,
|
||||||
|
Bytes;
|
||||||
|
from_binary(_, {tuple, []}, _, _) ->
|
||||||
|
{};
|
||||||
|
from_binary(Visited, {tuple,Cpts}, Heap, V) ->
|
||||||
|
check_circular_refs(Visited, V),
|
||||||
|
NewVisited = Visited#{V => true},
|
||||||
|
ElementNums = lists:seq(0, length(Cpts)-1),
|
||||||
|
TypesAndPointers = lists:zip(Cpts, ElementNums),
|
||||||
|
ElementAddress = fun(Index) -> V + 32 * Index end,
|
||||||
|
Element = fun(Index) ->
|
||||||
|
heap_word(Heap, ElementAddress(Index))
|
||||||
|
end,
|
||||||
|
Convert = fun(Type, Index) ->
|
||||||
|
from_binary(NewVisited, Type, Heap, Element(Index))
|
||||||
|
end,
|
||||||
|
Elements = [Convert(T, I) || {T,I} <- TypesAndPointers],
|
||||||
|
list_to_tuple(Elements);
|
||||||
|
from_binary(Visited, {list, Elem}, Heap, V) ->
|
||||||
|
<<Nil:256>> = <<(-1):256>>,
|
||||||
|
if V==Nil ->
|
||||||
|
[];
|
||||||
|
true ->
|
||||||
|
{H,T} = from_binary(Visited, {tuple,[Elem,{list,Elem}]},Heap,V),
|
||||||
|
[H|T]
|
||||||
|
end;
|
||||||
|
from_binary(Visited, {option, A}, Heap, V) ->
|
||||||
|
from_binary(Visited, {variant_t, [{none, []}, {some, [A]}]}, Heap, V);
|
||||||
|
from_binary(Visited, {variant, Cons}, Heap, V) ->
|
||||||
|
Tag = heap_word(Heap, V),
|
||||||
|
Args = lists:nth(Tag + 1, Cons),
|
||||||
|
Visited1 = Visited#{V => true},
|
||||||
|
{variant, Tag, tuple_to_list(from_binary(Visited1, {tuple, Args}, Heap, V + 32))};
|
||||||
|
from_binary(Visited, {variant_t, TCons}, Heap, V) -> %% Tagged variants
|
||||||
|
{Tags, Cons} = lists:unzip(TCons),
|
||||||
|
{variant, I, Args} = from_binary(Visited, {variant, Cons}, Heap, V),
|
||||||
|
Tag = lists:nth(I + 1, Tags),
|
||||||
|
case Args of
|
||||||
|
[] -> Tag;
|
||||||
|
_ -> list_to_tuple([Tag | Args])
|
||||||
|
end;
|
||||||
|
from_binary(_Visited, {map, A, B}, Heap, Ptr) ->
|
||||||
|
%% FORMAT: [Size] [KeySize] Key [ValSize] Val .. [KeySize] Key [ValSize] Val
|
||||||
|
Size = heap_word(Heap, Ptr),
|
||||||
|
map_binary_to_value(A, B, Size, Heap, Ptr + 32);
|
||||||
|
from_binary(Visited, typerep, Heap, V) ->
|
||||||
|
check_circular_refs(Visited, V),
|
||||||
|
Tag = heap_word(Heap, V),
|
||||||
|
Arg1 = fun(T, I) -> from_binary(Visited#{V => true}, T, Heap, heap_word(Heap, V + 32 * I)) end,
|
||||||
|
Arg = fun(T) -> Arg1(T, 1) end,
|
||||||
|
case Tag of
|
||||||
|
?TYPEREP_WORD_TAG -> word;
|
||||||
|
?TYPEREP_STRING_TAG -> string;
|
||||||
|
?TYPEREP_TYPEREP_TAG -> typerep;
|
||||||
|
?TYPEREP_LIST_TAG -> {list, Arg(typerep)};
|
||||||
|
?TYPEREP_TUPLE_TAG -> {tuple, Arg({list, typerep})};
|
||||||
|
?TYPEREP_VARIANT_TAG -> {variant, Arg({list, {list, typerep}})};
|
||||||
|
?TYPEREP_MAP_TAG -> {map, Arg(typerep), Arg1(typerep, 2)};
|
||||||
|
?TYPEREP_FUN_TAG -> function
|
||||||
|
end.
|
||||||
|
|
||||||
|
map_binary_to_value(KeyType, ValType, N, Bin, Ptr) ->
|
||||||
|
%% Avoid looping on bogus sizes
|
||||||
|
MaxN = byte_size(Bin) div 64,
|
||||||
|
Heap = heap_fragment(Bin),
|
||||||
|
map_from_binary({value, KeyType, ValType}, min(N, MaxN), Heap, Ptr, #{}).
|
||||||
|
|
||||||
|
map_from_binary(_, 0, _, _, Map) -> Map;
|
||||||
|
map_from_binary({value, KeyType, ValType} = Output, I, Heap, Ptr, Map) ->
|
||||||
|
KeySize = get_word(Heap, Ptr),
|
||||||
|
KeyPtr = Ptr + 32,
|
||||||
|
KeyBin = get_chunk(Heap, KeyPtr, KeySize),
|
||||||
|
ValSize = get_word(Heap, KeyPtr + KeySize),
|
||||||
|
ValPtr = KeyPtr + KeySize + 32,
|
||||||
|
ValBin = get_chunk(Heap, ValPtr, ValSize),
|
||||||
|
%% Keys and values are self contained binaries
|
||||||
|
{ok, Key} = from_binary(KeyType, KeyBin),
|
||||||
|
{ok, Val} = from_binary(ValType, ValBin),
|
||||||
|
map_from_binary(Output, I - 1, Heap, ValPtr + ValSize, Map#{Key => Val}).
|
||||||
|
|
||||||
|
check_circular_refs(Visited, V) ->
|
||||||
|
case maps:is_key(V, Visited) of
|
||||||
|
true -> exit(circular_references);
|
||||||
|
false -> ok
|
||||||
|
end.
|
||||||
|
|
||||||
|
heap_word(Heap, Addr) when is_binary(Heap) ->
|
||||||
|
BitSize = 8*Addr,
|
||||||
|
<<_:BitSize,W:256,_/binary>> = Heap,
|
||||||
|
W;
|
||||||
|
heap_word(Heap, Addr) when is_map(Heap) ->
|
||||||
|
0 = Addr rem 32, %% Check that it's word aligned.
|
||||||
|
maps:get(Addr, Heap, 0).
|
||||||
|
|
||||||
|
get_word(#heap{offset = Offs, heap = Mem}, Addr) when Addr >= Offs ->
|
||||||
|
get_word(Mem, Addr - Offs);
|
||||||
|
get_word(Mem, Addr) when is_binary(Mem) ->
|
||||||
|
<<_:Addr/unit:8, Word:256, _/binary>> = Mem,
|
||||||
|
Word.
|
||||||
|
|
||||||
|
get_chunk(#heap{offset = Offs, heap = Mem}, Addr, Bytes) when Addr >= Offs ->
|
||||||
|
get_chunk(Mem, Addr - Offs, Bytes);
|
||||||
|
get_chunk(Mem, Addr, Bytes) when is_binary(Mem) ->
|
||||||
|
<<_:Addr/unit:8, Chunk:Bytes/binary, _/binary>> = Mem,
|
||||||
|
Chunk.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% @copyright (C) 2018, Aeternity Anstalt
|
||||||
|
%%% @doc
|
||||||
|
%%% Memory speifics that compiler and VM need to agree upon
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 19 Dec 2018
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
|
-module(aeb_memory).
|
||||||
|
|
||||||
|
-export([binary_to_words/1]).
|
||||||
|
|
||||||
|
binary_to_words(<<>>) ->
|
||||||
|
[];
|
||||||
|
binary_to_words(<<N:256,Bin/binary>>) ->
|
||||||
|
[N|binary_to_words(Bin)];
|
||||||
|
binary_to_words(Bin) ->
|
||||||
|
binary_to_words(<<Bin/binary,0>>).
|
||||||
|
|
||||||
@@ -51,6 +51,7 @@ opcode(?SHL) -> ?SHL;
|
|||||||
opcode(?SHR) -> ?SHR;
|
opcode(?SHR) -> ?SHR;
|
||||||
opcode(?SAR) -> ?SAR;
|
opcode(?SAR) -> ?SAR;
|
||||||
opcode(?SHA3) -> ?SHA3;
|
opcode(?SHA3) -> ?SHA3;
|
||||||
|
opcode(?CREATOR) -> ?CREATOR;
|
||||||
opcode(?ADDRESS) -> ?ADDRESS;
|
opcode(?ADDRESS) -> ?ADDRESS;
|
||||||
opcode(?BALANCE) -> ?BALANCE;
|
opcode(?BALANCE) -> ?BALANCE;
|
||||||
opcode(?ORIGIN) -> ?ORIGIN;
|
opcode(?ORIGIN) -> ?ORIGIN;
|
||||||
@@ -191,6 +192,7 @@ mnemonic(?SHL) -> 'SHL' ;
|
|||||||
mnemonic(?SHR) -> 'SHR' ;
|
mnemonic(?SHR) -> 'SHR' ;
|
||||||
mnemonic(?SAR) -> 'SAR' ;
|
mnemonic(?SAR) -> 'SAR' ;
|
||||||
mnemonic(?SHA3) -> 'SHA3' ;
|
mnemonic(?SHA3) -> 'SHA3' ;
|
||||||
|
mnemonic(?CREATOR) -> 'CREATOR' ;
|
||||||
mnemonic(?ADDRESS) -> 'ADDRESS' ;
|
mnemonic(?ADDRESS) -> 'ADDRESS' ;
|
||||||
mnemonic(?BALANCE) -> 'BALANCE' ;
|
mnemonic(?BALANCE) -> 'BALANCE' ;
|
||||||
mnemonic(?ORIGIN) -> 'ORIGIN' ;
|
mnemonic(?ORIGIN) -> 'ORIGIN' ;
|
||||||
@@ -332,6 +334,7 @@ m_to_op('SHL') -> ?SHL ;
|
|||||||
m_to_op('SHR') -> ?SHR ;
|
m_to_op('SHR') -> ?SHR ;
|
||||||
m_to_op('SAR') -> ?SAR ;
|
m_to_op('SAR') -> ?SAR ;
|
||||||
m_to_op('SHA3') -> ?SHA3 ;
|
m_to_op('SHA3') -> ?SHA3 ;
|
||||||
|
m_to_op('CREATOR') -> ?CREATOR ;
|
||||||
m_to_op('ADDRESS') -> ?ADDRESS ;
|
m_to_op('ADDRESS') -> ?ADDRESS ;
|
||||||
m_to_op('BALANCE') -> ?BALANCE ;
|
m_to_op('BALANCE') -> ?BALANCE ;
|
||||||
m_to_op('ORIGIN') -> ?ORIGIN ;
|
m_to_op('ORIGIN') -> ?ORIGIN ;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{application, aebytecode,
|
{application, aebytecode,
|
||||||
[{description, "Bytecode definitions, serialization and deserialization for aeternity."},
|
[{description, "Bytecode definitions, serialization and deserialization for aeternity."},
|
||||||
{vsn, "2.0.1"},
|
{vsn, "2.1.0"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications,
|
{applications,
|
||||||
[kernel,
|
[kernel,
|
||||||
|
|||||||
@@ -25,12 +25,7 @@ read_file(File) ->
|
|||||||
Asm.
|
Asm.
|
||||||
|
|
||||||
assemble(Asm) ->
|
assemble(Asm) ->
|
||||||
{Env, BC} = aeb_fate_asm:asm_to_bytecode(Asm, []),
|
aeb_fate_asm:asm_to_bytecode(Asm, []).
|
||||||
{Env, BC}.
|
|
||||||
|
|
||||||
disassemble(BC) ->
|
|
||||||
aeb_fate_asm:bytecode_to_fate_code(BC, []).
|
|
||||||
|
|
||||||
|
|
||||||
asm_disasm_idenity_test() ->
|
asm_disasm_idenity_test() ->
|
||||||
check_roundtrip(identity).
|
check_roundtrip(identity).
|
||||||
@@ -52,18 +47,20 @@ sources() ->
|
|||||||
, "tuple"
|
, "tuple"
|
||||||
, "mapofmap"
|
, "mapofmap"
|
||||||
, "immediates"
|
, "immediates"
|
||||||
, "all_instructions"
|
, "names"
|
||||||
|
, "oracles"
|
||||||
|
%% , "all_instructions"
|
||||||
].
|
].
|
||||||
|
|
||||||
check_roundtrip(File) ->
|
check_roundtrip(File) ->
|
||||||
AssemblerCode = read_file(File),
|
AssemblerCode = read_file(File),
|
||||||
{_Env, ByteCode} = assemble(AssemblerCode),
|
{_Env, ByteCode} = assemble(AssemblerCode),
|
||||||
FateCode = disassemble(ByteCode),
|
FateCode = aeb_fate_code:deserialize(ByteCode),
|
||||||
DissasmCode = aeb_fate_asm:to_asm(FateCode),
|
DissasmCode = aeb_fate_asm:to_asm(FateCode),
|
||||||
io:format("~s~n", [AssemblerCode]),
|
|
||||||
io:format("~s~n", [DissasmCode]),
|
|
||||||
{_Env2, ByteCode2} = assemble(DissasmCode),
|
{_Env2, ByteCode2} = assemble(DissasmCode),
|
||||||
|
ByteCode3 = aeb_fate_code:serialize(FateCode),
|
||||||
Code1 = aeb_fate_asm:strip(ByteCode),
|
Code1 = aeb_fate_asm:strip(ByteCode),
|
||||||
Code2 = aeb_fate_asm:strip(ByteCode2),
|
Code2 = aeb_fate_asm:strip(ByteCode2),
|
||||||
io:format("~s~n", [aeb_fate_asm:to_asm(disassemble(ByteCode2))]),
|
Code3 = aeb_fate_asm:strip(ByteCode3),
|
||||||
?assertEqual(Code1, Code2).
|
?assertEqual(Code1, Code2),
|
||||||
|
?assertEqual(Code1, Code3).
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ sources() ->
|
|||||||
[aeb_fate_data:make_integer(0),
|
[aeb_fate_data:make_integer(0),
|
||||||
aeb_fate_data:make_integer(1),
|
aeb_fate_data:make_integer(1),
|
||||||
True, False, Unit, Nil, EmptyString, EmptyMap,
|
True, False, Unit, Nil, EmptyString, EmptyMap,
|
||||||
|
aeb_fate_data:make_hash(<<1,2,3,4,5>>),
|
||||||
|
aeb_fate_data:make_signature(<<1,2,3,4,5>>),
|
||||||
|
aeb_fate_data:make_contract(<<1,2,3,4,5>>),
|
||||||
|
aeb_fate_data:make_channel(<<1,2,3,4,5>>),
|
||||||
aeb_fate_data:make_list([True]),
|
aeb_fate_data:make_list([True]),
|
||||||
aeb_fate_data:make_address(
|
aeb_fate_data:make_address(
|
||||||
<<0,1,2,3,4,5,6,7,8,9,
|
<<0,1,2,3,4,5,6,7,8,9,
|
||||||
@@ -72,12 +76,13 @@ sources() ->
|
|||||||
aeb_fate_data:make_bits(1),
|
aeb_fate_data:make_bits(1),
|
||||||
aeb_fate_data:make_bits(-1),
|
aeb_fate_data:make_bits(-1),
|
||||||
aeb_fate_data:make_list(make_int_list(65)),
|
aeb_fate_data:make_list(make_int_list(65)),
|
||||||
aeb_fate_data:make_variant(2, 0, {FortyTwo}),
|
aeb_fate_data:make_variant([1,2,3], 0, {FortyTwo}),
|
||||||
aeb_fate_data:make_variant(2, 1, {}),
|
aeb_fate_data:make_variant([2,0], 1, {}),
|
||||||
aeb_fate_data:make_list([aeb_fate_data:make_variant(3, 0, {})]),
|
aeb_fate_data:make_list([aeb_fate_data:make_variant([0,0,0], 0, {})]),
|
||||||
aeb_fate_data:make_variant(255, 254, {}),
|
aeb_fate_data:make_variant([0|| _<-lists:seq(1,255)], 254, {}),
|
||||||
aeb_fate_data:make_variant(5, 3, {aeb_fate_data:make_boolean(true),
|
aeb_fate_data:make_variant([0,1,2,3,4,5],
|
||||||
aeb_fate_data:make_list(make_int_list(3)),
|
3, {aeb_fate_data:make_boolean(true),
|
||||||
aeb_fate_data:make_string(<<"foo">>)})
|
aeb_fate_data:make_list(make_int_list(3)),
|
||||||
|
aeb_fate_data:make_string(<<"foo">>)})
|
||||||
|
|
||||||
].
|
].
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
ADD a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
ADDR_TO_STR a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -1,30 +1,34 @@
|
|||||||
;; CONTRACT all_instructions
|
;; CONTRACT all_instructions
|
||||||
|
|
||||||
;; Dont expect this contract to typecheck or run.
|
;; Dont expect this contract to typecheck or run.
|
||||||
;; Just used to check assembler rountrip of all instruction.
|
;; Just used to check assembler rountrip of all instructions.
|
||||||
|
|
||||||
FUNCTION foo () : {tuple, []}
|
FUNCTION foo () : {tuple, []}
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
RETURNR a13
|
RETURNR a
|
||||||
|
|
||||||
CALL foo
|
CALL "foo"
|
||||||
|
|
||||||
CALL_R arg125 foo
|
CALL_R arg125 foo 0
|
||||||
|
|
||||||
CALL_T foo
|
CALL_T "foo"
|
||||||
|
|
||||||
CALL_TR arg245 foo
|
CALL_TR arg245 foo 4711
|
||||||
|
|
||||||
|
CALL_GTR arg245 foo 0 100
|
||||||
|
|
||||||
|
CALL_GR arg245 foo 0 4711
|
||||||
|
|
||||||
JUMP 5514251025295783441695716053282666408426
|
JUMP 5514251025295783441695716053282666408426
|
||||||
|
|
||||||
JUMPIF arg196 0x12c651665
|
JUMPIF arg196 0x12c651665
|
||||||
|
|
||||||
SWITCH_V2 a27 63 33
|
SWITCH_V2 a 63 33
|
||||||
|
|
||||||
SWITCH_V3 var4 0x1d61723dd 79 7
|
SWITCH_V3 var4 0x1d61723dd 79 7
|
||||||
|
|
||||||
SWITCH_VN #nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv [1, 2, 3]
|
SWITCH_VN arg0 [1, 2, 3]
|
||||||
|
|
||||||
PUSH var80
|
PUSH var80
|
||||||
|
|
||||||
@@ -32,29 +36,29 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
DUP a
|
DUP a
|
||||||
|
|
||||||
POP a107
|
POP a
|
||||||
|
|
||||||
STORE arg183 var225
|
STORE arg183 var225
|
||||||
|
|
||||||
INCA
|
INCA
|
||||||
|
|
||||||
INC a25
|
INC a
|
||||||
|
|
||||||
DECA
|
DECA
|
||||||
|
|
||||||
DEC a
|
DEC a
|
||||||
|
|
||||||
ADD a217 a a
|
ADD a a a
|
||||||
|
|
||||||
SUB arg35 arg165 var74
|
SUB arg35 arg165 var74
|
||||||
|
|
||||||
MUL 44 35 "foo"
|
MUL 44 35 "foo"
|
||||||
|
|
||||||
DIV 263838340369912686645632650718169038811 a24 a
|
DIV 263838340369912686645632650718169038811 a a
|
||||||
|
|
||||||
MOD var113 arg80 arg207
|
MOD var113 arg80 arg207
|
||||||
|
|
||||||
POW a176 a a123
|
POW a a a
|
||||||
|
|
||||||
LT a 78 var81
|
LT a 78 var81
|
||||||
|
|
||||||
@@ -62,49 +66,53 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
EQ 85 a arg164
|
EQ 85 a arg164
|
||||||
|
|
||||||
ELT a161 arg226 a168
|
ELT a arg226 a
|
||||||
|
|
||||||
EGT a131 1 var250
|
EGT a 1 var250
|
||||||
|
|
||||||
NEQ a85 a a83
|
NEQ a a a
|
||||||
|
|
||||||
AND var255 0x294a24f6 var189
|
AND var255 0x294a24f6 var189
|
||||||
|
|
||||||
OR (| 2 | 0 | ( (), (42) ) |) arg168 var107
|
OR (| [2,0] | 0 | ( (), (42) ) |) arg168 var107
|
||||||
|
|
||||||
NOT arg124 a
|
NOT arg124 a
|
||||||
|
|
||||||
TUPLE 5019186157739257888756115213149493826410
|
TUPLE var999 5019186157739257888756115213149493826410
|
||||||
|
|
||||||
ELEMENT integer arg148 var25 a219
|
ELEMENT arg148 var25 a
|
||||||
|
|
||||||
MAP_EMPTY a135
|
MAP_EMPTY a
|
||||||
|
|
||||||
MAP_LOOKUP a82 a a143
|
MAP_LOOKUP a a a
|
||||||
|
|
||||||
MAP_LOOKUPD var112 arg35 a163 var112
|
MAP_LOOKUPD var112 arg35 a var112
|
||||||
|
|
||||||
MAP_UPDATE false a0 a56 a
|
MAP_UPDATE false a a a
|
||||||
|
|
||||||
MAP_DELETE arg180 a var1
|
MAP_DELETE arg180 a var1
|
||||||
|
|
||||||
MAP_MEMBER a { true => 4} 94
|
MAP_MEMBER a { true => 4} 94
|
||||||
|
|
||||||
MAP_FROM_LIST () a159
|
MAP_FROM_LIST () a
|
||||||
|
|
||||||
|
MAP_TO_LIST a { true => 4 }
|
||||||
|
|
||||||
|
MAP_SIZE a { true => 42 }
|
||||||
|
|
||||||
NIL arg91
|
NIL arg91
|
||||||
|
|
||||||
IS_NIL a121 var6
|
IS_NIL a var6
|
||||||
|
|
||||||
CONS arg185 "foo" a114
|
CONS arg185 "foo" a
|
||||||
|
|
||||||
HD a150 var124
|
HD a var124
|
||||||
|
|
||||||
TL arg223 a
|
TL arg223 a
|
||||||
|
|
||||||
LENGTH var216 a143
|
LENGTH var216 a
|
||||||
|
|
||||||
STR_EQ { 203961992615221001243597889146034217896 => 0x1f53a1843} 281217554184165828643225535776787296845 a177
|
APPEND { 203961992615221001243597889146034217896 => 0x1f53a1843} 281217554184165828643225535776787296845 a
|
||||||
|
|
||||||
STR_JOIN a a 7144184027126178769820155907121270843348
|
STR_JOIN a a 7144184027126178769820155907121270843348
|
||||||
|
|
||||||
@@ -112,15 +120,17 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
ADDR_TO_STR a arg216
|
ADDR_TO_STR a arg216
|
||||||
|
|
||||||
STR_REVERSE a174 #nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
STR_REVERSE a @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
STR_LENGTH a "foo"
|
||||||
|
|
||||||
INT_TO_ADDR arg127 var207
|
INT_TO_ADDR arg127 var207
|
||||||
|
|
||||||
VARIANT a a 0x1f7b72200 a
|
VARIANT a a 0x1f7b72200 a
|
||||||
|
|
||||||
VARIANT_TEST a26 arg217 a
|
VARIANT_TEST a arg217 a
|
||||||
|
|
||||||
VARIANT_ELEMENT a86 arg103 arg108
|
VARIANT_ELEMENT a arg103 arg108
|
||||||
|
|
||||||
BITS_NONEA
|
BITS_NONEA
|
||||||
|
|
||||||
@@ -128,35 +138,37 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
BITS_ALLA
|
BITS_ALLA
|
||||||
|
|
||||||
BITS_ALL a164
|
BITS_ALL a
|
||||||
|
|
||||||
BITS_ALL_N a221 arg135
|
BITS_ALL_N a arg135
|
||||||
|
|
||||||
BITS_SET arg150 a48 { 0x1a715e2a6 => 3}
|
BITS_SET arg150 a { 0x1a715e2a6 => 3}
|
||||||
|
|
||||||
BITS_CLEAR arg98 a arg164
|
BITS_CLEAR arg98 a arg164
|
||||||
|
|
||||||
BITS_TEST a a242 (| 5 | 2 | (1, "foo", ()) |)
|
BITS_TEST a a (| [0,0,3] | 2 | (1, "foo", ()) |)
|
||||||
|
|
||||||
BITS_SUM a244 a71
|
BITS_SUM a a
|
||||||
|
|
||||||
BITS_OR var20 var186 a
|
BITS_OR var20 var186 a
|
||||||
|
|
||||||
BITS_AND a187 4 arg203
|
BITS_AND a 4 arg203
|
||||||
|
|
||||||
BITS_DIFF var200 arg247 var20
|
BITS_DIFF var200 arg247 var20
|
||||||
|
|
||||||
ADDRESS a237
|
ADDRESS a
|
||||||
|
|
||||||
BALANCE a231
|
BALANCE a
|
||||||
|
|
||||||
ORIGIN arg216
|
ORIGIN arg216
|
||||||
|
|
||||||
CALLER a27
|
CALLER a
|
||||||
|
|
||||||
GASPRICE arg119
|
GASPRICE arg119
|
||||||
|
|
||||||
BLOCKHASH arg110
|
BLOCKHASH a arg110
|
||||||
|
|
||||||
|
CALL_VALUE a
|
||||||
|
|
||||||
BENEFICIARY var163
|
BENEFICIARY var163
|
||||||
|
|
||||||
@@ -172,21 +184,21 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
GAS var35
|
GAS var35
|
||||||
|
|
||||||
LOG0 a a85
|
LOG0 a
|
||||||
|
|
||||||
LOG1 arg94 arg86 arg208
|
LOG1 arg86 arg208
|
||||||
|
|
||||||
LOG2 a113 (| 5 | 2 | (1, "foo", ()) |) arg238 var108
|
LOG2 a a (| [0,1,3] | 2 | (1, "foo", ()) |)
|
||||||
|
|
||||||
LOG3 arg255 arg15 arg211 var139 arg44
|
LOG3 arg15 arg211 var139 arg44
|
||||||
|
|
||||||
LOG4 #nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv a247 a 9 a38 a
|
LOG4 a a 9 a a
|
||||||
|
|
||||||
DEACTIVATE
|
DEACTIVATE
|
||||||
|
|
||||||
SPEND #nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv var136
|
SPEND @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv var136
|
||||||
|
|
||||||
ORACLE_REGISTER arg29 48 ((| 5 | 2 | (1, "foo", ()) |)) arg65 { <> => false} <>
|
ORACLE_REGISTER arg29 48 ((| [0,1,3] | 2 | (1, "foo", ()) |)) arg65 { <> => false} <>
|
||||||
|
|
||||||
ORACLE_QUERY
|
ORACLE_QUERY
|
||||||
|
|
||||||
@@ -214,15 +226,11 @@ FUNCTION foo () : {tuple, []}
|
|||||||
|
|
||||||
ECVERIFY
|
ECVERIFY
|
||||||
|
|
||||||
SHA3
|
SHA3 a
|
||||||
|
|
||||||
SHA256
|
SHA256 a
|
||||||
|
|
||||||
BLAKE2B
|
BLAKE2B a
|
||||||
|
|
||||||
DUMMY7ARG a a 7607708484837907159893701471377343595877 (| 2 | 0 | ( [], [ 45, { 1 => 3441201581501946066216994494994943246334} ] ) |) a0 var56 "foo"
|
|
||||||
|
|
||||||
DUMMY8ARG 3673679924816289365509492271980889822579 a69 arg242 var237 a175 arg106 () var255
|
|
||||||
|
|
||||||
ABORT a
|
ABORT a
|
||||||
|
|
||||||
@@ -231,3 +239,11 @@ FUNCTION foo () : {tuple, []}
|
|||||||
NOP
|
NOP
|
||||||
|
|
||||||
RETURNR ()
|
RETURNR ()
|
||||||
|
|
||||||
|
BALANCE_OTHER a arg0
|
||||||
|
|
||||||
|
SETELEMENT a 2 (1, "two", 3) 2
|
||||||
|
|
||||||
|
AUTH_TX_HASH
|
||||||
|
|
||||||
|
CONTRACT_TO_ADDRESS @ct_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
AND a true true
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
APPEND a [1] [2]
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
BALANCE a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
BITS_ALL a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
BITS_ALL_N a 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
BITS_ALLA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
BITS_AND a <101010> <010101>
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
BITS_CLEAR a <101010> 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
BITS_DIFF a <101010> <010101>
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
BITS_NONE a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
BITS_NONEA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
BITS_OR a <101010> <010101>
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
BITS_SET a <101010> 2
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
BITS_SUM a <101010>
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
BITS_TEST a <101010> 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
BLAKE2B a "This is a string"
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
BLOCKHASH var3 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
CALLER var3
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
CONS a 42 []
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
DEC a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
DECA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
DIV a 1 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
DUP 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
DUPA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
EGT a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
ELEMENT a 0 (42)
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
ELT a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
;; CONTRACT empty
|
||||||
|
|
||||||
|
FUNCTION run () : integer
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
EQ a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
GASPRICE var3
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
GT a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
HD a [42]
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -66,12 +66,21 @@ FUNCTION tuple() : {tuple, [integer, boolean, string, {tuple, [integer, integer]
|
|||||||
|
|
||||||
|
|
||||||
FUNCTION address() : address
|
FUNCTION address() : address
|
||||||
RETURNR #deadbeef
|
RETURNR @ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
FUNCTION oracle() : oracle
|
||||||
|
RETURNR @ok_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
FUNCTION contract() : contract
|
||||||
|
RETURNR @ct_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
FUNCTION channel() : channel
|
||||||
|
RETURNR @ch_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
;; Option(integer) = NONE | SOME(integer)
|
;; Option(integer) = NONE | SOME(integer)
|
||||||
FUNCTION variant_none() : {variant, [{tuple, []}, {tuple, [integer]}]}
|
FUNCTION variant_none() : {variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
RETURNR (| 2 | 0 | () |)
|
RETURNR (| [0,1] | 0 | () |)
|
||||||
|
|
||||||
;; Option(integer) = NONE | SOME(integer)
|
;; Option(integer) = NONE | SOME(integer)
|
||||||
FUNCTION variant_some() : {variant, [{tuple, []}, {tuple, [integer]}]}
|
FUNCTION variant_some() : {variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
RETURNR (| 2 | 1 | (42) |)
|
RETURNR (| [0,1] | 1 | (42) |)
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
INC a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
INCA
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
INT_TO_ADDR a 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
INT_TO_STR a 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
IS_NIL a []
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
LENGTH a [42]
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
LT a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
MAP_DELETE a { 42 => true } 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
MAP_EMPTY a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
MAP_FROM_LIST a [ ( 42, true) ]
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
MAP_LOOKUP a { 42 => true } 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
MAP_LOOKUPD a { 42 => true } 41 false
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
MAP_MEMBER a { 42 => true } 42
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
MAP_UPDATE a { 42 => true } 42 false
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
FUNCTION call(integer):integer
|
FUNCTION call(integer):integer
|
||||||
STORE var1 arg0
|
STORE var1 arg0
|
||||||
PUSH 0
|
PUSH 0
|
||||||
CALL write
|
CALL "write"
|
||||||
PUSH var1
|
PUSH var1
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
MOD a 1 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
MUL a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
;; CONTRACT names
|
||||||
|
|
||||||
|
FUNCTION preclaim(address, {bytes, 32}) : {tuple, []}
|
||||||
|
AENS_PRECLAIM #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION claim(address, string, integer) : {tuple, []}
|
||||||
|
AENS_CLAIM #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1 arg2
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION transfer(address, address, {bytes, 32}) : {tuple, []}
|
||||||
|
AENS_TRANSFER #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1 arg2
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION revoke(address, {bytes, 32}) : {tuple, []}
|
||||||
|
AENS_REVOKE #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION resolve(string, string) : {variant, [{tuple, []}, {tuple, [address]}]}
|
||||||
|
AENS_RESOLVE a arg0 arg1 'address
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
NEQ a 0 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
NIL a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
NOT a true
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
OR a true true
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
;; CONTRACT oracles
|
||||||
|
|
||||||
|
FUNCTION register (address, integer, {variant, [{tuple, [integer]}, {tuple, [integer]}]}) : oracle
|
||||||
|
ORACLE_REGISTER a #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1 arg2 'string '{variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
FUNCTION query (oracle, integer, string) : oracle_query
|
||||||
|
ORACLE_QUERY a arg0 arg1 arg2 (| [1,1] | 0 | (100) |) (| [1,1] | 0 | (100) |) 'string '{variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
FUNCTION bogus_query () : oracle_query
|
||||||
|
RETURNR @oq_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv
|
||||||
|
|
||||||
|
FUNCTION respond (oracle, integer, string) : {tuple, []}
|
||||||
|
ORACLE_RESPOND #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1 arg2 'string '{variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION extend (oracle, {variant, [{tuple, [integer]}, {tuple, [integer]}]}) : {tuple, []}
|
||||||
|
ORACLE_EXTEND #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== arg0 arg1
|
||||||
|
RETURNR {}
|
||||||
|
|
||||||
|
FUNCTION get_question (oracle, oracle_query) : string
|
||||||
|
ORACLE_GET_QUESTION a arg0 arg1 'string '{variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
FUNCTION get_answer (oracle, oracle_query) : {variant, [{tuple, []}, {tuple, [string]}]}
|
||||||
|
ORACLE_GET_ANSWER a arg1 arg2 'string '{variant, [{tuple, []}, {tuple, [integer]}]}
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
FUNCTION query_fee (oracle) : integer
|
||||||
|
ORACLE_QUERY_FEE a arg0
|
||||||
|
RETURN
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
ORIGIN var3
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
POP a
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
POW a 1 1
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
PUSH 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
SETELEMENT a 0 (42) 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
SHA256 a "This is a string"
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; CONTRACT empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH 0
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
STORE var3 0
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
;; Contract empty_loop
|
||||||
|
|
||||||
|
FUNCTION run (integer) : integer
|
||||||
|
STORE var0 arg0
|
||||||
|
PUSH (0)
|
||||||
|
JUMP 1
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
STR_JOIN a "hello " "world!"
|
||||||
|
|
||||||
|
DEC var0
|
||||||
|
GT var1 var0 0
|
||||||
|
JUMPIF var1 1
|
||||||
|
|
||||||
|
RETURNR 0
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user