blob: 29d276134828323ca80bbf35abc9c0c4bc9e7e47 [file] [log] [blame]
Mathieu Chartiere5f13e52015-02-24 09:37:21 -08001/*
2 * Copyright 2015 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_JIT_JIT_COMPILER_H_
18#define ART_COMPILER_JIT_JIT_COMPILER_H_
19
20#include "base/mutex.h"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080021
22namespace art {
23
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080024class ArtMethod;
Vladimir Markoa0431112018-06-25 09:32:54 +010025class CompiledMethod;
26class CompilerDriver;
27class CompilerOptions;
28class Thread;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080029
30namespace jit {
31
Vladimir Markoa0431112018-06-25 09:32:54 +010032class JitLogger;
33
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080034class JitCompiler {
35 public:
36 static JitCompiler* Create();
37 virtual ~JitCompiler();
Nicolas Geoffraybcd94c82016-03-03 13:23:33 +000038
39 // Compilation entrypoint. Returns whether the compilation succeeded.
Nicolas Geoffray075456e2018-12-14 08:54:21 +000040 bool CompileMethod(Thread* self, ArtMethod* method, bool baseline, bool osr)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070041 REQUIRES_SHARED(Locks::mutator_lock_);
Nicolas Geoffraybcd94c82016-03-03 13:23:33 +000042
Vladimir Markoa0431112018-06-25 09:32:54 +010043 const CompilerOptions& GetCompilerOptions() const {
44 return *compiler_options_.get();
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000045 }
Nicolas Geoffrayc9de61c2018-11-27 17:34:31 +000046
David Srbecky5d811202016-03-08 13:21:22 +000047 CompilerDriver* GetCompilerDriver() const {
48 return compiler_driver_.get();
49 }
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080050
Nicolas Geoffrayc9de61c2018-11-27 17:34:31 +000051 void ParseCompilerOptions();
52
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080053 private:
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080054 std::unique_ptr<CompilerOptions> compiler_options_;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080055 std::unique_ptr<CompilerDriver> compiler_driver_;
xueliang.zhong383b57d2016-10-04 11:19:17 +010056 std::unique_ptr<JitLogger> jit_logger_;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080057
Nicolas Geoffray0c3c2662015-10-15 13:53:04 +010058 JitCompiler();
59
Mathieu Chartier3130cdf2015-05-03 15:20:23 -070060 DISALLOW_COPY_AND_ASSIGN(JitCompiler);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080061};
62
63} // namespace jit
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080064} // namespace art
65
66#endif // ART_COMPILER_JIT_JIT_COMPILER_H_