blob: 06315a5f8dbd3ff24c9eb2d6799192361c80881e [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 Marko038924b2019-02-19 15:09:35 +000025class Compiler;
Vladimir Markoa0431112018-06-25 09:32:54 +010026class CompilerOptions;
27class Thread;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080028
29namespace jit {
30
Vladimir Markoa0431112018-06-25 09:32:54 +010031class JitLogger;
Nicolas Geoffray7f7539b2019-06-06 16:20:54 +010032class JitMemoryRegion;
Vladimir Markoa0431112018-06-25 09:32:54 +010033
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 Geoffray7f7539b2019-06-06 16:20:54 +010040 bool CompileMethod(
41 Thread* self, JitMemoryRegion* region, ArtMethod* method, bool baseline, bool osr)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070042 REQUIRES_SHARED(Locks::mutator_lock_);
Nicolas Geoffraybcd94c82016-03-03 13:23:33 +000043
Vladimir Markoa0431112018-06-25 09:32:54 +010044 const CompilerOptions& GetCompilerOptions() const {
45 return *compiler_options_.get();
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000046 }
Nicolas Geoffrayc9de61c2018-11-27 17:34:31 +000047
Nicolas Geoffrayc9de61c2018-11-27 17:34:31 +000048 void ParseCompilerOptions();
49
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080050 private:
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080051 std::unique_ptr<CompilerOptions> compiler_options_;
Vladimir Marko038924b2019-02-19 15:09:35 +000052 std::unique_ptr<Compiler> compiler_;
xueliang.zhong383b57d2016-10-04 11:19:17 +010053 std::unique_ptr<JitLogger> jit_logger_;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080054
Nicolas Geoffray0c3c2662015-10-15 13:53:04 +010055 JitCompiler();
56
Mathieu Chartier3130cdf2015-05-03 15:20:23 -070057 DISALLOW_COPY_AND_ASSIGN(JitCompiler);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080058};
59
60} // namespace jit
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080061} // namespace art
62
63#endif // ART_COMPILER_JIT_JIT_COMPILER_H_