[Sol->Yul] Adding cleanUpArrayEnd util function.

Co-authored-by: chriseth <chris@ethereum.org>

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>

Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>

Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
Djordje Mijovic
2021-05-05 08:53:34 +02:00
co-authored by chriseth Alex Beregszaszi Kamil Śliwak
parent 1d1175c292
commit 3e5f5fccf9
2 changed files with 82 additions and 38 deletions
+13
View File
@@ -207,6 +207,11 @@ public:
/// signature: (array, newLen)
std::string resizeArrayFunction(ArrayType const& _type);
/// @returns the name of a function that zeroes all storage array elements from `startIndex` to `len` (excluding).
/// Assumes that `len` is the array length. Does nothing if `startIndex >= len`. Does not modify the stored length.
/// signature: (array, len, startIndex)
std::string cleanUpStorageArrayEndFunction(ArrayType const& _type);
/// @returns the name of a function that reduces the size of a storage array by one element
/// signature: (array)
std::string storageArrayPopFunction(ArrayType const& _type);
@@ -543,6 +548,14 @@ private:
/// signature: (array, newLen)
std::string resizeDynamicByteArrayFunction(ArrayType const& _type);
/// @returns the name of a function that cleans up elements of a storage byte array starting from startIndex.
/// It will not copy elements in case of transformation to short byte array, and will not change array length.
/// In case of startIndex is greater than len, doesn't do anything.
/// In case of short byte array (< 32 bytes) doesn't do anything.
/// If the first slot to be cleaned up is partially occupied, does not touch it. Cleans up only completely unused slots.
/// signature: (array, len, startIndex)
std::string cleanUpDynamicByteArrayEndSlotsFunction(ArrayType const& _type);
/// @returns the name of a function that increases size of byte array
/// when we resize byte array frextractUsedSetLenom < 32 elements to >= 32 elements or we push to byte array of size 31 copying of data will occur
/// signature: (array, data, oldLen, newLen)