mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-26 08:41:47 -07:00
Assert that the range passed to landinsert is not empty.
Assert that the range passed to ArenaFreeLandInsert is not empty. Assert that there's address space left over in a chunk after the overheads have been accounted for. Copied from Perforce Change: 190920 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
c8afcfa724
commit
d6fd31cecb
3 changed files with 8 additions and 3 deletions
|
|
@ -949,6 +949,7 @@ Res ArenaFreeLandInsert(Arena arena, Addr base, Addr limit)
|
|||
Res res;
|
||||
|
||||
AVERT(Arena, arena);
|
||||
AVER(base < limit);
|
||||
|
||||
RangeInit(&range, base, limit);
|
||||
res = arenaFreeLandInsertExtend(&oldRange, arena, &range);
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ Res LandInsert(Range rangeReturn, Land land, Range range)
|
|||
AVERT(Land, land);
|
||||
AVERT(Range, range);
|
||||
AVER(RangeIsAligned(range, land->alignment));
|
||||
AVER(!RangeIsEmpty(range));
|
||||
landEnter(land);
|
||||
|
||||
res = (*land->class->insert)(rangeReturn, land, range);
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ Res ChunkInit(Chunk chunk, Arena arena, Addr base, Addr limit, Size reserved,
|
|||
Count pages;
|
||||
Shift pageShift;
|
||||
Size pageTableSize;
|
||||
Addr allocBase;
|
||||
void *p;
|
||||
Res res;
|
||||
|
||||
|
|
@ -219,12 +220,14 @@ Res ChunkInit(Chunk chunk, Arena arena, Addr base, Addr limit, Size reserved,
|
|||
/* Init allocTable after class init, because it might be mapped there. */
|
||||
BTResRange(chunk->allocTable, 0, pages);
|
||||
|
||||
/* Check that there is some usable address space remaining in the chunk. */
|
||||
allocBase = PageIndexBase(chunk, chunk->allocBase);
|
||||
AVER(allocBase < chunk->limit);
|
||||
|
||||
/* Add the chunk's free address space to the arena's freeLand, so that
|
||||
we can allocate from it. */
|
||||
if (arena->hasFreeLand) {
|
||||
res = ArenaFreeLandInsert(arena,
|
||||
PageIndexBase(chunk, chunk->allocBase),
|
||||
chunk->limit);
|
||||
res = ArenaFreeLandInsert(arena, allocBase, chunk->limit);
|
||||
if (res != ResOK)
|
||||
goto failLandInsert;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue