blob: 578aff45e5f005a54ff083a11261cefb110aca87 [file] [log] [blame]
Ian Rogerse63db272014-07-15 15:36:11 -07001/*
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 Geoffray6bb7f1b2016-11-03 10:52:49 +000021#include "verifier/verifier_deps.h"
Ian Rogerse63db272014-07-15 15:36:11 -070022
23namespace art {
24
Mathieu Chartier9e050df2017-08-09 10:05:47 -070025class CompilerDriver;
Ian Rogerse63db272014-07-15 15:36:11 -070026class VerificationResults;
Ian Rogerse63db272014-07-15 15:36:11 -070027
28class QuickCompilerCallbacks FINAL : public CompilerCallbacks {
29 public:
Mathieu Chartiere01b6f62017-07-19 16:55:04 -070030 explicit QuickCompilerCallbacks(CompilerCallbacks::CallbackMode mode)
31 : CompilerCallbacks(mode) {}
Ian Rogerse63db272014-07-15 15:36:11 -070032
33 ~QuickCompilerCallbacks() { }
34
Andreas Gampe53e32d12015-12-09 21:03:23 -080035 void MethodVerified(verifier::MethodVerifier* verifier)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070036 REQUIRES_SHARED(Locks::mutator_lock_) OVERRIDE;
Ian Rogerse63db272014-07-15 15:36:11 -070037
38 void ClassRejected(ClassReference ref) OVERRIDE;
39
Alex Lighta59dd802014-07-02 16:28:08 -070040 // We are running in an environment where we can call patchoat safely so we should.
41 bool IsRelocationPossible() OVERRIDE {
42 return true;
43 }
44
David Brazdilca3c8c32016-09-06 14:04:48 +010045 verifier::VerifierDeps* GetVerifierDeps() const OVERRIDE {
Nicolas Geoffray6bb7f1b2016-11-03 10:52:49 +000046 return verifier_deps_.get();
David Brazdilca3c8c32016-09-06 14:04:48 +010047 }
48
Nicolas Geoffray6bb7f1b2016-11-03 10:52:49 +000049 void SetVerifierDeps(verifier::VerifierDeps* deps) OVERRIDE {
50 verifier_deps_.reset(deps);
David Brazdilca3c8c32016-09-06 14:04:48 +010051 }
52
Mathieu Chartiere01b6f62017-07-19 16:55:04 -070053 void SetVerificationResults(VerificationResults* verification_results) {
54 verification_results_ = verification_results;
55 }
56
Mathieu Chartier9e050df2017-08-09 10:05:47 -070057 bool CanAssumeVerified(ClassReference ref) OVERRIDE;
58
59 void SetDoesClassUnloading(bool does_class_unloading, CompilerDriver* compiler_driver)
60 OVERRIDE {
61 does_class_unloading_ = does_class_unloading;
62 compiler_driver_ = compiler_driver;
63 DCHECK(!does_class_unloading || compiler_driver_ != nullptr);
64 }
65
Ian Rogerse63db272014-07-15 15:36:11 -070066 private:
Mathieu Chartiere01b6f62017-07-19 16:55:04 -070067 VerificationResults* verification_results_ = nullptr;
Mathieu Chartier9e050df2017-08-09 10:05:47 -070068 bool does_class_unloading_ = false;
69 CompilerDriver* compiler_driver_ = nullptr;
Nicolas Geoffray6bb7f1b2016-11-03 10:52:49 +000070 std::unique_ptr<verifier::VerifierDeps> verifier_deps_;
Ian Rogerse63db272014-07-15 15:36:11 -070071};
72
73} // namespace art
74
75#endif // ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_