1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00
emacs/mps/code/plan.txt
Richard Kistruck b75de3e923 mps br/vmem: simple-chunk-return:
arenavm.c --  on VMFree(), destroy any empty chunks (except the primary).  (VMFree is not the ideal place to do it, but works for proof of concept).
 tract.c -- fix ChunkCache defects:
  - previously, if cache is empty (chunkCache->chunk == NULL) then other fields are *undefined*; but code looks at them anyway (!) without first checking chunkCache->chunk;
  - change it (.chunk.empty.fields) so that, if cache is empty, other fields have defined values: cache-using code may look at them, and they are chosen so that no cache hit will occur.
  --> this fixes crashing defect shown by changelist 170072
  - AVERT(ChunkCache) in the many places it should be checked;
  - use AVERT_CRITICAL in ChunkEncache, because it is called by ChunkOfAddr;

 Also:
 plan.txt -- notes on use of primary chunk.
 config.h -- DIAG also in ci, please [Do not integ to master]
 diag.c -- skip ChainCondemnAuto diag thanks
 zcoll.c -- move printf announcing Destroying arena etc to just before, not just after, we do it.

Copied from Perforce
 Change: 170082
 ServerID: perforce.ravenbrook.com
2010-03-22 13:24:49 +00:00

88 lines
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. PageSize is known by chunks, not the arena. When arena needs to know page size, it asks the primary chunk.
3. 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$