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 | #include "compiled_method.h" |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 22 | #include "dex/quick/dex_file_to_method_inliner_map.h" |
| 23 | #include "driver/compiler_driver.h" |
| 24 | #include "driver/compiler_options.h" |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 25 | |
| 26 | namespace art { |
| 27 | |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 28 | class ArtMethod; |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 29 | class InstructionSetFeatures; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 30 | |
| 31 | namespace jit { |
| 32 | |
| 33 | class JitCompiler { |
| 34 | public: |
| 35 | static JitCompiler* Create(); |
| 36 | virtual ~JitCompiler(); |
Nicolas Geoffray | bcd94c8 | 2016-03-03 13:23:33 +0000 | [diff] [blame] | 37 | |
| 38 | // Compilation entrypoint. Returns whether the compilation succeeded. |
Nicolas Geoffray | b331feb | 2016-02-05 16:51:53 +0000 | [diff] [blame] | 39 | bool CompileMethod(Thread* self, ArtMethod* method, bool osr) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 40 | SHARED_REQUIRES(Locks::mutator_lock_); |
Nicolas Geoffray | bcd94c8 | 2016-03-03 13:23:33 +0000 | [diff] [blame] | 41 | |
Nicolas Geoffray | a25dce9 | 2016-01-12 16:41:10 +0000 | [diff] [blame] | 42 | CompilerOptions* GetCompilerOptions() const { |
| 43 | return compiler_options_.get(); |
| 44 | } |
David Srbecky | 5d81120 | 2016-03-08 13:21:22 +0000 | [diff] [blame^] | 45 | CompilerDriver* GetCompilerDriver() const { |
| 46 | return compiler_driver_.get(); |
| 47 | } |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 48 | |
| 49 | private: |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 50 | std::unique_ptr<CompilerOptions> compiler_options_; |
| 51 | std::unique_ptr<CumulativeLogger> cumulative_logger_; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 52 | std::unique_ptr<DexFileToMethodInlinerMap> method_inliner_map_; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 53 | std::unique_ptr<CompilerDriver> compiler_driver_; |
| 54 | std::unique_ptr<const InstructionSetFeatures> instruction_set_features_; |
Nicolas Geoffray | a25dce9 | 2016-01-12 16:41:10 +0000 | [diff] [blame] | 55 | std::unique_ptr<File> perf_file_; |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 56 | |
Nicolas Geoffray | 0c3c266 | 2015-10-15 13:53:04 +0100 | [diff] [blame] | 57 | JitCompiler(); |
| 58 | |
| 59 | // This is in the compiler since the runtime doesn't have access to the compiled method |
| 60 | // structures. |
Nicolas Geoffray | bcd94c8 | 2016-03-03 13:23:33 +0000 | [diff] [blame] | 61 | bool AddToCodeCache(ArtMethod* method, const CompiledMethod* compiled_method) |
Nicolas Geoffray | 1dad3f6 | 2015-10-23 14:59:54 +0100 | [diff] [blame] | 62 | SHARED_REQUIRES(Locks::mutator_lock_); |
Mathieu Chartier | 3130cdf | 2015-05-03 15:20:23 -0700 | [diff] [blame] | 63 | |
| 64 | DISALLOW_COPY_AND_ASSIGN(JitCompiler); |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | } // namespace jit |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 68 | } // namespace art |
| 69 | |
| 70 | #endif // ART_COMPILER_JIT_JIT_COMPILER_H_ |