blob: fd2cd4a31dfbee52e981b661e5dbba49343a6356 [file] [log] [blame]
Brian Carlstrom6449c622014-02-10 23:48:36 -08001/*
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_DRIVER_COMPILER_CALLBACKS_IMPL_H_
18#define ART_COMPILER_DRIVER_COMPILER_CALLBACKS_IMPL_H_
19
20#include "compiler_callbacks.h"
21#include "dex/quick/dex_file_to_method_inliner_map.h"
22#include "verifier/method_verifier-inl.h"
23
24namespace art {
25
26class CompilerCallbacksImpl : public CompilerCallbacks {
27 public:
28 CompilerCallbacksImpl(VerificationResults* verification_results,
29 DexFileToMethodInlinerMap* method_inliner_map)
30 : verification_results_(verification_results),
31 method_inliner_map_(method_inliner_map) {
32 CHECK(verification_results != nullptr);
33 CHECK(method_inliner_map != nullptr);
34 }
35
36 virtual ~CompilerCallbacksImpl() { }
37
38 virtual bool MethodVerified(verifier::MethodVerifier* verifier)
39 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
40 bool result = verification_results_->ProcessVerifiedMethod(verifier);
41 if (result) {
42 MethodReference ref = verifier->GetMethodReference();
43 method_inliner_map_->GetMethodInliner(ref.dex_file)
44 ->AnalyseMethodCode(verifier);
45 }
46 return result;
47 }
48 virtual void ClassRejected(ClassReference ref) {
49 verification_results_->AddRejectedClass(ref);
50 }
51
52 private:
Brian Carlstromae7083d2014-02-24 21:56:02 -080053 VerificationResults* const verification_results_;
54 DexFileToMethodInlinerMap* const method_inliner_map_;
Brian Carlstrom6449c622014-02-10 23:48:36 -080055};
56
57} // namespace art
58
59#endif // ART_COMPILER_DRIVER_COMPILER_CALLBACKS_IMPL_H_