|
@ -35,6 +35,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) |
|
|
{ |
|
|
{ |
|
|
unsigned const stackPosition = m_context.baseToCurrentStackOffset(m_context.getBaseStackOffsetOfVariable(_variable)); |
|
|
unsigned const stackPosition = m_context.baseToCurrentStackOffset(m_context.getBaseStackOffsetOfVariable(_variable)); |
|
|
unsigned const size = _variable.getType()->getSizeOnStack(); |
|
|
unsigned const size = _variable.getType()->getSizeOnStack(); |
|
|
|
|
|
// move variable starting from its top end in the stack
|
|
|
if (stackPosition - size + 1 > 16) |
|
|
if (stackPosition - size + 1 > 16) |
|
|
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_sourceLocation(_variable.getLocation()) |
|
|
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_sourceLocation(_variable.getLocation()) |
|
|
<< errinfo_comment("Stack too deep.")); |
|
|
<< errinfo_comment("Stack too deep.")); |
|
@ -42,7 +43,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) |
|
|
m_context << eth::swapInstruction(stackPosition - size + 1) << eth::Instruction::POP; |
|
|
m_context << eth::swapInstruction(stackPosition - size + 1) << eth::Instruction::POP; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void CompilerUtils::copyToStackTop(unsigned _stackDepth, const Type& _type) |
|
|
void CompilerUtils::copyToStackTop(unsigned _stackDepth, Type const& _type) |
|
|
{ |
|
|
{ |
|
|
if (_stackDepth > 16) |
|
|
if (_stackDepth > 16) |
|
|
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Stack too deep.")); |
|
|
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Stack too deep.")); |
|
|