Home | History | Annotate | Download | only in dex
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "quick_compiler_callbacks.h"
     18 
     19 #include "driver/compiler_driver.h"
     20 #include "verifier/method_verifier-inl.h"
     21 #include "verification_results.h"
     22 
     23 namespace art {
     24 
     25 void QuickCompilerCallbacks::MethodVerified(verifier::MethodVerifier* verifier) {
     26   if (verification_results_ != nullptr) {
     27     verification_results_->ProcessVerifiedMethod(verifier);
     28   }
     29 }
     30 
     31 void QuickCompilerCallbacks::ClassRejected(ClassReference ref) {
     32   if (verification_results_ != nullptr) {
     33     verification_results_->AddRejectedClass(ref);
     34   }
     35 }
     36 
     37 bool QuickCompilerCallbacks::CanAssumeVerified(ClassReference ref) {
     38   // If we don't have class unloading enabled in the compiler, we will never see class that were
     39   // previously verified. Return false to avoid overhead from the lookup in the compiler driver.
     40   if (!does_class_unloading_) {
     41     return false;
     42   }
     43   DCHECK(compiler_driver_ != nullptr);
     44   // In the case of the quicken filter: avoiding verification of quickened instructions, which the
     45   // verifier doesn't currently support.
     46   // In the case of the verify filter, avoiding verifiying twice.
     47   return compiler_driver_->CanAssumeVerified(ref);
     48 }
     49 
     50 }  // namespace art
     51