diff options
author | chriseth <c@ethdev.com> | 2015-06-25 23:51:01 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-27 01:15:00 +0800 |
commit | 37e7f1f10d597efb7773417779e32f0533b6ba1b (patch) | |
tree | 7ad95be5d1c6f51b3fbad577de4494665c6eb7d3 /CompilerUtils.h | |
parent | 342ca948661a3f2088b3025b5f15c97d3a53f86e (diff) | |
download | dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar.gz dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar.bz2 dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar.lz dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar.xz dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.tar.zst dexon-solidity-37e7f1f10d597efb7773417779e32f0533b6ba1b.zip |
Do not copy reference types to memory in-place.
Diffstat (limited to 'CompilerUtils.h')
-rw-r--r-- | CompilerUtils.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/CompilerUtils.h b/CompilerUtils.h index a9e07f74..7dd44da8 100644 --- a/CompilerUtils.h +++ b/CompilerUtils.h @@ -41,6 +41,10 @@ public: void fetchFreeMemoryPointer(); /// Stores the free memory pointer from the stack. void storeFreeMemoryPointer(); + /// Allocates a number of bytes in memory as given on the stack. + /// Stack pre: <size> + /// Stack post: <mem_start> + void allocateMemory(); /// Appends code that transforms memptr to (memptr - free_memptr) memptr void toSizeAfterFreeMemoryPointer(); @@ -70,7 +74,8 @@ public: /// @param _type type of the data on the stack void storeInMemory(unsigned _offset); /// Dynamic version of @see storeInMemory, expects the memory offset below the value on the stack - /// and also updates that. For arrays, only copies the data part. + /// and also updates that. For reference types, only copies the data pointer. Fails for + /// non-memory-references. /// @param _padToWordBoundaries if true, adds zeros to pad to multiple of 32 bytes. Array elements /// are always padded (except for byte arrays), regardless of this parameter. /// Stack pre: memory_offset value... @@ -107,6 +112,10 @@ public: /// necessary. void convertType(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded = false); + /// Creates a zero-value for the given type and puts it onto the stack. This might allocate + /// memory for memory references. + void pushZeroValue(Type const& _type); + /// Moves the value that is at the top of the stack to a stack variable. void moveToStackVariable(VariableDeclaration const& _variable); /// Copies an item that occupies @a _itemSize stack slots from a stack depth of @a _stackDepth |