Undo systemlib change
Put systemlib in the repo again, and use it for repo-authoritative builds
Esse commit está contido em:
@@ -7331,6 +7331,41 @@ static void batchCommit(std::vector<UnitEmitter*>& ues) {
|
||||
ues.clear();
|
||||
}
|
||||
|
||||
static void emitSystemLib() {
|
||||
if (!Option::WholeProgram) return;
|
||||
|
||||
string slib = get_systemlib();
|
||||
if (slib.empty()) return;
|
||||
|
||||
Option::WholeProgram = false;
|
||||
SystemLib::s_inited = false;
|
||||
|
||||
SCOPE_EXIT {
|
||||
SystemLib::s_inited = true;
|
||||
Option::WholeProgram = true;
|
||||
};
|
||||
|
||||
AnalysisResultPtr ar(new AnalysisResult());
|
||||
Scanner scanner(slib.c_str(), slib.size(),
|
||||
RuntimeOption::ScannerType, "/:systemlib.php");
|
||||
Parser parser(scanner, "/:systemlib.php", ar, slib.size());
|
||||
parser.parse();
|
||||
FileScopePtr fsp = parser.getFileScope();
|
||||
fsp->setOuterScope(ar);
|
||||
|
||||
ar->loadBuiltins();
|
||||
ar->setPhase(AnalysisResult::AnalyzeAll);
|
||||
fsp->analyzeProgram(ar);
|
||||
|
||||
int md5len;
|
||||
char* md5str = string_md5(slib.c_str(), slib.size(), false, md5len);
|
||||
MD5 md5(md5str);
|
||||
free(md5str);
|
||||
|
||||
UnitEmitter* ue = emitHHBCUnitEmitter(ar, fsp, md5);
|
||||
Repo::get().commitUnit(ue, UnitOriginFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the entry point for offline bytecode generation.
|
||||
*/
|
||||
@@ -7385,6 +7420,8 @@ void emitAllHHBC(AnalysisResultPtr ar) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
emitSystemLib();
|
||||
} else {
|
||||
dispatcher.waitEmpty();
|
||||
}
|
||||
|
||||
@@ -110,10 +110,10 @@ void ProcessInit() {
|
||||
// Save the current options, and set things up so that
|
||||
// systemlib.php can be read from and stored in the
|
||||
// normal repo.
|
||||
bool db = RuntimeOption::EvalDumpBytecode;
|
||||
int db = RuntimeOption::EvalDumpBytecode;
|
||||
bool rp = RuntimeOption::AlwaysUseRelativePath;
|
||||
bool sf = RuntimeOption::SafeFileAccess;
|
||||
RuntimeOption::EvalDumpBytecode = false;
|
||||
RuntimeOption::EvalDumpBytecode &= ~1;
|
||||
RuntimeOption::AlwaysUseRelativePath = false;
|
||||
RuntimeOption::SafeFileAccess = false;
|
||||
|
||||
@@ -125,16 +125,27 @@ void ProcessInit() {
|
||||
|
||||
String currentDir = g_vmContext->getCwd();
|
||||
|
||||
string slib = get_systemlib();
|
||||
if (RuntimeOption::RepoAuthoritative) {
|
||||
auto file = g_vmContext->lookupPhpFile(String("/:systemlib.php").get(),
|
||||
currentDir.data(), nullptr);
|
||||
if (!file) {
|
||||
// Die a horrible death.
|
||||
Logger::Error("Unable to find/load systemlib.php");
|
||||
_exit(1);
|
||||
}
|
||||
file->incRef();
|
||||
SystemLib::s_unit = file->unit();
|
||||
} else {
|
||||
string slib = get_systemlib();
|
||||
|
||||
if (slib.empty()) {
|
||||
// Die a horrible death.
|
||||
Logger::Error("Unable to find/load systemlib.php");
|
||||
_exit(1);
|
||||
if (slib.empty()) {
|
||||
// Die a horrible death.
|
||||
Logger::Error("Unable to find/load systemlib.php");
|
||||
_exit(1);
|
||||
}
|
||||
SystemLib::s_unit = compile_string(slib.c_str(), slib.size());
|
||||
}
|
||||
|
||||
SystemLib::s_unit = compile_string(slib.c_str(), slib.size());
|
||||
|
||||
// Restore most settings before merging anything,
|
||||
// because of optimizations that depend on them
|
||||
RuntimeOption::AlwaysUseRelativePath = rp;
|
||||
|
||||
@@ -433,7 +433,8 @@ public:
|
||||
F(bool, HHIRDisableTx64, true) \
|
||||
F(uint64_t, MaxHHIRTrans, -1) \
|
||||
F(bool, HHIRDeadCodeElim, true) \
|
||||
F(bool, DumpBytecode, false) \
|
||||
/* DumpBytecode =1 dumps user php, =2 dumps systemlib & user php */ \
|
||||
F(int32_t, DumpBytecode, 0) \
|
||||
F(bool, DumpTC, false) \
|
||||
F(bool, DumpAst, false) \
|
||||
F(bool, MapTCHuge, true) \
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário