Skip to content

Commit

Permalink
Move more configs to configs.specification 8/N
Browse files Browse the repository at this point in the history
Summary: - Move configs from runtime-option.h to configs.specifiction

Reviewed By: mdko

Differential Revision: D65425430

fbshipit-source-id: fa7b5acf697b26ab323ce8df04de57d1ad63d32a
  • Loading branch information
WizKid authored and facebook-github-bot committed Nov 5, 2024
1 parent c060954 commit b4326cc
Show file tree
Hide file tree
Showing 35 changed files with 201 additions and 149 deletions.
22 changes: 11 additions & 11 deletions hphp/compiler/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ std::unique_ptr<UnitIndex> computeIndex(
coro::blockingWait(coro::collectAll(
indexPackage.index(indexUnit),
coro::co_invoke([&]() -> coro::Task<bool> {
if (RO::EvalEnableDecl) {
if (Cfg::Eval::EnableDecl) {
co_return co_await
indexBuiltinSymbolDecls(indexUnit, executor, client);
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ bool process(CompilerOptions &po) {
sample.setStr("push_phases", po.push_phases);
sample.setStr("matched_overrides", po.matched_overrides);
sample.setStr("use_hphpc", "true");
sample.setStr("use_hhbbc", RO::EvalUseHHBBC ? "true" : "false");
sample.setStr("use_hhbbc", Cfg::Eval::UseHHBBC ? "true" : "false");

// Track the unit-emitters created for system during
// hphp_process_init().
Expand Down Expand Up @@ -1098,7 +1098,7 @@ bool process(CompilerOptions &po) {
// HHBBC specific state (if we're going to run it).
Optional<WPI> hhbbcInputs;
Optional<CoroAsyncValue<Ref<HHBBC::Config>>> hhbbcConfig;
if (RO::EvalUseHHBBC) {
if (Cfg::Eval::UseHHBBC) {
hhbbcInputs.emplace();
// We want to do this as early as possible
hhbbcConfig.emplace(
Expand Down Expand Up @@ -1161,7 +1161,7 @@ bool process(CompilerOptions &po) {

if (Option::GenerateTextHHBC || Option::GenerateHhasHHBC) {
auto old_repo_auth = RuntimeOption::RepoAuthoritative;
RuntimeOption::RepoAuthoritative = RuntimeOption::EvalUseHHBBC;
RuntimeOption::RepoAuthoritative = Cfg::Eval::UseHHBBC;
SCOPE_EXIT { RuntimeOption::RepoAuthoritative = old_repo_auth; };
genText(*ue, po.outputDir);
}
Expand All @@ -1170,7 +1170,7 @@ bool process(CompilerOptions &po) {

++numUnits;

if (!RO::EvalUseHHBBC) {
if (!Cfg::Eval::UseHHBBC) {
// HHBBC assigns m_sn and the SHA1, but we have to do it ourself
// if we're not running it.
auto const sn = nextSn++;
Expand All @@ -1192,7 +1192,7 @@ bool process(CompilerOptions &po) {

// Process unit-emitters produced locally (usually systemlib stuff).
auto const emitLocalUnit = [&] (Package::UEVec ues) -> coro::Task<void> {
if (RO::EvalUseHHBBC) {
if (Cfg::Eval::UseHHBBC) {
// If we're using HHBBC, turn them into WholeProgramInput
// key/values (after checking uniqueness), upload the values,
// and store them in the WholeProgramInput.
Expand Down Expand Up @@ -1230,7 +1230,7 @@ bool process(CompilerOptions &po) {
std::vector<Package::FileData> files,
Client::ExecMetadata metadata)
-> coro::Task<Package::ParseMetaVec> {
if (RO::EvalUseHHBBC) {
if (Cfg::Eval::UseHHBBC) {
// Run the HHBBC parse job, which produces WholeProgramInput
// key/values.
auto hhbbcConfigRef = co_await hhbbcConfig->getCopy();
Expand Down Expand Up @@ -1331,7 +1331,7 @@ bool process(CompilerOptions &po) {
return p.m_module_use && moduleInDeployment.contains(p.m_module_use);
};

if (RO::EvalUseHHBBC) {
if (Cfg::Eval::UseHHBBC) {
// Retrieve HHBBC WPI (Key, Ref<Value>) pairs that were already parsed.
// No Async I/O is necessary in this case.
for (size_t i = 0, n = rpaths.size(); i < n; ++i) {
Expand Down Expand Up @@ -1459,7 +1459,7 @@ bool process(CompilerOptions &po) {
Timer emitTimer(Timer::WallTime, "emit");
addInputsToPackage(*package, po);

if (!RO::EvalUseHHBBC && Option::GenerateBinaryHHBC) {
if (!Cfg::Eval::UseHHBBC && Option::GenerateBinaryHHBC) {
// Initialize autoload and repo for emitUnit() to populate
autoload.emplace();
repo.emplace(outputFile);
Expand Down Expand Up @@ -1522,7 +1522,7 @@ bool process(CompilerOptions &po) {

auto const logSample = [&] {
// Only log big builds.
if (numUnits >= RO::EvalHHBBCMinUnitsToLog) {
if (numUnits >= Cfg::Eval::HHBBCMinUnitsToLog) {
sample.force_init = true;
StructuredLog::log("hhvm_whole_program", sample);
}
Expand All @@ -1537,7 +1537,7 @@ bool process(CompilerOptions &po) {
repo->finish(getGlobalData(), *autoload, packageInfo);
return true;
};
if (!RO::EvalUseHHBBC) {
if (!Cfg::Eval::UseHHBBC) {
logSample();
dispose(std::move(executor), std::move(client));
return finish();
Expand Down
3 changes: 0 additions & 3 deletions hphp/compiler/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ void Option::Load(const IniSetting::Map& ini, Hdf &config) {
Config::Bind(ForceEnableSymbolRefs, ini, config,
"ForceEnableSymbolRefs", false);

Config::Bind(RuntimeOption::EvalUseHHBBC, ini, config, "UseHHBBC",
RuntimeOption::EvalUseHHBBC);

Config::Bind(ParserGroupSize, ini, config,
"ParserGroupSize", kDefaultParserGroupSize);
Config::Bind(ParserDirGroupSizeLimit, ini, config,
Expand Down
7 changes: 4 additions & 3 deletions hphp/compiler/package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "hphp/runtime/vm/type-alias-emitter.h"
#include "hphp/runtime/vm/unit-emitter.h"
#include "hphp/runtime/vm/unit-parser.h"
#include "hphp/util/configs/eval.h"
#include "hphp/util/exception.h"
#include "hphp/util/extern-worker.h"
#include "hphp/util/hash.h"
Expand Down Expand Up @@ -385,7 +386,7 @@ Package::parseRun(const std::string& content,
/* forDebuggerEval */ false,
repoOptions,
mode,
RO::EvalEnableDecl ? &provider : nullptr
Cfg::Eval::EnableDecl ? &provider : nullptr
);
} catch (const CompilerAbort& exn) {
ParseMeta meta;
Expand Down Expand Up @@ -1136,7 +1137,7 @@ Package::UnitDecls IndexJob::run(
auto symbols = hackc::decls_to_symbols(*decls.decls);
auto summary = summary_of_symbols(symbols);
s_indexMetas.emplace_back(summary);
if (!RO::EvalEnableDecl) {
if (!Cfg::Eval::EnableDecl) {
// If decl-directed bytecode is disabled, parseRun() will not need
// these decls, so don't bother storing them.
return Package::UnitDecls{};
Expand All @@ -1163,7 +1164,7 @@ coro::Task<bool> Package::index(const IndexCallback& callback) {
coro::Task<void> Package::indexAll(const IndexCallback& callback) {
// If EnableDecl==true, all source files should be included in the
// index, not just ondemand-eligible files.
auto const filterFiles = !RO::EvalEnableDecl;
auto const filterFiles = !Cfg::Eval::EnableDecl;
auto const filterDirs = false;

// Compute the groups to index
Expand Down
90 changes: 90 additions & 0 deletions hphp/doc/configs.specification
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,96 @@ The format can be found in hphp/tools/configs/generate_configs.rs

- bool Eval.WarnOnSkipFrameLookup = true, UNKNOWN

- uint32_t Eval.EnableCodeCoverage = 0, UNKNOWN

0 - Code coverage cannot be enabled through request param
1 - Code coverage can be enabled through request param
2 - Code coverage enabled

- uint32_t Eval.EnablePerFileCoverage = 0, UNKNOWN

0 - Per-file coverage cannot be enabled through request param
1 - Per-file coverage can be enabled through request param
2 - Per-file coverage enabled

- bool Eval.EnableFuncCoverage = false, UNKNOWN

- uint64_t Eval.FactsWorkers, UNKNOWN

The number of worker threads to spawn for facts extraction.

- bool Eval.FactsExcludeModuleMembership = false, UNKNOWN

Whether to force the old Facts SQLite DB format.

- bool Eval.HackCompilerInheritConfig = true, UNKNOWN

Whether the HackC compiler should inherit the compiler config of the
HHVM process that launches it.

- bool Eval.EnableDecl = false, UNKNOWN, unitcacheflag

enable decl-directed bytecode compilation

- uint32_t Eval.LogDeclDeps = 0, UNKNOWN

- uint32_t Eval.LogDeclErrors = 0, UNKNOWN

- bool Eval.LogAllDeclTearing = false, UNKNOWN

- std::string Eval.EmbeddedDataExtractPath = "/var/run/hhvm_%{type}_%{buildid}", UNKNOWN, postprocess

When using embedded data, extract it to the ExtractPath or the
ExtractFallback.

- std::string Eval.EmbeddedDataFallbackPath = "/tmp/hhvm_%{type}_%{buildid}_XXXXXX", UNKNOWN, postprocess

See Eval.EmbeddedDataExtractPath

- bool Eval.EmbeddedDataTrustExtract = true, UNKNOWN

Whether to trust existing versions of extracted embedded data.

- bool Eval.LogThreadCreateBacktraces = false, UNKNOWN

- bool Eval.FailJitPrologs = false, UNKNOWN

- bool Eval.UseHHBBC, UNKNOWN, compileroption(UseHHBBC)

- uint32_t Eval.HHBBCMinUnitsToLog = 1000, UNKNOWN

Threshold number of units to log to hhvm_whole_program table.
systemlib has around 200 units, so use a larger default to avoid
logging for unit tests.

- bool Eval.CachePerRepoOptionsPath = true, UNKNOWN

- bool Eval.LogHackcMemStats = false, UNKNOWN

- uint32_t Eval.TsameCollisionSampleRate = 1, UNKNOWN

- uint32_t Eval.WarnOnTooManyArguments = 0, emil

0 -> no warning, 1 -> warning, 2 -> exception

- uint32_t Eval.GetClassBadArgument = 0, emil

0 -> no warning, 1 -> warning, 2 -> exception

- uint32_t Eval.WarnOnIncDecInvalidType = 0, UNKNOWN

0 - No restrictions on types that can be incremented or decremented
1 - Warn when incrementing or decrementing non numeric types
2 - Throw when incrementing or decrementing non numeric types

- uint32_t Eval.WarnOnImplicitCoercionOfEnumValue = 0, UNKNOWN

This flag exists to control behaviour when implicit coercion is
taking place on an enum value.
0 - No warning
1 - Warning
2 - Do not do implicit coercion

- uint32_t Eval.MaxHighArenaHugePages = 0, UNKNOWN

- uint32_t Eval.Num1GPagesForReqHeap = 0, UNKNOWN
Expand Down
3 changes: 2 additions & 1 deletion hphp/hhbbc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "hphp/hhbbc/parallel.h"
#include "hphp/hhbbc/representation.h"

#include "hphp/util/configs/eval.h"
#include "hphp/util/configs/jit.h"
#include "hphp/util/configs/php7.h"
#include "hphp/util/logger.h"
Expand Down Expand Up @@ -536,7 +537,7 @@ void compile_repo() {
repo.finish(get_global_data(), autoload, packageInfo);

// Only log big builds.
if (numUnits >= RO::EvalHHBBCMinUnitsToLog) {
if (numUnits >= Cfg::Eval::HHBBCMinUnitsToLog) {
sample.force_init = true;
StructuredLog::log("hhvm_whole_program", sample);
}
Expand Down
17 changes: 17 additions & 0 deletions hphp/runtime/base/configs/eval-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "hphp/runtime/base/configs/eval-loader.h"

#include "hphp/util/build-info.h"
#include "hphp/util/compilation-flags.h"
#include "hphp/util/process-cpu.h"

Expand All @@ -29,6 +30,14 @@ uint64_t EvalLoader::VMStackElmsDefault() {
#endif
}

uint64_t EvalLoader::FactsWorkersDefault() {
return Process::GetCPUCount();
}

bool EvalLoader::UseHHBBCDefault() {
return !getenv("HHVM_DISABLE_HHBBC");
}

uint32_t EvalLoader::UnixServerWorkersDefault() {
return Process::GetCPUCount();
}
Expand All @@ -37,4 +46,12 @@ bool EvalLoader::CrashOnStaticAnalysisErrorDefault() {
return debug;
}

void EvalLoader::EmbeddedDataExtractPathPostProcess(std::string& path) {
replacePlaceholders(path);
}

void EvalLoader::EmbeddedDataFallbackPathPostProcess(std::string& path) {
replacePlaceholders(path);
}

}
2 changes: 1 addition & 1 deletion hphp/runtime/base/enum-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool isCoercibleToInteger(const TypedValue *cell, int64_t &num, const char* call
return false;
}

switch (RuntimeOption::EvalWarnOnImplicitCoercionOfEnumValue) {
switch (Cfg::Eval::WarnOnImplicitCoercionOfEnumValue) {
case 0:
return true;
case 1:
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/base/execution-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ void ExecutionContext::requestExit() {
if (Logger::UseRequestLog) Logger::SetThreadHook(nullptr);
if (m_requestTrace) record_trace(std::move(*m_requestTrace));
if (!RO::RepoAuthoritative) m_requestStartForTearing.reset();
if (RO::EvalLogDeclDeps) m_loadedRdepMap.clear();
if (Cfg::Eval::LogDeclDeps) m_loadedRdepMap.clear();
}

/**
Expand Down
8 changes: 5 additions & 3 deletions hphp/runtime/base/isame-log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "hphp/runtime/ext/std/ext_std_errorfunc.h"
#include "hphp/runtime/vm/jit/fixup.h"
#include "hphp/runtime/vm/unit-parser.h"

#include "hphp/util/configs/eval.h"
#include "hphp/util/stack-trace.h"

namespace HPHP {
Expand Down Expand Up @@ -67,19 +69,19 @@ bool log_impl(const char* event, uint32_t rate,

bool tsame_log(const StringData* input, const StringData* arg) {
FTRACE(1, "tsame collision {} != {}\n", input->slice(), arg->slice());
return log_impl("tsame", RO::EvalTsameCollisionSampleRate, input->slice(),
return log_impl("tsame", Cfg::Eval::TsameCollisionSampleRate, input->slice(),
arg->slice());
}

int tstrcmp_log(const char* s1, const char* s2) {
FTRACE(1, "tstrcmp collision {} != {}\n", s1, s2);
log_impl("tstrcmp", RO::EvalTsameCollisionSampleRate, s1, s2);
log_impl("tstrcmp", Cfg::Eval::TsameCollisionSampleRate, s1, s2);
return 0;
}

int tstrcmp_log_slice(folly::StringPiece s1, folly::StringPiece s2) {
FTRACE(1, "tstrcmp_slice collision {} != {}\n", s1, s2);
log_impl("tstrcmp_slice", RO::EvalTsameCollisionSampleRate, s1, s2);
log_impl("tstrcmp_slice", Cfg::Eval::TsameCollisionSampleRate, s1, s2);
return 0;
}
}
14 changes: 7 additions & 7 deletions hphp/runtime/base/program-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1991,14 +1991,14 @@ static int execute_program_impl(int argc, char** argv) {
try {
type_scan::init(
addTypeToEmbeddedPath(
RuntimeOption::EvalEmbeddedDataExtractPath,
Cfg::Eval::EmbeddedDataExtractPath,
"type_scanners"
),
addTypeToEmbeddedPath(
RuntimeOption::EvalEmbeddedDataFallbackPath,
Cfg::Eval::EmbeddedDataFallbackPath,
"type_scanners"
),
RuntimeOption::EvalEmbeddedDataTrustExtract
Cfg::Eval::EmbeddedDataTrustExtract
);
} catch (const type_scan::InitException& exn) {
Logger::Error("Unable to initialize GC type-scanners: %s", exn.what());
Expand All @@ -2009,14 +2009,14 @@ static int execute_program_impl(int argc, char** argv) {
// It's okay if this fails.
init_member_reflection(
addTypeToEmbeddedPath(
RuntimeOption::EvalEmbeddedDataExtractPath,
Cfg::Eval::EmbeddedDataExtractPath,
"member_reflection"
),
addTypeToEmbeddedPath(
RuntimeOption::EvalEmbeddedDataFallbackPath,
Cfg::Eval::EmbeddedDataFallbackPath,
"member_reflection"
),
RuntimeOption::EvalEmbeddedDataTrustExtract
Cfg::Eval::EmbeddedDataTrustExtract
);

if (!ShmCounters::initialize(true, Logger::Error)) {
Expand Down Expand Up @@ -2566,7 +2566,7 @@ void hphp_process_init(bool skipExtensions) {

jit::mcgen::processInit();
jit::processInitProfData();
if (RuntimeOption::EvalEnableDecl) {
if (Cfg::Eval::EnableDecl) {
if (!skipExtensions) {
ExtensionRegistry::moduleDeclInit();
}
Expand Down
Loading

0 comments on commit b4326cc

Please sign in to comment.