aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-08 21:52:15 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-06-09 17:45:36 +0800
commit6b3e7f79cf42edd031a2000978e394d818212b39 (patch)
tree39176b3ba7da9d82902abbd8eca041845a33bb0b
parent40cb14cdefea38c7b09439210e9eaa8806d609ed (diff)
downloaddexon-solidity-6b3e7f79cf42edd031a2000978e394d818212b39.tar.gz
dexon-solidity-6b3e7f79cf42edd031a2000978e394d818212b39.tar.zst
dexon-solidity-6b3e7f79cf42edd031a2000978e394d818212b39.zip
Comments and consistent variable names.
-rw-r--r--libjulia/backends/evm/AbstractAssembly.h12
-rw-r--r--libjulia/backends/evm/EVMAssembly.cpp5
-rw-r--r--libjulia/backends/evm/EVMAssembly.h10
-rw-r--r--libsolidity/inlineasm/AsmCodeGen.cpp8
4 files changed, 18 insertions, 17 deletions
diff --git a/libjulia/backends/evm/AbstractAssembly.h b/libjulia/backends/evm/AbstractAssembly.h
index baed833b..f667c1a7 100644
--- a/libjulia/backends/evm/AbstractAssembly.h
+++ b/libjulia/backends/evm/AbstractAssembly.h
@@ -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;
diff --git a/libjulia/backends/evm/EVMAssembly.cpp b/libjulia/backends/evm/EVMAssembly.cpp
index 4b16dd24..daca2393 100644
--- a/libjulia/backends/evm/EVMAssembly.cpp
+++ b/libjulia/backends/evm/EVMAssembly.cpp
@@ -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&)
diff --git a/libjulia/backends/evm/EVMAssembly.h b/libjulia/backends/evm/EVMAssembly.h
index 4b0076dd..a2df0cdc 100644
--- a/libjulia/backends/evm/EVMAssembly.h
+++ b/libjulia/backends/evm/EVMAssembly.h
@@ -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;
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp
index 217c6885..0e4e744f 100644
--- a/libsolidity/inlineasm/AsmCodeGen.cpp
+++ b/libsolidity/inlineasm/AsmCodeGen.cpp
@@ -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