зеркало из https://github.com/mozilla/pjs.git
Bug 589735 - JS engine is completely broken on ia64 - jemalloc part; r=pbiggar
This commit is contained in:
Родитель
9242ea3c9f
Коммит
35bd99a804
|
@ -2195,6 +2195,26 @@ static void *
|
|||
pages_map(void *addr, size_t size, int pfd)
|
||||
{
|
||||
void *ret;
|
||||
#if defined(__ia64__)
|
||||
/*
|
||||
* The JS engine assumes that all allocated pointers have their high 17 bits clear,
|
||||
* which ia64's mmap doesn't support directly. However, we can emulate it by passing
|
||||
* mmap an "addr" parameter with those bits clear. The mmap will return that address,
|
||||
* or the nearest available memory above that address, providing a near-guarantee
|
||||
* that those bits are clear. If they are not, we return NULL below to indicate
|
||||
* out-of-memory.
|
||||
*
|
||||
* The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual
|
||||
* address space.
|
||||
*
|
||||
* See Bug 589735 for more information.
|
||||
*/
|
||||
bool check_placement = true;
|
||||
if (addr == NULL) {
|
||||
addr = (void*)0x0000070000000000;
|
||||
check_placement = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We don't use MAP_FIXED here, because it can cause the *replacement*
|
||||
|
@ -2214,7 +2234,20 @@ pages_map(void *addr, size_t size, int pfd)
|
|||
|
||||
if (ret == MAP_FAILED)
|
||||
ret = NULL;
|
||||
#if defined(__ia64__)
|
||||
/*
|
||||
* If the allocated memory doesn't have its upper 17 bits clear, consider it
|
||||
* as out of memory.
|
||||
*/
|
||||
else if ((long long)ret & 0xffff800000000000) {
|
||||
munmap(ret, size);
|
||||
ret = NULL;
|
||||
}
|
||||
/* If the caller requested a specific memory location, verify that's what mmap returned. */
|
||||
else if (check_placement && ret != addr) {
|
||||
#else
|
||||
else if (addr != NULL && ret != addr) {
|
||||
#endif
|
||||
/*
|
||||
* We succeeded in mapping memory, but not in the right place.
|
||||
*/
|
||||
|
@ -2230,8 +2263,13 @@ pages_map(void *addr, size_t size, int pfd)
|
|||
ret = NULL;
|
||||
}
|
||||
|
||||
#if defined(__ia64__)
|
||||
assert(ret == NULL || (!check_placement && ret != NULL)
|
||||
|| (check_placement && ret == addr));
|
||||
#else
|
||||
assert(ret == NULL || (addr == NULL && ret != addr)
|
||||
|| (addr != NULL && ret == addr));
|
||||
#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче