mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 746112 - Don't decommit if page size is too large; r=billm
The powerpc architecture has 64KiB pages, which is too large to represent in the free list. This patch splits the page size from the arena size and disabled decommit logic in that case.
This commit is contained in:
parent
4faceed9c4
commit
3aa723ba1f
@ -104,7 +104,9 @@ struct Cell
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Page size is 4096 by default, except for SPARC, where it is 8192.
|
* Page size must be static to support our arena pointer optimizations, so we
|
||||||
|
* are forced to support each platform with non-4096 pages as a special case.
|
||||||
|
* Note: The freelist supports a maximum arena shift of 15.
|
||||||
* Note: Do not use JS_CPU_SPARC here, this header is used outside JS.
|
* Note: Do not use JS_CPU_SPARC here, this header is used outside JS.
|
||||||
* Bug 692267: Move page size definition to gc/Memory.h and include it
|
* Bug 692267: Move page size definition to gc/Memory.h and include it
|
||||||
* directly once jsgc.h is no longer an installed header.
|
* directly once jsgc.h is no longer an installed header.
|
||||||
@ -112,19 +114,22 @@ struct Cell
|
|||||||
#if (defined(SOLARIS) || defined(__FreeBSD__)) && \
|
#if (defined(SOLARIS) || defined(__FreeBSD__)) && \
|
||||||
(defined(__sparc) || defined(__sparcv9) || defined(__ia64))
|
(defined(__sparc) || defined(__sparcv9) || defined(__ia64))
|
||||||
const size_t PageShift = 13;
|
const size_t PageShift = 13;
|
||||||
|
const size_t ArenaShift = PageShift;
|
||||||
|
#elif defined(__powerpc__)
|
||||||
|
const size_t PageShift = 16;
|
||||||
|
const size_t ArenaShift = 12;
|
||||||
#else
|
#else
|
||||||
const size_t PageShift = 12;
|
const size_t PageShift = 12;
|
||||||
|
const size_t ArenaShift = PageShift;
|
||||||
#endif
|
#endif
|
||||||
const size_t PageSize = size_t(1) << PageShift;
|
const size_t PageSize = size_t(1) << PageShift;
|
||||||
|
const size_t ArenaSize = size_t(1) << ArenaShift;
|
||||||
|
const size_t ArenaMask = ArenaSize - 1;
|
||||||
|
|
||||||
const size_t ChunkShift = 20;
|
const size_t ChunkShift = 20;
|
||||||
const size_t ChunkSize = size_t(1) << ChunkShift;
|
const size_t ChunkSize = size_t(1) << ChunkShift;
|
||||||
const size_t ChunkMask = ChunkSize - 1;
|
const size_t ChunkMask = ChunkSize - 1;
|
||||||
|
|
||||||
const size_t ArenaShift = PageShift;
|
|
||||||
const size_t ArenaSize = PageSize;
|
|
||||||
const size_t ArenaMask = ArenaSize - 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the maximum number of arenas we allow in the FreeCommitted state
|
* This is the maximum number of arenas we allow in the FreeCommitted state
|
||||||
* before we trigger a GC_SHRINK to release free arenas to the OS.
|
* before we trigger a GC_SHRINK to release free arenas to the OS.
|
||||||
|
@ -15,6 +15,15 @@
|
|||||||
namespace js {
|
namespace js {
|
||||||
namespace gc {
|
namespace gc {
|
||||||
|
|
||||||
|
/* Unused memory decommiting requires the arena size match the page size. */
|
||||||
|
extern const size_t PageSize;
|
||||||
|
extern const size_t ArenaSize;
|
||||||
|
static bool
|
||||||
|
DecommitEnabled()
|
||||||
|
{
|
||||||
|
return PageSize == ArenaSize;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
#include "jswin.h"
|
#include "jswin.h"
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
@ -83,6 +92,9 @@ UnmapPages(void *p, size_t size)
|
|||||||
bool
|
bool
|
||||||
MarkPagesUnused(void *p, size_t size)
|
MarkPagesUnused(void *p, size_t size)
|
||||||
{
|
{
|
||||||
|
if (!DecommitEnabled())
|
||||||
|
return false;
|
||||||
|
|
||||||
JS_ASSERT(uintptr_t(p) % PageSize == 0);
|
JS_ASSERT(uintptr_t(p) % PageSize == 0);
|
||||||
LPVOID p2 = VirtualAlloc(p, size, MEM_RESET, PAGE_READWRITE);
|
LPVOID p2 = VirtualAlloc(p, size, MEM_RESET, PAGE_READWRITE);
|
||||||
return p2 == p;
|
return p2 == p;
|
||||||
@ -352,6 +364,9 @@ UnmapPages(void *p, size_t size)
|
|||||||
bool
|
bool
|
||||||
MarkPagesUnused(void *p, size_t size)
|
MarkPagesUnused(void *p, size_t size)
|
||||||
{
|
{
|
||||||
|
if (!DecommitEnabled())
|
||||||
|
return false;
|
||||||
|
|
||||||
JS_ASSERT(uintptr_t(p) % PageSize == 0);
|
JS_ASSERT(uintptr_t(p) % PageSize == 0);
|
||||||
int result = madvise(p, size, MADV_DONTNEED);
|
int result = madvise(p, size, MADV_DONTNEED);
|
||||||
return result != -1;
|
return result != -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user