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 #ifndef ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
18 #define ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
19 
20 #include "compiler_callbacks.h"
21 
22 namespace art {
23 
24 class VerificationResults;
25 class DexFileToMethodInlinerMap;
26 
27 class QuickCompilerCallbacks FINAL : public CompilerCallbacks {
28   public:
QuickCompilerCallbacks(VerificationResults * verification_results,DexFileToMethodInlinerMap * method_inliner_map)29     QuickCompilerCallbacks(VerificationResults* verification_results,
30                            DexFileToMethodInlinerMap* method_inliner_map)
31         : verification_results_(verification_results),
32           method_inliner_map_(method_inliner_map) {
33       CHECK(verification_results != nullptr);
34       CHECK(method_inliner_map != nullptr);
35     }
36 
~QuickCompilerCallbacks()37     ~QuickCompilerCallbacks() { }
38 
39     bool MethodVerified(verifier::MethodVerifier* verifier)
40         SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) OVERRIDE;
41 
42     void ClassRejected(ClassReference ref) OVERRIDE;
43 
44     // We are running in an environment where we can call patchoat safely so we should.
IsRelocationPossible()45     bool IsRelocationPossible() OVERRIDE {
46       return true;
47     }
48 
49   private:
50     VerificationResults* const verification_results_;
51     DexFileToMethodInlinerMap* const method_inliner_map_;
52 };
53 
54 }  // namespace art
55 
56 #endif  // ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
57