| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2013 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 | #ifndef ART_COMPILER_DEX_VERIFICATION_RESULTS_H_ | 
 | 18 | #define ART_COMPILER_DEX_VERIFICATION_RESULTS_H_ | 
 | 19 |  | 
 | 20 | #include <stdint.h> | 
 | 21 | #include <set> | 
 | 22 | #include <vector> | 
 | 23 |  | 
 | 24 | #include "base/macros.h" | 
 | 25 | #include "base/mutex.h" | 
 | 26 | #include "class_reference.h" | 
 | 27 | #include "method_reference.h" | 
 | 28 | #include "safe_map.h" | 
 | 29 |  | 
 | 30 | namespace art { | 
 | 31 |  | 
 | 32 | namespace verifier { | 
 | 33 | class MethodVerifier; | 
 | 34 | }  // namespace verifier | 
 | 35 |  | 
| Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 36 | class CompilerOptions; | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 37 | class VerifiedMethod; | 
 | 38 |  | 
| Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 39 | // Used by CompilerCallbacks to track verification information from the Runtime. | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 40 | class VerificationResults { | 
 | 41 |   public: | 
| Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 42 |     explicit VerificationResults(const CompilerOptions* compiler_options); | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 43 |     ~VerificationResults(); | 
 | 44 |  | 
 | 45 |     bool ProcessVerifiedMethod(verifier::MethodVerifier* method_verifier) | 
 | 46 |         SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) | 
 | 47 |         LOCKS_EXCLUDED(verified_methods_lock_); | 
 | 48 |  | 
 | 49 |     const VerifiedMethod* GetVerifiedMethod(MethodReference ref) | 
 | 50 |         LOCKS_EXCLUDED(verified_methods_lock_); | 
 | 51 |  | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 52 |     void AddRejectedClass(ClassReference ref) LOCKS_EXCLUDED(rejected_classes_lock_); | 
 | 53 |     bool IsClassRejected(ClassReference ref) LOCKS_EXCLUDED(rejected_classes_lock_); | 
 | 54 |  | 
| Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 55 |     bool IsCandidateForCompilation(MethodReference& method_ref, | 
 | 56 |                                    const uint32_t access_flags); | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 57 |  | 
 | 58 |   private: | 
 | 59 |     // Verified methods. | 
 | 60 |     typedef SafeMap<MethodReference, const VerifiedMethod*, | 
 | 61 |         MethodReferenceComparator> VerifiedMethodMap; | 
 | 62 |     ReaderWriterMutex verified_methods_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; | 
| Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 63 |     VerifiedMethodMap verified_methods_ GUARDED_BY(verified_methods_lock_); | 
| Vladimir Marko | c7f8320 | 2014-01-24 17:55:18 +0000 | [diff] [blame] | 64 |  | 
 | 65 |     // Rejected classes. | 
 | 66 |     ReaderWriterMutex rejected_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; | 
 | 67 |     std::set<ClassReference> rejected_classes_ GUARDED_BY(rejected_classes_lock_); | 
 | 68 | }; | 
 | 69 |  | 
 | 70 | }  // namespace art | 
 | 71 |  | 
 | 72 | #endif  // ART_COMPILER_DEX_VERIFICATION_RESULTS_H_ |