diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-15 03:38:59 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-15 04:21:26 +0800 |
commit | c08c4b8b6f0e8c4ccc139e525218cb0cb1ac4ad4 (patch) | |
tree | 0a30cbc22c44772cdad87e772c603525aec9f53a /libevmasm | |
parent | 6a260a9ff1c0c9c8ee14e988bd066b74555651e7 (diff) | |
download | dexon-solidity-c08c4b8b6f0e8c4ccc139e525218cb0cb1ac4ad4.tar.gz dexon-solidity-c08c4b8b6f0e8c4ccc139e525218cb0cb1ac4ad4.tar.zst dexon-solidity-c08c4b8b6f0e8c4ccc139e525218cb0cb1ac4ad4.zip |
Move subroutine helpers from CompilerContext to Assembly
Diffstat (limited to 'libevmasm')
-rw-r--r-- | libevmasm/Assembly.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index 36fdda36..13d82e1a 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -70,6 +70,13 @@ public: AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMP); return ret; } AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMPI); return ret; } + /// Adds a subroutine to the code (in the data section) and pushes its size (via a tag) + /// on the stack. @returns the pushsub assembly item. + AssemblyItem appendSubroutine(AssemblyPointer const& _assembly) { auto sub = newSub(_assembly); append(newPushSubSize(size_t(sub.data()))); return sub; } + void pushSubroutineSize(size_t _subRoutine) { append(newPushSubSize(_subRoutine)); } + /// Pushes the offset of the subroutine. + void pushSubroutineOffset(size_t _subRoutine) { append(AssemblyItem(PushSub, _subRoutine)); } + /// Appends @a _data literally to the very end of the bytecode. void appendAuxiliaryDataToEnd(bytes const& _data) { m_auxiliaryData += _data; } |