Comments and consistent variable names.

This commit is contained in:
chriseth 2017-06-08 15:52:15 +02:00 committed by Alex Beregszaszi
parent 40cb14cdef
commit 6b3e7f79cf
4 changed files with 18 additions and 17 deletions

View File

@ -77,15 +77,15 @@ public:
/// Append a jump-to-immediate operation.
/// @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.
virtual void appendJumpToIf(LabelID _label) = 0;
/// Start a subroutine identified by @a _label that takes @a _arguments
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 _label, int _arguments) = 0;
/// Call a subroutine identified by @a _label, taking @a _arguments from the
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 _label, int _arguments, int _returns) = 0;
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;

View File

@ -30,6 +30,7 @@ using namespace julia;
namespace
{
/// Size of labels in bytes. Four-byte labels are required by some EVM1.5 instructions.
size_t constexpr labelReferenceSize = 4;
}
@ -70,8 +71,8 @@ void EVMAssembly::appendLabelReference(LabelID _labelId)
EVMAssembly::LabelID EVMAssembly::newLabelId()
{
m_labelPositions[m_nextLabelID] = size_t(-1);
return m_nextLabelID++;
m_labelPositions[m_nextLabelId] = size_t(-1);
return m_nextLabelId++;
}
void EVMAssembly::appendLinkerSymbol(string const&)

View File

@ -60,13 +60,13 @@ public:
/// @param _stackDiffAfter the stack adjustment after this instruction.
virtual void appendJump(int _stackDiffAfter) override;
/// 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.
virtual void appendJumpToIf(LabelID _label) override;
virtual void appendJumpToIf(LabelID _labelId) override;
/// Start a subroutine.
virtual void appendBeginsub(LabelID _label, int _arguments) override;
virtual void appendBeginsub(LabelID _labelId, int _arguments) override;
/// 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.
virtual void appendReturnsub(int _returns, int _stackDiffAfter) override;
@ -79,7 +79,7 @@ private:
void appendLabelReferenceInternal(AbstractAssembly::LabelID _labelId);
bool m_evm15 = false; ///< if true, switch to evm1.5 mode
LabelID m_nextLabelID = 0;
LabelID m_nextLabelId = 0;
int m_stackHeight = 0;
bytes m_bytecode;
std::map<LabelID, size_t> m_labelPositions;

View File

@ -92,14 +92,14 @@ public:
appendInstruction(solidity::Instruction::JUMP);
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);
}
virtual void appendJumpToIf(LabelID _label) override
virtual void appendJumpToIf(LabelID _labelId) override
{
appendLabelReference(_label);
appendLabelReference(_labelId);
appendInstruction(solidity::Instruction::JUMPI);
}
virtual void appendBeginsub(LabelID, int) override