MCPcopy Create free account
hub / github.com/argotorg/solidity / loadFromMemoryDynamic

Method loadFromMemoryDynamic

libsolidity/codegen/CompilerUtils.cpp:164–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void 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
194void CompilerUtils::storeInMemory(unsigned _offset)
195{

Callers 4

retrieveValueMethod · 0.80
visitMethod · 0.80

Calls 3

isDynamicallySizedMethod · 0.45
memoryDataSizeMethod · 0.45
sizeOnStackMethod · 0.45

Tested by

no test coverage detected