C++ namespace cleanup (except tests).

This commit is contained in:
Christian Parpart
2020-01-07 15:51:50 +01:00
committed by Daniel Kirchner
parent 8385256bdc
commit 6b23412fae
403 changed files with 1656 additions and 1926 deletions
+10 -10
View File
@@ -57,20 +57,20 @@ namespace
return input;
}
eth::KnownState createInitialState(AssemblyItems const& _input)
evmasm::KnownState createInitialState(AssemblyItems const& _input)
{
eth::KnownState state;
evmasm::KnownState state;
for (auto const& item: addDummyLocations(_input))
state.feedItem(item, true);
return state;
}
AssemblyItems CSE(AssemblyItems const& _input, eth::KnownState const& _state = eth::KnownState())
AssemblyItems CSE(AssemblyItems const& _input, evmasm::KnownState const& _state = evmasm::KnownState())
{
AssemblyItems input = addDummyLocations(_input);
bool usesMsize = (find(_input.begin(), _input.end(), AssemblyItem{Instruction::MSIZE}) != _input.end());
eth::CommonSubexpressionEliminator cse(_state);
evmasm::CommonSubexpressionEliminator cse(_state);
BOOST_REQUIRE(cse.feedItems(input.begin(), input.end(), usesMsize) == input.end());
AssemblyItems output = cse.getOptimizedItems();
@@ -84,7 +84,7 @@ namespace
void checkCSE(
AssemblyItems const& _input,
AssemblyItems const& _expectation,
KnownState const& _state = eth::KnownState()
KnownState const& _state = evmasm::KnownState()
)
{
AssemblyItems output = CSE(_input, _state);
@@ -118,8 +118,8 @@ BOOST_AUTO_TEST_SUITE(Optimiser)
BOOST_AUTO_TEST_CASE(cse_intermediate_swap)
{
eth::KnownState state;
eth::CommonSubexpressionEliminator cse(state);
evmasm::KnownState state;
evmasm::CommonSubexpressionEliminator cse(state);
AssemblyItems input{
Instruction::SWAP1, Instruction::POP, Instruction::ADD, u256(0), Instruction::SWAP1,
Instruction::SLOAD, Instruction::SWAP1, u256(100), Instruction::EXP, Instruction::SWAP1,
@@ -651,7 +651,7 @@ BOOST_AUTO_TEST_CASE(cse_keccak256_twice_same_content_noninterfering_store_in_be
BOOST_AUTO_TEST_CASE(cse_with_initially_known_stack)
{
eth::KnownState state = createInitialState(AssemblyItems{
evmasm::KnownState state = createInitialState(AssemblyItems{
u256(0x12),
u256(0x20),
Instruction::ADD
@@ -664,7 +664,7 @@ BOOST_AUTO_TEST_CASE(cse_with_initially_known_stack)
BOOST_AUTO_TEST_CASE(cse_equality_on_initially_known_stack)
{
eth::KnownState state = createInitialState(AssemblyItems{Instruction::DUP1});
evmasm::KnownState state = createInitialState(AssemblyItems{Instruction::DUP1});
AssemblyItems input{
Instruction::EQ
};
@@ -677,7 +677,7 @@ BOOST_AUTO_TEST_CASE(cse_access_previous_sequence)
{
// Tests that the code generator detects whether it tries to access SLOAD instructions
// from a sequenced expression which is not in its scope.
eth::KnownState state = createInitialState(AssemblyItems{
evmasm::KnownState state = createInitialState(AssemblyItems{
u256(0),
Instruction::SLOAD,
u256(1),