diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-03-12 21:08:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-12 21:08:24 +0800 |
commit | c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe (patch) | |
tree | 215d08a62882a409f29bcbf1559ee123f36e7678 | |
parent | 30443f3a3e8131813dc6c62c2096c5d79f100a86 (diff) | |
parent | 0649f900cacdbe43c127d543c47e834b80210949 (diff) | |
download | dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar.gz dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar.bz2 dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar.lz dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar.xz dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.tar.zst dexon-solidity-c6e9dd13bc34cd422c47ee7f8dd3832d9f00fdbe.zip |
Merge pull request #3697 from ethereum/fixAvoidStorageClearLoop
Properly skip cleanup if only enlarging storage array.
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | libsolidity/codegen/ArrayUtils.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Changelog.md b/Changelog.md index c9bffa64..6a25569f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Features: Bugfixes: + * Code Generator: Properly skip unneeded storgae array cleanup when not reducing length. diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index ce8cbb5f..4703fc1f 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -741,10 +741,10 @@ void ArrayUtils::resizeDynamicArray(ArrayType const& _typeIn) const if (_type.isByteArray()) // For a "long" byte array, store length as 2*length+1 _context << Instruction::DUP1 << Instruction::ADD << u256(1) << Instruction::ADD; - _context<< Instruction::DUP4 << Instruction::SSTORE; + _context << Instruction::DUP4 << Instruction::SSTORE; // skip if size is not reduced _context << Instruction::DUP2 << Instruction::DUP2 - << Instruction::ISZERO << Instruction::GT; + << Instruction::GT << Instruction::ISZERO; _context.appendConditionalJumpTo(resizeEnd); // size reduced, clear the end of the array |