ART: Skip image visitor in OatWriter for VerifyAtRuntime
There's no use running the visitor, and it will force-resolve all
methods. Avoid the overhead. Reduces boot image compile time in
verify-at-runtime mode from 1.25s to 1s (on the host, in -j4 mode).
Bug: 24103765
Change-Id: Icdc3be628fed0c9bda01cf5f24fe377f23c571a9
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 4ddd457..c96b171 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -1123,7 +1123,11 @@
} while (false)
VISIT(InitCodeMethodVisitor);
- if (compiler_driver_->IsImage()) {
+ // InitImageMethodVisitor visits all methods, resolves them (failing if one cannot be resolved,
+ // which is a bad sign for a working boot image), and then install entrypoints.
+ // In case of VerifyAtRuntime, there won't be code, and we do not want to resolve the methods
+ // (this has been skipped in the driver for performance).
+ if (compiler_driver_->IsImage() && !compiler_driver_->GetCompilerOptions().VerifyAtRuntime()) {
VISIT(InitImageMethodVisitor);
}