diff options
author | Christian <c@ethdev.com> | 2014-12-10 19:51:26 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-10 19:51:26 +0800 |
commit | 5edffeba19192c2fc8683e8e683cf5bbc261e28b (patch) | |
tree | 9b82cdb01fb38abf7a13fb7fe09b5af74b4b8012 /CompilerUtils.cpp | |
parent | 35d5b28faeee5e19d0dbbeb3c75454249d636abd (diff) | |
download | dexon-solidity-5edffeba19192c2fc8683e8e683cf5bbc261e28b.tar.gz dexon-solidity-5edffeba19192c2fc8683e8e683cf5bbc261e28b.tar.zst dexon-solidity-5edffeba19192c2fc8683e8e683cf5bbc261e28b.zip |
Take variable stack size correctly into account for return value packer.
Diffstat (limited to 'CompilerUtils.cpp')
-rw-r--r-- | CompilerUtils.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp index cbd92d2b..824fd477 100644 --- a/CompilerUtils.cpp +++ b/CompilerUtils.cpp @@ -42,6 +42,15 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) m_context << eth::swapInstruction(stackPosition - size + 1) << eth::Instruction::POP; } +void CompilerUtils::copyToStackTop(unsigned _stackDepth, const Type& _type) +{ + if (_stackDepth > 16) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Stack too deep.")); + unsigned const size = _type.getSizeOnStack(); + for (unsigned i = 0; i < size; ++i) + m_context << eth::dupInstruction(_stackDepth); +} + void CompilerUtils::popStackElement(Type const& _type) { unsigned const size = _type.getSizeOnStack(); |