diff options
author | chriseth <c@ethdev.com> | 2015-06-05 23:32:13 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-09 06:27:56 +0800 |
commit | 35ec81971acc31f16253bd1702fb81adbee85f48 (patch) | |
tree | 3e8e3b1079a01ab03ed1b2d86d203f3bfe56f435 /CompilerUtils.cpp | |
parent | c2a9419e495e931a825e8146aec49ffc34e44954 (diff) | |
download | dexon-solidity-35ec81971acc31f16253bd1702fb81adbee85f48.tar.gz dexon-solidity-35ec81971acc31f16253bd1702fb81adbee85f48.tar.zst dexon-solidity-35ec81971acc31f16253bd1702fb81adbee85f48.zip |
Dynamic memory.
Diffstat (limited to 'CompilerUtils.cpp')
-rw-r--r-- | CompilerUtils.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp index 3549ef98..693bd466 100644 --- a/CompilerUtils.cpp +++ b/CompilerUtils.cpp @@ -31,7 +31,24 @@ namespace dev namespace solidity { -const unsigned int CompilerUtils::dataStartOffset = 4; +const unsigned CompilerUtils::dataStartOffset = 4; +const size_t CompilerUtils::freeMemoryPointer = 64; + +void CompilerUtils::initialiseFreeMemoryPointer() +{ + m_context << u256(freeMemoryPointer + 32); + storeFreeMemoryPointer(); +} + +void CompilerUtils::fetchFreeMemoryPointer() +{ + m_context << u256(freeMemoryPointer) << eth::Instruction::MLOAD; +} + +void CompilerUtils::storeFreeMemoryPointer() +{ + m_context << u256(freeMemoryPointer) << eth::Instruction::MSTORE; +} unsigned CompilerUtils::loadFromMemory( unsigned _offset, |