diff options
author | chriseth <chris@ethereum.org> | 2018-07-12 19:01:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-12 19:01:15 +0800 |
commit | 576f3ef18c47c13b92e5b604d19f99018b0300b0 (patch) | |
tree | 3cf2e9c41606f6c2a599621297a8155e097333dc /libsolidity/codegen/CompilerUtils.cpp | |
parent | c438b73f689b904152f4b8b636579317fb55e60a (diff) | |
parent | a18a475b1a6ba1ebcf235f322dec0e7ff3d3dcb0 (diff) | |
download | dexon-solidity-576f3ef18c47c13b92e5b604d19f99018b0300b0.tar.gz dexon-solidity-576f3ef18c47c13b92e5b604d19f99018b0300b0.tar.zst dexon-solidity-576f3ef18c47c13b92e5b604d19f99018b0300b0.zip |
Merge pull request #4083 from ethereum/variable_stack_slot
[BREAKING] Allocate local variables according to their scope
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 2e335ca5..2d81a106 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1170,6 +1170,15 @@ void CompilerUtils::popStackSlots(size_t _amount) m_context << Instruction::POP; } +void CompilerUtils::popAndJump(unsigned _toHeight, eth::AssemblyItem const& _jumpTo) +{ + solAssert(m_context.stackHeight() >= _toHeight, ""); + unsigned amount = m_context.stackHeight() - _toHeight; + popStackSlots(amount); + m_context.appendJumpTo(_jumpTo); + m_context.adjustStackOffset(amount); +} + unsigned CompilerUtils::sizeOnStack(vector<shared_ptr<Type const>> const& _variableTypes) { unsigned size = 0; |