diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-09 18:23:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-09 18:23:40 +0800 |
commit | 76667fed4f9865c4a3a5a267c469446f8bce1bef (patch) | |
tree | 4f8d0d9eee83e30912e78685d6c0fbdc916521a9 /libjulia/backends/evm/AbstractAssembly.h | |
parent | 21e0b69dcb189fb52ac4e38959801582e02ca8fd (diff) | |
parent | 80227af08a72e37e35a0a8bfacadc1c201f1d114 (diff) | |
download | dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.gz dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.bz2 dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.lz dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.xz dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.zst dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.zip |
Merge pull request #2304 from ethereum/evm15asm
Implementation of EVM 1.5 backend
Diffstat (limited to 'libjulia/backends/evm/AbstractAssembly.h')
-rw-r--r-- | libjulia/backends/evm/AbstractAssembly.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libjulia/backends/evm/AbstractAssembly.h b/libjulia/backends/evm/AbstractAssembly.h index de31be28..f667c1a7 100644 --- a/libjulia/backends/evm/AbstractAssembly.h +++ b/libjulia/backends/evm/AbstractAssembly.h @@ -41,6 +41,9 @@ struct Identifier; namespace julia { +/// +/// Assembly class that abstracts both the libevmasm assembly and the new julia evm assembly. +/// class AbstractAssembly { public: @@ -66,6 +69,26 @@ public: /// Append a reference to a to-be-linked symobl. /// Currently, we assume that the value is always a 20 byte number. virtual void appendLinkerSymbol(std::string const& _name) = 0; + + /// Append a jump instruction. + /// @param _stackDiffAfter the stack adjustment after this instruction. + /// This is helpful to stack height analysis if there is no continuing control flow. + virtual void appendJump(int _stackDiffAfter) = 0; + + /// Append a jump-to-immediate operation. + /// @param _stackDiffAfter the stack adjustment after this instruction. + virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter = 0) = 0; + /// Append a jump-to-if-immediate operation. + virtual void appendJumpToIf(LabelID _labelId) = 0; + /// Start a subroutine identified by @a _labelId that takes @a _arguments + /// stack slots as arguments. + virtual void appendBeginsub(LabelID _labelId, int _arguments) = 0; + /// Call a subroutine identified by @a _labelId, taking @a _arguments from the + /// stack upon call and putting @a _returns arguments onto the stack upon return. + virtual void appendJumpsub(LabelID _labelId, int _arguments, int _returns) = 0; + /// Return from a subroutine. + /// @param _stackDiffAfter the stack adjustment after this instruction. + virtual void appendReturnsub(int _returns, int _stackDiffAfter = 0) = 0; }; enum class IdentifierContext { LValue, RValue }; @@ -74,7 +97,7 @@ enum class IdentifierContext { LValue, RValue }; /// to inline assembly (not used in standalone assembly mode). struct ExternalIdentifierAccess { - using Resolver = std::function<size_t(solidity::assembly::Identifier const&, IdentifierContext)>; + using Resolver = std::function<size_t(solidity::assembly::Identifier const&, IdentifierContext, bool /*_crossesFunctionBoundary*/)>; /// Resolve a an external reference given by the identifier in the given context. /// @returns the size of the value (number of stack slots) or size_t(-1) if not found. Resolver resolve; |