Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 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" |
Nicolas Geoffray | 6bb7f1b | 2016-11-03 10:52:49 +0000 | [diff] [blame] | 21 | #include "verifier/verifier_deps.h" |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | class VerificationResults; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 26 | |
| 27 | class QuickCompilerCallbacks FINAL : public CompilerCallbacks { |
| 28 | public: |
Mathieu Chartier | e01b6f6 | 2017-07-19 16:55:04 -0700 | [diff] [blame^] | 29 | explicit QuickCompilerCallbacks(CompilerCallbacks::CallbackMode mode) |
| 30 | : CompilerCallbacks(mode) {} |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 31 | |
| 32 | ~QuickCompilerCallbacks() { } |
| 33 | |
Andreas Gampe | 53e32d1 | 2015-12-09 21:03:23 -0800 | [diff] [blame] | 34 | void MethodVerified(verifier::MethodVerifier* verifier) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 35 | REQUIRES_SHARED(Locks::mutator_lock_) OVERRIDE; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 36 | |
| 37 | void ClassRejected(ClassReference ref) OVERRIDE; |
| 38 | |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 39 | // We are running in an environment where we can call patchoat safely so we should. |
| 40 | bool IsRelocationPossible() OVERRIDE { |
| 41 | return true; |
| 42 | } |
| 43 | |
David Brazdil | ca3c8c3 | 2016-09-06 14:04:48 +0100 | [diff] [blame] | 44 | verifier::VerifierDeps* GetVerifierDeps() const OVERRIDE { |
Nicolas Geoffray | 6bb7f1b | 2016-11-03 10:52:49 +0000 | [diff] [blame] | 45 | return verifier_deps_.get(); |
David Brazdil | ca3c8c3 | 2016-09-06 14:04:48 +0100 | [diff] [blame] | 46 | } |
| 47 | |
Nicolas Geoffray | 6bb7f1b | 2016-11-03 10:52:49 +0000 | [diff] [blame] | 48 | void SetVerifierDeps(verifier::VerifierDeps* deps) OVERRIDE { |
| 49 | verifier_deps_.reset(deps); |
David Brazdil | ca3c8c3 | 2016-09-06 14:04:48 +0100 | [diff] [blame] | 50 | } |
| 51 | |
Mathieu Chartier | e01b6f6 | 2017-07-19 16:55:04 -0700 | [diff] [blame^] | 52 | void SetVerificationResults(VerificationResults* verification_results) { |
| 53 | verification_results_ = verification_results; |
| 54 | } |
| 55 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 56 | private: |
Mathieu Chartier | e01b6f6 | 2017-07-19 16:55:04 -0700 | [diff] [blame^] | 57 | VerificationResults* verification_results_ = nullptr; |
Nicolas Geoffray | 6bb7f1b | 2016-11-03 10:52:49 +0000 | [diff] [blame] | 58 | std::unique_ptr<verifier::VerifierDeps> verifier_deps_; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace art |
| 62 | |
| 63 | #endif // ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_ |