Gareth Rees
6359b0ed98
Merge branch/2014-09-29/reserved into the master sources.
...
Copied from Perforce
Change: 188090
ServerID: perforce.ravenbrook.com
2015-08-07 16:33:43 +01:00
Gareth Rees
b3e8eb2280
The primary chunk is always the last chunk to be removed, so assert that. review suggestion from rb; see < https://info.ravenbrook.com/mail/2015/08/07/13-56-51/0/ >
...
Copied from Perforce
Change: 188089
ServerID: perforce.ravenbrook.com
2015-08-07 16:14:50 +01:00
Gareth Rees
0394f40751
Fix comment (function is named vmarenamap, not vmarenamap).
...
Copied from Perforce
Change: 187965
ServerID: perforce.ravenbrook.com
2015-06-19 12:01:01 +01:00
Gareth Rees
0c42e3aa23
Improved assertion messages when a required keyword argument is not found. instead of "unreachable code", the assertion message is the name of the missing key.
...
Copied from Perforce
Change: 187267
ServerID: perforce.ravenbrook.com
2014-10-14 22:05:30 +01:00
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
f9a37d2942
Document the behaviour of committed (memory marked as in use) and spare_committed (always zero) in the client arena class.
...
Account for (and check) committed memory in the client arena class.
Can't check arena->committed <= arena->reserved in ArenaCheck, but can in ClientArenaCheck.
Rename ClientFree to ClientArenaFree to match the naming convention elsewhere.
Copied from Perforce
Change: 187093
ServerID: perforce.ravenbrook.com
2014-09-30 20:04:35 +01:00
Gareth Rees
6d10abd466
Remove orphaned comment (originally from grm in change 19855) about being unable to "check that limit>=size" (referring to the reservoir). it seems, at least from testing, that this check is good now, so add it to reservoircheck.
...
Copied from Perforce
Change: 187092
ServerID: perforce.ravenbrook.com
2014-09-30 18:57: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
1f517274f3
Cast all arguments to the writef function to make it easy to check that none of the necessary casts have been omitted.
...
New macro WriteFYesNo makes it easy to describe a Boolean.
Describe more structure elements for ABQ, Arena, Buffer, Format, MFS, Root, Seg.
Copied from Perforce
Change: 187063
ServerID: perforce.ravenbrook.com
2014-09-27 12:49:30 +01:00
Gareth Rees
7c2e271e60
Rename segpref to locuspref -- this structure describes preferences for the placement of any kind of address, not just segments.
...
Add LocusPrefDescribe and use it in MVFFDescribe.
Copied from Perforce
Change: 187061
ServerID: perforce.ravenbrook.com
2014-09-27 11:27:00 +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
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
cdee105f58
Fix defects found by coverity < https://info.ravenbrook.com/mail/2014/06/13/18-12-37/0/ >
...
Copied from Perforce
Change: 186604
ServerID: perforce.ravenbrook.com
2014-06-13 21:45:46 +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
a7c6cd3600
Catch-up merge from master sources @186573 to branch/2014-05-28/align.
...
Copied from Perforce
Change: 186574
ServerID: perforce.ravenbrook.com
2014-06-13 15:37:20 +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
1dd8a0fa26
Merge branch/2014-06-11/grain into branch/2014-05-28/align.
...
Copied from Perforce
Change: 186561
ServerID: perforce.ravenbrook.com
2014-06-13 13:35:14 +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
8c9de5f775
New function arenachunktreetraverse ensures that calls to chunkofaddr are reliably detected.
...
Copied from Perforce
Change: 186550
ServerID: perforce.ravenbrook.com
2014-06-12 20:28:50 +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
e50888e0c5
Fix problems identified by dl in review < https://info.ravenbrook.com/mail/2014/06/12/15-04-02/0/ >.
...
Copied from Perforce
Change: 186542
ServerID: perforce.ravenbrook.com
2014-06-12 17:11:09 +01:00
Gareth Rees
9268a0adc8
Catch-up merge from master sources @186528 to branch/2014-04-15/mvffnoseg.
...
Copied from Perforce
Change: 186534
ServerID: perforce.ravenbrook.com
2014-06-12 15:59:39 +01:00
Gareth Rees
15df9bb6de
Use xyzpool macros systematically as suggested by nb in < https://info.ravenbrook.com/mail/2014/06/11/20-47-37/0/ >
...
Copied from Perforce
Change: 186529
ServerID: perforce.ravenbrook.com
2014-06-12 14:25:00 +01:00
Gareth Rees
cb629746ea
Catch-up merge from masters sources @186519 to branch/2014-04-17/describe.
...
Copied from Perforce
Change: 186526
ServerID: perforce.ravenbrook.com
2014-06-12 13:45:22 +01:00
Gareth Rees
d897119121
Rename grainsizecheck as arenagrainsizecheck.
...
Copied from Perforce
Change: 186506
ServerID: perforce.ravenbrook.com
2014-06-11 17:33:10 +01:00
Gareth Rees
57412df08b
One last occurrence of arena->alignment.
...
Copied from Perforce
Change: 186504
ServerID: perforce.ravenbrook.com
2014-06-11 17:27:25 +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
1707089319
Oops, fumbled the merge.
...
Copied from Perforce
Change: 186493
ServerID: perforce.ravenbrook.com
2014-06-11 14:02:22 +01:00
Gareth Rees
a331b13075
Use unused_pointer and unused_size now we have 'em.
...
Copied from Perforce
Change: 186492
ServerID: perforce.ravenbrook.com
2014-06-11 13:59:02 +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
8eb003846d
Fix problems identified by rb in review < https://info.ravenbrook.com/mail/2014/06/04/15-13-24/0/ >.
...
Copied from Perforce
Change: 186449
ServerID: perforce.ravenbrook.com
2014-06-08 20:28:33 +01:00
Gareth Rees
51e39dc087
Pass and check special closure values unused_pointer, unused_size instead of null, 0.
...
Copied from Perforce
Change: 186352
ServerID: perforce.ravenbrook.com
2014-05-29 15:28:33 +01:00
Richard Brooksby
f1b01ff0c1
Clarifying a couple of comments most likely messed up by search-and-replace edits.
...
Copied from Perforce
Change: 186344
ServerID: perforce.ravenbrook.com
2014-05-28 17:42:11 +01:00
Gareth Rees
fd57486106
Fix problems identified by dl in review < https://info.ravenbrook.com/mail/2014/05/23/12-44-54/0/ >.
...
Copied from Perforce
Change: 186300
ServerID: perforce.ravenbrook.com
2014-05-25 20:49:22 +01:00
Gareth Rees
a0e076be57
Improvements following review.
...
Copied from Perforce
Change: 186227
ServerID: perforce.ravenbrook.com
2014-05-21 00:43:06 +01:00
Gareth Rees
dbfe3ca425
Fix compilation on windows.
...
Fix bug in ArenaDescribeTracts (only described the first tract).
Copied from Perforce
Change: 186215
ServerID: perforce.ravenbrook.com
2014-05-20 19:19:14 +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
e2d346aa67
No need to store primary chunk in the closure: can get it via the arena.
...
Copied from Perforce
Change: 186164
ServerID: perforce.ravenbrook.com
2014-05-18 22:27:07 +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
c77c91056d
Consistent order stream, depth.
...
Copied from Perforce
Change: 186001
ServerID: perforce.ravenbrook.com
2014-05-11 18:30:23 +01:00
Gareth Rees
2493f121dc
Correct indentation of describe output by passing depth parameter to describe functions and to writef.
...
Call Describe functions from test cases so that we get coverage.
Copied from Perforce
Change: 186000
ServerID: perforce.ravenbrook.com
2014-05-11 18:20:38 +01:00
Gareth Rees
d1b44a4f05
Back out change 185626 (violates the design.mps.writef.snazzy).
...
Copied from Perforce
Change: 185941
ServerID: perforce.ravenbrook.com
2014-05-02 12:44:31 +01:00
Gareth Rees
6721c2b913
Correct indentation of describe output.
...
Copied from Perforce
Change: 185626
ServerID: perforce.ravenbrook.com
2014-04-17 13:36:42 +01:00