Add additional babel transform
[hiphop-php.git] / hphp / runtime / base / runtime-option.h
blob62e20aabf28cba1862f12533ce0af2e1cfbd85b1
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 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_RUNTIME_OPTION_H_
18 #define incl_HPHP_RUNTIME_OPTION_H_
20 #include <folly/dynamic.h>
22 #include <unordered_map>
23 #include <algorithm>
24 #include <vector>
25 #include <string>
26 #include <map>
27 #include <set>
28 #include <boost/container/flat_set.hpp>
29 #include <memory>
30 #include <sys/stat.h>
32 #include "hphp/runtime/base/config.h"
33 #include "hphp/runtime/base/typed-value.h"
34 #include "hphp/util/compilation-flags.h"
35 #include "hphp/util/hash-map.h"
36 #include "hphp/util/functional.h"
38 namespace HPHP {
39 ///////////////////////////////////////////////////////////////////////////////
41 struct AccessLogFileData;
42 struct ErrorLogFileData;
43 struct VirtualHost;
44 struct IpBlockMap;
45 struct SatelliteServerInfo;
46 struct FilesMatch;
47 struct Hdf;
48 struct IniSettingMap;
50 constexpr int kDefaultInitialStaticStringTableSize = 500000;
52 enum class JitSerdesMode {
53 // Bit 0: serialize
54 // Bit 1: deserialize
55 Off = 0x0,
56 Serialize = 0x1, // 00001
57 SerializeAndExit = 0x5, // 00101
58 Deserialize = 0x2, // 00010
59 DeserializeOrFail = 0x6, // 00110
60 DeserializeOrGenerate = 0xa, // 01010
61 DeserializeAndDelete = 0xe, // 01110
62 DeserializeAndExit = 0x12, // 10010
65 inline constexpr bool isJitDeserializing(JitSerdesMode m) {
66 return static_cast<std::underlying_type<JitSerdesMode>::type>(m) & 0x2;
69 inline constexpr bool isJitSerializing(JitSerdesMode m) {
70 return static_cast<std::underlying_type<JitSerdesMode>::type>(m) & 0x1;
73 struct RepoOptions {
74 RepoOptions(const RepoOptions&) = default;
75 RepoOptions(RepoOptions&&) = default;
77 using StringMap = std::map<std::string, std::string>;
78 // (Type, HDFName, DV)
79 // (N=no-prefix, P=PHP7, E=Eval, H=Hack.Lang)
80 #define PARSERFLAGS() \
81 N(StringMap, AliasedNamespaces, StringMap{}) \
82 P(bool, UVS, s_PHP7_master) \
83 P(bool, LTRAssign, s_PHP7_master) \
84 H(bool, EnableIsExprPrimitiveMigration, true) \
85 H(bool, EnableCoroutines, true) \
86 H(bool, Hacksperimental, false) \
87 H(bool, EnableConcurrent, false) \
88 H(bool, EnableAwaitAsAnExpression, false) \
89 H(bool, EnableStrongerAwaitBinding, false) \
90 H(bool, EnableReifiedGenerics, true) \
91 H(bool, DisableLvalAsAnExpression, false) \
92 E(bool, CreateInOutWrapperFunctions, true) \
93 E(std::string, HHJSAdditionalTransform, "") \
94 E(bool, HHJSUniqueFilenames, true) \
95 E(std::string, HHJSBabelTransform, \
96 hhjsBabelTransformDefault()) \
97 E(std::string, HHJSRepoRoot, "") \
98 E(std::string, HHJSNodeModules, "") \
99 E(bool, EmitFuncPointers, true) \
100 E(bool, EmitClsMethPointers, EmitFuncPointers) \
101 E(bool, EmitInstMethPointers, EmitFuncPointers) \
102 E(bool, EmitMethCallerFuncPointers, false) \
103 /**/
105 std::string path() const { return m_path; }
106 std::string cacheKeyRaw() const;
107 std::string cacheKeySha1() const;
108 std::string toJSON() const;
109 folly::dynamic toDynamic() const;
110 struct stat stat() const { return m_stat; }
112 bool operator==(const RepoOptions& o) const;
114 static const RepoOptions& defaults();
115 static void setDefaults(const Hdf& hdf, const IniSettingMap& ini);
117 static const RepoOptions& forFile(const char* path);
119 private:
120 RepoOptions() = default;
121 explicit RepoOptions(const char* file);
123 void filterNamespaces();
124 void initDefaults(const Hdf& hdf, const IniSettingMap& ini);
126 #define N(t, n, ...) t n;
127 #define P(t, n, ...) t n;
128 #define H(t, n, ...) t n;
129 #define E(t, n, ...) t n;
130 PARSERFLAGS()
131 #undef N
132 #undef P
133 #undef H
134 #undef E
136 std::string m_path;
137 struct stat m_stat;
139 static bool s_init;
140 static RepoOptions s_defaults;
144 * Configurable options set from command line or configurable file at startup
145 * time.
147 struct RuntimeOption {
148 static void Load(
149 IniSettingMap &ini, Hdf& config,
150 const std::vector<std::string>& iniClis = std::vector<std::string>(),
151 const std::vector<std::string>& hdfClis = std::vector<std::string>(),
152 std::vector<std::string>* messages = nullptr,
153 std::string cmd = "");
155 static bool ServerExecutionMode() {
156 return ServerMode;
159 static bool GcSamplingEnabled() {
160 return EvalGCSampleRate > 0;
163 static bool JitSamplingEnabled() {
164 return EvalJit && EvalJitSampleRate > 0;
167 static void ReadSatelliteInfo(
168 const IniSettingMap& ini,
169 const Hdf& hdf,
170 std::vector<std::shared_ptr<SatelliteServerInfo>>& infos,
171 std::string& xboxPassword,
172 std::set<std::string>& xboxPasswords
175 static std::string getTraceOutputFile();
177 static bool ServerMode;
178 static std::string BuildId;
179 static std::string InstanceId;
180 static std::string DeploymentId; // ID for set of instances deployed at once
181 static int64_t ConfigId; // Queryable to verify a specific config was read
182 static std::string PidFile;
184 static std::map<std::string, ErrorLogFileData> ErrorLogs;
185 static std::string LogFile;
186 static std::string LogFileSymLink;
187 static uint16_t LogFilePeriodMultiplier;
189 static int LogHeaderMangle;
190 static bool AlwaysEscapeLog;
191 static bool AlwaysLogUnhandledExceptions;
192 static bool NoSilencer;
193 static int ErrorUpgradeLevel; // Bitmask of errors to upgrade to E_USER_ERROR
194 static bool CallUserHandlerOnFatals;
195 static bool ThrowExceptionOnBadMethodCall;
196 static bool LogNativeStackOnOOM;
197 static int RuntimeErrorReportingLevel;
198 static int ForceErrorReportingLevel; // Bitmask ORed with the reporting level
200 static std::string ServerUser; // run server under this user account
201 static bool AllowRunAsRoot; // Allow running hhvm as root.
203 static int MaxSerializedStringSize;
204 static bool NoInfiniteRecursionDetection;
205 static bool AssertEmitted;
206 static int64_t NoticeFrequency; // output 1 out of NoticeFrequency notices
207 static int64_t WarningFrequency;
208 static int RaiseDebuggingFrequency;
209 static int64_t SerializationSizeLimit;
211 static std::string AccessLogDefaultFormat;
212 static std::map<std::string, AccessLogFileData> AccessLogs;
214 static std::string AdminLogFormat;
215 static std::string AdminLogFile;
216 static std::string AdminLogSymLink;
218 static std::map<std::string, AccessLogFileData> RPCLogs;
220 static std::string Host;
221 static std::string DefaultServerNameSuffix;
222 static std::string ServerType;
223 static std::string ServerIP;
224 static std::string ServerFileSocket;
225 static const std::string& GetServerPrimaryIPv4();
226 static const std::string& GetServerPrimaryIPv6();
227 static int ServerPort;
228 static int ServerPortFd;
229 static int ServerBacklog;
230 static int ServerConnectionLimit;
231 static int ServerThreadCount;
232 static int ServerQueueCount;
233 // Number of worker threads with stack partially on huge pages.
234 static int ServerHugeThreadCount;
235 static int ServerHugeStackKb;
236 static uint32_t ServerLoopSampleRate;
237 static int ServerWarmupThrottleRequestCount;
238 static int ServerWarmupThrottleThreadCount;
239 static int ServerThreadDropCacheTimeoutSeconds;
240 static int ServerThreadJobLIFOSwitchThreshold;
241 static int ServerThreadJobMaxQueuingMilliSeconds;
242 static bool AlwaysDecodePostDataDefault;
243 static bool ServerThreadDropStack;
244 static bool ServerHttpSafeMode;
245 static bool ServerStatCache;
246 static bool ServerFixPathInfo;
247 static bool ServerAddVaryEncoding;
248 static bool ServerLogSettingsOnStartup;
249 static bool ServerForkEnabled;
250 static bool ServerForkLogging;
251 static bool ServerWarmupConcurrently;
252 static std::vector<std::string> ServerWarmupRequests;
253 static std::string ServerCleanupRequest;
254 static int ServerInternalWarmupThreads;
255 static boost::container::flat_set<std::string> ServerHighPriorityEndPoints;
256 static bool ServerExitOnBindFail;
257 static int PageletServerThreadCount;
258 static int PageletServerHugeThreadCount;
259 static int PageletServerThreadDropCacheTimeoutSeconds;
260 static int PageletServerQueueLimit;
261 static bool PageletServerThreadDropStack;
263 static int RequestTimeoutSeconds;
264 static int PspTimeoutSeconds;
265 static int PspCpuTimeoutSeconds;
266 static int64_t MaxRequestAgeFactor;
267 static int64_t RequestMemoryMaxBytes;
268 // Threshold for aborting when host is low on memory.
269 static int64_t RequestMemoryOOMKillBytes;
270 // Approximate upper bound for thread heap that is backed by huge pages. This
271 // doesn't include the first slab colocated with thread stack, if any.
272 static int64_t RequestHugeMaxBytes;
273 static int64_t ImageMemoryMaxBytes;
274 static int ServerGracefulShutdownWait;
275 static bool ServerHarshShutdown;
276 static bool ServerEvilShutdown;
277 static bool ServerKillOnTimeout;
278 static int ServerPreShutdownWait;
279 static int ServerShutdownListenWait;
280 static int ServerShutdownEOMWait;
281 static int ServerPrepareToStopTimeout;
282 static int ServerPartialPostStatusCode;
283 // If `StopOldServer` is set, we try to stop the old server running
284 // on the local host earlier when we initialize, and we do not start
285 // serving requests until we are confident that the system can give
286 // the new server `ServerRSSNeededMb` resident memory, or till
287 // `OldServerWait` seconds passes after an effort to stop the old
288 // server is made.
289 static bool StopOldServer;
290 static int64_t ServerRSSNeededMb;
291 // Threshold of free memory below which the old server is shutdown immediately
292 // upon a memory pressure check.
293 static int64_t ServerCriticalFreeMb;
294 static int OldServerWait;
295 // The percentage of page caches that can be considered as free (0 -
296 // 100). This is experimental.
297 static int CacheFreeFactor;
298 static std::vector<std::string> ServerNextProtocols;
299 static bool ServerEnableH2C;
300 static int BrotliCompressionEnabled;
301 static int BrotliChunkedCompressionEnabled;
302 static int BrotliCompressionMode;
303 // Base 2 logarithm of the sliding window size. Range is 10-24.
304 static int BrotliCompressionLgWindowSize;
305 static int BrotliCompressionQuality;
306 static int ZstdCompressionEnabled;
307 static int ZstdCompressionLevel;
308 static int GzipCompressionLevel;
309 static int GzipMaxCompressionLevel;
310 static bool EnableKeepAlive;
311 static bool ExposeHPHP;
312 static bool ExposeXFBServer;
313 static bool ExposeXFBDebug;
314 static std::string XFBDebugSSLKey;
315 static int ConnectionTimeoutSeconds;
316 static bool EnableOutputBuffering;
317 static std::string OutputHandler;
318 static bool ImplicitFlush;
319 static bool EnableEarlyFlush;
320 static bool ForceChunkedEncoding;
321 static int64_t MaxPostSize;
322 static int64_t LowestMaxPostSize;
323 static bool AlwaysPopulateRawPostData;
324 static int64_t UploadMaxFileSize;
325 static std::string UploadTmpDir;
326 static bool EnableFileUploads;
327 static bool EnableUploadProgress;
328 static int64_t MaxFileUploads;
329 static int Rfc1867Freq;
330 static std::string Rfc1867Prefix;
331 static std::string Rfc1867Name;
332 static bool ExpiresActive;
333 static int ExpiresDefault;
334 static std::string DefaultCharsetName;
335 static bool ForceServerNameToHeader;
336 static bool PathDebug;
337 static std::vector<std::shared_ptr<VirtualHost>> VirtualHosts;
338 static std::shared_ptr<IpBlockMap> IpBlocks;
339 static std::vector<std::shared_ptr<SatelliteServerInfo>>
340 SatelliteServerInfos;
342 // If a request has a body over this limit, switch to on-demand reading.
343 // -1 for no limit.
344 static int64_t RequestBodyReadLimit;
346 static bool EnableSSL;
347 static int SSLPort;
348 static int SSLPortFd;
349 static std::string SSLCertificateFile;
350 static std::string SSLCertificateKeyFile;
351 static std::string SSLCertificateDir;
352 static std::string SSLTicketSeedFile;
353 static bool TLSDisableTLS1_2;
354 static std::string TLSClientCipherSpec;
355 static bool EnableSSLWithPlainText;
357 static int XboxServerThreadCount;
358 static int XboxServerMaxQueueLength;
359 static int XboxServerPort;
360 static int XboxDefaultLocalTimeoutMilliSeconds;
361 static int XboxDefaultRemoteTimeoutSeconds;
362 static int XboxServerInfoMaxRequest;
363 static int XboxServerInfoDuration;
364 static std::string XboxServerInfoReqInitFunc;
365 static std::string XboxServerInfoReqInitDoc;
366 static bool XboxServerInfoAlwaysReset;
367 static bool XboxServerLogInfo;
368 static std::string XboxProcessMessageFunc;
369 static std::string XboxPassword;
370 static std::set<std::string> XboxPasswords;
372 static std::string SourceRoot;
373 static std::vector<std::string> IncludeSearchPaths;
376 * Legal root directory expressions in an include expression. For example,
378 * include_once $PHP_ROOT . '/lib.php';
380 * Here, "$PHP_ROOT" is a legal include root. Stores what it resolves to.
382 * RuntimeOption::IncludeRoots["$PHP_ROOT"] = "";
383 * RuntimeOption::IncludeRoots["$LIB_ROOT"] = "lib";
385 static std::map<std::string, std::string> IncludeRoots;
386 static std::map<std::string, std::string> AutoloadRoots;
388 static std::string FileCache;
389 static std::string DefaultDocument;
390 static std::string ErrorDocument404;
391 static bool ForbiddenAs404;
392 static std::string ErrorDocument500;
393 static std::string FatalErrorMessage;
394 static std::string FontPath;
395 static bool EnableStaticContentFromDisk;
396 static bool EnableOnDemandUncompress;
397 static bool EnableStaticContentMMap;
399 static bool Utf8izeReplace;
401 static std::string RequestInitFunction;
402 static std::string RequestInitDocument;
403 static std::string AutoPrependFile;
404 static std::string AutoAppendFile;
406 static bool SafeFileAccess;
407 static std::vector<std::string> AllowedDirectories;
408 static std::set<std::string> AllowedFiles;
409 static hphp_string_imap<std::string> StaticFileExtensions;
410 static hphp_string_imap<std::string> PhpFileExtensions;
411 static std::set<std::string> ForbiddenFileExtensions;
412 static std::set<std::string> StaticFileGenerators;
413 static std::vector<std::shared_ptr<FilesMatch>> FilesMatches;
415 static bool WhitelistExec;
416 static bool WhitelistExecWarningOnly;
417 static std::vector<std::string> AllowedExecCmds;
419 static bool UnserializationWhitelistCheck;
420 static bool UnserializationWhitelistCheckWarningOnly;
421 static int64_t UnserializationBigMapThreshold;
423 static std::string TakeoverFilename;
424 static std::string AdminServerIP;
425 static int AdminServerPort;
426 static int AdminThreadCount;
427 static std::string AdminPassword;
428 static std::set<std::string> AdminPasswords;
429 static std::set<std::string> HashedAdminPasswords;
432 * Options related to reverse proxying. ProxyOriginRaw and ProxyPercentageRaw
433 * may be mutated by background threads and should only be read or written
434 * using the helper functions defined with HttpRequestHandler.
436 static std::string ProxyOriginRaw;
437 static int ProxyPercentageRaw;
438 static int ProxyRetry;
439 static bool UseServeURLs;
440 static std::set<std::string> ServeURLs;
441 static bool UseProxyURLs;
442 static std::set<std::string> ProxyURLs;
443 static std::vector<std::string> ProxyPatterns;
444 static bool AlwaysUseRelativePath;
446 static int HttpDefaultTimeout;
447 static int HttpSlowQueryThreshold;
449 static bool NativeStackTrace;
450 static bool ServerErrorMessage;
451 static bool RecordInput;
452 static bool ClearInputOnSuccess;
453 static std::string ProfilerOutputDir;
454 static std::string CoreDumpEmail;
455 static bool CoreDumpReport;
456 static std::string CoreDumpReportDirectory;
457 static std::string StackTraceFilename;
458 static int StackTraceTimeout;
459 static std::string RemoteTraceOutputDir;
460 static std::set<std::string, stdltistr> TraceFunctions;
461 static uint32_t TraceFuncId;
463 static bool EnableStats;
464 static bool EnableAPCStats;
465 static bool EnableWebStats;
466 static bool EnableMemoryStats;
467 static bool EnableSQLStats;
468 static bool EnableSQLTableStats;
469 static bool EnableNetworkIOStatus;
470 static std::string StatsXSL;
471 static std::string StatsXSLProxy;
472 static uint32_t StatsSlotDuration;
473 static uint32_t StatsMaxSlot;
475 static bool EnableHotProfiler;
476 static int32_t ProfilerTraceBuffer;
477 static double ProfilerTraceExpansion;
478 static int32_t ProfilerMaxTraceBuffer;
480 static int64_t MaxSQLRowCount;
481 static int64_t SocketDefaultTimeout;
482 static bool LockCodeMemory;
483 static int MaxArrayChain;
484 static bool WarnOnCollectionToArray;
485 static bool UseDirectCopy;
487 static bool DisableSmallAllocator;
489 static int PerAllocSampleF;
490 static int TotalAllocSampleF;
492 static std::map<std::string, std::string> ServerVariables;
494 static std::map<std::string, std::string> EnvVariables;
496 // The file name that is used by LightProcess to bind the socket
497 // is the following prefix followed by the pid of the hphp process.
498 static std::string LightProcessFilePrefix;
499 static int LightProcessCount;
501 // Eval options
502 static bool EnableHipHopSyntax;
503 static bool EnableShortTags;
504 static bool EnableXHP;
505 static bool EnablePHP;
506 static bool CheckParamTypeInvariance;
507 static bool EnableIntrinsicsExtension;
508 static bool CheckSymLink;
509 static bool EnableArgsInBacktraces;
510 static bool EnableZendIniCompat;
511 static bool TimeoutsUseWallTime;
512 static bool CheckFlushOnUserClose;
513 static bool EvalAuthoritativeMode;
514 static bool IntsOverflowToInts;
515 static HackStrictOption StrictArrayFillKeys;
516 static HackStrictOption DisallowDynamicVarEnvFuncs;
517 static HackStrictOption IconvIgnoreCorrect;
518 static HackStrictOption MinMaxAllowDegenerate;
519 static bool LookForTypechecker;
520 static bool AutoTypecheck;
521 static uint32_t EvalInitialStaticStringTableSize;
522 static uint32_t EvalInitialNamedEntityTableSize;
523 static JitSerdesMode EvalJitSerdesMode;
524 static int ProfDataTTLHours;
525 static std::string EvalJitSerdesFile;
526 static bool DumpPreciseProfData;
527 static bool EnablePocketUniverses;
529 // ENABLED (1) selects PHP7 behavior.
530 static bool PHP7_DeprecationWarnings;
531 static bool PHP7_IntSemantics;
532 static bool PHP7_NoHexNumerics;
533 static bool PHP7_Builtins;
534 static bool PHP7_ScalarTypes;
535 static bool PHP7_EngineExceptions;
536 static bool PHP7_Substr;
537 static bool PHP7_DisallowUnsafeCurlUploads;
539 static int64_t HeapSizeMB;
540 static int64_t HeapResetCountBase;
541 static int64_t HeapResetCountMultiple;
542 static int64_t HeapLowWaterMark;
543 static int64_t HeapHighWaterMark;
545 // Controls PHP's behavior of falling back to the default namespace for
546 // undefined functions.
547 // 0 => fall back to root namespace (default)
548 // 1 => raise notice and fall back to root namespace
549 // 2 => raise error
550 static uint64_t UndefinedFunctionFallback;
551 // Disables PHP's call_user_func function.
552 // Valid values are 0 => enabled (default),
553 // 1 => warning, 2 => error.
554 static uint64_t DisableCallUserFunc;
555 // Disables PHP's call_user_func_array function.
556 // Valid values are 0 => enabled (default),
557 // 1 => warning, 2 => error.
558 static uint64_t DisableCallUserFuncArray;
559 // Disables PHP's parse_str function with one argument
560 // valid values are 0 => enabled (default)
561 // 1 => warning, 2 => error
562 static uint64_t DisableParseStrSingleArg;
563 // Disables PHP's backtick language
564 // true => error, false => default behaviour
565 static bool DisallowExecutionOperator;
566 // Disables PHP's constant function
567 // valid values are 0 => enabled (default)
568 // 1 => warning, 2 => error
569 static uint64_t DisableConstant;
570 // Disables PHP's define() function
571 // valid values are 0 => enabled (default)
572 // 1 => warning, 2 => error
573 static uint64_t DisableDefine;
574 // Disables PHP's assert() function
575 // valid values are 0 => enabled (default)
576 // 1 => warning, 2 => error
577 static uint64_t DisableAssert;
578 // Disables non-top-level declarations
579 // true => error, false => default behaviour
580 static bool DisableNontoplevelDeclarations;
581 // Disables static closures
582 // true => error, false => default behaviour
583 static bool DisableStaticClosures;
585 // Disables the setting of reserved variable php_errorsmg
586 // true => error, false => php_errormsg can be set
587 static bool DisableReservedVariables;
588 static int GetScannerType();
590 static std::set<std::string, stdltistr> DynamicInvokeFunctions;
591 static hphp_string_imap<Cell> ConstantFunctions;
593 static const uint32_t kPCREInitialTableSize = 96 * 1024;
595 static std::string ExtensionDir;
596 static std::vector<std::string> Extensions;
597 static std::string DynamicExtensionPath;
598 static std::vector<std::string> DynamicExtensions;
600 static std::vector<std::string> TzdataSearchPaths;
602 #define HAC_CHECK_OPTS \
603 HC(IntishCast, intish_cast) \
604 HC(RefBind, ref_bind) \
605 HC(FalseyPromote, falsey_promote) \
606 HC(EmptyStringPromote, empty_string_promote) \
607 HC(Compare, compare) \
608 HC(ArrayKeyCast, array_key_cast) \
609 HC(ArrayPlus, array_plus)
611 #define EVALFLAGS() \
612 /* F(type, name, defaultVal) */ \
613 /* \
614 * Maximum number of elements on the VM execution stack. \
615 */ \
616 F(uint64_t, VMStackElms, kEvalVMStackElmsDefault) \
617 /* \
618 * Initial space reserved for the global variable environment (in \
619 * number of global variables). \
620 */ \
621 F(uint32_t, VMInitialGlobalTableSize, \
622 kEvalVMInitialGlobalTableSizeDefault) \
623 F(bool, Jit, evalJitDefault()) \
624 F(bool, JitEvaledCode, true) \
625 F(bool, JitRequireWriteLease, false) \
626 F(uint64_t, JitRelocationSize, kJitRelocationSizeDefault) \
627 F(uint64_t, JitMatureSize, 125 << 20) \
628 F(bool, JitMatureAfterWarmup, true) \
629 F(double, JitMaturityExponent, 1.) \
630 F(double, LogLoadedUnitsRate, 0.0) \
631 F(string, LogLoadedUnitsBaseDir, "{PHP_ROOT}") \
632 F(bool, JitTimer, kJitTimerDefault) \
633 F(int, JitConcurrently, 1) \
634 F(int, JitThreads, 4) \
635 F(int, JitWorkerThreads, std::max(1, Process::GetCPUCount() / 2)) \
636 F(int, JitWorkerThreadsForSerdes, 0) \
637 F(int, JitWorkerArenas, std::max(1, Process::GetCPUCount() / 4)) \
638 F(bool, JitParallelDeserialize, true) \
639 F(int, JitLdimmqSpan, 8) \
640 F(int, JitPrintOptimizedIR, 0) \
641 F(bool, RecordSubprocessTimes, false) \
642 F(bool, AllowHhas, false) \
643 F(bool, DisassemblerSourceMapping, true) \
644 F(bool, GenerateDocComments, true) \
645 F(bool, DisassemblerDocComments, true) \
646 F(bool, DisassemblerPropDocComments, true) \
647 F(bool, LoadFilepathFromUnitCache, false) \
648 F(bool, WarnOnCoerceBuiltinParams, false) \
649 F(bool, FatalOnParserOptionMismatch, true) \
650 F(bool, WarnOnSkipFrameLookup, true) \
651 /* Whether to use the embedded hackc binary */ \
652 F(bool, HackCompilerUseEmbedded, facebook) \
653 /* Whether to trust existing versions of the extracted compiler */ \
654 F(bool, HackCompilerTrustExtract, true) \
655 /* When using an embedded hackc, extract it to the ExtractPath or the
656 ExtractFallback. */ \
657 F(string, HackCompilerExtractPath, "/var/run/hackc_%{schema}") \
658 F(string, HackCompilerFallbackPath, "/tmp/hackc_%{schema}_XXXXXX") \
659 /* Arguments to run embedded hackc binary with */ \
660 F(string, HackCompilerArgs, hackCompilerArgsDefault()) \
661 /* The command to invoke to spawn hh_single_compile in server mode. */\
662 F(string, HackCompilerCommand, hackCompilerCommandDefault()) \
663 /* The number of hh_single_compile daemons to keep alive. */ \
664 F(uint64_t, HackCompilerWorkers, Process::GetCPUCount()) \
665 /* The number of times to retry after an infra failure communicating
666 with a compiler process. */ \
667 F(uint64_t, HackCompilerMaxRetries, 0) \
668 /* Whether to log extern compiler performance */ \
669 F(bool, LogExternCompilerPerf, false) \
670 /* Whether to write verbose log messages to the error log and include
671 the hhas from failing units in the fatal error messages produced by
672 bad hh_single_compile units. */ \
673 F(bool, HackCompilerVerboseErrors, true) \
674 /* Whether the HackC compiler should inherit the compiler config of the
675 HHVM process that launches it. */ \
676 F(bool, HackCompilerInheritConfig, true) \
677 /* When using embedded data, extract it to the ExtractPath or the
678 * ExtractFallback. */ \
679 F(string, EmbeddedDataExtractPath, "/var/run/hhvm_%{type}_%{buildid}") \
680 F(string, EmbeddedDataFallbackPath, "/tmp/hhvm_%{type}_%{buildid}_XXXXXX") \
681 /* Whether to trust existing versions of extracted embedded data. */ \
682 F(bool, EmbeddedDataTrustExtract, true) \
683 F(bool, EmitSwitch, true) \
684 F(bool, LogThreadCreateBacktraces, false) \
685 F(bool, FailJitPrologs, false) \
686 F(bool, EnableHHJS, false) \
687 F(bool, DumpHHJS, false) \
688 F(bool, UseHHBBC, !getenv("HHVM_DISABLE_HHBBC")) \
689 F(bool, EnablePerRepoOptions, true) \
690 F(bool, CachePerRepoOptionsPath, true) \
691 /* Generate warning of side effect of the pseudomain is called by \
692 top-level code.*/ \
693 F(bool, WarnOnRealPseudomain, false) \
694 /* Generate warnings of side effect on top-level code that is not \
695 * called by pseudomain directly (include from other file) \
696 * 0 - Nothing \
697 * 1 - Raise Warning \
698 * 2 - Throw exception \
699 */ \
700 F(int32_t, WarnOnUncalledPseudomain, 0) \
701 /* The following option enables the runtime checks for `this` typehints.
702 * There are 4 possible options:
703 * 0 - No checking of `this` typehints.
704 * 1 - Check `this` as hard `self` typehints.
705 * 2 - Check `this` typehints as soft `this` typehints
706 * 3 - Check `this` typehints as hard `this` typehints (unless explicitly
707 * soft). This is the only option which enable optimization in HHBBC.
708 */ \
709 F(int32_t, ThisTypeHintLevel, EnableHipHopSyntax ? 3 : 0) \
710 /* CheckReturnTypeHints:
711 0 - No checks or enforcement for return type hints.
712 1 - Raises E_WARNING if a return type hint fails.
713 2 - Raises E_RECOVERABLE_ERROR if regular return type hint fails,
714 raises E_WARNING if soft return type hint fails. If a regular
715 return type hint fails, it's possible for execution to resume
716 normally if the user error handler doesn't throw and returns
717 something other than boolean false.
718 3 - Same as 2, except if a regular type hint fails the runtime
719 will not allow execution to resume normally; if the user
720 error handler returns something other than boolean false,
721 the runtime will throw a fatal error. */ \
722 F(int32_t, CheckReturnTypeHints, 2) \
724 CheckPropTypeHints:
725 0 - No checks or enforcement of property type hints.
726 1 - Raises E_WARNING if a property type hint fails.
727 2 - Raises E_RECOVERABLE_ERROR if regular property type hint fails, raises
728 E_WARNING if soft property type hint fails. If a regular property type
729 hint fails, it's possible for execution to resume normally if the user
730 error handler doesn't throw and returns something other than boolean
731 false.
732 3 - Same as 2, except if a regular property type hint fails the runtime will
733 not allow execution to resume normally; if the user error handler
734 returns something other than boolean false, the runtime will throw a
735 fatal error.
736 */ \
737 F(int32_t, CheckPropTypeHints, 0) \
738 /* Whether or not to assume that VerifyParamType instructions must
739 throw if the parameter does not match the associated type
740 constraint. This changes program behavior because parameter type
741 hint validation is normally a recoverable fatal. When this option
742 is on, hhvm will fatal if the error handler tries to recover in
743 this situation.
744 1) In repo-mode, we only set this option to hphpc, and serialize
745 it in Repo::GlobalData::HardTypeHints. Subsequent invocations
746 to hhbbc/hhvm runtime will only load it from the GlobalData.
747 2) In non-repo mode, we set this option to the runtime as usual.
748 3) Both HHBBC and the runtime should query only this option
749 instead of the GlobalData.
750 */ \
751 F(bool, HardTypeHints, RepoAuthoritative) \
752 /* WarnOnTooManyArguments:
753 * 0 -> no warning, 1 -> warning, 2 -> exception
754 */ \
755 F(uint32_t, WarnOnTooManyArguments, 0) \
756 F(bool, PromoteEmptyObject, !EnableHipHopSyntax) \
757 F(bool, LibXMLUseSafeSubtrees, true) \
758 F(bool, AllDestructorsOptional, false) \
759 F(bool, AllowScopeBinding, false) \
760 F(bool, JitNoGdb, true) \
761 F(bool, SpinOnCrash, false) \
762 F(uint32_t, DumpRingBufferOnCrash, 0) \
763 F(bool, PerfPidMap, true) \
764 F(bool, PerfPidMapIncludeFilePath, true) \
765 F(bool, PerfJitDump, false) \
766 F(string, PerfJitDumpDir, "/tmp") \
767 F(bool, PerfDataMap, false) \
768 F(bool, KeepPerfPidMap, false) \
769 F(int32_t, PerfRelocate, 0) \
770 F(uint32_t, ThreadTCMainBufferSize, 6 << 20) \
771 F(uint32_t, ThreadTCColdBufferSize, 6 << 20) \
772 F(uint32_t, ThreadTCFrozenBufferSize,4 << 20) \
773 F(uint32_t, ThreadTCDataBufferSize, 256 << 10) \
774 F(uint32_t, JitTargetCacheSize, 64 << 20) \
775 F(uint32_t, HHBCArenaChunkSize, 10 << 20) \
776 F(bool, ProfileBC, false) \
777 F(bool, ProfileHeapAcrossRequests, false) \
778 F(bool, ProfileHWEnable, true) \
779 F(string, ProfileHWEvents, std::string("")) \
780 F(bool, ProfileHWExcludeKernel, false) \
781 F(bool, ProfileHWFastReads, false) \
782 F(bool, ProfileHWStructLog, false) \
783 F(int32_t, ProfileHWExportInterval, 30) \
784 F(bool, JitAlwaysInterpOne, false) \
785 F(int32_t, JitNopInterval, 0) \
786 F(uint32_t, JitMaxTranslations, 10) \
787 F(uint32_t, JitMaxProfileTranslations, 30) \
788 F(uint32_t, JitTraceletGuardsLimit, 5) \
789 F(uint64_t, JitGlobalTranslationLimit, -1) \
790 F(int64_t, JitMaxRequestTranslationTime, -1) \
791 F(uint32_t, JitMaxRegionInstrs, 1347) \
792 F(uint32_t, JitProfileInterpRequests, kDefaultProfileInterpRequests) \
793 F(uint32_t, JitMaxAwaitAllUnroll, 8) \
794 F(bool, JitProfileWarmupRequests, false) \
795 F(uint32_t, JitProfileRequests, profileRequestsDefault()) \
796 F(uint32_t, JitProfileBCSize, profileBCSizeDefault()) \
797 F(uint32_t, JitResetProfCountersRequest, resetProfCountersDefault()) \
798 F(uint32_t, JitRetranslateAllRequest, retranslateAllRequestDefault()) \
799 F(uint32_t, JitRetranslateAllSeconds, retranslateAllSecondsDefault()) \
800 F(bool, JitPGOLayoutSplitHotCold, pgoLayoutSplitHotColdDefault()) \
801 F(bool, JitLayoutPrologueSplitHotCold, layoutPrologueSplitHotColdDefault()) \
802 F(bool, JitLayoutProfileSplitHotCold, true) \
803 F(double, JitLayoutHotThreshold, 0.05) \
804 F(int32_t, JitLayoutMainFactor, 1000) \
805 F(int32_t, JitLayoutColdFactor, 5) \
806 F(bool, JitAHotSizeRoundUp, true) \
807 F(bool, JitProfileRecord, false) \
808 F(uint32_t, GdbSyncChunks, 128) \
809 F(bool, JitKeepDbgFiles, false) \
810 /* despite the unfortunate name, this enables function renaming and
811 * interception in the interpreter as well as the jit, and also
812 * implies all functions may be used with fb_intercept */ \
813 F(bool, JitEnableRenameFunction, EvalJitEnableRenameFunction) \
814 F(bool, JitUseVtuneAPI, false) \
815 F(bool, TraceCommandLineRequest, true) \
817 F(bool, JitDisabledByHphpd, false) \
818 F(bool, JitPseudomain, true) \
819 F(uint32_t, JitWarmupStatusBytes, ((25 << 10) + 1)) \
820 F(uint32_t, JitWarmupMaxCodeGenRate, 20000) \
821 F(uint32_t, JitWarmupRateSeconds, 64) \
822 F(uint32_t, JitWriteLeaseExpiration, 1500) /* in microseconds */ \
823 F(int, JitRetargetJumps, 1) \
824 F(bool, HHIRLICM, false) \
825 F(bool, HHIRSimplification, true) \
826 F(bool, HHIRGenOpts, true) \
827 F(bool, HHIRRefcountOpts, true) \
828 F(bool, HHIREnableGenTimeInlining, true) \
829 F(uint32_t, HHIRInliningVasmCostLimit, 175) \
830 F(uint32_t, HHIRInliningMinVasmCostLimit, 100) \
831 F(uint32_t, HHIRInliningMaxVasmCostLimit, 400) \
832 F(uint32_t, HHIRAlwaysInlineVasmCostLimit, 80) \
833 F(double, HHIRInliningVasmCallerExp, .5) \
834 F(double, HHIRInliningVasmCalleeExp, .5) \
835 F(uint32_t, HHIRInliningMaxReturnDecRefs, 12) \
836 F(uint32_t, HHIRInliningMaxReturnLocals, 20) \
837 F(uint32_t, HHIRInliningMaxInitObjProps, 12) \
838 F(bool, HHIRInliningIgnoreHints, !debug) \
839 F(bool, HHIRInlineFrameOpts, true) \
840 F(bool, HHIRPartialInlineFrameOpts, true) \
841 F(bool, HHIRInlineSingletons, true) \
842 F(std::string, InlineRegionMode, "both") \
843 F(bool, HHIRGenerateAsserts, false) \
844 F(bool, HHIRDeadCodeElim, true) \
845 F(bool, HHIRGlobalValueNumbering, true) \
846 F(bool, HHIRPredictionOpts, true) \
847 F(bool, HHIRMemoryOpts, true) \
848 F(bool, AssemblerFoldDefaultValues, true) \
849 F(uint64_t, AssemblerMaxScalarSize, 1073741824) /* 1GB */ \
850 F(uint32_t, HHIRLoadElimMaxIters, 10) \
851 F(bool, HHIRStorePRE, true) \
852 F(bool, HHIROutlineGenericIncDecRef, true) \
853 F(double, HHIRMixedArrayProfileThreshold, 0.8554) \
854 /* Register allocation flags */ \
855 F(bool, HHIREnablePreColoring, true) \
856 F(bool, HHIREnableCoalescing, true) \
857 F(bool, HHIRAllocSIMDRegs, true) \
858 F(bool, HHIRStressSpill, false) \
859 /* Region compiler flags */ \
860 F(string, JitRegionSelector, regionSelectorDefault()) \
861 F(bool, JitPGO, pgoDefault()) \
862 F(string, JitPGORegionSelector, "hotcfg") \
863 F(uint64_t, JitPGOThreshold, pgoThresholdDefault()) \
864 F(bool, JitPGOOnly, false) \
865 F(bool, JitPGOHotOnly, false) \
866 F(bool, JitPGOUsePostConditions, true) \
867 F(bool, JitPGOUseAddrCountedCheck, false) \
868 F(uint32_t, JitPGOUnlikelyIncRefCountedPercent, 2) \
869 F(uint32_t, JitPGOUnlikelyIncRefIncrementPercent, 5) \
870 F(uint32_t, JitPGOUnlikelyDecRefReleasePercent, 5) \
871 F(uint32_t, JitPGOUnlikelyDecRefCountedPercent, 2) \
872 F(uint32_t, JitPGOUnlikelyDecRefPersistPercent, 5) \
873 F(uint32_t, JitPGOUnlikelyDecRefSurvivePercent, 5) \
874 F(uint32_t, JitPGOUnlikelyDecRefDecrementPercent, 5) \
875 F(double, JitPGODecRefNZReleasePercentCOW, 0.5) \
876 F(double, JitPGODecRefNZReleasePercent, 5) \
877 F(uint32_t, JitPGOReleaseVVMinPercent, 8) \
878 F(bool, JitPGOArrayGetStress, false) \
879 F(double, JitPGOMinBlockCountPercent, 0.05) \
880 F(double, JitPGOMinArcProbability, 0.0) \
881 F(uint32_t, JitPGOMaxFuncSizeDupBody, 80) \
882 F(uint32_t, JitPGORelaxPercent, 100) \
883 F(uint32_t, JitPGORelaxUncountedToGenPercent, 20) \
884 F(uint32_t, JitPGORelaxCountedToGenPercent, 75) \
885 F(uint32_t, JitPGOBindCallThreshold, 50) \
886 F(double, JitPGOCalledFuncThreshold, 90) \
887 F(bool, JitPGODumpCallGraph, false) \
888 F(bool, JitPGORacyProfiling, false) \
889 F(uint64_t, FuncCountHint, 10000) \
890 F(uint64_t, PGOFuncCountHint, 1000) \
891 F(uint32_t, HotFuncCount, 4100) \
892 F(bool, RegionRelaxGuards, true) \
893 /* DumpBytecode =1 dumps user php, =2 dumps systemlib & user php */ \
894 F(int32_t, DumpBytecode, 0) \
895 /* DumpHhas =1 dumps user php, =2 dumps systemlib & user php */ \
896 F(int32_t, DumpHhas, 0) \
897 F(string, DumpHhasToFile, "") \
898 F(bool, DisableHphpcOpts, false) \
899 F(bool, DisableErrorHandler, false) \
900 F(bool, DumpTC, false) \
901 F(string, DumpTCPath, "/tmp") \
902 F(bool, DumpTCAnchors, false) \
903 F(uint32_t, DumpIR, 0) \
904 F(bool, DumpTCAnnotationsForAllTrans,debug) \
905 /* DumpInlDecision 0=none ; 1=refuses ; 2=refuses+accepts */ \
906 F(uint32_t, DumpInlDecision, 0) \
907 F(uint32_t, DumpRegion, 0) \
908 F(bool, DumpAst, false) \
909 F(bool, DumpTargetProfiles, false) \
910 F(bool, MapTgtCacheHuge, false) \
911 F(uint32_t, MaxHotTextHugePages, hotTextHugePagesDefault()) \
912 F(uint32_t, MaxLowMemHugePages, hugePagesSoundNice() ? 8 : 0) \
913 F(uint32_t, MaxHighArenaHugePages, 0) \
914 F(uint32_t, Num1GPagesForSlabs, 0) \
915 F(uint32_t, Num2MPagesForSlabs, 0) \
916 F(bool, LowStaticArrays, true) \
917 F(int64_t, HeapPurgeWindowSize, 5 * 1000000) \
918 F(uint64_t, HeapPurgeThreshold, 128 * 1024 * 1024) \
919 /* GC Options: See heap-collect.cpp for more details */ \
920 F(bool, EagerGC, eagerGcDefault()) \
921 F(bool, FilterGCPoints, true) \
922 F(bool, Quarantine, eagerGcDefault()) \
923 F(uint32_t, GCSampleRate, 0) \
924 F(int64_t, GCMinTrigger, 64L<<20) \
925 F(double, GCTriggerPct, 0.5) \
926 F(bool, GCForAPC, false) \
927 F(int64_t, GCForAPCTrigger, 1024*1024*1024) \
928 F(bool, TwoPhaseGC, false) \
929 F(bool, EnableGC, enableGcDefault()) \
930 /* End of GC Options */ \
931 F(bool, RaiseMissingThis, !EnableHipHopSyntax) \
932 F(bool, QuoteEmptyShellArg, !EnableHipHopSyntax) \
933 F(bool, Verify, (getenv("HHVM_VERIFY") || \
934 !EvalHackCompilerCommand.empty())) \
935 F(bool, VerifyOnly, false) \
936 F(bool, FatalOnVerifyError, !RepoAuthoritative) \
937 F(bool, AbortBuildOnVerifyError, true) \
938 F(uint32_t, StaticContentsLogRate, 100) \
939 F(uint32_t, LogUnitLoadRate, 0) \
940 F(uint32_t, MaxDeferredErrors, 50) \
941 F(bool, JitAlignMacroFusionPairs, alignMacroFusionPairs()) \
942 F(bool, JitAlignUniqueStubs, true) \
943 F(uint32_t, SerDesSampleRate, 0) \
944 F(bool, JitSerdesModeForceOff, false) \
945 F(int, SimpleJsonMaxLength, 2 << 20) \
946 F(uint32_t, JitSampleRate, 0) \
947 F(uint32_t, TraceServerRequestRate, 0) \
948 /* Log the sizes and metadata for all translations in the TC broken
949 * down by function and inclusive/exclusive size for inlined regions.
950 * When set to "" TC size data will be sampled on a per function basis
951 * as determined by JitSampleRate. When set to a non-empty string all
952 * translations will be logged, and run_key column will be logged with
953 * the value of this option. */ \
954 F(string, JitLogAllInlineRegions, "") \
955 F(bool, JitProfileGuardTypes, false) \
956 F(uint32_t, JitFilterLease, 1) \
957 F(bool, DisableSomeRepoAuthNotices, true) \
958 F(uint32_t, PCRETableSize, kPCREInitialTableSize) \
959 F(uint64_t, PCREExpireInterval, 2 * 60 * 60) \
960 F(string, PCRECacheType, std::string("static")) \
961 F(bool, EnableCompactBacktrace, true) \
962 F(bool, EnableNuma, ServerExecutionMode()) \
963 F(bool, EnableNumaLocal, ServerExecutionMode()) \
964 /* Use 1G pages for jemalloc metadata. */ \
965 F(bool, EnableArenaMetadata1GPage, false) \
966 /* Use 1G pages for jemalloc metadata (NUMA arenas if applicable). */ \
967 F(bool, EnableNumaArenaMetadata1GPage, false) \
968 /* Reserved space on 1G pages for jemalloc metadata (arena0). */ \
969 F(uint64_t, ArenaMetadataReservedSize, 216 << 20) \
970 F(bool, EnableCallBuiltin, true) \
971 F(bool, EnableReusableTC, reuseTCDefault()) \
972 F(bool, LogServerRestartStats, false) \
973 F(uint32_t, ReusableTCPadding, 128) \
974 F(int64_t, StressUnitCacheFreq, 0) \
975 F(int64_t, PerfWarningSampleRate, 1) \
976 F(int64_t, FunctionCallSampleRate, 0) \
977 F(double, InitialLoadFactor, 1.0) \
978 /* Raise notices on various array operations which may present \
979 * compatibility issues with Hack arrays. \
981 * The various *Notices options independently control separate \
982 * subsets of notices. The Check* options are subordinate to the \
983 * HackArrCompatNotices option, and control whether various runtime
984 * checks are made; they do not affect any optimizations. */ \
985 F(bool, HackArrCompatNotices, false) \
986 F(bool, HackArrCompatCheckIntishCast, false) \
987 F(bool, HackArrCompatCheckRefBind, false) \
988 F(bool, HackArrCompatCheckFalseyPromote, false) \
989 F(bool, HackArrCompatCheckEmptyStringPromote, false) \
990 F(bool, HackArrCompatCheckCompare, false) \
991 F(bool, HackArrCompatCheckArrayPlus, false) \
992 F(bool, HackArrCompatCheckArrayKeyCast, false) \
993 /* Raise notices when is_array is called with any hack array */ \
994 F(bool, HackArrCompatIsArrayNotices, false) \
995 /* Raise notices when is_vec or is_dict is called with a v/darray */ \
996 F(bool, HackArrCompatIsVecDictNotices, false) \
997 /* Raise a notice when a varray is promoted to a darray through: \
998 * - inserting at a key that would force the array to be mixed \
999 * - unsetting _any_ key \
1000 */ \
1001 F(bool, HackArrCompatCheckVarrayPromote, false) \
1002 /* Raise a notice when a varray is implicitly appended to by \
1003 * inserting at n == count(arr) \
1004 */ \
1005 F(bool, HackArrCompatCheckImplicitVarrayAppend, false) \
1006 F(bool, HackArrCompatTypeHintNotices, false) \
1007 F(bool, HackArrCompatDVCmpNotices, false) \
1008 F(bool, HackArrCompatSerializeNotices, false) \
1009 /* Raise notices when fb_compact_*() would change behavior */ \
1010 F(bool, HackArrCompatCompactSerializeNotices, false) \
1011 /* Raises notice when a function that returns a PHP array, not */ \
1012 /* a v/darray, is called */ \
1013 F(bool, HackArrCompatArrayProducingFuncNotices, false) \
1014 /* Disables intish cast wherever we would have warned for \
1015 * HackArrCompatCheckIntishCast--this includes intish key cast in any \
1016 * PHP code and much of the runtime and extensions */ \
1017 F(bool, EnableIntishCast, true) \
1018 F(bool, HackArrDVArrs, false) \
1019 F(uint32_t, LogSuppressedIntishCastRate, 0) \
1020 /* Warn if is expression are used with type aliases that cannot be |
1021 * resolved */ \
1022 F(bool, IsExprEnableUnresolvedWarning, false) \
1023 /* Raise a notice if a Func type is passed to is_string */ \
1024 F(bool, IsStringNotices, false) \
1025 /* Raise a notice if a Func type is passed to function that expects a
1026 string */ \
1027 F(bool, StringHintNotices, false) \
1028 /* Raise a notice if a ClsMeth type is passed to is_vec/is_array */ \
1029 F(bool, IsVecNotices, false) \
1030 /* Raise a notice if a ClsMeth type is passed to a function that
1031 * expects a vec/varray */ \
1032 F(bool, VecHintNotices, false) \
1033 /* Switches on miscellaneous junk. */ \
1034 F(bool, NoticeOnCreateDynamicProp, false) \
1035 F(bool, NoticeOnReadDynamicProp, false) \
1036 F(bool, NoticeOnImplicitInvokeToString, false) \
1037 F(bool, FatalOnConvertObjectToString, false) \
1038 F(bool, ReffinessInvariance, false) \
1039 F(bool, NoticeOnBuiltinDynamicCalls, false) \
1040 F(bool, RxPretendIsEnabled, false) \
1041 F(bool, NoArrayAccessInIdx, false) \
1042 F(bool, NoticeOnArrayAccessUse, false) \
1043 /* Raise warning when function pointers are used as strings. */ \
1044 F(bool, RaiseFuncConversionWarning, false) \
1045 /* Raise warning when class pointers are used as strings. */ \
1046 F(bool, RaiseClassConversionWarning, false) \
1047 /* Raise warning when ClsMethDataRef is used as varray/vec. */ \
1048 F(bool, RaiseClsMethConversionWarning, false) \
1049 /* Raise warning when strings are used as classes. */ \
1050 F(bool, RaiseStrToClsConversionWarning, false) \
1051 F(bool, NoticeOnCollectionToBool, false) \
1052 F(bool, NoticeOnSimpleXMLBehavior, false) \
1053 F(bool, NoticeOnBadMethodStaticness, false) \
1054 F(bool, ForbidDivisionByZero, false) \
1055 F(bool, NoticeOnByRefArgumentTypehintViolation, false) \
1056 /* \
1057 * Control dynamic calls to functions and dynamic constructs of \
1058 * classes which haven't opted into being called that way. \
1060 * 0 - Nothing \
1061 * 1 - Warn \
1062 * 2 - Throw exception \
1064 */ \
1065 F(int32_t, ForbidDynamicCalls, 0) \
1066 /* \
1067 * Control handling of out-of-range integer values in the compact \
1068 * Thrift serializer. \
1070 * 0 - Nothing \
1071 * 1 - Warn \
1072 * 2 - Throw exception \
1073 */ \
1074 F(int32_t, ForbidThriftIntegerValuesOutOfRange, 0) \
1075 /* \
1076 * Don't allow unserializing to __PHP_Incomplete_Class \
1077 * 0 - Nothing \
1078 * 1 - Warn \
1079 * 2 - Throw exception \
1080 */ \
1081 F(int32_t, ForbidUnserializeIncompleteClass, 0) \
1082 F(int32_t, RxEnforceCalls, 0) \
1083 /* \
1084 * 0 - Nothing \
1085 * 1 - Warn \
1086 * 2 - Fail unit verification (i.e. fail to load it) \
1087 */ \
1088 F(int32_t, RxVerifyBody, 0) \
1089 F(bool, RxIsEnabled, EvalRxPretendIsEnabled) \
1090 F(int32_t, ServerOOMAdj, 0) \
1091 F(std::string, PreludePath, "") \
1092 F(uint32_t, NonSharedInstanceMemoCaches, 10) \
1093 F(bool, UseGraphColor, false) \
1094 F(std::vector<std::string>, IniGetHide, std::vector<std::string>()) \
1095 F(std::string, UseRemoteUnixServer, "no") \
1096 F(std::string, UnixServerPath, "") \
1097 F(uint32_t, UnixServerWorkers, Process::GetCPUCount()) \
1098 F(bool, UnixServerQuarantineApc, false) \
1099 F(bool, UnixServerQuarantineUnits, false) \
1100 F(bool, UnixServerVerifyExeAccess, false) \
1101 F(bool, UnixServerFailWhenBusy, false) \
1102 F(std::vector<std::string>, UnixServerAllowedUsers, \
1103 std::vector<std::string>()) \
1104 F(std::vector<std::string>, UnixServerAllowedGroups, \
1105 std::vector<std::string>()) \
1106 /* Options for testing */ \
1107 F(bool, TrashFillOnRequestExit, false) \
1108 /****************** \
1109 | ARM Options. | \
1110 *****************/ \
1111 F(bool, JitArmLse, armLseDefault()) \
1112 /****************** \
1113 | PPC64 Options. | \
1114 *****************/ \
1115 /* Minimum immediate size to use TOC */ \
1116 F(uint16_t, PPC64MinTOCImmSize, 64) \
1117 /* Relocation features. Use with care on production */ \
1118 /* Allow a Far branch be converted to a Near branch. */ \
1119 F(bool, PPC64RelocationShrinkFarBranches, false) \
1120 /* Remove nops from a Far branch. */ \
1121 F(bool, PPC64RelocationRemoveFarBranchesNops, true) \
1122 /******************** \
1123 | Profiling flags. | \
1124 ********************/ \
1125 /* Whether to maintain the address-to-VM-object mapping. */ \
1126 F(bool, EnableReverseDataMap, true) \
1127 /* Turn on perf-mem-event sampling roughly every this many requests. \
1128 * To maintain the same overall sampling rate, the ratio between the \
1129 * request and sample frequencies should be kept constant. */ \
1130 F(uint32_t, PerfMemEventRequestFreq, 0) \
1131 /* Sample this many memory instructions per second. This should be \
1132 * kept low to avoid the risk of collecting a sample while we're \
1133 * processing a previous sample. */ \
1134 F(uint32_t, PerfMemEventSampleFreq, 80) \
1135 /* Sampling frequency for TC branch profiling. */ \
1136 F(uint32_t, ProfBranchSampleFreq, 0) \
1137 /* Sampling frequency for profiling packed array accesses. */ \
1138 F(uint32_t, ProfPackedArraySampleFreq, 0) \
1139 F(bool, UseXedAssembler, false) \
1140 /* */
1142 private:
1143 using string = std::string;
1145 // Custom settings. This should be accessed via the GetServerCustomSetting
1146 // APIs.
1147 static std::map<std::string, std::string> CustomSettings;
1149 public:
1150 #define F(type, name, unused) \
1151 static type Eval ## name;
1152 EVALFLAGS()
1153 #undef F
1155 static bool RecordCodeCoverage;
1156 static std::string CodeCoverageOutputFile;
1158 // Repo (hhvm bytecode repository) options
1159 static std::string RepoLocalMode;
1160 static std::string RepoLocalPath;
1161 static std::string RepoCentralPath;
1162 static int32_t RepoCentralFileMode;
1163 static std::string RepoCentralFileUser;
1164 static std::string RepoCentralFileGroup;
1165 static bool RepoAllowFallbackPath;
1166 static std::string RepoEvalMode;
1167 static std::string RepoJournal;
1168 static bool RepoCommit;
1169 static bool RepoDebugInfo;
1170 static bool RepoAuthoritative;
1171 static bool RepoPreload;
1172 static int64_t RepoLocalReadaheadRate;
1173 static bool RepoLocalReadaheadConcurrent;
1175 // pprof/hhprof options
1176 static bool HHProfEnabled;
1177 static bool HHProfActive;
1178 static bool HHProfAccum;
1179 static bool HHProfRequest;
1180 static bool TrackPerUnitMemory;
1182 // Sandbox options
1183 static bool SandboxMode;
1184 static std::string SandboxPattern;
1185 static std::string SandboxHome;
1186 static std::string SandboxFallback;
1187 static std::string SandboxConfFile;
1188 static std::map<std::string, std::string> SandboxServerVariables;
1189 static bool SandboxFromCommonRoot;
1190 static std::string SandboxDirectoriesRoot;
1191 static std::string SandboxLogsRoot;
1193 // Debugger options
1194 static bool EnableHphpdDebugger;
1195 static bool EnableVSDebugger;
1196 static int VSDebuggerListenPort;
1197 static std::string VSDebuggerDomainSocketPath;
1198 static bool VSDebuggerNoWait;
1199 static bool EnableDebuggerColor;
1200 static bool EnableDebuggerPrompt;
1201 static bool EnableDebuggerServer;
1202 static bool EnableDebuggerUsageLog;
1203 static bool DebuggerDisableIPv6;
1204 static std::string DebuggerServerIP;
1205 static int DebuggerServerPort;
1206 static int DebuggerDefaultRpcPort;
1207 static std::string DebuggerDefaultRpcAuth;
1208 static std::string DebuggerRpcHostDomain;
1209 static int DebuggerDefaultRpcTimeout;
1210 static std::string DebuggerDefaultSandboxPath;
1211 static std::string DebuggerStartupDocument;
1212 static int DebuggerSignalTimeout;
1213 static std::string DebuggerAuthTokenScriptBin;
1214 static std::string DebuggerSessionAuthScriptBin;
1216 // Mail options
1217 static std::string SendmailPath;
1218 static std::string MailForceExtraParameters;
1220 // preg stack depth and debug support options
1221 static int64_t PregBacktraceLimit;
1222 static int64_t PregRecursionLimit;
1223 static bool EnablePregErrorLog;
1225 // SimpleXML options
1226 static bool SimpleXMLEmptyNamespaceMatchesAll;
1228 // Cookie options
1229 static bool AllowDuplicateCookies;
1231 #ifdef FACEBOOK
1232 // fb303 server
1233 static bool EnableFb303Server;
1234 static int Fb303ServerPort;
1235 static int Fb303ServerThreadStackSizeMb;
1236 static int Fb303ServerWorkerThreads;
1237 static int Fb303ServerPoolThreads;
1238 #endif
1240 // Xenon options
1241 static double XenonPeriodSeconds;
1242 static uint32_t XenonRequestFreq;
1243 static bool XenonForceAlwaysOn;
1245 static_assert(sizeof(RuntimeOption) == 1, "no instance variables");
1247 ///////////////////////////////////////////////////////////////////////////////
1250 #endif // incl_HPHP_RUNTIME_OPTION_H_