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; |
| 26 | class CompilerDriver; |
| 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 | |
David Srbecky | 5d81120 | 2016-03-08 13:21:22 +0000 | [diff] [blame] | 47 | CompilerDriver* GetCompilerDriver() const { |
| 48 | return compiler_driver_.get(); |
| 49 | } |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 50 | |
Nicolas Geoffray | c9de61c | 2018-11-27 17:34:31 +0000 | [diff] [blame] | 51 | void ParseCompilerOptions(); |
| 52 | |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 53 | private: |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 54 | std::unique_ptr<CompilerOptions> compiler_options_; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 55 | std::unique_ptr<CompilerDriver> compiler_driver_; |
xueliang.zhong | 383b57d | 2016-10-04 11:19:17 +0100 | [diff] [blame] | 56 | std::unique_ptr<JitLogger> jit_logger_; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 57 | |
Nicolas Geoffray | 0c3c266 | 2015-10-15 13:53:04 +0100 | [diff] [blame] | 58 | JitCompiler(); |
| 59 | |
Mathieu Chartier | 3130cdf | 2015-05-03 15:20:23 -0700 | [diff] [blame] | 60 | DISALLOW_COPY_AND_ASSIGN(JitCompiler); |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace jit |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 64 | } // namespace art |
| 65 | |
| 66 | #endif // ART_COMPILER_JIT_JIT_COMPILER_H_ |