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