mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Comments and consistent variable names.
This commit is contained in:
parent
40cb14cdef
commit
6b3e7f79cf
@ -77,15 +77,15 @@ public:
|
|||||||
|
|
||||||
/// Append a jump-to-immediate operation.
|
/// Append a jump-to-immediate operation.
|
||||||
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
||||||
virtual void appendJumpTo(LabelID _label, int _stackDiffAfter = 0) = 0;
|
virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter = 0) = 0;
|
||||||
/// Append a jump-to-if-immediate operation.
|
/// Append a jump-to-if-immediate operation.
|
||||||
virtual void appendJumpToIf(LabelID _label) = 0;
|
virtual void appendJumpToIf(LabelID _labelId) = 0;
|
||||||
/// Start a subroutine identified by @a _label that takes @a _arguments
|
/// Start a subroutine identified by @a _labelId that takes @a _arguments
|
||||||
/// stack slots as arguments.
|
/// stack slots as arguments.
|
||||||
virtual void appendBeginsub(LabelID _label, int _arguments) = 0;
|
virtual void appendBeginsub(LabelID _labelId, int _arguments) = 0;
|
||||||
/// Call a subroutine identified by @a _label, taking @a _arguments from the
|
/// 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.
|
/// stack upon call and putting @a _returns arguments onto the stack upon return.
|
||||||
virtual void appendJumpsub(LabelID _label, int _arguments, int _returns) = 0;
|
virtual void appendJumpsub(LabelID _labelId, int _arguments, int _returns) = 0;
|
||||||
/// Return from a subroutine.
|
/// Return from a subroutine.
|
||||||
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
||||||
virtual void appendReturnsub(int _returns, int _stackDiffAfter = 0) = 0;
|
virtual void appendReturnsub(int _returns, int _stackDiffAfter = 0) = 0;
|
||||||
|
@ -30,6 +30,7 @@ using namespace julia;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
/// Size of labels in bytes. Four-byte labels are required by some EVM1.5 instructions.
|
||||||
size_t constexpr labelReferenceSize = 4;
|
size_t constexpr labelReferenceSize = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +71,8 @@ void EVMAssembly::appendLabelReference(LabelID _labelId)
|
|||||||
|
|
||||||
EVMAssembly::LabelID EVMAssembly::newLabelId()
|
EVMAssembly::LabelID EVMAssembly::newLabelId()
|
||||||
{
|
{
|
||||||
m_labelPositions[m_nextLabelID] = size_t(-1);
|
m_labelPositions[m_nextLabelId] = size_t(-1);
|
||||||
return m_nextLabelID++;
|
return m_nextLabelId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVMAssembly::appendLinkerSymbol(string const&)
|
void EVMAssembly::appendLinkerSymbol(string const&)
|
||||||
|
@ -60,13 +60,13 @@ public:
|
|||||||
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
/// @param _stackDiffAfter the stack adjustment after this instruction.
|
||||||
virtual void appendJump(int _stackDiffAfter) override;
|
virtual void appendJump(int _stackDiffAfter) override;
|
||||||
/// Append a jump-to-immediate operation.
|
/// Append a jump-to-immediate operation.
|
||||||
virtual void appendJumpTo(LabelID _label, int _stackDiffAfter) override;
|
virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override;
|
||||||
/// Append a jump-to-if-immediate operation.
|
/// Append a jump-to-if-immediate operation.
|
||||||
virtual void appendJumpToIf(LabelID _label) override;
|
virtual void appendJumpToIf(LabelID _labelId) override;
|
||||||
/// Start a subroutine.
|
/// Start a subroutine.
|
||||||
virtual void appendBeginsub(LabelID _label, int _arguments) override;
|
virtual void appendBeginsub(LabelID _labelId, int _arguments) override;
|
||||||
/// Call a subroutine.
|
/// Call a subroutine.
|
||||||
virtual void appendJumpsub(LabelID _label, int _arguments, int _returns) override;
|
virtual void appendJumpsub(LabelID _labelId, int _arguments, int _returns) override;
|
||||||
/// Return from a subroutine.
|
/// Return from a subroutine.
|
||||||
virtual void appendReturnsub(int _returns, int _stackDiffAfter) override;
|
virtual void appendReturnsub(int _returns, int _stackDiffAfter) override;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ private:
|
|||||||
void appendLabelReferenceInternal(AbstractAssembly::LabelID _labelId);
|
void appendLabelReferenceInternal(AbstractAssembly::LabelID _labelId);
|
||||||
|
|
||||||
bool m_evm15 = false; ///< if true, switch to evm1.5 mode
|
bool m_evm15 = false; ///< if true, switch to evm1.5 mode
|
||||||
LabelID m_nextLabelID = 0;
|
LabelID m_nextLabelId = 0;
|
||||||
int m_stackHeight = 0;
|
int m_stackHeight = 0;
|
||||||
bytes m_bytecode;
|
bytes m_bytecode;
|
||||||
std::map<LabelID, size_t> m_labelPositions;
|
std::map<LabelID, size_t> m_labelPositions;
|
||||||
|
@ -92,14 +92,14 @@ public:
|
|||||||
appendInstruction(solidity::Instruction::JUMP);
|
appendInstruction(solidity::Instruction::JUMP);
|
||||||
m_assembly.adjustDeposit(_stackDiffAfter);
|
m_assembly.adjustDeposit(_stackDiffAfter);
|
||||||
}
|
}
|
||||||
virtual void appendJumpTo(LabelID _label, int _stackDiffAfter) override
|
virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override
|
||||||
{
|
{
|
||||||
appendLabelReference(_label);
|
appendLabelReference(_labelId);
|
||||||
appendJump(_stackDiffAfter);
|
appendJump(_stackDiffAfter);
|
||||||
}
|
}
|
||||||
virtual void appendJumpToIf(LabelID _label) override
|
virtual void appendJumpToIf(LabelID _labelId) override
|
||||||
{
|
{
|
||||||
appendLabelReference(_label);
|
appendLabelReference(_labelId);
|
||||||
appendInstruction(solidity::Instruction::JUMPI);
|
appendInstruction(solidity::Instruction::JUMPI);
|
||||||
}
|
}
|
||||||
virtual void appendBeginsub(LabelID, int) override
|
virtual void appendBeginsub(LabelID, int) override
|
||||||
|
Loading…
Reference in New Issue
Block a user