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