OSDN Git Service

ART: Set methods to preverified in verify-none
authorAndreas Gampe <agampe@google.com>
Wed, 24 Jun 2015 23:25:33 +0000 (16:25 -0700)
committerAndreas Gampe <agampe@google.com>
Thu, 25 Jun 2015 17:23:41 +0000 (17:23 +0000)
Actually mark all methods to be verified, so that the interpreter
doesn't do access checks. Speedup is about 2x on a Nexus 6 when booting
in verify-none mode.

Bug: 22040916
Change-Id: I2d6c8df2a68eae6e358da2639d980cb8bfcc1560

compiler/driver/compiler_driver.cc

index 4cdf75b..7890108 100644 (file)
@@ -1971,7 +1971,13 @@ static void SetVerifiedClass(const ParallelCompilationManager* manager, size_t c
     if (klass->IsResolved()) {
       if (klass->GetStatus() < mirror::Class::kStatusVerified) {
         ObjectLock<mirror::Class> lock(soa.Self(), klass);
+        // Set class status to verified.
         mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, soa.Self());
+        // Mark methods as pre-verified. If we don't do this, the interpreter will run with
+        // access checks.
+        klass->SetPreverifiedFlagOnAllMethods(
+            GetInstructionSetPointerSize(manager->GetCompiler()->GetInstructionSet()));
+        klass->SetPreverified();
       }
       // Record the final class status if necessary.
       ClassReference ref(manager->GetDexFile(), class_def_index);