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