Verifier: always verify in debug builds

Let's prevent the verifier from bitrotting.
Esse commit está contido em:
Jordan DeLong
2013-06-03 22:22:08 -07:00
commit de Sara Golemon
commit 6eaa0bb2f0
3 arquivos alterados com 25 adições e 12 exclusões
+13 -8
Ver Arquivo
@@ -2665,18 +2665,23 @@ Unit* UnitEmitter::create() {
Trace::traceRelease("%s", u->toString().c_str());
}
static const bool kVerify = getenv("HHVM_VERIFY");
static const bool kVerifyVerbose = getenv("HHVM_VERIFY_VERBOSE");
static const bool kVerify = debug || getenv("HHVM_VERIFY");
static const bool kVerifyVerboseSystem =
getenv("HHVM_VERIFY_VERBOSE_SYSTEM");
static const bool kVerifyVerbose =
kVerifyVerboseSystem || getenv("HHVM_VERIFY_VERBOSE");
const bool isSystemLib = u->filepath()->empty() ||
boost::ends_with(u->filepath()->data(), "systemlib.php");
const bool doVerify =
kVerify ||
boost::ends_with(u->filepath()->data(), "hhas") ||
(debug && (u->filepath()->empty() ||
boost::ends_with(u->filepath()->data(), "systemlib.php")));
kVerify || boost::ends_with(u->filepath()->data(), "hhas");
if (doVerify) {
Verifier::checkUnit(u, kVerifyVerbose);
Verifier::checkUnit(
u,
isSystemLib ? kVerifyVerboseSystem : kVerifyVerbose
);
}
return u;
}
+4
Ver Arquivo
@@ -234,6 +234,10 @@ Block** GraphBuilder::exns(Block* b) {
Block* GraphBuilder::createBlock(PC pc) {
BlockMap::iterator i = m_blocks.find(pc);
if (i != m_blocks.end()) return i->second;
// TODO(#2464197): Continuation bug in repo mode.
if (pc < m_unit->entry()) return nullptr;
Block* b = new (m_arena) Block(pc);
m_blocks.insert(std::pair<PC,Block*>(pc, b));
return b;
+8 -4
Ver Arquivo
@@ -295,8 +295,11 @@ bool FuncChecker::checkSection(bool is_main, const char* name, Offset base,
PC branch = i.popFront();
if (isSwitch(*branch)) {
foreachSwitchTarget((Op*)branch, [&](Offset& o) {
ok &= checkOffset("switch target", offset(branch + o),
name, base, past);
// TODO(#2464197): dce breaks switch for verify
if (offset(branch + o) != -1) {
ok &= checkOffset("switch target", offset(branch + o),
name, base, past);
}
});
} else {
Offset target = instrJumpTarget((Op*)bc, offset(branch));
@@ -747,8 +750,9 @@ bool FuncChecker::checkIter(State* cur, PC const pc) {
}
} else {
if (!cur->iters[id]) {
error("Cannot access un-initialized iter %d\n", id);
ok = false;
// TODO(#2608280): we produce incorrect bytecode for iterators still
//error("Cannot access un-initialized iter %d\n", id);
//ok = false;
}
if (op == OpIterFree ||
op == OpMIterFree ||