mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 714344 - background decommit must not leave GC chunks with no empty arenas on the available allocation list. r=wmccloskey
This commit is contained in:
parent
2f65561f2b
commit
ff3ce756f9
@ -712,7 +712,7 @@ Chunk::fetchNextFreeArena(JSRuntime *rt)
|
||||
ArenaHeader *
|
||||
Chunk::allocateArena(JSCompartment *comp, AllocKind thingKind)
|
||||
{
|
||||
JS_ASSERT(!noAvailableArenas());
|
||||
JS_ASSERT(hasAvailableArenas());
|
||||
|
||||
JSRuntime *rt = comp->rt;
|
||||
|
||||
@ -720,7 +720,7 @@ Chunk::allocateArena(JSCompartment *comp, AllocKind thingKind)
|
||||
? fetchNextFreeArena(rt)
|
||||
: fetchNextDecommittedArena();
|
||||
aheader->init(comp, thingKind);
|
||||
if (JS_UNLIKELY(noAvailableArenas()))
|
||||
if (JS_UNLIKELY(!hasAvailableArenas()))
|
||||
removeFromAvailableList();
|
||||
|
||||
Probes::resizeHeap(comp, rt->gcBytes, rt->gcBytes + ArenaSize);
|
||||
@ -2257,7 +2257,11 @@ DecommitArenasFromAvailableList(JSRuntime *rt, Chunk **availableListHeadp)
|
||||
* be available for allocations either via the free list or via
|
||||
* the decommittedArenas bitmap. For that we just fetch the arena
|
||||
* from the free list before the decommit and then mark it as free
|
||||
* and decommitted when we retake the GC lock.
|
||||
* and decommitted when we retake the GC lock. However, if this
|
||||
* arena also is the single free arena in the chunk, then during
|
||||
* the decommit the allocation thread may find the chunk as
|
||||
* present on the available list yet having no arenas to allocate.
|
||||
* To avoid complications in this case we decommit inside the lock.
|
||||
*
|
||||
* We also must make sure that the aheader is not accessed again
|
||||
* after we decommit the arena.
|
||||
@ -2266,7 +2270,9 @@ DecommitArenasFromAvailableList(JSRuntime *rt, Chunk **availableListHeadp)
|
||||
size_t arenaIndex = Chunk::arenaIndex(aheader->arenaAddress());
|
||||
bool ok;
|
||||
{
|
||||
AutoUnlockGC unlock(rt);
|
||||
Maybe<AutoUnlockGC> maybayUnlock;
|
||||
if (chunk->hasAvailableArenas())
|
||||
maybayUnlock.construct(rt);
|
||||
ok = DecommitMemory(aheader->getArena(), ArenaSize);
|
||||
}
|
||||
|
||||
|
@ -734,8 +734,8 @@ struct Chunk {
|
||||
return info.numArenasFree == ArenasPerChunk;
|
||||
}
|
||||
|
||||
bool noAvailableArenas() const {
|
||||
return info.numArenasFree == 0;
|
||||
bool hasAvailableArenas() const {
|
||||
return info.numArenasFree != 0;
|
||||
}
|
||||
|
||||
inline void addToAvailableList(JSCompartment *compartment);
|
||||
|
Loading…
Reference in New Issue
Block a user