blob: d512b256cd988ff2fab1b3dfc467579366b6f308 [file] [log] [blame]
Andreas Gampe53c913b2014-08-12 23:19:23 -07001/*
2 * Copyright (C) 2014 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_QUICK_COMPILER_H_
18#define ART_COMPILER_DEX_QUICK_QUICK_COMPILER_H_
19
Mathieu Chartier5bdab122015-01-26 18:30:19 -080020#include "compiler.h"
21
Andreas Gampe53c913b2014-08-12 23:19:23 -070022namespace art {
23
Mathieu Chartier736b5602015-09-02 14:54:11 -070024namespace mirror {
25class DexCache;
26}
27
Andreas Gampe53c913b2014-08-12 23:19:23 -070028class Compiler;
29class CompilerDriver;
Mathieu Chartier5bdab122015-01-26 18:30:19 -080030class Mir2Lir;
31class PassManager;
Andreas Gampe53c913b2014-08-12 23:19:23 -070032
Mathieu Chartier5bdab122015-01-26 18:30:19 -080033class QuickCompiler : public Compiler {
34 public:
35 virtual ~QuickCompiler();
36
37 void Init() OVERRIDE;
38
39 void UnInit() const OVERRIDE;
40
41 bool CanCompileMethod(uint32_t method_idx, const DexFile& dex_file, CompilationUnit* cu) const
42 OVERRIDE;
43
44 CompiledMethod* Compile(const DexFile::CodeItem* code_item,
45 uint32_t access_flags,
46 InvokeType invoke_type,
47 uint16_t class_def_idx,
48 uint32_t method_idx,
49 jobject class_loader,
Mathieu Chartier736b5602015-09-02 14:54:11 -070050 const DexFile& dex_file,
51 Handle<mirror::DexCache> dex_cache) const OVERRIDE;
Mathieu Chartier5bdab122015-01-26 18:30:19 -080052
53 CompiledMethod* JniCompile(uint32_t access_flags,
54 uint32_t method_idx,
55 const DexFile& dex_file) const OVERRIDE;
56
Mathieu Chartiere401d142015-04-22 13:56:20 -070057 uintptr_t GetEntryPointOf(ArtMethod* method) const OVERRIDE
Mathieu Chartier90443472015-07-16 20:32:27 -070058 SHARED_REQUIRES(Locks::mutator_lock_);
Mathieu Chartier5bdab122015-01-26 18:30:19 -080059
David Srbecky1109fb32015-04-07 20:21:06 +010060 static Mir2Lir* GetCodeGenerator(CompilationUnit* cu, void* compilation_unit);
Mathieu Chartier5bdab122015-01-26 18:30:19 -080061
62 void InitCompilationUnit(CompilationUnit& cu) const OVERRIDE;
63
64 static Compiler* Create(CompilerDriver* driver);
65
66 const PassManager* GetPreOptPassManager() const {
67 return pre_opt_pass_manager_.get();
68 }
69 const PassManager* GetPostOptPassManager() const {
70 return post_opt_pass_manager_.get();
71 }
72
73 protected:
74 explicit QuickCompiler(CompilerDriver* driver);
75
76 private:
77 std::unique_ptr<PassManager> pre_opt_pass_manager_;
78 std::unique_ptr<PassManager> post_opt_pass_manager_;
79 DISALLOW_COPY_AND_ASSIGN(QuickCompiler);
80};
Andreas Gampe53c913b2014-08-12 23:19:23 -070081
82} // namespace art
83
84#endif // ART_COMPILER_DEX_QUICK_QUICK_COMPILER_H_