diff options
author | chriseth <chris@ethereum.org> | 2017-09-01 19:59:21 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-11-30 00:08:44 +0800 |
commit | bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2 (patch) | |
tree | bcc4a52df3ea9487e56b1bd32f7fce881fb33970 /libsolidity/codegen/CompilerUtils.cpp | |
parent | 7c69d88f937324b64ed8825f9e611e417421434b (diff) | |
download | dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar.gz dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar.bz2 dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar.lz dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar.xz dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.tar.zst dexon-solidity-bdc1ff8ec71bdf96e0706c951dd92def3aee4aa2.zip |
ABI decoder.
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 053bed6a..533aca5c 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -319,6 +319,23 @@ void CompilerUtils::abiEncodeV2( m_context << ret.tag(); } +void CompilerUtils::abiDecodeV2(TypePointers const& _parameterTypes, bool _fromMemory) +{ + // stack: <source_offset> + auto ret = m_context.pushNewTag(); + m_context << Instruction::SWAP1; + if (_fromMemory) + // TODO pass correct size for the memory case + m_context << (u256(1) << 63); + else + m_context << Instruction::CALLDATASIZE; + m_context << Instruction::SWAP1; + string decoderName = m_context.abiFunctions().tupleDecoder(_parameterTypes, _fromMemory); + m_context.appendJumpTo(m_context.namedTag(decoderName)); + m_context.adjustStackOffset(int(sizeOnStack(_parameterTypes)) - 3); + m_context << ret.tag(); +} + void CompilerUtils::zeroInitialiseMemoryArray(ArrayType const& _type) { auto repeat = m_context.newTag(); |