aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerUtils.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-06 06:57:51 +0800
committerchriseth <c@ethdev.com>2015-06-09 16:03:25 +0800
commit02d57169442d9f5ccf6536341fba1bfe0431473a (patch)
treedb0290340311c2530b3de6064c770a26af96c451 /CompilerUtils.cpp
parent35ec81971acc31f16253bd1702fb81adbee85f48 (diff)
downloaddexon-solidity-02d57169442d9f5ccf6536341fba1bfe0431473a.tar.gz
dexon-solidity-02d57169442d9f5ccf6536341fba1bfe0431473a.tar.zst
dexon-solidity-02d57169442d9f5ccf6536341fba1bfe0431473a.zip
Use dynamic memory for argument encoding.
Diffstat (limited to 'CompilerUtils.cpp')
-rw-r--r--CompilerUtils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp
index 693bd466..7a96db92 100644
--- a/CompilerUtils.cpp
+++ b/CompilerUtils.cpp
@@ -50,6 +50,13 @@ void CompilerUtils::storeFreeMemoryPointer()
m_context << u256(freeMemoryPointer) << eth::Instruction::MSTORE;
}
+void CompilerUtils::toSizeAfterFreeMemoryPointer()
+{
+ fetchFreeMemoryPointer();
+ m_context << eth::Instruction::DUP1 << eth::Instruction::SWAP2 << eth::Instruction::SUB;
+ m_context << eth::Instruction::SWAP1;
+}
+
unsigned CompilerUtils::loadFromMemory(
unsigned _offset,
Type const& _type,
@@ -204,6 +211,7 @@ unsigned CompilerUtils::getSizeOnStack(vector<shared_ptr<Type const>> const& _va
void CompilerUtils::computeHashStatic(Type const& _type, bool _padToWordBoundaries)
{
unsigned length = storeInMemory(0, _type, _padToWordBoundaries);
+ solAssert(length <= CompilerUtils::freeMemoryPointer, "");
m_context << u256(length) << u256(0) << eth::Instruction::SHA3;
}