aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry <dimitry@ethdev.com>2016-04-04 19:18:24 +0800
committerDimitry <dimitry@ethdev.com>2016-04-04 19:18:24 +0800
commit98165100658bc4f29e6194f0c5ede6e5b9d516f5 (patch)
tree31e3b6413c2928e527ecc03307f08818984dcd33
parent858c41260d4cec26ba38ea3bd2ef71dcede63f7c (diff)
downloaddexon-solidity-98165100658bc4f29e6194f0c5ede6e5b9d516f5.tar.gz
dexon-solidity-98165100658bc4f29e6194f0c5ede6e5b9d516f5.tar.zst
dexon-solidity-98165100658bc4f29e6194f0c5ede6e5b9d516f5.zip
enable solidity test
-rw-r--r--CMakeLists.txt2
-rw-r--r--libevmasm/Assembly.h10
-rw-r--r--libevmasm/AssemblyItem.h2
-rw-r--r--libsolidity/codegen/ArrayUtils.cpp2
-rw-r--r--test/libsolidity/SolidityExpressionCompiler.cpp222
-rw-r--r--test/libsolidity/SolidityOptimizer.cpp38
6 files changed, 138 insertions, 138 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d319314..a843ab89 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ add_subdirectory(libsolidity)
add_subdirectory(solc)
if (NOT EMSCRIPTEN)
add_subdirectory(liblll)
- #add_subdirectory(test)
+ add_subdirectory(test)
add_subdirectory(lllc)
endif()
diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h
index e7ca520b..d48fa99c 100644
--- a/libevmasm/Assembly.h
+++ b/libevmasm/Assembly.h
@@ -69,10 +69,10 @@ public:
void appendProgramSize() { append(AssemblyItem(PushProgramSize)); }
void appendLibraryAddress(std::string const& _identifier) { append(newPushLibraryAddress(_identifier)); }
- AssemblyItem appendJump() { auto ret = append(newPushTag()); append(Instruction::JUMP); return ret; }
- AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(Instruction::JUMPI); return ret; }
- AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMP); return ret; }
- AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMPI); return ret; }
+ AssemblyItem appendJump() { auto ret = append(newPushTag()); append(solidity::Instruction::JUMP); return ret; }
+ AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(solidity::Instruction::JUMPI); return ret; }
+ AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMP); return ret; }
+ AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMPI); return ret; }
AssemblyItem errorTag() { return AssemblyItem(PushTag, 0); }
template <class T> Assembly& operator<<(T const& _d) { append(_d); return *this; }
@@ -86,7 +86,7 @@ public:
void ignored() { m_baseDeposit = m_deposit; }
void endIgnored() { m_deposit = m_baseDeposit; m_baseDeposit = 0; }
- void popTo(int _deposit) { while (m_deposit > _deposit) append(Instruction::POP); }
+ void popTo(int _deposit) { while (m_deposit > _deposit) append(solidity::Instruction::POP); }
void injectStart(AssemblyItem const& _i);
std::string out() const;
diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h
index 9399fef4..1c3d9789 100644
--- a/libevmasm/AssemblyItem.h
+++ b/libevmasm/AssemblyItem.h
@@ -58,7 +58,7 @@ public:
AssemblyItem(u256 _push, SourceLocation const& _location = SourceLocation()):
AssemblyItem(Push, _push, _location) { }
- AssemblyItem(Instruction _i, SourceLocation const& _location = SourceLocation()):
+ AssemblyItem(solidity::Instruction _i, SourceLocation const& _location = SourceLocation()):
AssemblyItem(Operation, byte(_i), _location) { }
AssemblyItem(AssemblyItemType _type, u256 _data = 0, SourceLocation const& _location = SourceLocation()):
m_type(_type),
diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp
index bbb01c7d..c06d83e2 100644
--- a/libsolidity/codegen/ArrayUtils.cpp
+++ b/libsolidity/codegen/ArrayUtils.cpp
@@ -66,7 +66,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons
{
// increment source pointer to point to data
m_context << solidity::Instruction::SWAP1 << u256(0x20);
- m_context << solidity::Instruction::ADD << solidity::Instruction::SWAP1;
+ m_context << solidity::Instruction::ADD << Instruction::SWAP1;
}
// stack: target_ref source_ref source_length
diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp
index 0e814e56..e7cf7e24 100644
--- a/test/libsolidity/SolidityExpressionCompiler.cpp
+++ b/test/libsolidity/SolidityExpressionCompiler.cpp
@@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(literal_true)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x1});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x1});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(literal_false)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x0});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x0});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(int_literal)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH10), 0x12, 0x34, 0x56, 0x78, 0x90,
+ bytes expectation({byte(solidity::Instruction::PUSH10), 0x12, 0x34, 0x56, 0x78, 0x90,
0x12, 0x34, 0x56, 0x78, 0x90});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(int_with_wei_ether_subdenomination)
})";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x1});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x1});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(int_with_szabo_ether_subdenomination)
})";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00});
+ bytes expectation({byte(solidity::Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(int_with_finney_ether_subdenomination)
})";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
+ bytes expectation({byte(solidity::Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE(int_with_ether_ether_subdenomination)
})";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH8), 0xd, 0xe0, 0xb6, 0xb3, 0xa7, 0x64, 0x00, 0x00});
+ bytes expectation({byte(solidity::Instruction::PUSH8), 0xd, 0xe0, 0xb6, 0xb3, 0xa7, 0x64, 0x00, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -268,12 +268,12 @@ BOOST_AUTO_TEST_CASE(comparison)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::PUSH2), 0x11, 0xaa,
- byte(eth::Instruction::PUSH2), 0x10, 0xaa,
- byte(eth::Instruction::LT),
- byte(eth::Instruction::EQ),
- byte(eth::Instruction::ISZERO)});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::PUSH2), 0x11, 0xaa,
+ byte(solidity::Instruction::PUSH2), 0x10, 0xaa,
+ byte(solidity::Instruction::LT),
+ byte(solidity::Instruction::EQ),
+ byte(solidity::Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -284,22 +284,22 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x12, // 8 + 10
- byte(eth::Instruction::PUSH1), 0x4,
- byte(eth::Instruction::GT),
- byte(eth::Instruction::ISZERO), // after this we have 4 <= 8 + 10
- byte(eth::Instruction::DUP1),
- byte(eth::Instruction::PUSH1), 0x11,
- byte(eth::Instruction::JUMPI), // short-circuit if it is true
- byte(eth::Instruction::POP),
- byte(eth::Instruction::PUSH1), 0x2,
- byte(eth::Instruction::PUSH1), 0x9,
- byte(eth::Instruction::EQ),
- byte(eth::Instruction::ISZERO), // after this we have 9 != 2
- byte(eth::Instruction::JUMPDEST),
- byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::EQ),
- byte(eth::Instruction::ISZERO)});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x12, // 8 + 10
+ byte(solidity::Instruction::PUSH1), 0x4,
+ byte(solidity::Instruction::GT),
+ byte(solidity::Instruction::ISZERO), // after this we have 4 <= 8 + 10
+ byte(solidity::Instruction::DUP1),
+ byte(solidity::Instruction::PUSH1), 0x11,
+ byte(solidity::Instruction::JUMPI), // short-circuit if it is true
+ byte(solidity::Instruction::POP),
+ byte(solidity::Instruction::PUSH1), 0x2,
+ byte(solidity::Instruction::PUSH1), 0x9,
+ byte(solidity::Instruction::EQ),
+ byte(solidity::Instruction::ISZERO), // after this we have 9 != 2
+ byte(solidity::Instruction::JUMPDEST),
+ byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::EQ),
+ byte(solidity::Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -309,23 +309,23 @@ BOOST_AUTO_TEST_CASE(arithmetics)
" function f(uint y) { var x = ((((((((y ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); }"
"}\n";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}, {"test", "f", "x"}});
- bytes expectation({byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::PUSH1), 0x2,
- byte(eth::Instruction::PUSH1), 0x3,
- byte(eth::Instruction::PUSH1), 0x4,
- byte(eth::Instruction::PUSH1), 0x5,
- byte(eth::Instruction::PUSH1), 0x6,
- byte(eth::Instruction::PUSH1), 0x7,
- byte(eth::Instruction::PUSH1), 0x8,
- byte(eth::Instruction::DUP10),
- byte(eth::Instruction::XOR),
- byte(eth::Instruction::AND),
- byte(eth::Instruction::OR),
- byte(eth::Instruction::SUB),
- byte(eth::Instruction::ADD),
- byte(eth::Instruction::MOD),
- byte(eth::Instruction::DIV),
- byte(eth::Instruction::MUL)});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::PUSH1), 0x2,
+ byte(solidity::Instruction::PUSH1), 0x3,
+ byte(solidity::Instruction::PUSH1), 0x4,
+ byte(solidity::Instruction::PUSH1), 0x5,
+ byte(solidity::Instruction::PUSH1), 0x6,
+ byte(solidity::Instruction::PUSH1), 0x7,
+ byte(solidity::Instruction::PUSH1), 0x8,
+ byte(solidity::Instruction::DUP10),
+ byte(solidity::Instruction::XOR),
+ byte(solidity::Instruction::AND),
+ byte(solidity::Instruction::OR),
+ byte(solidity::Instruction::SUB),
+ byte(solidity::Instruction::ADD),
+ byte(solidity::Instruction::MOD),
+ byte(solidity::Instruction::DIV),
+ byte(solidity::Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -336,13 +336,13 @@ BOOST_AUTO_TEST_CASE(unary_operators)
"}\n";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}, {"test", "f", "x"}});
- bytes expectation({byte(eth::Instruction::PUSH1), 0x2,
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::PUSH1), 0x0,
- byte(eth::Instruction::SUB),
- byte(eth::Instruction::NOT),
- byte(eth::Instruction::EQ),
- byte(eth::Instruction::ISZERO)});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x2,
+ byte(solidity::Instruction::DUP3),
+ byte(solidity::Instruction::PUSH1), 0x0,
+ byte(solidity::Instruction::SUB),
+ byte(solidity::Instruction::NOT),
+ byte(solidity::Instruction::EQ),
+ byte(solidity::Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -354,44 +354,44 @@ BOOST_AUTO_TEST_CASE(unary_inc_dec)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}});
// Stack: a, x
- bytes expectation({byte(eth::Instruction::DUP2),
- byte(eth::Instruction::DUP1),
- byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::ADD),
+ bytes expectation({byte(solidity::Instruction::DUP2),
+ byte(solidity::Instruction::DUP1),
+ byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::ADD),
// Stack here: a x a (a+1)
- byte(eth::Instruction::SWAP3),
- byte(eth::Instruction::POP), // first ++
+ byte(solidity::Instruction::SWAP3),
+ byte(solidity::Instruction::POP), // first ++
// Stack here: (a+1) x a
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::ADD),
+ byte(solidity::Instruction::DUP3),
+ byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::ADD),
// Stack here: (a+1) x a (a+2)
- byte(eth::Instruction::SWAP3),
- byte(eth::Instruction::POP),
+ byte(solidity::Instruction::SWAP3),
+ byte(solidity::Instruction::POP),
// Stack here: (a+2) x a
- byte(eth::Instruction::DUP3), // second ++
- byte(eth::Instruction::XOR),
+ byte(solidity::Instruction::DUP3), // second ++
+ byte(solidity::Instruction::XOR),
// Stack here: (a+2) x a^(a+2)
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::DUP1),
- byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::SWAP1),
- byte(eth::Instruction::SUB),
+ byte(solidity::Instruction::DUP3),
+ byte(solidity::Instruction::DUP1),
+ byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::SWAP1),
+ byte(solidity::Instruction::SUB),
// Stack here: (a+2) x a^(a+2) (a+2) (a+1)
- byte(eth::Instruction::SWAP4),
- byte(eth::Instruction::POP), // first --
- byte(eth::Instruction::XOR),
+ byte(solidity::Instruction::SWAP4),
+ byte(solidity::Instruction::POP), // first --
+ byte(solidity::Instruction::XOR),
// Stack here: (a+1) x a^(a+2)^(a+2)
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::PUSH1), 0x1,
- byte(eth::Instruction::SWAP1),
- byte(eth::Instruction::SUB),
+ byte(solidity::Instruction::DUP3),
+ byte(solidity::Instruction::PUSH1), 0x1,
+ byte(solidity::Instruction::SWAP1),
+ byte(solidity::Instruction::SUB),
// Stack here: (a+1) x a^(a+2)^(a+2) a
- byte(eth::Instruction::SWAP3),
- byte(eth::Instruction::POP), // second ++
+ byte(solidity::Instruction::SWAP3),
+ byte(solidity::Instruction::POP), // second ++
// Stack here: a x a^(a+2)^(a+2)
- byte(eth::Instruction::DUP3), // will change
- byte(eth::Instruction::XOR)});
+ byte(solidity::Instruction::DUP3), // will change
+ byte(solidity::Instruction::XOR)});
// Stack here: a x a^(a+2)^(a+2)^a
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -404,16 +404,16 @@ BOOST_AUTO_TEST_CASE(assignment)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}});
// Stack: a, b
- bytes expectation({byte(eth::Instruction::PUSH1), 0x2,
- byte(eth::Instruction::DUP2),
- byte(eth::Instruction::DUP4),
- byte(eth::Instruction::ADD),
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x2,
+ byte(solidity::Instruction::DUP2),
+ byte(solidity::Instruction::DUP4),
+ byte(solidity::Instruction::ADD),
// Stack here: a b 2 a+b
- byte(eth::Instruction::SWAP3),
- byte(eth::Instruction::POP),
- byte(eth::Instruction::DUP3),
+ byte(solidity::Instruction::SWAP3),
+ byte(solidity::Instruction::POP),
+ byte(solidity::Instruction::DUP3),
// Stack here: a+b b 2 a+b
- byte(eth::Instruction::MUL)});
+ byte(solidity::Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -427,26 +427,26 @@ BOOST_AUTO_TEST_CASE(function_call)
{{"test", "f", "a"}, {"test", "f", "b"}});
// Stack: a, b
- bytes expectation({byte(eth::Instruction::PUSH1), 0x02,
- byte(eth::Instruction::PUSH1), 0x0c,
- byte(eth::Instruction::PUSH1), 0x01,
- byte(eth::Instruction::DUP5),
- byte(eth::Instruction::ADD),
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x02,
+ byte(solidity::Instruction::PUSH1), 0x0c,
+ byte(solidity::Instruction::PUSH1), 0x01,
+ byte(solidity::Instruction::DUP5),
+ byte(solidity::Instruction::ADD),
// Stack here: a b 2 <ret label> (a+1)
- byte(eth::Instruction::DUP4),
- byte(eth::Instruction::PUSH1), 0x13,
- byte(eth::Instruction::JUMP),
- byte(eth::Instruction::JUMPDEST),
+ byte(solidity::Instruction::DUP4),
+ byte(solidity::Instruction::PUSH1), 0x13,
+ byte(solidity::Instruction::JUMP),
+ byte(solidity::Instruction::JUMPDEST),
// Stack here: a b 2 g(a+1, b)
- byte(eth::Instruction::MUL),
+ byte(solidity::Instruction::MUL),
// Stack here: a b g(a+1, b)*2
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::ADD),
+ byte(solidity::Instruction::DUP3),
+ byte(solidity::Instruction::ADD),
// Stack here: a b a+g(a+1, b)*2
- byte(eth::Instruction::SWAP2),
- byte(eth::Instruction::POP),
- byte(eth::Instruction::DUP2),
- byte(eth::Instruction::JUMPDEST)});
+ byte(solidity::Instruction::SWAP2),
+ byte(solidity::Instruction::POP),
+ byte(solidity::Instruction::DUP2),
+ byte(solidity::Instruction::JUMPDEST)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -457,7 +457,7 @@ BOOST_AUTO_TEST_CASE(negative_literals_8bits)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(eth::Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x80));
+ bytes expectation(bytes({byte(solidity::Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x80));
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -468,7 +468,7 @@ BOOST_AUTO_TEST_CASE(negative_literals_16bits)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(eth::Instruction::PUSH32)}) + bytes(30, 0xff) + bytes{0xf5, 0x43});
+ bytes expectation(bytes({byte(solidity::Instruction::PUSH32)}) + bytes(30, 0xff) + bytes{0xf5, 0x43});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -481,7 +481,7 @@ BOOST_AUTO_TEST_CASE(intermediately_overflowing_literals)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(eth::Instruction::PUSH1), 0xbf}));
+ bytes expectation(bytes({byte(solidity::Instruction::PUSH1), 0xbf}));
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -495,8 +495,8 @@ BOOST_AUTO_TEST_CASE(blockhash)
bytes code = compileFirstExpression(sourceCode, {}, {},
{make_shared<MagicVariableDeclaration>("block", make_shared<MagicType>(MagicType::Kind::Block))});
- bytes expectation({byte(eth::Instruction::PUSH1), 0x03,
- byte(eth::Instruction::BLOCKHASH)});
+ bytes expectation({byte(solidity::Instruction::PUSH1), 0x03,
+ byte(solidity::Instruction::BLOCKHASH)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp
index 6aa90973..d48c7648 100644
--- a/test/libsolidity/SolidityOptimizer.cpp
+++ b/test/libsolidity/SolidityOptimizer.cpp
@@ -58,11 +58,11 @@ public:
m_optimize = true;
bytes optimizedBytecode = compileAndRun(_sourceCode, _value, _contractName);
size_t nonOptimizedSize = 0;
- eth::eachInstruction(nonOptimizedBytecode, [&](Instruction, u256 const&) {
+ solidity::eachInstruction(nonOptimizedBytecode, [&](Instruction, u256 const&) {
nonOptimizedSize++;
});
size_t optimizedSize = 0;
- eth::eachInstruction(optimizedBytecode, [&](Instruction, u256 const&) {
+ solidity::eachInstruction(optimizedBytecode, [&](Instruction, u256 const&) {
optimizedSize++;
});
BOOST_CHECK_MESSAGE(
@@ -308,8 +308,8 @@ BOOST_AUTO_TEST_CASE(retain_information_in_branches)
m_optimize = true;
bytes optimizedBytecode = compileAndRun(sourceCode, 0, "c");
size_t numSHA3s = 0;
- eth::eachInstruction(optimizedBytecode, [&](Instruction _instr, u256 const&) {
- if (_instr == eth::Instruction::SHA3)
+ eachInstruction(optimizedBytecode, [&](Instruction _instr, u256 const&) {
+ if (_instr == Instruction::SHA3)
numSHA3s++;
});
BOOST_CHECK_EQUAL(1, numSHA3s);
@@ -351,8 +351,8 @@ BOOST_AUTO_TEST_CASE(store_tags_as_unions)
m_optimize = true;
bytes optimizedBytecode = compileAndRun(sourceCode, 0, "test");
size_t numSHA3s = 0;
- eth::eachInstruction(optimizedBytecode, [&](Instruction _instr, u256 const&) {
- if (_instr == eth::Instruction::SHA3)
+ eachInstruction(optimizedBytecode, [&](Instruction _instr, u256 const&) {
+ if (_instr == Instruction::SHA3)
numSHA3s++;
});
// TEST DISABLED UNTIL 93693404 IS IMPLEMENTED
@@ -1071,16 +1071,16 @@ BOOST_AUTO_TEST_CASE(block_deduplicator)
AssemblyItem(PushTag, 1),
AssemblyItem(PushTag, 3),
u256(6),
- eth::Instruction::SWAP3,
- eth::Instruction::JUMP,
+ Instruction::SWAP3,
+ Instruction::JUMP,
AssemblyItem(Tag, 1),
u256(6),
- eth::Instruction::SWAP3,
- eth::Instruction::JUMP,
+ Instruction::SWAP3,
+ Instruction::JUMP,
AssemblyItem(Tag, 2),
u256(6),
- eth::Instruction::SWAP3,
- eth::Instruction::JUMP,
+ Instruction::SWAP3,
+ Instruction::JUMP,
AssemblyItem(Tag, 3)
};
BlockDeduplicator dedup(input);
@@ -1097,23 +1097,23 @@ BOOST_AUTO_TEST_CASE(block_deduplicator_loops)
{
AssemblyItems input{
u256(0),
- eth::Instruction::SLOAD,
+ Instruction::SLOAD,
AssemblyItem(PushTag, 1),
AssemblyItem(PushTag, 2),
- eth::Instruction::JUMPI,
- eth::Instruction::JUMP,
+ Instruction::JUMPI,
+ Instruction::JUMP,
AssemblyItem(Tag, 1),
u256(5),
u256(6),
- eth::Instruction::SSTORE,
+ Instruction::SSTORE,
AssemblyItem(PushTag, 1),
- eth::Instruction::JUMP,
+ Instruction::JUMP,
AssemblyItem(Tag, 2),
u256(5),
u256(6),
- eth::Instruction::SSTORE,
+ Instruction::SSTORE,
AssemblyItem(PushTag, 2),
- eth::Instruction::JUMP,
+ Instruction::JUMP,
};
BlockDeduplicator dedup(input);
dedup.deduplicate();