16449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom/*
26449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * Copyright (C) 2011 The Android Open Source Project
36449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom *
46449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * Licensed under the Apache License, Version 2.0 (the "License");
56449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * you may not use this file except in compliance with the License.
66449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * You may obtain a copy of the License at
76449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom *
86449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom *      http://www.apache.org/licenses/LICENSE-2.0
96449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom *
106449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * Unless required by applicable law or agreed to in writing, software
116449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * distributed under the License is distributed on an "AS IS" BASIS,
126449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * See the License for the specific language governing permissions and
146449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom * limitations under the License.
156449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom */
166449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
17e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#ifndef ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
18e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#define ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
196449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
206449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom#include "compiler_callbacks.h"
216449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
226449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstromnamespace art {
236449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
24e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogersclass VerificationResults;
25e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogersclass DexFileToMethodInlinerMap;
26e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers
27e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogersclass QuickCompilerCallbacks FINAL : public CompilerCallbacks {
286449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  public:
29e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers    QuickCompilerCallbacks(VerificationResults* verification_results,
3081c6f8db12b203878a7d72444ead2bc7cf5c47adAndreas Gampe                           DexFileToMethodInlinerMap* method_inliner_map,
314585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe                           CompilerCallbacks::CallbackMode mode)
324585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe        : CompilerCallbacks(mode), verification_results_(verification_results),
336449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom          method_inliner_map_(method_inliner_map) {
346449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom      CHECK(verification_results != nullptr);
356449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom      CHECK(method_inliner_map != nullptr);
366449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom    }
376449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
38e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers    ~QuickCompilerCallbacks() { }
396449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
4053e32d14d7a51198c6ef09120c15bafdd1d055c2Andreas Gampe    void MethodVerified(verifier::MethodVerifier* verifier)
4190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier        SHARED_REQUIRES(Locks::mutator_lock_) OVERRIDE;
42e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers
43e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers    void ClassRejected(ClassReference ref) OVERRIDE;
446449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
45a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light    // We are running in an environment where we can call patchoat safely so we should.
46a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light    bool IsRelocationPossible() OVERRIDE {
47a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light      return true;
48a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light    }
49a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
506449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  private:
51ae7083dac2db59dcdef869e35ac44a039d888ee9Brian Carlstrom    VerificationResults* const verification_results_;
52ae7083dac2db59dcdef869e35ac44a039d888ee9Brian Carlstrom    DexFileToMethodInlinerMap* const method_inliner_map_;
536449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom};
546449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
556449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom}  // namespace art
566449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom
57e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#endif  // ART_COMPILER_DEX_QUICK_COMPILER_CALLBACKS_H_
58