Update hhvm version.h
[hiphop-php.git] / hphp / util / alloc-defs.h
blobb6ec01dc3835a5cf5d7343955beb22c8127b89cc
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 #ifndef incl_HPHP_COMPILATION_ALLOC_FLAGS_H
17 #define incl_HPHP_COMPILATION_ALLOC_FLAGS_H
19 #include <folly/CPortability.h>
20 #include "hphp/util/low-ptr-def.h"
22 #if FOLLY_SANITIZE
23 // ASan is less precise than valgrind so we'll need a superset of those tweaks
24 # define VALGRIND
25 // TODO: (t2869817) ASan doesn't play well with jemalloc
26 # ifdef USE_JEMALLOC
27 # undef USE_JEMALLOC
28 # endif
29 #endif
31 #ifdef USE_JEMALLOC
32 #include <jemalloc/jemalloc.h>
33 # if (JEMALLOC_VERSION_MAJOR >= 5) && defined(USE_LOWPTR) && \
34 defined(__linux__) && !defined(USE_JEMALLOC_EXTENT_HOOKS)
35 # define USE_JEMALLOC_EXTENT_HOOKS 1
36 # endif
37 # if USE_JEMALLOC_EXTENT_HOOKS
38 # if (JEMALLOC_VERSION_MAJOR > 5) || (JEMALLOC_VERSION_MINOR >= 1)
39 # define JEMALLOC_METADATA_1G_PAGES 1
40 # endif
41 # endif
42 # if (JEMALLOC_VERSION_MAJOR > 4)
43 # define JEMALLOC_NEW_ARENA_CMD "arenas.create"
44 # else
45 # define JEMALLOC_NEW_ARENA_CMD "arenas.extend"
46 # endif
47 #endif
49 namespace HPHP {
50 constexpr bool use_jemalloc =
51 #ifdef USE_JEMALLOC
52 true
53 #else
54 false
55 #endif
58 // When we have control over the virtual address space for the heap, all
59 // static/uncounted strings/arrays have addresses lower than kUncountedMaxAddr,
60 // and all counted HeapObjects have higher addresses.
61 constexpr bool addr_encodes_persistency =
62 #if USE_JEMALLOC_EXTENT_HOOKS && defined(__x86_64__) && defined(__linux__)
63 true
64 #else
65 false
66 #endif
69 // ASAN modifies the generated code in ways that cause abnormally high C++
70 // stack usage.
71 constexpr size_t kStackSizeMinimum =
72 #if FOLLY_SANITIZE
73 16 << 20;
74 #else
75 8 << 20;
76 #endif
78 extern const size_t s_pageSize;
82 #endif