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 
22 namespace art {
23 
24 class ArtMethod;
25 class CompiledMethod;
26 class Compiler;
27 class CompilerOptions;
28 class Thread;
29 
30 namespace jit {
31 
32 class JitLogger;
33 
34 class JitCompiler {
35  public:
36   static JitCompiler* Create();
37   virtual ~JitCompiler();
38 
39   // Compilation entrypoint. Returns whether the compilation succeeded.
40   bool CompileMethod(Thread* self, ArtMethod* method, bool baseline, bool osr)
41       REQUIRES_SHARED(Locks::mutator_lock_);
42 
GetCompilerOptions()43   const CompilerOptions& GetCompilerOptions() const {
44     return *compiler_options_.get();
45   }
46 
47   void ParseCompilerOptions();
48 
49  private:
50   std::unique_ptr<CompilerOptions> compiler_options_;
51   std::unique_ptr<Compiler> compiler_;
52   std::unique_ptr<JitLogger> jit_logger_;
53 
54   JitCompiler();
55 
56   DISALLOW_COPY_AND_ASSIGN(JitCompiler);
57 };
58 
59 }  // namespace jit
60 }  // namespace art
61 
62 #endif  // ART_COMPILER_JIT_JIT_COMPILER_H_
63