| 1418 | } |
| 1419 | |
| 1420 | void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) |
| 1421 | { |
| 1422 | unsigned const stackPosition = m_context.baseToCurrentStackOffset(m_context.baseStackOffsetOfVariable(_variable)); |
| 1423 | unsigned const size = _variable.annotation().type->sizeOnStack(); |
| 1424 | solAssert(stackPosition >= size, "Variable size and position mismatch."); |
| 1425 | // move variable starting from its top end in the stack |
| 1426 | if (stackPosition - size + 1 > m_context.reachableStackDepth()) |
| 1427 | BOOST_THROW_EXCEPTION( |
| 1428 | StackTooDeepError() << |
| 1429 | errinfo_sourceLocation(_variable.location()) << |
| 1430 | util::errinfo_comment(util::stackTooDeepString) |
| 1431 | ); |
| 1432 | for (unsigned i = 0; i < size; ++i) |
| 1433 | m_context << swapInstruction(stackPosition - size + 1) << Instruction::POP; |
| 1434 | } |
| 1435 | |
| 1436 | void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize) |
| 1437 | { |
no test coverage detected