diff options
author | chriseth <c@ethdev.com> | 2017-02-25 00:42:41 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-03-03 22:41:02 +0800 |
commit | 13fd569f761154a4e4b4fe2c6431b056f04a9119 (patch) | |
tree | c65c57ef90547df08df4fb090bb034f8a4c2054b /libsolidity/inlineasm/AsmCodeGen.cpp | |
parent | 455e8a4ef896984b7ce204a998a3392f191a7671 (diff) | |
download | dexon-solidity-13fd569f761154a4e4b4fe2c6431b056f04a9119.tar.gz dexon-solidity-13fd569f761154a4e4b4fe2c6431b056f04a9119.tar.zst dexon-solidity-13fd569f761154a4e4b4fe2c6431b056f04a9119.zip |
First reset stack height, then register variables.
Diffstat (limited to 'libsolidity/inlineasm/AsmCodeGen.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmCodeGen.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp index bfa48c0e..69ce9507 100644 --- a/libsolidity/inlineasm/AsmCodeGen.cpp +++ b/libsolidity/inlineasm/AsmCodeGen.cpp @@ -194,19 +194,20 @@ public: m_scope.identifiers | boost::adaptors::map_values, [](Scope::Identifier const& var) { return var.type() == typeid(Scope::Variable) && boost::get<Scope::Variable>(var).active; } ); - for (auto const& identifier: _label.stackInfo) - if (!identifier.empty()) - { - solAssert(m_scope.identifiers.count(identifier), ""); - Scope::Variable& var = boost::get<Scope::Variable>(m_scope.identifiers[identifier]); - var.active = true; - var.stackHeight = m_initialDeposit + numVariables; - numVariables++; - } + numVariables += boost::count_if(_label.stackInfo, [](string const& s) { return !s.empty(); }); m_state.assembly.setDeposit(m_initialDeposit + numVariables); } else if (label.stackAdjustment != 0) m_state.assembly.adjustDeposit(label.stackAdjustment); + int height = m_state.assembly.deposit(); + for (auto const& identifier: _label.stackInfo | boost::adaptors::reversed) + if (!identifier.empty()) + { + solAssert(m_scope.identifiers.count(identifier), ""); + Scope::Variable& var = boost::get<Scope::Variable>(m_scope.identifiers[identifier]); + var.active = true; + var.stackHeight = --height; + } m_state.assembly.append(eth::AssemblyItem(eth::Tag, label.id)); } void operator()(assembly::Assignment const& _assignment) |