diff options
author | chriseth <c@ethdev.com> | 2015-03-12 01:09:35 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-17 01:07:14 +0800 |
commit | fff3f98f58345d45dcf518d7dccbfa0d0a4e67b7 (patch) | |
tree | fd00609ec95fd240a8a41efcd9461b60ea15b142 /Types.h | |
parent | c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124 (diff) | |
download | dexon-solidity-fff3f98f58345d45dcf518d7dccbfa0d0a4e67b7.tar.gz dexon-solidity-fff3f98f58345d45dcf518d7dccbfa0d0a4e67b7.tar.zst dexon-solidity-fff3f98f58345d45dcf518d7dccbfa0d0a4e67b7.zip |
Enlarge storage references to two stack slots.
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -284,6 +284,9 @@ public: /** * The type of an array. The flavours are byte array (bytes), statically- (<type>[<length>]) * and dynamically-sized array (<type>[]). + * In storage, all arrays are packed tightly (as long as more than one elementary type fits in + * one slot). Dynamically sized arrays (including byte arrays) start with their size as a uint and + * thus start on their own slot. */ class ArrayType: public Type { @@ -384,7 +387,7 @@ public: virtual bool operator==(Type const& _other) const override; virtual u256 getStorageSize() const override; virtual bool canLiveOutsideStorage() const override; - virtual unsigned getSizeOnStack() const override { return 1; /*@todo*/ } + virtual unsigned getSizeOnStack() const override { return 2; } virtual std::string toString() const override; virtual MemberList const& getMembers() const override; @@ -527,6 +530,7 @@ private: /** * The type of a mapping, there is one distinct type per key/value type pair. + * Mappings always occupy their own storage slot, but do not actually use it. */ class MappingType: public Type { @@ -537,6 +541,7 @@ public: virtual bool operator==(Type const& _other) const override; virtual std::string toString() const override; + virtual unsigned getSizeOnStack() const override { return 2; } virtual bool canLiveOutsideStorage() const override { return false; } TypePointer const& getKeyType() const { return m_keyType; } |