aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia/backends/evm/AbstractAssembly.h
diff options
context:
space:
mode:
Diffstat (limited to 'libjulia/backends/evm/AbstractAssembly.h')
-rw-r--r--libjulia/backends/evm/AbstractAssembly.h25
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;