From a657d3b1a165d9ec14f9875db2380954f9ca37cf Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 26 Sep 2017 18:50:43 +0100 Subject: Make most of the parameters mandatory in encodeToMemory --- libsolidity/codegen/CompilerUtils.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libsolidity/codegen/CompilerUtils.h') diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index 5e45699b..b239bde6 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -102,10 +102,10 @@ public: /// @note the locations of target reference types are ignored, because it will always be /// memory. void encodeToMemory( - TypePointers const& _givenTypes = {}, - TypePointers const& _targetTypes = {}, - bool _padToWords = true, - bool _copyDynamicDataInPlace = false, + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _padToWords, + bool _copyDynamicDataInPlace, bool _encodeAsLibraryTypes = false ); -- cgit v1.2.3 From 204214f0700179e3d8fa97c77d4f92acd349f015 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 26 Sep 2017 22:10:30 +0100 Subject: Split encodeToMemory to packedEncode and abiEncode --- libsolidity/codegen/CompilerUtils.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libsolidity/codegen/CompilerUtils.h') diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index b239bde6..ad3989ad 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -109,6 +109,19 @@ public: bool _encodeAsLibraryTypes = false ); + /// Special case of @a encodeToMemory which assumes tight packing, e.g. no zero padding + /// and dynamic data is encoded in-place. + /// Stack pre: ... + /// Stack post: + void packedEncode( + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _encodeAsLibraryTypes = false + ) + { + encodeToMemory(_givenTypes, _targetTypes, false, true, _encodeAsLibraryTypes); + } + /// Special case of @a encodeToMemory which assumes that everything is padded to words /// and dynamic data is not copied in place (i.e. a proper ABI encoding). /// Stack pre: ... @@ -117,6 +130,20 @@ public: TypePointers const& _givenTypes, TypePointers const& _targetTypes, bool _encodeAsLibraryTypes = false + ) + { + encodeToMemory(_givenTypes, _targetTypes, true, false, _encodeAsLibraryTypes); + } + + /// Special case of @a encodeToMemory which assumes that everything is padded to words + /// and dynamic data is not copied in place (i.e. a proper ABI encoding). + /// Uses a new, less tested encoder implementation. + /// Stack pre: ... + /// Stack post: + void abiEncodeV2( + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _encodeAsLibraryTypes = false ); /// Zero-initialises (the data part of) an already allocated memory array. -- cgit v1.2.3