New arena class method chunkReserved handles the class-specific computation of the reserved size of a chunk.
Copied from Perforce
Change: 187089
ServerID: perforce.ravenbrook.com
* Return value from TreeVisitor is Bool, not Res, so pass Res back via a closure.
* Can't use TRACT_TRACT_FOR while iterating over the chunk tree, because that macro uses ChunkOfAddr. (A plain loop is simpler.)
* Mustn't try to describe unallocated tracts -- they might not even be mapped into memory. So consult the allocTable.
Make tract functions more robust:
* TractCheck must only check the pool if there is one (otherwise it segfaults for unallocated tracts)
* TractLimit can't look up the arena via TractPool, because the tract might not have a pool. So pass in the arena as an argument.
Copied from Perforce
Change: 186547
ServerID: perforce.ravenbrook.com
Change the arena's chunk tree from a splay tree to an ordinary tree (so that it's not possible to accidentally splay it and leave it unbalanced).
New function TreeFindNext allows us to implement TractFirst and TractNext without having to splay the tree.
Make sure all operations on the chunk tree leave it balanced. But don't balance the tree directly in ChunkFinish() because this is only ever called in a loop where multiple chunks are being deleted from the tre. Instead use the sequence TreeToVine -- iterate and delete -- TreeBalance. The new macro TREE_DESTROY assists with this.
No need any more for ArenaIsReservedAddr, CHUNK_OF_ADDR, TRACT_OF_ADDR.
Update design documentation.
Copied from Perforce
Change: 186212
ServerID: perforce.ravenbrook.com
Balance the chunk tree after insertion and deletion.
Avoid calling TractFirst and TractNext in ArenaDescribeTracts and PoolOfRange.
Copied from Perforce
Change: 186199
ServerID: perforce.ravenbrook.com
Make sure that we can tear down the arena if ArenaCreate fails:
1. Don't set hasFreeCBS until the block pool has some pages.
2. Finish the CBS block pool in ArenaFinish, not ArenaDestroy.
3. Delete the chunk from the arena's free CBS before destroying the chunk, just in case the chunk contains pages from the CBS's block pool.
Copied from Perforce
Change: 186177
ServerID: perforce.ravenbrook.com
1. Where Type is a pointer type with a signature, replace CHECKL(TypeCheck(val)) with CHECKD(Type, val).
2. Where Type is a pointer type with no signature, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val).
3. Where Type is a pointer type with a signature, but the structure is not visible at point of checking, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val). Reference <design/check/#.hidden-type>
4. Make BTCheck extern and use it where possible.
5. Replace AVER(TypeCheck(val)) with AVERT(Type, val).
Copied from Perforce
Change: 185263
ServerID: perforce.ravenbrook.com
ArenaDestroy fixed so that ChunkDestroy can go ahead even though the freeCBS has been torn down. Allows completion of test programs.
Copied from Perforce
Change: 184295
ServerID: perforce.ravenbrook.com
Not quite working yet. This code fails to unmap unused page table pages, and so triggers an assertion at chunk finish.
Copied from Perforce
Change: 184246
ServerID: perforce.ravenbrook.com
Spare pages are returned to the OS using the ring in roughly LRU order.
Only enough spare pages are returned to maintain hysteresis, rather than all of them.
Nearly ready to strip out the noSparePages bit table.
Copied from Perforce
Change: 184245
ServerID: perforce.ravenbrook.com
* Use const char * in places where we want to assign string constants.
Avoid warnings when compiling with -Wextra:
* Avoid if statement with empty body in amcsshe.c
* Avoid comparison of unsigned >= 0.
Copied from Perforce
Change: 183498
ServerID: perforce.ravenbrook.com
Fixing cast from external scan state structure to a PARENT, now that we're not punning the pointer any more.
Copied from Perforce
Change: 179347
ServerID: perforce.ravenbrook.com
tract.c -- fix more ChunkCache defects:
- drop never-read chunkCache->pageTableBase and pageTableLimit fields: they were used for ChunkOfSeg(), back when each SegStruct was actually a PageStruct is some chunk's PageStructTable; see VMArenaChunkOfSeg() in //info.ravenbrook.com/project/mps/branch/2001-08-13/trunk/src/arenavm.chttps://github.com/Ravenbrook/mps/issues/46
- there's no need for arena to initialise the chunk cache; this allows en/decache functions to be local to tract.c (ie. declared static)
Copied from Perforce
Change: 170083
ServerID: perforce.ravenbrook.com
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
arenavm.c: VMFree is okay for testing chunk-ret; though just sparePagesPurge() for now;
diag.c: show what we want for using zcoll to show chunk-ret:
VM_ix_Create/Destroy
TraceStart, excpet only briefly for dyn-crit (why=2) and not at all for minor
locus.c: no newline on "condemn gens" diag please
tract.c: ChunkDecache is BROKEN; just add AVER to catch this for now
vmix.c: VM_ix_Create_ok/VM_ix_Destroy (vmw3.c needs similar)
zcoll.c:
release after mps_arena_collect!!!
make, collect, make, collect, to show chunk-ret
10MB arena means many chunks
None of this is releaseable quality of course.
Copied from Perforce
Change: 170071
ServerID: perforce.ravenbrook.com
#define TractArena(tract). The broken definition worked because
it was always invoked with "TractPool(tract)". (Source-only change)
Copied from Perforce
Change: 160013
ServerID: perforce.ravenbrook.com
Making some new files consistent with changes from that branch.
Deleting some new Global Graphics confidential files.
Copied from Perforce
Change: 30256
ServerID: perforce.ravenbrook.com