mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
arenavm.c -- move chunk-return into new function "VMCompact". (also, in VMArenaFinish, null out arena->primary in VMArenaFinish, so it is not left dangling). arena.c, arenavm.c, mpm.h, mpmst.h, mpmtypes.h: arena->class->compact: ArenaCompact, ArenaTrivCompact, VMCompact trace.c -- traceReclaim calls ArenaCompact! Copied from Perforce Change: 170095 ServerID: perforce.ravenbrook.com
90 lines
2.2 KiB
Text
90 lines
2.2 KiB
Text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
================ NOTES; CONSIDER ADDING THESE TO DESIGN DOCS ==================
|
|
|
|
____PRIMARY____
|
|
|
|
The primary chunk is used specially:
|
|
|
|
1. Arenacl requires a chunk to store the ArenaStruct in. (Whereas arenavm gets storage by simply mapping a new page). Therefore destroying the primary chunk would (in general) destroy the arena.
|
|
|
|
2. there's a field arena->primary that stores a pointer to the primary chunk. If the primary chunk ever goes away (eg. at ArenaFinish), this pointer must be nulled out so it is not left dangling.
|
|
|
|
3. PageSize is known by chunks, not the arena. When arena needs to know page size, it asks the primary chunk.
|
|
|
|
4. Various *Check functions only bother to check the primary chunk, and ignore other chunks.
|
|
|
|
|
|
|
|
______NOTES ON CHUNK_CREATE________
|
|
VMArenaInit
|
|
VMChunkCreate
|
|
vmArenaExtend
|
|
VMChunkCreate
|
|
|
|
VMChunkCreate [arenavm.c]
|
|
VMCreate [
|
|
|
|
- normal:
|
|
Create
|
|
alloc
|
|
Init
|
|
<class>Init
|
|
|
|
- arena:
|
|
ACreate
|
|
VMAInit
|
|
alloc VMAS, contains AS
|
|
AInit
|
|
init AS fields
|
|
init VMAS fields
|
|
- AS and VMAS fields are set
|
|
VMChunkCreate
|
|
VMCreate(size) - alloc big chunk of vmem!
|
|
BootBlockInit
|
|
alloc(VMChunkStruct) (contains ChunkStruct)
|
|
map(VMChunkStruct)
|
|
ChunkInit
|
|
ChunkStruct fields
|
|
RingAppend(&arena->chunkRing, &chunk->chunkRing)
|
|
alloc(aBPageIsAllocated "allocTable")
|
|
VMChunkInit
|
|
alloc(aBPSGIsMapped "pageTableMapped")
|
|
alloc(aBPSGHasNoSpares "noSparePages")
|
|
map(up to here)
|
|
res(pTM)
|
|
res(nSP)
|
|
alloc(aPS "pageTable")
|
|
allocBase = iPageFirstUseable
|
|
res(aT)
|
|
sig(Chunk)
|
|
sig(VMChunk)
|
|
primary = chunk
|
|
zoneShift = SizeFloorLog2(chunkSize >> MPS_WORD_SHIFT);
|
|
alignment = ChunkPageSize(arena->primary)
|
|
ChunkEncache(arena, arena->primary);
|
|
|
|
--- chunk contents:
|
|
VMChunkStruct (contains ChunkStruct)
|
|
|
|
aBPageIsAllocated "allocTable"
|
|
|
|
- 1 PSG (PageStructGroup) fits into 1 page
|
|
aBPSGIsMapped "pageTableMapped"
|
|
aBPSGHasNoSpares "noSparePages"
|
|
(...memory up to here is always mapped)
|
|
|
|
aPS "pageTable"
|
|
|
|
- iPageFirstUseable "allocBase" is here
|
|
---
|
|
|
|
|
|
$Id$
|