Use iterator adapters in decl_class_parents
[hiphop-php.git] / hphp / util / alloc-defs.h
blob3a92f88e0c3d69b321fe5313118e8c9916fc513f
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #pragma once
18 #include <cstddef>
20 #include <folly/CPortability.h>
21 #include "hphp/util/low-ptr-def.h"
23 #if FOLLY_SANITIZE
24 // ASan is less precise than valgrind so we'll need a superset of those tweaks
25 # define VALGRIND
26 // TODO: (t2869817) ASan doesn't play well with jemalloc
27 # ifdef USE_JEMALLOC
28 # undef USE_JEMALLOC
29 # endif
30 #endif
32 #ifdef USE_JEMALLOC
33 #include <jemalloc/jemalloc.h>
34 #if (JEMALLOC_VERSION_MAJOR < 5)
35 # error "jemalloc 5 is required"
36 #endif
37 #if defined(USE_LOWPTR) && defined(__linux__) \
38 && !defined(USE_JEMALLOC_EXTENT_HOOKS)
39 # define USE_JEMALLOC_EXTENT_HOOKS 1
40 #endif
41 #if USE_JEMALLOC_EXTENT_HOOKS && \
42 (JEMALLOC_VERSION_MAJOR > 5) || (JEMALLOC_VERSION_MINOR >= 1)
43 # define JEMALLOC_METADATA_1G_PAGES 1
44 #endif
45 #endif
47 namespace HPHP {
48 constexpr bool use_jemalloc =
49 #ifdef USE_JEMALLOC
50 true
51 #else
52 false
53 #endif
56 // When we have control over the virtual address space for the heap, all
57 // static/uncounted strings/arrays have addresses lower than kUncountedMaxAddr,
58 // and all counted HeapObjects have higher addresses.
59 constexpr bool addr_encodes_persistency =
60 #if USE_JEMALLOC_EXTENT_HOOKS && defined(__x86_64__) && defined(__linux__)
61 true
62 #else
63 false
64 #endif
67 // ASAN modifies the generated code in ways that cause abnormally high C++
68 // stack usage.
69 constexpr size_t kStackSizeMinimum =
70 #if FOLLY_SANITIZE
71 16 << 20;
72 #else
73 8 << 20;
74 #endif
76 extern const size_t s_pageSize;