diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-16 10:46:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-16 10:46:29 +0800 |
commit | a0d171722a211720773aae0ded8a80991d44ba9d (patch) | |
tree | ae1376cd7d128573edb235f92191dd30118d07bf /libsolidity/codegen/CompilerUtils.cpp | |
parent | 7dd372ce5c9ea1cacf2c70a16f0285bb74314db8 (diff) | |
parent | 80ce3ca66f063d8d87c2393e689f92d8608b4e0a (diff) | |
download | dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar.gz dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar.bz2 dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar.lz dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar.xz dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.tar.zst dexon-solidity-a0d171722a211720773aae0ded8a80991d44ba9d.zip |
Merge pull request #2823 from ethereum/iuliaCompressor
Combine all ABI functions into a single assembly.
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 146472f9..1e623357 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -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"); - - ABIFunctions funs; - string routine = funs.tupleEncoder(_givenTypes, _targetTypes, _encodeAsLibraryTypes); - routine += funs.requestedFunctions(); - m_context.appendInlineAssembly("{" + routine + "}", variables); - // Remove everyhing except for "value0" / the final memory pointer. - popStackSlots(numValues); + auto ret = m_context.pushNewTag(); + moveIntoStack(sizeOnStack(_givenTypes) + 1); + + 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) |