aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/CompilerUtils.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-25 23:13:29 +0800
committerchriseth <c@ethdev.com>2015-10-02 19:12:23 +0800
commitda408640ca44b0d0cd8140fe2882bd344b4e24b9 (patch)
tree214b57e1bd300e1df40263d1b0e52283fb342ef9 /libsolidity/CompilerUtils.cpp
parentcae8db989a28838dc25c262f60b34162e6e3f83d (diff)
downloaddexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar.gz
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar.bz2
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar.lz
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar.xz
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.tar.zst
dexon-solidity-da408640ca44b0d0cd8140fe2882bd344b4e24b9.zip
Store small byte arrays and strings in storage in one slot with their
length.
Diffstat (limited to 'libsolidity/CompilerUtils.cpp')
-rw-r--r--libsolidity/CompilerUtils.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp
index a77e6536..d6624ca4 100644
--- a/libsolidity/CompilerUtils.cpp
+++ b/libsolidity/CompilerUtils.cpp
@@ -237,15 +237,7 @@ void CompilerUtils::encodeToMemory(
// stack: ... <end_of_mem> <value...>
// copy length to memory
m_context << eth::dupInstruction(1 + arrayType.sizeOnStack());
- if (arrayType.location() == DataLocation::CallData)
- m_context << eth::Instruction::DUP2; // length is on stack
- else if (arrayType.location() == DataLocation::Storage)
- m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD;
- else
- {
- solAssert(arrayType.location() == DataLocation::Memory, "");
- m_context << eth::Instruction::DUP2 << eth::Instruction::MLOAD;
- }
+ ArrayUtils(m_context).retrieveLength(arrayType, 1);
// stack: ... <end_of_mem> <value...> <end_of_mem'> <length>
storeInMemoryDynamic(IntegerType(256), true);
// stack: ... <end_of_mem> <value...> <end_of_mem''>