Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 278698
Collapse All | Expand All

(-)mozilla-1.9.1-orig/memory/jemalloc/jemalloc.c (-11 / +22 lines)
Lines 392-398 __FBSDID("$FreeBSD: head/lib/libc/stdlib Link Here
392
static const bool __isthreaded = true;
392
static const bool __isthreaded = true;
393
#endif
393
#endif
394
394
395
#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
395
#if defined(MOZ_MEMORY_SOLARIS) || defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
396
#define JEMALLOC_USES_MAP_ALIGN	 /* Required on Solaris 10. Might improve performance elsewhere. */
396
#define JEMALLOC_USES_MAP_ALIGN	 /* Required on Solaris 10. Might improve performance elsewhere. */
397
#endif
397
#endif
398
398
Lines 2305-2324 pages_map_align(size_t size, int pfd, si Link Here
2305
	 * We don't use MAP_FIXED here, because it can cause the *replacement*
2305
	 * We don't use MAP_FIXED here, because it can cause the *replacement*
2306
	 * of existing mappings, and we only want to create new mappings.
2306
	 * of existing mappings, and we only want to create new mappings.
2307
	 */
2307
	 */
2308
#ifdef MALLOC_PAGEFILE
2308
	ret = mmap(NULL, size + alignment, PROT_READ | PROT_WRITE, MAP_PRIVATE |
2309
	if (pfd != -1) {
2309
		    MAP_NOSYNC| MAP_ANON, -1, 0);
2310
		ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
2311
		    MAP_NOSYNC | MAP_ALIGN, pfd, 0);
2312
	} else
2313
#endif
2314
	       {
2315
		ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
2316
		    MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
2317
	}
2318
	assert(ret != NULL);
2310
	assert(ret != NULL);
2319
2311
2320
	if (ret == MAP_FAILED)
2312
	if (ret == MAP_FAILED)
2321
		ret = NULL;
2313
		ret = NULL;
2314
	else {
2315
		uintptr_t aligned_ret;
2316
		size_t extra_size;
2317
2318
		aligned_ret = (uintptr_t)ret + alignment - 1;
2319
		aligned_ret &= ~(alignment - 1);
2320
		extra_size = aligned_ret - (uintptr_t)ret;
2321
		munmap(ret, extra_size);
2322
		munmap(ret + extra_size + size, alignment - extra_size);
2323
		ret = (void *)aligned_ret;
2324
#ifdef MALLOC_PAGEFILE
2325
		if (pfd != -1) {
2326
			ret = mmap(ret, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
2327
			    MAP_NOSYNC | MAP_FIXED, pfd, 0);
2328
		}
2329
		if (ret == MAP_FAILED)
2330
			ret = NULL;
2331
#endif
2332
	}
2322
	return (ret);
2333
	return (ret);
2323
}
2334
}
2324
#endif
2335
#endif

Return to bug 278698