Home | History | Annotate | Download | only in jit

Lines Matching defs:Jit

17 #include "jit.h"
37 namespace jit {
40 // At what priority to schedule jit threads. 9 is the lowest foreground priority on device.
43 // JIT compiler
44 void* Jit::jit_library_handle_= nullptr;
45 void* Jit::jit_compiler_handle_ = nullptr;
46 void* (*Jit::jit_load_)(bool*) = nullptr;
47 void (*Jit::jit_unload_)(void*) = nullptr;
48 bool (*Jit::jit_compile_method_)(void*, ArtMethod*, Thread*, bool) = nullptr;
49 void (*Jit::jit_types_loaded_)(void*, mirror::Class**, size_t count) = nullptr;
50 bool Jit::generate_debug_info_ = false;
101 jit_options->warmup_threshold_ / Jit::kDefaultPriorityThreadWeightRatio,
115 jit_options->warmup_threshold_ / Jit::kDefaultInvokeTransitionWeightRatio,
122 bool Jit::ShouldUsePriorityThreadWeight() {
127 void Jit::DumpInfo(std::ostream& os) {
134 void Jit::DumpForSigQuit(std::ostream& os) {
139 void Jit::AddTimingLogger(const TimingLogger& logger) {
143 Jit::Jit() : dump_info_on_shutdown_(false),
144 cumulative_timings_("JIT timings"),
146 lock_("JIT memory use lock"),
150 Jit* Jit::Create(JitOptions* options, std::string* error_msg) {
152 std::unique_ptr<Jit> jit(new Jit);
153 jit->dump_info_on_shutdown_ = options->DumpJitInfoOnShutdown();
157 jit->code_cache_.reset(JitCodeCache::Create(
160 jit->generate_debug_info_,
162 if (jit->GetCodeCache() == nullptr) {
165 jit->use_jit_compilation_ = options->UseJitCompilation();
166 jit->save_profiling_info_ = options->GetSaveProfilingInfo();
167 VLOG(jit) << "JIT created with initial_capacity="
174 jit->hot_method_threshold_ = options->GetCompileThreshold();
175 jit->warm_method_threshold_ = options->GetWarmupThreshold();
176 jit->osr_method_threshold_ = options->GetOsrThreshold();
177 jit->priority_thread_weight_ = options->GetPriorityThreadWeight();
178 jit->invoke_transition_weight_ = options->GetInvokeTransitionWeight();
180 jit->CreateThreadPool();
182 // Notify native debugger about the classes already loaded before the creation of the jit.
183 jit->DumpTypeInfoForLoadedTypes(Runtime::Current()->GetClassLinker());
184 return jit.release();
187 bool Jit::LoadCompilerLibrary(std::string* error_msg) {
192 oss << "JIT could not load libart-compiler.so: " << dlerror();
199 *error_msg = "JIT couldn't find jit_load entry point";
206 *error_msg = "JIT couldn't find jit_unload entry point";
213 *error_msg = "JIT couldn't find jit_compile_method entry point";
220 *error_msg = "JIT couldn't find jit_types_loaded entry point";
226 bool Jit::LoadCompiler(std::string* error_msg) {
231 VLOG(jit) << "Calling JitLoad interpreter_only="
236 *error_msg = "JIT couldn't load compiler";
243 bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) {
249 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to breakpoint";
256 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to deoptimization";
267 VLOG(jit) << "Compiling method "
273 VLOG(jit) << "Failed to compile method "
280 void Jit::CreateThreadPool() {
283 thread_pool_.reset(new ThreadPool("Jit thread pool", 1));
288 void Jit::DeleteThreadPool() {
309 void Jit::StartProfileSaver(const std::string& filename,
318 void Jit::StopProfileSaver() {
324 bool Jit::JitAtFirstUse() {
328 bool Jit::CanInvokeCompiledCode(ArtMethod* method) {
332 Jit::~Jit() {
348 void Jit::NewTypeLoadedIfUsingJit(mirror::Class* type) {
350 // No need to notify if we only use the JIT to save profiles.
353 jit::Jit* jit = Runtime::Current()->GetJit();
354 if (jit->generate_debug_info_) {
355 DCHECK(jit->jit_types_loaded_ != nullptr);
356 jit->jit_types_loaded_(jit->jit_compiler_handle_, &type, 1);
360 void Jit::DumpTypeInfoForLoadedTypes(ClassLinker* linker) {
385 bool Jit::MaybeDoOnStackReplacement(Thread* thread,
394 Jit* jit = Runtime::Current()->GetJit();
395 if (jit == nullptr) {
408 // and the JIT code cache do not expect methods from proxy classes.
413 if (!jit->GetCodeCache()->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) {
418 // suspension once we hold an OSR method, as the JIT code cache could delete the OSR
422 std::string method_name(VLOG_IS_ON(jit) ? PrettyMethod(method) : "");
430 const OatQuickMethodHeader* osr_method = jit->GetCodeCache()->LookupOsrMethodHeader(method);
505 VLOG(jit) << "Jumping to "
528 VLOG(jit) << "Done running OSR code for " << method_name;
532 void Jit::AddMemoryUsage(ArtMethod* method, size_t bytes) {
572 VLOG(jit) << "Start profiling " << PrettyMethod(method_);
590 void Jit::AddSamples(Thread* self, ArtMethod* method, uint16_t count, bool with_backedges) {
609 if (Jit::ShouldUsePriorityThreadWeight()) {
618 VLOG(jit) << "Start profiling " << PrettyMethod(method);
660 void Jit::MethodEntered(Thread* thread, ArtMethod* method) {
681 void Jit::InvokeVirtualOrInterface(Thread* thread,
694 void Jit::WaitForCompilationToFinish(Thread* self) {
700 } // namespace jit