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