mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Added some comments.
This commit is contained in:
		
							parent
							
								
									9b8cf4af1d
								
							
						
					
					
						commit
						5673f994fc
					
				| @ -54,6 +54,8 @@ public: | |||||||
| 	unsigned storeInMemory(unsigned _offset, Type const& _type = IntegerType(256), bool _padToWordBoundaries = false); | 	unsigned storeInMemory(unsigned _offset, Type const& _type = IntegerType(256), bool _padToWordBoundaries = false); | ||||||
| 	/// Dynamic version of @see storeInMemory, expects the memory offset below the value on the stack
 | 	/// Dynamic version of @see storeInMemory, expects the memory offset below the value on the stack
 | ||||||
| 	/// and also updates that.
 | 	/// and also updates that.
 | ||||||
|  | 	/// Stack pre: memory_offset value...
 | ||||||
|  | 	/// Stack post: (memory_offset+length)
 | ||||||
| 	void storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries = true); | 	void storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries = true); | ||||||
| 	/// @returns _size rounded up to the next multiple of 32 (the number of bytes occupied in the
 | 	/// @returns _size rounded up to the next multiple of 32 (the number of bytes occupied in the
 | ||||||
| 	///          padded calldata)
 | 	///          padded calldata)
 | ||||||
| @ -75,11 +77,13 @@ public: | |||||||
| 	/// @note Only works for types of fixed size.
 | 	/// @note Only works for types of fixed size.
 | ||||||
| 	void computeHashStatic(Type const& _type = IntegerType(256), bool _padToWordBoundaries = false); | 	void computeHashStatic(Type const& _type = IntegerType(256), bool _padToWordBoundaries = false); | ||||||
| 
 | 
 | ||||||
| 	/// Copies a byte array to a byte array in storage, where the target is assumed to be on the
 | 	/// Copies a byte array to a byte array in storage.
 | ||||||
| 	/// to top of the stay. Leaves a reference to the target on the stack.
 | 	/// Stack pre: [source_reference] target_reference
 | ||||||
|  | 	/// Stack post: target_reference
 | ||||||
| 	void copyByteArrayToStorage(ByteArrayType const& _targetType, ByteArrayType const& _sourceType) const; | 	void copyByteArrayToStorage(ByteArrayType const& _targetType, ByteArrayType const& _sourceType) const; | ||||||
| 	/// Clears the length and data elements of the byte array referenced on the stack.
 | 	/// Clears the length and data elements of the byte array referenced on the stack.
 | ||||||
| 	/// Removes the reference from the stack.
 | 	/// Stack pre: reference
 | ||||||
|  | 	/// Stack post:
 | ||||||
| 	void clearByteArray(ByteArrayType const& _type) const; | 	void clearByteArray(ByteArrayType const& _type) const; | ||||||
| 
 | 
 | ||||||
| 	/// Bytes we need to the start of call data.
 | 	/// Bytes we need to the start of call data.
 | ||||||
| @ -87,10 +91,11 @@ public: | |||||||
| 	static const unsigned int dataStartOffset; | 	static const unsigned int dataStartOffset; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  | 	/// Prepares the given type for storing in memory by shifting it if necessary.
 | ||||||
| 	unsigned prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const; | 	unsigned prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const; | ||||||
| 	/// Appends a loop that clears all storage between the storage reference at the stack top
 | 	/// Appends a loop that clears a sequence of storage slots (excluding end).
 | ||||||
| 	/// and the one below it (excluding).
 | 	/// Stack pre: end_ref start_ref
 | ||||||
| 	/// Will leave the single value of the end pointer on the stack.
 | 	/// Stack post: end_ref
 | ||||||
| 	void clearStorageLoop() const; | 	void clearStorageLoop() const; | ||||||
| 
 | 
 | ||||||
| 	CompilerContext& m_context; | 	CompilerContext& m_context; | ||||||
|  | |||||||
| @ -1032,7 +1032,7 @@ void ExpressionCompiler::LValue::storeValue(Expression const& _expression, Type | |||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
| 	case LValueType::Storage: | 	case LValueType::Storage: | ||||||
| 		// stack layout: value value ... value ref
 | 		// stack layout: value value ... value target_ref
 | ||||||
| 		if (_expression.getType()->isValueType()) | 		if (_expression.getType()->isValueType()) | ||||||
| 		{ | 		{ | ||||||
| 			if (!_move) // copy values
 | 			if (!_move) // copy values
 | ||||||
| @ -1050,7 +1050,7 @@ void ExpressionCompiler::LValue::storeValue(Expression const& _expression, Type | |||||||
| 				if (i + 1 >= m_size) | 				if (i + 1 >= m_size) | ||||||
| 					*m_context << eth::Instruction::SSTORE; | 					*m_context << eth::Instruction::SSTORE; | ||||||
| 				else | 				else | ||||||
| 					// v v ... v v r+x
 | 					// stack here: value value ... value value (target_ref+offset)
 | ||||||
| 					*m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2 | 					*m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2 | ||||||
| 							   << eth::Instruction::SSTORE | 							   << eth::Instruction::SSTORE | ||||||
| 							   << u256(1) << eth::Instruction::SWAP1 << eth::Instruction::SUB; | 							   << u256(1) << eth::Instruction::SWAP1 << eth::Instruction::SUB; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user