Deterministic YulStringRepository using string hashes.

This commit is contained in:
Daniel Kirchner
2018-11-12 23:43:16 +01:00
parent 09f8ff27fc
commit 74557ceb0e
5 changed files with 71 additions and 44 deletions
+3 -3
View File
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(simple)
BOOST_CHECK_EQUAL(inlinableFunctions("{"
"function g(a:u256) -> b:u256 { b := a }"
"function f() -> x:u256 { x := g(2:u256) }"
"}"), "f,g");
"}"), "g,f");
}
BOOST_AUTO_TEST_CASE(simple_inside_structures)
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(simple_inside_structures)
"function g(a:u256) -> b:u256 { b := a }"
"function f() -> x:u256 { x := g(2:u256) }"
"}"
"}"), "f,g");
"}"), "g,f");
BOOST_CHECK_EQUAL(inlinableFunctions("{"
"for {"
"function g(a:u256) -> b:u256 { b := a }"
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(simple_inside_structures)
"{"
"function h() -> y:u256 { y := 2:u256 }"
"}"
"}"), "f,g,h");
"}"), "h,g,f");
}
BOOST_AUTO_TEST_CASE(negative)
-2
View File
@@ -90,8 +90,6 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename)
bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
{
yul::YulStringRepository::instance().reset();
assembly::AsmPrinter printer{m_yul};
shared_ptr<Block> ast;
shared_ptr<assembly::AsmAnalysisInfo> analysisInfo;
@@ -41,18 +41,19 @@
// h_t := 2
// mstore(7, h_t)
// let g_x_1 := 10
// f(1)
// let g_f_x_8 := 1
// mstore(0, g_f_x_8)
// mstore(7, h())
// g(10)
// mstore(1, g_f_x_8)
// mstore(1, x)
// }
// function g(x_1)
// {
// let f_x_8 := 1
// mstore(0, f_x_8)
// let f_h_t
// f_h_t := 2
// mstore(7, f_h_t)
// let f_g_x_1 := 10
// f(1)
// mstore(7, h())
// g(10)
// mstore(1, f_x_8)
// }
// function h() -> t