Clean up kAccWritable in the verifier.
kAccVerifier was deprecated, instead memory permissions were used in its
stead.
Move dead code scanning in the verifier to be enabled when the results
will be logged.
Change-Id: Id20e62eefe958bd577b86bd7396a439d7a01c1b3
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index 9082172..0a487e3 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -1249,7 +1249,7 @@
insn_flags_[insn_idx].ClearChanged();
}
- if (DEAD_CODE_SCAN && ((method_access_flags_ & kAccWritable) == 0)) {
+ if (gDebugVerify) {
/*
* Scan for dead code. There's nothing "evil" about dead code
* (besides the wasted space), but it indicates a flaw somewhere
@@ -3073,6 +3073,9 @@
<< PrettyMethod(method_idx_, *dex_file_) << " " << failure_message->str();
return;
}
+
+ CHECK_EQ(dex_file_->GetPermissions() & PROT_WRITE, PROT_WRITE); // Dex file needs to be writable.
+
const Instruction* inst = Instruction::At(code_item_->insns_ + work_insn_idx_);
DCHECK(inst->IsThrow()) << "Expected instruction that will throw " << inst->Name();
VerifyErrorRefType ref_type;
diff --git a/src/verifier/method_verifier.h b/src/verifier/method_verifier.h
index 8eef71a..b2a88b7 100644
--- a/src/verifier/method_verifier.h
+++ b/src/verifier/method_verifier.h
@@ -58,13 +58,6 @@
class PcToReferenceMap;
/*
- * Set this to enable dead code scanning. This is not required, but it's very useful when testing
- * changes to the verifier (to make sure we're not skipping over stuff). The only reason not to do
- * it is that it slightly increases the time required to perform verification.
- */
-#define DEAD_CODE_SCAN kIsDebugBuild
-
-/*
* "Direct" and "virtual" methods are stored independently. The type of call used to invoke the
* method determines which list we search, and whether we travel up into superclasses.
*