mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge the two EVM memory introduction sections
This commit is contained in:
parent
f0524ed45a
commit
3d12c2ddc7
@ -348,9 +348,11 @@ storage. A contract can neither read nor write to any storage apart
|
|||||||
from its own.
|
from its own.
|
||||||
|
|
||||||
The second memory area is called **memory**, of which a contract obtains
|
The second memory area is called **memory**, of which a contract obtains
|
||||||
a freshly cleared instance for each message call. Memory can be
|
a freshly cleared instance for each message call. Memory is linear and can be
|
||||||
addressed at byte level, but read and written to in 32 byte (256-bit)
|
addressed at byte level, but reads are limited to a width of 256 bits, while writes
|
||||||
chunks. Memory is more costly the larger it grows (it scales
|
can be either 8 bits or 256 bits wide. Memory is expanded by accessing (either
|
||||||
|
reading or writing) a previously untouched memory offset. At the time of expansion,
|
||||||
|
the cost in gas must be paid. Memory is more costly the larger it grows (it scales
|
||||||
quadratically).
|
quadratically).
|
||||||
|
|
||||||
The EVM is not a register machine but a stack machine, so all
|
The EVM is not a register machine but a stack machine, so all
|
||||||
|
@ -60,8 +60,6 @@ The position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint25
|
|||||||
Layout in Memory
|
Layout in Memory
|
||||||
****************
|
****************
|
||||||
|
|
||||||
EVM memory is linear. Reading is limited to 256-bit width, but both 8-bit and 256-bit writes are allowed. Memory size is 0 at the beginning of execution. Memory is expanded by accessing (either reading or writing) a previously untouched memory offset. At the time of expansion, the cost in gas must be paid.
|
|
||||||
|
|
||||||
Solidity reserves three 256-bit slots:
|
Solidity reserves three 256-bit slots:
|
||||||
- 0 - 64: scratch space for hashing methods
|
- 0 - 64: scratch space for hashing methods
|
||||||
- 64 - 96: currently allocated memory size (aka. free memory pointer)
|
- 64 - 96: currently allocated memory size (aka. free memory pointer)
|
||||||
|
Loading…
Reference in New Issue
Block a user