diff options
author | chriseth <c@ethdev.com> | 2015-06-12 17:06:05 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-12 17:31:03 +0800 |
commit | d60ef3f2d792989ebcbf3326bcf8fced6031b5b9 (patch) | |
tree | 028f6b5ec8e89f542e05b57a2b64b87a2c4eebce | |
parent | c3caa2ce259696d3855a82ea384b4dafd2b2547b (diff) | |
download | dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar.gz dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar.bz2 dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar.lz dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar.xz dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.tar.zst dexon-solidity-d60ef3f2d792989ebcbf3326bcf8fced6031b5b9.zip |
Optimize RETURN x 0 to STOP.
-rw-r--r-- | Compiler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index 950b1e75..b2b8bfa4 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -298,7 +298,10 @@ void Compiler::appendReturnValuePacker(TypePointers const& _typeParameters) stackDepth -= type->getSizeOnStack(); } // note that the stack is not cleaned up here - m_context << u256(dataOffset) << u256(0) << eth::Instruction::RETURN; + if (dataOffset == 0) + m_context << eth::Instruction::STOP; + else + m_context << u256(dataOffset) << u256(0) << eth::Instruction::RETURN; } void Compiler::registerStateVariables(ContractDefinition const& _contract) |