xref: /aosp_15_r20/art/dex2oat/dex/verification_results.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker  * Copyright (C) 2013 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker  *
4*795d594fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker  *
8*795d594fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker  *
10*795d594fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker  * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker  */
16*795d594fSAndroid Build Coastguard Worker 
17*795d594fSAndroid Build Coastguard Worker #ifndef ART_DEX2OAT_DEX_VERIFICATION_RESULTS_H_
18*795d594fSAndroid Build Coastguard Worker #define ART_DEX2OAT_DEX_VERIFICATION_RESULTS_H_
19*795d594fSAndroid Build Coastguard Worker 
20*795d594fSAndroid Build Coastguard Worker #include <set>
21*795d594fSAndroid Build Coastguard Worker 
22*795d594fSAndroid Build Coastguard Worker #include "base/macros.h"
23*795d594fSAndroid Build Coastguard Worker #include "base/mutex.h"
24*795d594fSAndroid Build Coastguard Worker #include "dex/class_reference.h"
25*795d594fSAndroid Build Coastguard Worker #include "dex/method_reference.h"
26*795d594fSAndroid Build Coastguard Worker 
27*795d594fSAndroid Build Coastguard Worker namespace art {
28*795d594fSAndroid Build Coastguard Worker 
29*795d594fSAndroid Build Coastguard Worker namespace verifier {
30*795d594fSAndroid Build Coastguard Worker class VerifierDepsTest;
31*795d594fSAndroid Build Coastguard Worker }  // namespace verifier
32*795d594fSAndroid Build Coastguard Worker 
33*795d594fSAndroid Build Coastguard Worker // Used by CompilerCallbacks to track verification information from the Runtime.
34*795d594fSAndroid Build Coastguard Worker class VerificationResults {
35*795d594fSAndroid Build Coastguard Worker  public:
36*795d594fSAndroid Build Coastguard Worker   VerificationResults();
37*795d594fSAndroid Build Coastguard Worker   ~VerificationResults();
38*795d594fSAndroid Build Coastguard Worker 
39*795d594fSAndroid Build Coastguard Worker   void AddRejectedClass(ClassReference ref) REQUIRES(!rejected_classes_lock_);
40*795d594fSAndroid Build Coastguard Worker   bool IsClassRejected(ClassReference ref) const REQUIRES(!rejected_classes_lock_);
41*795d594fSAndroid Build Coastguard Worker 
42*795d594fSAndroid Build Coastguard Worker   void AddUncompilableClass(ClassReference ref) REQUIRES(!uncompilable_methods_lock_);
43*795d594fSAndroid Build Coastguard Worker   void AddUncompilableMethod(MethodReference ref) REQUIRES(!uncompilable_methods_lock_);
44*795d594fSAndroid Build Coastguard Worker   bool IsUncompilableMethod(MethodReference ref) const REQUIRES(!uncompilable_methods_lock_);
45*795d594fSAndroid Build Coastguard Worker 
46*795d594fSAndroid Build Coastguard Worker  private:
47*795d594fSAndroid Build Coastguard Worker   // TODO: External locking during CompilerDriver::PreCompile(), no locking during compilation.
48*795d594fSAndroid Build Coastguard Worker   mutable ReaderWriterMutex uncompilable_methods_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
49*795d594fSAndroid Build Coastguard Worker   std::set<MethodReference> uncompilable_methods_ GUARDED_BY(uncompilable_methods_lock_);
50*795d594fSAndroid Build Coastguard Worker 
51*795d594fSAndroid Build Coastguard Worker   // Rejected classes.
52*795d594fSAndroid Build Coastguard Worker   // TODO: External locking during CompilerDriver::PreCompile(), no locking during compilation.
53*795d594fSAndroid Build Coastguard Worker   mutable ReaderWriterMutex rejected_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
54*795d594fSAndroid Build Coastguard Worker   std::set<ClassReference> rejected_classes_ GUARDED_BY(rejected_classes_lock_);
55*795d594fSAndroid Build Coastguard Worker 
56*795d594fSAndroid Build Coastguard Worker   friend class verifier::VerifierDepsTest;
57*795d594fSAndroid Build Coastguard Worker };
58*795d594fSAndroid Build Coastguard Worker 
59*795d594fSAndroid Build Coastguard Worker }  // namespace art
60*795d594fSAndroid Build Coastguard Worker 
61*795d594fSAndroid Build Coastguard Worker #endif  // ART_DEX2OAT_DEX_VERIFICATION_RESULTS_H_
62