2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2013 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_REPO_GLOBAL_DATA_H_
17 #define incl_HPHP_REPO_GLOBAL_DATA_H_
19 #include "hphp/runtime/vm/repo.h"
20 #include "hphp/runtime/base/repo-auth-type-array.h"
24 //////////////////////////////////////////////////////////////////////
27 * Global repo metadata.
29 * Only used in RepoAuthoritative mode. See loadGlobalData().
31 struct Repo::GlobalData
{
35 * Indicates whether a repo was compiled using HHBBC.
37 bool UsedHHBBC
= false;
40 * Was the repo compiled with EnableHipHopSyntax.
42 bool EnableHipHopSyntax
= false;
45 * Copy of InitialNamedEntityTableSize for hhbbc to use.
47 uint32_t InitialNamedEntityTableSize
= 0;
50 * Copy of InitialStaticStringTableSize for hhbbc to use.
52 uint32_t InitialStaticStringTableSize
= 0;
55 * Indicates whether a repo was compiled with HardTypeHints.
57 * If so, we disallow recovering from the E_RECOVERABLE_ERROR we
58 * raise if you violate a parameter typehint, because doing so
59 * would allow violating assumptions from the optimizer.
61 bool HardTypeHints
= false;
64 * Indicates whether a repo was compiled with HardReturnTypeHints.
66 * If so, we disallow recovering from the E_RECOVERABLE_ERROR we
67 * raise if you violate a return typehint, because doing so would
68 * allow violating assumptions from the optimizer.
70 bool HardReturnTypeHints
= false;
73 * Indicates whether a repo was compiled assumming that `this` types will be
74 * verified by Verify*Type instructions at runtime.
76 * This changes program behavior because this type hints that are checked
77 * at runtime will enable additional HHBBC optimizations.
79 int32_t ThisTypeHintLevel
= 0;
82 * Indicates whether a repo was compiled with HardPrivatePropInference.
84 bool HardPrivatePropInference
= false;
87 * Indicates whether the repo was compiled with DisallowDynamicVarEnvFuncs. If
88 * so, we assume that '$f()' doesn't read or write over locals (that
89 * haven't been passed).
91 HackStrictOption DisallowDynamicVarEnvFuncs
= HackStrictOption::OFF
;
94 * Indicates whether the repo was compiled with ElideAutoloadInvokes. If so,
95 * potential invocations of the autoloader may have been optimized away if it
96 * could be proven the invocation would not find a viable function.
98 bool ElideAutoloadInvokes
= true;
101 * Indicates whether the repo was compiled with PHP7 integer semantics. This
102 * slightly changes the way certain arithmetic operations are evaluated, in
103 * small enough ways that don't warrant new bytecodes, but in ways that do
104 * affect everything from hphpc's constant folding up through the JIT, and
105 * so need to be kept consistent.
107 bool PHP7_IntSemantics
= false;
110 * Indicates whether hex strings (e.g. "0x20") can be used for numeric
111 * operations, e.g. ("0x20" + 1)
113 bool PHP7_NoHexNumerics
= false;
116 * Indicates whether the repo was compiled with PHP7 scalar type hint support.
117 * In this mode non hh units will default to weak types and scalar types will
118 * be available outside the HH namespace.
120 bool PHP7_ScalarTypes
= false;
123 * Indicates whether the repo was compiled with PHP7 builtins enabled.
125 bool PHP7_Builtins
= false;
128 * Indicates whether the repo was compiled with PHP7 substr behavior which
129 * returns an empty string if the stringi length is equal to start characters
130 * long, instead of PHP5's false.
132 bool PHP7_Substr
= false;
135 * Indicates that generators should be autoprimed and not require an initial
136 * call to next() before calling other generator functions.
138 bool AutoprimeGenerators
= true;
141 * Should emptyish in lval context be promoted to a stdclass object?
143 bool PromoteEmptyObject
= true;
146 * Disable return by reference in PHP
148 bool DisableReturnByReference
= true;
151 * Should all functions be interceptable?
153 bool EnableRenameFunction
= false;
156 * Are Hack array compatibility notices enabled? If so, certain optimizations
159 bool HackArrCompatNotices
= false;
160 bool HackArrCompatIsArrayNotices
= false;
161 bool HackArrCompatPromoteNotices
= false;
162 bool HackArrCompatTypeHintNotices
= false;
163 bool HackArrCompatDVCmpNotices
= false;
164 bool HackArrCompatSerializeNotices
= false;
167 * Are d/varrays dicts and vecs?
169 bool HackArrDVArrs
= false;
172 * Should the extension containing HHVM intrinsics be enabled?
174 bool EnableIntrinsicsExtension
= false;
177 * Should the runtime emit notices or throw whenever a function is called
178 * dynamically and that function has not been marked as allowing that?
180 int32_t ForbidDynamicCalls
= 0;
183 * Should the runtime emit notices whenever a builtin is called dynamically?
185 bool NoticeOnBuiltinDynamicCalls
= false;
188 * Should we enforce that reffiness annotations are invaraint in overridden
191 bool ReffinessInvariance
= false;
194 * Are objects allowed to run destructors?
196 bool AllowObjectDestructors
= false;
199 * A more-or-less unique identifier for the repo
201 uint64_t Signature
= 0;
203 std::vector
<const StringData
*> APCProfile
;
205 std::vector
<std::pair
<std::string
,Cell
>> ConstantFunctions
;
207 template<class SerDe
> void serde(SerDe
& sd
) {
210 (InitialNamedEntityTableSize
)
211 (InitialStaticStringTableSize
)
214 (HardReturnTypeHints
)
215 (HardPrivatePropInference
)
216 (DisallowDynamicVarEnvFuncs
)
217 (ElideAutoloadInvokes
)
223 (AutoprimeGenerators
)
225 (EnableRenameFunction
)
226 (HackArrCompatNotices
)
227 (HackArrCompatIsArrayNotices
)
228 (HackArrCompatPromoteNotices
)
229 (HackArrCompatTypeHintNotices
)
230 (HackArrCompatDVCmpNotices
)
231 (HackArrCompatSerializeNotices
)
233 (EnableIntrinsicsExtension
)
234 (ReffinessInvariance
)
236 (NoticeOnBuiltinDynamicCalls
)
237 (AllowObjectDestructors
)
239 (DisableReturnByReference
)
244 //////////////////////////////////////////////////////////////////////