From e73b3068c4c0f0f14e1b929588990fd648a79513 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Apr 2015 16:33:13 +0200 Subject: [PATCH] Typos and docs. --- libevmcore/CommonSubexpressionEliminator.cpp | 5 +++-- libevmcore/ExpressionClasses.h | 4 ++-- test/SolidityOptimizer.cpp | 18 +++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libevmcore/CommonSubexpressionEliminator.cpp b/libevmcore/CommonSubexpressionEliminator.cpp index 9b9862166..d857158b9 100644 --- a/libevmcore/CommonSubexpressionEliminator.cpp +++ b/libevmcore/CommonSubexpressionEliminator.cpp @@ -203,8 +203,9 @@ void CommonSubexpressionEliminator::storeInStorage(Id _slot, Id _value) return; m_sequenceNumber++; decltype(m_storageContent) storageContents; - // copy over values at points where we know that they are different from _slot or that we know - // that the value is equal + // Copy over all values (i.e. retain knowledge about them) where we know that this store + // operation will not destroy the knowledge. Specifically, we copy storage locations we know + // are different from _slot or locations where we know that the stored value is equal to _value. for (auto const& storageItem: m_storageContent) if (m_expressionClasses.knownToBeDifferent(storageItem.first, _slot) || storageItem.second == _value) storageContents.insert(storageItem); diff --git a/libevmcore/ExpressionClasses.h b/libevmcore/ExpressionClasses.h index f91e71ea0..dba7384ec 100644 --- a/libevmcore/ExpressionClasses.h +++ b/libevmcore/ExpressionClasses.h @@ -79,10 +79,10 @@ public: /// Similar to @a knownToBeDifferent but require that abs(_a - b) >= 32. bool knownToBeDifferentBy32(Id _a, Id _b); /// @returns true if the value of the given class is known to be zero. - /// @note that this is not the negariot of knownNonZero + /// @note that this is not the negation of knownNonZero bool knownZero(Id _c); /// @returns true if the value of the given class is known to be nonzero. - /// @note that this is not the negariot of knownZero + /// @note that this is not the negation of knownZero bool knownNonZero(Id _c); /// @returns a pointer to the value if the given class is known to be a constant, /// and a nullptr otherwise. diff --git a/test/SolidityOptimizer.cpp b/test/SolidityOptimizer.cpp index ca72f4fe1..f523847f1 100644 --- a/test/SolidityOptimizer.cpp +++ b/test/SolidityOptimizer.cpp @@ -715,15 +715,15 @@ BOOST_AUTO_TEST_CASE(cse_sha3_twice_same_content_noninterfering_store_in_between Instruction::DUP5, Instruction::DUP2, Instruction::MSTORE, // m[12] = DUP1 - Instruction::DUP12, - u256(12 + 32), - Instruction::MSTORE, // does not destoy memory knowledge - Instruction::DUP13, - u256(128 - 32), - Instruction::MSTORE, // does not destoy memory knowledge - u256(0x20), - u256(12), - Instruction::SHA3 // sha3(m[12..(12+32)]) + Instruction::DUP12, + u256(12 + 32), + Instruction::MSTORE, // does not destoy memory knowledge + Instruction::DUP13, + u256(128 - 32), + Instruction::MSTORE, // does not destoy memory knowledge + u256(0x20), + u256(12), + Instruction::SHA3 // sha3(m[12..(12+32)]) }; // if this changes too often, only count the number of SHA3 and MSTORE instructions AssemblyItems output = getCSE(input);