1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 06:50:46 -08:00
Commit graph

61 commits

Author SHA1 Message Date
Gareth Rees
72209444c0 Store reserved address space associated with chunk in a field in the chunkstruct, as suggested by rb in <https://info.ravenbrook.com/mail/2014/10/01/13-55-44/0/>.
Copied from Perforce
 Change: 187104
 ServerID: perforce.ravenbrook.com
2014-10-01 21:40:50 +01:00
Gareth Rees
53c5301a9e Instead of iterating over the chunks to compute the total reserved address space, maintain a running total in arenachunkinsert and (new function) arenachunkremoved.
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
2014-09-29 22:50:46 +01:00
Gareth Rees
83a93881a2 Design.mps.ring.naming: "when one structure parent contains one ring of child structures, the field in parent is usually known as childring, and the field in child is known as parentring". so the field in chunkstruct should be named arenaring.
Copied from Perforce
 Change: 187084
 ServerID: perforce.ravenbrook.com
2014-09-29 20:54:00 +01:00
Gareth Rees
c968255f1e Ensure that code of the form if (condition) statement; is split over two lines, so that it is possible to set a breakpoint on the statement in a debugger.
This change was agreed in 1997 (see <https://info.ravenbrook.com/project/mps/mail/1997/08/19/13-44/0.txt>), so it's about time it was implemented.

Copied from Perforce
 Change: 187071
 ServerID: perforce.ravenbrook.com
2014-09-27 22:57:02 +01:00
Gareth Rees
1608519fe2 Fix problems identified by nb in review <https://info.ravenbrook.com/mail/2014/07/24/12-21-04/0/>.
Copied from Perforce
 Change: 186945
 ServerID: perforce.ravenbrook.com
2014-08-06 16:18:34 +01:00
Gareth Rees
07912c0833 Fix problems noted by dl in review <https://info.ravenbrook.com/mail/2014/06/17/13-35-38/0/>.
Copied from Perforce
 Change: 186662
 ServerID: perforce.ravenbrook.com
2014-06-17 15:15:32 +01:00
Gareth Rees
3aba0f32d9 Catch-up merge from master sources @186573 to branch/2014-05-28/align.
Copied from Perforce
 Change: 186631
 ServerID: perforce.ravenbrook.com
2014-06-14 16:11:20 +01:00
Gareth Rees
33b3eec69d More modular to assign the primary chunk in arenachunkinsert.
Copied from Perforce
 Change: 186621
 ServerID: perforce.ravenbrook.com
2014-06-14 14:34:10 +01:00
Gareth Rees
8ecf6264f4 Configurable grain size for client arenas.
Copied from Perforce
 Change: 186579
 ServerID: perforce.ravenbrook.com
2014-06-13 16:24:55 +01:00
Gareth Rees
8b012960dc Some assertions with && crept back in. split them up so that we get as much information as possible from an assertion failure.
Copied from Perforce
 Change: 186577
 ServerID: perforce.ravenbrook.com
2014-06-13 15:52:50 +01:00
Gareth Rees
a13a1aa1df Catch-up merge from master sources @186564 to branch/2014-06-11/grain.
Copied from Perforce
 Change: 186572
 ServerID: perforce.ravenbrook.com
2014-06-13 15:30:46 +01:00
Gareth Rees
100405cac2 Restore the chunk ring.
Copied from Perforce
 Change: 186558
 ServerID: perforce.ravenbrook.com
2014-06-13 12:31:47 +01:00
Gareth Rees
b240945cb9 Tract iteration interface is only used by the arena coverage test, so move it out of tract.c and into arenacv.c.
Copied from Perforce
 Change: 186548
 ServerID: perforce.ravenbrook.com
2014-06-12 19:06:10 +01:00
Gareth Rees
1d9afa915f Fix arenadescribetracts:
* 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
2014-06-12 18:46:49 +01:00
Gareth Rees
08f341fcc9 Catch-up merge from master sources @186540 to branch/2014-05-17/chunk-tree.
Copied from Perforce
 Change: 186546
 ServerID: perforce.ravenbrook.com
2014-06-12 17:55:16 +01:00
Gareth Rees
bfb0b771dd Rename "arena alignment" to "arena grain size" to avoid confusion with ordinary structure alignment.
Copied from Perforce
 Change: 186503
 ServerID: perforce.ravenbrook.com
2014-06-11 17:13:03 +01:00
Gareth Rees
de2a30d207 Catch-up merge from master sources @186481 to branch/2014-05-17/chunk-tree.
Copied from Perforce
 Change: 186491
 ServerID: perforce.ravenbrook.com
2014-06-11 13:52:31 +01:00
Gareth Rees
2087688964 Fix problems identified by rb in review <https://info.ravenbrook.com/mail/2014/06/05/14-58-24/0/>.
Copied from Perforce
 Change: 186451
 ServerID: perforce.ravenbrook.com
2014-06-08 22:10:21 +01:00
Gareth Rees
220e23a758 Fix problems identified by dl in review <https://info.ravenbrook.com/mail/2014/06/05/14-49-13/0/>.
Copied from Perforce
 Change: 186445
 ServerID: perforce.ravenbrook.com
2014-06-08 17:45:44 +01:00
Gareth Rees
2f0ef9355d Clarify tracefix logic by unwinding the nested conditions.
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
2014-05-20 18:12:37 +01:00
Gareth Rees
47befaa46b Use treefind instead of splaytreefind to search the chunk tree.
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
2014-05-19 20:19:50 +01:00
Gareth Rees
632ac692a5 Restore "avoid" mechanism in arenaallocpage.
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
2014-05-19 12:24:11 +01:00
Gareth Rees
0b0a465674 Replace the chunk ring with a chunk tree.
Fix bug in SplayFindNext (LESS and GREATER the wrong way round).

Copied from Perforce
 Change: 186157
 ServerID: perforce.ravenbrook.com
2014-05-17 17:05:42 +01:00
Gareth Rees
4b5d396792 Catch-up merge from master sources to branch/2014-03-30/addrset.
Copied from Perforce
 Change: 185288
 ServerID: perforce.ravenbrook.com
2014-04-07 15:02:09 +01:00
Gareth Rees
d3d2795fce Improve control over checking:
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
2014-04-06 22:51:05 +01:00
Gareth Rees
d2cbfda452 First pass at implementation of lands (collections of address ranges). 100% boilerplate!
Copied from Perforce
 Change: 185131
 ServerID: perforce.ravenbrook.com
2014-04-01 19:51:55 +01:00
Richard Brooksby
d1473656ee Resolving questions left behind in fixmes.
Copied from Perforce
 Change: 184609
 ServerID: perforce.ravenbrook.com
2014-02-28 14:42:44 +00:00
Richard Brooksby
460f988a46 Removing the freering allocation cache, which breaks the cbs abstraction and does not give any benefit once we’re allocating from zonecbss.
Copied from Perforce
 Change: 184529
 ServerID: perforce.ravenbrook.com
2014-02-25 11:35:18 +00:00
Richard Brooksby
2151d00c7f Catch-up merge from master, mainly to pick up spare-ring merge.
Copied from Perforce
 Change: 184365
 ServerID: perforce.ravenbrook.com
2014-02-18 13:47:49 +00:00
Richard Brooksby
4fc8971802 Minor updates in response to review. see https://info.ravenbrook.com/mail/2014/02/17/16-27-18/0/
Copied from Perforce
 Change: 184354
 ServerID: perforce.ravenbrook.com
2014-02-17 16:45:12 +00:00
Richard Brooksby
bc47522ae2 Abstracting partially mapped page tables into a sparsearray abstract datatype, removing a great deal of complexity from the vm arena, and some unnecessary double-initialisation and scanning loops during allocation.
Copied from Perforce
 Change: 184333
 ServerID: perforce.ravenbrook.com
2014-02-12 17:32:20 +00:00
Richard Brooksby
f1d5750639 Adding a cache of free pages per zone to the arena, so that we recycle single pages fast, especially after each reclaim.
Copied from Perforce
 Change: 184324
 ServerID: perforce.ravenbrook.com
2014-02-11 15:23:32 +00:00
Richard Brooksby
9bc635b24d Further tidying up of the page descriptor and naming.
Copied from Perforce
 Change: 184323
 ServerID: perforce.ravenbrook.com
2014-02-11 14:14:16 +00:00
Richard Brooksby
f9e9805b39 Encoding the page state in the bottom two bits of the first field, rather than using up a whole word, in order to make room for a free list pointer.
Copied from Perforce
 Change: 184322
 ServerID: perforce.ravenbrook.com
2014-02-11 13:41:57 +00:00
Richard Brooksby
3a1236d0ea Generic chunkinit and chunkdestroy now maintain their memory in the freecbs so that the client arena should also work.
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
2014-02-04 18:50:56 +00:00
Richard Brooksby
2b08236430 Using a more robust page table unmapping method that catches pages previously left mapped in the error page of pagesmarkallocated.
Test run passes.

Copied from Perforce
 Change: 184250
 ServerID: perforce.ravenbrook.com
2014-01-31 02:05:11 +00:00
Richard Brooksby
ce329f192e Abolishing the spare pages bit table.
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
2014-01-30 19:58:36 +00:00
Richard Brooksby
0296f9c04a Adding spare pages to a ring within each chunk, so that they can be found without a bit table scan.
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
2014-01-30 19:58:36 +00:00
Richard Brooksby
e50418ce54 Tidying up the bootstrap so that every chunk gets added to the arena’s freecbs.
Copied from Perforce
 Change: 184238
 ServerID: perforce.ravenbrook.com
2014-01-30 15:44:46 +00:00
Gareth Rees
fab773659d Use macro nonnegative so that we can keep asserting that values are >= 0 without provoking "unsigned comparison >= 0 is always true" warnings from gcc.
Copied from Perforce
 Change: 183505
 ServerID: perforce.ravenbrook.com
2013-10-01 14:27:52 +01:00
Gareth Rees
949578bac4 Avoid warnings when compiling with -wwrite-strings:
* 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
2013-10-01 10:52:45 +01:00
Richard Brooksby
e8d345149f Adding references to critical path design.
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
2012-09-07 20:49:05 +01:00
Richard Kistruck
7078ef1586 mps br/vmem: simple-chunk-return (fix broken compile):
Ooops, remove ALL references to pageTableBase and pageTableLimit fields.

Copied from Perforce
 Change: 170085
 ServerID: perforce.ravenbrook.com
2010-03-22 14:49:11 +00:00
Richard Kistruck
39da284821 mps br/vmem: simple-chunk-return:
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
2010-03-22 13:39:36 +00:00
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
Richard Kistruck
e82d034c98 Mps br/vmem: prepare for simple-chunk-return:
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
2010-03-20 13:51:23 +00:00
Richard Kistruck
b27e4ff179 Mps br/timing (fix warnings "... may be used uninitialized"):
trace.c, tract.c: initialise variable to NULL

Copied from Perforce
 Change: 167191
 ServerID: perforce.ravenbrook.com
2009-01-21 14:17:56 +00:00
Richard Kistruck
0f430304ad Mps source typo in tract.c #define tractarena(seg) should be
#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
2006-08-10 14:21:20 +01:00
Richard Brooksby
e854cd8e1d Merging branch mps/2002-05-22/open-source-prep.
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
2002-06-18 16:19:34 +01:00
Nick Barnes
6a1a360814 Integrate changes from global graphics.
Copied from Perforce
 Change: 30250
 ServerID: perforce.ravenbrook.com
2002-06-18 14:14:55 +01:00