| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 1 | /* |
| 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 Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 21 | |
| 22 | namespace art { |
| 23 | |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 24 | class ArtMethod; |
| Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 25 | class CompiledMethod; |
| Vladimir Marko | 038924b | 2019-02-19 15:09:35 +0000 | [diff] [blame] | 26 | class Compiler; |
| Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 27 | class CompilerOptions; |
| 28 | class Thread; |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 29 | |
| 30 | namespace jit { |
| 31 | |
| Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 32 | class JitLogger; |
| 33 | |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 34 | class JitCompiler { |
| 35 | public: |
| 36 | static JitCompiler* Create(); |
| 37 | virtual ~JitCompiler(); |
| Nicolas Geoffray | bcd94c8 | 2016-03-03 13:23:33 +0000 | [diff] [blame] | 38 | |
| 39 | // Compilation entrypoint. Returns whether the compilation succeeded. |
| Nicolas Geoffray | 075456e | 2018-12-14 08:54:21 +0000 | [diff] [blame] | 40 | bool CompileMethod(Thread* self, ArtMethod* method, bool baseline, bool osr) |
| Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 41 | REQUIRES_SHARED(Locks::mutator_lock_); |
| Nicolas Geoffray | bcd94c8 | 2016-03-03 13:23:33 +0000 | [diff] [blame] | 42 | |
| Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 43 | const CompilerOptions& GetCompilerOptions() const { |
| 44 | return *compiler_options_.get(); |
| Nicolas Geoffray | a25dce9 | 2016-01-12 16:41:10 +0000 | [diff] [blame] | 45 | } |
| Nicolas Geoffray | c9de61c | 2018-11-27 17:34:31 +0000 | [diff] [blame] | 46 | |
| Nicolas Geoffray | c9de61c | 2018-11-27 17:34:31 +0000 | [diff] [blame] | 47 | void ParseCompilerOptions(); |
| 48 | |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 49 | private: |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 50 | std::unique_ptr<CompilerOptions> compiler_options_; |
| Vladimir Marko | 038924b | 2019-02-19 15:09:35 +0000 | [diff] [blame] | 51 | std::unique_ptr<Compiler> compiler_; |
| xueliang.zhong | 383b57d | 2016-10-04 11:19:17 +0100 | [diff] [blame] | 52 | std::unique_ptr<JitLogger> jit_logger_; |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 53 | |
| Nicolas Geoffray | 0c3c266 | 2015-10-15 13:53:04 +0100 | [diff] [blame] | 54 | JitCompiler(); |
| 55 | |
| Mathieu Chartier | 3130cdf | 2015-05-03 15:20:23 -0700 | [diff] [blame] | 56 | DISALLOW_COPY_AND_ASSIGN(JitCompiler); |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | } // namespace jit |
| Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 60 | } // namespace art |
| 61 | |
| 62 | #endif // ART_COMPILER_JIT_JIT_COMPILER_H_ |