Closed cdecompilador closed 2 years ago
When running, say, mark and sweep garbage collection, the live object graph is traced and each Block
's BlockMeta
is used to for marking live lines and blocks.
Each Block
instance is aligned to the size of Block
. This means that when an object is going to be marked as live, the address of the object can be masked to obtain the address of the beginning of the Block
. The first word of the Block
is a pointer to the Block
's BlockMeta
.
This simplifies tracing an object in a Block
: to write the line mark bit requires
Block
For example, if a Block
is 64k, and every Block
is aligned at 64k byte boundaries, then to find the beginning of the Block
from an object's address, you would set the first 16 bits of the object's address to 0, by masking with 0xffffffffffff0000. By reading the pointer at the resulting address, you get the BlockMeta
location.
I hope that helps!
is there any special consideration on why is this?, or its just to make BumpBlock more cache friendly?