PT-164597852 Move aesophia heap handling into aebytecode #141

Merged
rvirding merged 6 commits from PT-164597852-move-aesophia-heap into master 2019-04-02 17:06:55 +09:00
5 changed files with 35 additions and 5 deletions
Showing only changes of commit 333bf53537 - Show all commits

View File

@ -1,6 +1,6 @@
-record(pmap, {key_t :: aeso_sophia:type(),
val_t :: aeso_sophia:type(),
-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}

View File

@ -23,7 +23,7 @@
-type hash() :: <<_:256>>. %% 256 = ?HASH_SIZE * 8.
-type function_name() :: binary(). %% String
-type typerep() :: aeso_sophia:type().
-type typerep() :: aeb_aevm_data:type().
-type function_type_info() :: { FunctionHash :: hash()
, FunctionName :: function_name()
, ArgType :: binary() %% binary typerep

30
src/aeb_aevm_data.erl Normal file
View File

@ -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().

View File

@ -92,7 +92,7 @@ heap_value_heap({_, Heap}) -> Heap#heap.heap.
%% -- Value to binary --------------------------------------------------------
-spec to_binary(aeso_sophia:data()) -> aeso_sophia:heap().
-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) ->

View File

@ -1,5 +1,5 @@
-define(Type(), aeso_sophia:type()).
-define(Type(), aeb_aevm_data:type()).
-define(TYPEREP_WORD_TAG, 0).
-define(TYPEREP_STRING_TAG, 1).