Home | History | Annotate | Download | only in jit

Lines Matching refs:Jit

17 #include "jit.h"
43 namespace jit {
46 // At what priority to schedule jit threads. 9 is the lowest foreground priority on device.
54 // JIT compiler
55 void* Jit::jit_library_handle_= nullptr;
56 void* Jit::jit_compiler_handle_ = nullptr;
57 void* (*Jit::jit_load_)(bool*) = nullptr;
58 void (*Jit::jit_unload_)(void*) = nullptr;
59 bool (*Jit::jit_compile_method_)(void*, ArtMethod*, Thread*, bool) = nullptr;
60 void (*Jit::jit_types_loaded_)(void*, mirror::Class**, size_t count) = nullptr;
61 bool Jit::generate_debug_info_ = false;
126 jit_options->warmup_threshold_ / Jit::kDefaultPriorityThreadWeightRatio,
140 jit_options->warmup_threshold_ / Jit::kDefaultInvokeTransitionWeightRatio,
147 bool Jit::ShouldUsePriorityThreadWeight() {
152 void Jit::DumpInfo(std::ostream& os) {
159 void Jit::DumpForSigQuit(std::ostream& os) {
164 void Jit::AddTimingLogger(const TimingLogger& logger) {
168 Jit::Jit() : dump_info_on_shutdown_(false),
169 cumulative_timings_("JIT timings"),
171 lock_("JIT memory use lock"),
179 Jit* Jit::Create(JitOptions* options, std::string* error_msg) {
181 std::unique_ptr<Jit> jit(new Jit);
182 jit->dump_info_on_shutdown_ = options->DumpJitInfoOnShutdown();
186 jit->code_cache_.reset(JitCodeCache::Create(
189 jit->generate_debug_info_,
191 if (jit->GetCodeCache() == nullptr) {
194 jit->use_jit_compilation_ = options->UseJitCompilation();
195 jit->profile_saver_options_ = options->GetProfileSaverOptions();
196 VLOG(jit) << "JIT created with initial_capacity="
203 jit->hot_method_threshold_ = options->GetCompileThreshold();
204 jit->warm_method_threshold_ = options->GetWarmupThreshold();
205 jit->osr_method_threshold_ = options->GetOsrThreshold();
206 jit->priority_thread_weight_ = options->GetPriorityThreadWeight();
207 jit->invoke_transition_weight_ = options->GetInvokeTransitionWeight();
209 jit->CreateThreadPool();
211 // Notify native debugger about the classes already loaded before the creation of the jit.
212 jit->DumpTypeInfoForLoadedTypes(Runtime::Current()->GetClassLinker());
213 return jit.release();
216 bool Jit::LoadCompilerLibrary(std::string* error_msg) {
221 oss << "JIT could not load libart-compiler.so: " << dlerror();
228 *error_msg = "JIT couldn't find jit_load entry point";
235 *error_msg = "JIT couldn't find jit_unload entry point";
242 *error_msg = "JIT couldn't find jit_compile_method entry point";
249 *error_msg = "JIT couldn't find jit_types_loaded entry point";
255 bool Jit::LoadCompiler(std::string* error_msg) {
260 VLOG(jit) << "Calling JitLoad interpreter_only="
265 *error_msg = "JIT couldn't load compiler";
272 bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) {
278 VLOG(jit) << "JIT not compiling " << method->PrettyMethod() << " due to breakpoint";
285 VLOG(jit) << "JIT not compiling " << method->PrettyMethod() << " due to deoptimization";
296 VLOG(jit) << "Compiling method "
302 VLOG(jit) << "Failed to compile method "
318 void Jit::CreateThreadPool() {
322 // We need peers as we may report the JIT thread, e.g., in the debugger.
324 thread_pool_.reset(new ThreadPool("Jit thread pool", 1, kJitPoolNeedsPeers));
330 void Jit::DeleteThreadPool() {
354 void Jit::StartProfileSaver(const std::string& filename,
364 void Jit::StopProfileSaver() {
370 bool Jit::JitAtFirstUse() {
374 bool Jit::CanInvokeCompiledCode(ArtMethod* method) {
378 Jit::~Jit() {
395 void Jit::NewTypeLoadedIfUsingJit(mirror::Class* type) {
397 // No need to notify if we only use the JIT to save profiles.
400 jit::Jit* jit = Runtime::Current()->GetJit();
401 if (jit->generate_debug_info_) {
402 DCHECK(jit->jit_types_loaded_ != nullptr);
403 jit->jit_types_loaded_(jit->jit_compiler_handle_, &type, 1);
407 void Jit::DumpTypeInfoForLoadedTypes(ClassLinker* linker) {
432 bool Jit::MaybeDoOnStackReplacement(Thread* thread,
441 Jit* jit = Runtime::Current()->GetJit();
442 if (jit == nullptr) {
455 // and the JIT code cache do not expect methods from proxy classes.
460 if (!jit->GetCodeCache()->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) {
465 // suspension once we hold an OSR method, as the JIT code cache could delete the OSR
469 std::string method_name(VLOG_IS_ON(jit) ? method->PrettyMethod() : "");
477 const OatQuickMethodHeader* osr_method = jit->GetCodeCache()->LookupOsrMethodHeader(method);
552 VLOG(jit) << "Jumping to "
575 VLOG(jit) << "Done running OSR code for " << method_name;
579 void Jit::AddMemoryUsage(ArtMethod* method, size_t bytes) {
619 VLOG(jit) << "Start profiling " << ArtMethod::PrettyMethod(method_);
637 void Jit::AddSamples(Thread* self, ArtMethod* method, uint16_t count, bool with_backedges) {
656 if (Jit::ShouldUsePriorityThreadWeight()) {
665 VLOG(jit) << "Start profiling " << method->PrettyMethod();
707 void Jit::MethodEntered(Thread* thread, ArtMethod* method) {
728 void Jit::InvokeVirtualOrInterface(ObjPtr<mirror::Object> this_object,
740 void Jit::WaitForCompilationToFinish(Thread* self) {
746 void Jit::Stop() {
754 void Jit::Start() {
759 jit::Jit* jit = Runtime::Current()->GetJit();
760 was_on_ = (jit != nullptr) && (jit->GetThreadPool() != nullptr);
762 jit->Stop();
774 } // namespace jit