1 <h2>Configurable Options for Compiler</h2>
3 Compiler has a --config option to take a configuration file in HDF format, and
4 it has a --config-value to take ad-hoc configurable options in HDF format.
5 This documentation describes what's available for both of them.
7 When in doubt, look for how these options are parsed in compiler/options.cpp.
11 Default is false. When turned on, all functions and methods can be invoked
12 dynamically even without a literal string. When turned off, some dynamic
13 function calls may fail, if compiler is not able to tell that function may be
14 invoked dynamically. Recommend to turn on this switch.
18 Default is false. When turned on, order-dependent function or class declaration
19 vs. existence testing can work. When turned off, some function_exists(),
20 class_exists(), get_defined_functions() or get_declared_classes() may return
21 different results than PHP does. Most programs don't have dependencies on their
22 behaviors, so this is recommended to leave as off.
26 Default is 0, eval() will throw a fatal error. When 1, eval() is supported in
27 a limited way, mixed together with compiled program. When 2, eval() is fully
28 supported as an interpreter mode.
32 Only needed when --input-list is not used, and --parse-on-demand is turned on.
33 In this case, compiler needs to understand every single include. Currently it
34 only understands these formats (compiler/analysis/dependency_graph.cpp),
36 include 'literal_file_path';
37 include $SOME_VARIABLE . 'literal_file_path';
39 IncludeRoots is designed to look up $SOME_VARIABLE in the second case, so to
40 resolve file paths at compilation time. It will look like this,
48 root = $SOME_OTHER_ROOT
55 Only needed when --input-list is not used, and --parse-on-demand is turned on.
56 In this case, compiler needs to understand all autoloads to find a class file.
57 It will look like this,
61 root = $GLOBALS['THRIFT_AUTOLOAD']
62 path = lib/thrift/packages
66 With the above configuration, whenever a class name is added to the array,
68 $GLOBALS['THRIFT_AUTOLOAD'][] = 'myclass';
70 It will be searched against the specified path. Please note that, this is
71 not a good way to work around the problem. --include-list is recommended to
72 specify all class files explicitly. Then this option isn't needed.
76 Only needed when --input-list is not used, and --parse-on-demand is turned on.
77 Specifies more paths to search for include files. For example,
80 * = lib/thrift/packages
86 Add all PHP files under these directories. For example,
89 * = lib/thrift/packages
95 Exclude file under these directories. Same as --exclude-dir command line
103 = PackageExcludeFiles
105 Exclude these files. Same as --exclude-file command line option. For example,
107 PackageExcludeFiles {
108 * = scripts/delete_user.php
109 * = tests/create_database.php
112 = PackageExcludeStaticFiles
114 Exclude files matching these patterns from static file content cache. A static
115 content cache creates one single file from all static contents, including
116 css, js, html, images and other MIME format files. When building static
117 content cache, the compiler will look for all non-PHP files to try to include
118 them. This option allows one to exclude certain files. Same as
119 --exclude-static-pattern command line option. For example,
121 PackageExcludeStaticFiles {
128 Default is false. Whether to include PHP files in static content cache.
130 = ScalarArrayFileCount
132 Default is 1. Scalar arrays are arrays with scalar values, including literal
133 strings, numbers and scalar arrays as keys and values, so their values are
134 entirely determined at compilation time. We pre-generate these arrays during
135 program startup time just once to avoid initialization costs. These scalar
136 arrays are groups into their own files. This option specifies how many files
137 to generate or split up scalar arrays, so we can compile them faster. For
138 large project with a lot of scalar arrays, use a higher value. Then each file
139 is smaller. When using distcc, normally it finishes compilation faster.
141 = ScalarArrayOverflowLimit
143 Default is 2000. Some scalar arrays can become extremely large when nested
144 with lots of elements and levels. This option controls how to split them up
145 into small ones, having sub-arrays defined by their own, so to flatten array
146 data structure for faster compilation.
148 = LiteralStringFileCount
150 Default is 1. Similar to scalar arrays, we have literal strings pre-generated
151 in files. This option specifies how many of these files are generated for
156 Default is false. Enables new syntax, including yield, new type names for
157 function parameter, function return and class variable type hints (string,
158 int, boolean, etc..), new array types (vector, map, set).
160 = EnableHipHopExperimentalSyntax
162 Default is false. Enables experimental syntax, including type hints for local
163 variables and global variables.
167 Default is true. Is <? allowed with PHP code?
171 Default is false. Is <% %> allowed with PHP code?
175 Whether to enable XHP extension. XHP adds some syntax sugar to allow better and
176 safer HTML templating. For more information, search XHP.
180 Whether to use HPHP to directly handle XHP.
184 How many threads to use when parsing PHP files. By default, it's 2x CPU count.
188 Facebook specific. Ignore.
192 Default is false. When turned on, it will generate better C++ code to be used
193 as C++ libraries, including better class methods and doc comments.
197 Default is false. Source info is a map from locations in C++ files to those in
198 PHP files. It can be used to translate C++ stacktrace to more readable PHP
199 stacktrace. When FrameInjection enabled, there is no need to do stacktrace
200 translation any more, so this option is by default set to false to save space.
202 = GenerateDocComments
204 Default is true. Whether to store doc comments in class map, so they can be
205 queried from reflection.
209 Default is false. In case clustering of output files has been requested and this
210 option is set to true, the files are pre-generated in memory in order to perform
211 a more precise partitioning.
215 Default is disabled. This option allows to selectively decrease the compiler
216 optimization level for long functions. It is specified as:
224 where X, Y, Z are the minimum length functions must have (measured as line
225 count) for their optimization level to be decreased respectively to O2, O1,
226 O0. Note that all these parameters are optional, so it is possible for example
227 to only specify O1 and O0 but not O2, meaning that O2 will never be used as an
228 optimization level. In general it is expected that if specified, the minimum
229 line counts will be increasing for a decreasing optimization level.
231 = DynamicFunctionPrefix
233 Deprecating. These are options for specifying which functions may be called
234 dynamically. This turned out to be hard to configure, and it's replaced by
237 = DynamicFunctionPostfix
239 Deprecating. These are options for specifying which functions may be called
240 dynamically. This turned out to be hard to configure, and it's replaced by
243 = DynamicMethodPrefix
245 Deprecating. These are options for specifying which methods may be called
246 dynamically. This turned out to be hard to configure, and it's replaced by
249 = DynamicInvokeFunctions
251 Deprecating. These are options for specifying which functions may be called
252 dynamically. This turned out to be hard to configure, and it's replaced by
257 Under "CodeGeneration", one can specify alternative name prefixes that are
258 used in different places of code generation.
264 - BuiltinFunctionPrefix
269 - GlobalVariablePrefix
270 - StaticVariablePrefix
272 - SystemScalarArrayName
275 - ClassStaticsObjectPrefix
276 - ClassStaticsCallbackPrefix
277 - ClassStaticsIdGetterPrefix
278 - ClassStaticInitializerPrefix
279 - ClassStaticInitializerFlagPrefix
280 - ClassWrapperFunctionPrefix
285 - MethodWrapperPrefix
288 - StaticPropertyPrefix
290 - ClassConstantPrefix
293 - EvalOrderTempPrefix