| 162 | } |
| 163 | |
| 164 | void CompilerUtils::loadFromMemoryDynamic( |
| 165 | Type const& _type, |
| 166 | bool _fromCalldata, |
| 167 | bool _padToWordBoundaries, |
| 168 | bool _keepUpdatedMemoryOffset |
| 169 | ) |
| 170 | { |
| 171 | if (_keepUpdatedMemoryOffset) |
| 172 | m_context << Instruction::DUP1; |
| 173 | |
| 174 | if (auto arrayType = dynamic_cast<ArrayType const*>(&_type)) |
| 175 | { |
| 176 | solAssert(!arrayType->isDynamicallySized()); |
| 177 | solAssert(!_fromCalldata); |
| 178 | solAssert(_padToWordBoundaries); |
| 179 | if (_keepUpdatedMemoryOffset) |
| 180 | m_context << arrayType->memoryDataSize() << Instruction::ADD; |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | unsigned numBytes = loadFromMemoryHelper(_type, _fromCalldata, _padToWordBoundaries); |
| 185 | if (_keepUpdatedMemoryOffset) |
| 186 | { |
| 187 | // update memory counter |
| 188 | moveToStackTop(_type.sizeOnStack()); |
| 189 | m_context << u256(numBytes) << Instruction::ADD; |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | void CompilerUtils::storeInMemory(unsigned _offset) |
| 195 | { |
no test coverage detected