mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move ABI encoder into its own function.
This commit is contained in:
1 parent
73771f5bb2
commit
80ce3ca66f
6 files changed
+82
-65
No files matched your search
@@ -310,18 +310,13 @@ void CompilerUtils::abiEncode(
|
||||
{
|
||||
// stack: <$value0> <$value1> ... <$value(n-1)> <$headStart>
|
||||
|
||||
vector<string> variables;
|
||||
size_t numValues = sizeOnStack(_givenTypes);
|
||||
for (size_t i = 0; i < numValues; ++i)
|
||||
variables.push_back("$value" + to_string(i));
|
||||
variables.push_back("$headStart");
|
||||
auto ret = m_context.pushNewTag();
|
||||
moveIntoStack(sizeOnStack(_givenTypes) + 1);
|
||||
|
||||
ABIFunctions funs;
|
||||
string routine = funs.tupleEncoder(_givenTypes, _targetTypes, _encodeAsLibraryTypes);
|
||||
routine += funs.requestedFunctions();
|
||||
m_context.appendInlineAssembly("{" + routine + "}", variables, true);
|
||||
// Remove everyhing except for "value0" / the final memory pointer.
|
||||
popStackSlots(numValues);
|
||||
string encoderName = m_context.abiFunctions().tupleEncoder(_givenTypes, _targetTypes, _encodeAsLibraryTypes);
|
||||
m_context.appendJumpTo(m_context.namedTag(encoderName));
|
||||
m_context.adjustStackOffset(-int(sizeOnStack(_givenTypes)) - 1);
|
||||
m_context << ret.tag();
|
||||
}
|
||||
|
||||
void CompilerUtils::zeroInitialiseMemoryArray(ArrayType const& _type)
|
||||
|
||||
Reference in new issue
Block a user