aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityOptimizer.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-09 00:18:31 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-09 00:18:31 +0800
commitefdef7f526d7cdf0dead9036a27794126bc4dceb (patch)
treea1feef6ad82705386eb22d96043eecf5dac726c3 /SolidityOptimizer.cpp
parent9f7e9d9cdd148892876c223de785ce70c2b50b36 (diff)
downloaddexon-solidity-efdef7f526d7cdf0dead9036a27794126bc4dceb.tar.gz
dexon-solidity-efdef7f526d7cdf0dead9036a27794126bc4dceb.tar.zst
dexon-solidity-efdef7f526d7cdf0dead9036a27794126bc4dceb.zip
Compiler EVM generation now takes into account for the new function hash
identifier - Changed tests to comply with the new function hash identifier - Changed the function index offset to 4, and made it a constant for easy adjustment in the future
Diffstat (limited to 'SolidityOptimizer.cpp')
-rw-r--r--SolidityOptimizer.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp
index ef5c6f9b..f334eee1 100644
--- a/SolidityOptimizer.cpp
+++ b/SolidityOptimizer.cpp
@@ -55,12 +55,12 @@ public:
}
template <class... Args>
- void compareVersions(byte _index, Args const&... _arguments)
+ void compareVersions(std::string _sig, Args const&... _arguments)
{
m_contractAddress = m_nonOptimizedContract;
- bytes nonOptimizedOutput = callContractFunction(_index, _arguments...);
+ bytes nonOptimizedOutput = callContractFunction(_sig, _arguments...);
m_contractAddress = m_optimizedContract;
- bytes optimizedOutput = callContractFunction(_index, _arguments...);
+ bytes optimizedOutput = callContractFunction(_sig, _arguments...);
BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match."
"\nNon-Optimized: " + toHex(nonOptimizedOutput) +
"\nOptimized: " + toHex(optimizedOutput));
@@ -81,8 +81,8 @@ BOOST_AUTO_TEST_CASE(smoke_test)
return a;
}
})";
- compileBothVersions(4, sourceCode);
- compareVersions(0, u256(7));
+ compileBothVersions(29, sourceCode);
+ compareVersions("f(uint256)", u256(7));
}
BOOST_AUTO_TEST_CASE(large_integers)
@@ -94,8 +94,8 @@ BOOST_AUTO_TEST_CASE(large_integers)
b = 0x110000000000000000000000002;
}
})";
- compileBothVersions(28, sourceCode);
- compareVersions(0);
+ compileBothVersions(53, sourceCode);
+ compareVersions("f()");
}
BOOST_AUTO_TEST_CASE(invariants)
@@ -106,8 +106,8 @@ BOOST_AUTO_TEST_CASE(invariants)
return (((a + (1 - 1)) ^ 0) | 0) & (uint(0) - 1);
}
})";
- compileBothVersions(28, sourceCode);
- compareVersions(0, u256(0x12334664));
+ compileBothVersions(53, sourceCode);
+ compareVersions("f(uint256)", u256(0x12334664));
}
BOOST_AUTO_TEST_CASE(unused_expressions)
@@ -120,8 +120,8 @@ BOOST_AUTO_TEST_CASE(unused_expressions)
data;
}
})";
- compileBothVersions(11, sourceCode);
- compareVersions(0);
+ compileBothVersions(36, sourceCode);
+ compareVersions("f()");
}
BOOST_AUTO_TEST_CASE(constant_folding_both_sides)
@@ -135,8 +135,8 @@ BOOST_AUTO_TEST_CASE(constant_folding_both_sides)
return 98 ^ (7 * ((1 | (x | 1000)) * 40) ^ 102);
}
})";
- compileBothVersions(31, sourceCode);
- compareVersions(0);
+ compileBothVersions(56, sourceCode);
+ compareVersions("f(uint256)");
}
BOOST_AUTO_TEST_SUITE_END()