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 | |
Vladimir Marko | 327497e | 2019-03-04 12:53:20 +0000 | [diff] [blame] | 17 | #ifndef ART_DEX2OAT_DEX_QUICK_COMPILER_CALLBACKS_H_ |
| 18 | #define ART_DEX2OAT_DEX_QUICK_COMPILER_CALLBACKS_H_ |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 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 | |
Mathieu Chartier | 9e050df | 2017-08-09 10:05:47 -0700 | [diff] [blame] | 25 | class CompilerDriver; |
Andreas Gampe | e993458 | 2018-01-19 21:23:04 -0800 | [diff] [blame] | 26 | class DexFile; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 27 | class VerificationResults; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 28 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 29 | class QuickCompilerCallbacks final : public CompilerCallbacks { |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 30 | public: |
| 31 | explicit QuickCompilerCallbacks(CompilerCallbacks::CallbackMode mode) |
Andreas Gampe | e993458 | 2018-01-19 21:23:04 -0800 | [diff] [blame] | 32 | : CompilerCallbacks(mode), dex_files_(nullptr) {} |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 33 | |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 34 | ~QuickCompilerCallbacks() { } |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 35 | |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 36 | void MethodVerified(verifier::MethodVerifier* verifier) |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 37 | REQUIRES_SHARED(Locks::mutator_lock_) override; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 38 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 39 | void ClassRejected(ClassReference ref) override; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 40 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 41 | verifier::VerifierDeps* GetVerifierDeps() const override { |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 42 | return verifier_deps_.get(); |
| 43 | } |
David Brazdil | ca3c8c3 | 2016-09-06 14:04:48 +0100 | [diff] [blame] | 44 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 45 | void SetVerifierDeps(verifier::VerifierDeps* deps) override { |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 46 | verifier_deps_.reset(deps); |
| 47 | } |
David Brazdil | ca3c8c3 | 2016-09-06 14:04:48 +0100 | [diff] [blame] | 48 | |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 49 | void SetVerificationResults(VerificationResults* verification_results) { |
| 50 | verification_results_ = verification_results; |
| 51 | } |
Mathieu Chartier | e01b6f6 | 2017-07-19 16:55:04 -0700 | [diff] [blame] | 52 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 53 | ClassStatus GetPreviousClassState(ClassReference ref) override; |
Mathieu Chartier | 9e050df | 2017-08-09 10:05:47 -0700 | [diff] [blame] | 54 | |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 55 | void SetDoesClassUnloading(bool does_class_unloading, CompilerDriver* compiler_driver) |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 56 | override { |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 57 | does_class_unloading_ = does_class_unloading; |
| 58 | compiler_driver_ = compiler_driver; |
| 59 | DCHECK(!does_class_unloading || compiler_driver_ != nullptr); |
| 60 | } |
Mathieu Chartier | 9e050df | 2017-08-09 10:05:47 -0700 | [diff] [blame] | 61 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 62 | void UpdateClassState(ClassReference ref, ClassStatus state) override; |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 63 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 64 | bool CanUseOatStatusForVerification(mirror::Class* klass) override |
Andreas Gampe | e993458 | 2018-01-19 21:23:04 -0800 | [diff] [blame] | 65 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 66 | |
| 67 | void SetDexFiles(const std::vector<const DexFile*>* dex_files) { |
| 68 | dex_files_ = dex_files; |
| 69 | } |
| 70 | |
Nicolas Geoffray | 486dda0 | 2017-09-11 14:15:52 +0100 | [diff] [blame] | 71 | private: |
| 72 | VerificationResults* verification_results_ = nullptr; |
| 73 | bool does_class_unloading_ = false; |
| 74 | CompilerDriver* compiler_driver_ = nullptr; |
| 75 | std::unique_ptr<verifier::VerifierDeps> verifier_deps_; |
Andreas Gampe | e993458 | 2018-01-19 21:23:04 -0800 | [diff] [blame] | 76 | const std::vector<const DexFile*>* dex_files_; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | } // namespace art |
| 80 | |
Vladimir Marko | 327497e | 2019-03-04 12:53:20 +0000 | [diff] [blame] | 81 | #endif // ART_DEX2OAT_DEX_QUICK_COMPILER_CALLBACKS_H_ |