blob: 7dbd89cedbbe49adcd27952ffb389f4c440f8f4c [file] [log] [blame]
Mathieu Chartiere5f13e52015-02-24 09:37:21 -08001/*
2 * Copyright 2014 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#include "jit.h"
18
19#include <dlfcn.h>
20
Mathieu Chartiere401d142015-04-22 13:56:20 -070021#include "art_method-inl.h"
Andreas Gampe2a5c4682015-08-14 08:22:54 -070022#include "debugger.h"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080023#include "entrypoints/runtime_asm_entrypoints.h"
24#include "interpreter/interpreter.h"
25#include "jit_code_cache.h"
26#include "jit_instrumentation.h"
Calin Juravle31f2c152015-10-23 17:56:15 +010027#include "oat_file_manager.h"
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000028#include "oat_quick_method_header.h"
Calin Juravle31f2c152015-10-23 17:56:15 +010029#include "offline_profiling_info.h"
Calin Juravle4d77b6a2015-12-01 18:38:09 +000030#include "profile_saver.h"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080031#include "runtime.h"
32#include "runtime_options.h"
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000033#include "stack_map.h"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080034#include "utils.h"
35
36namespace art {
37namespace jit {
38
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +000039static constexpr bool kEnableOnStackReplacement = true;
Nicolas Geoffraye8662132016-02-15 10:00:42 +000040
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080041JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& options) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080042 auto* jit_options = new JitOptions;
Mathieu Chartier455f67c2015-03-17 13:48:29 -070043 jit_options->use_jit_ = options.GetOrDefault(RuntimeArgumentMap::UseJIT);
Nicolas Geoffray0a3be162015-11-18 11:15:22 +000044 jit_options->code_cache_initial_capacity_ =
45 options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheInitialCapacity);
46 jit_options->code_cache_max_capacity_ =
47 options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheMaxCapacity);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080048 jit_options->compile_threshold_ =
49 options.GetOrDefault(RuntimeArgumentMap::JITCompileThreshold);
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000050 // TODO(ngeoffray): Make this a proper option.
51 jit_options->osr_threshold_ = jit_options->compile_threshold_ * 2;
Nicolas Geoffray5550ca82015-08-21 18:38:30 +010052 jit_options->warmup_threshold_ =
53 options.GetOrDefault(RuntimeArgumentMap::JITWarmupThreshold);
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070054 jit_options->dump_info_on_shutdown_ =
55 options.Exists(RuntimeArgumentMap::DumpJITInfoOnShutdown);
Calin Juravle31f2c152015-10-23 17:56:15 +010056 jit_options->save_profiling_info_ =
57 options.GetOrDefault(RuntimeArgumentMap::JITSaveProfilingInfo);;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080058 return jit_options;
59}
60
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070061void Jit::DumpInfo(std::ostream& os) {
Nicolas Geoffraybcd94c82016-03-03 13:23:33 +000062 code_cache_->Dump(os);
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070063 cumulative_timings_.Dump(os);
64}
65
66void Jit::AddTimingLogger(const TimingLogger& logger) {
67 cumulative_timings_.AddLogger(logger);
68}
69
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000070Jit::Jit() : jit_library_handle_(nullptr),
71 jit_compiler_handle_(nullptr),
72 jit_load_(nullptr),
73 jit_compile_method_(nullptr),
74 dump_info_on_shutdown_(false),
75 cumulative_timings_("JIT timings"),
76 save_profiling_info_(false),
77 generate_debug_info_(false) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080078}
79
80Jit* Jit::Create(JitOptions* options, std::string* error_msg) {
81 std::unique_ptr<Jit> jit(new Jit);
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070082 jit->dump_info_on_shutdown_ = options->DumpJitInfoOnShutdown();
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080083 if (!jit->LoadCompiler(error_msg)) {
84 return nullptr;
85 }
Nicolas Geoffray0a3be162015-11-18 11:15:22 +000086 jit->code_cache_.reset(JitCodeCache::Create(
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000087 options->GetCodeCacheInitialCapacity(),
88 options->GetCodeCacheMaxCapacity(),
89 jit->generate_debug_info_,
90 error_msg));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080091 if (jit->GetCodeCache() == nullptr) {
92 return nullptr;
93 }
Calin Juravle4d77b6a2015-12-01 18:38:09 +000094 jit->save_profiling_info_ = options->GetSaveProfilingInfo();
Nicolas Geoffraybcd94c82016-03-03 13:23:33 +000095 VLOG(jit) << "JIT created with initial_capacity="
Nicolas Geoffray0a3be162015-11-18 11:15:22 +000096 << PrettySize(options->GetCodeCacheInitialCapacity())
97 << ", max_capacity=" << PrettySize(options->GetCodeCacheMaxCapacity())
Calin Juravle4d77b6a2015-12-01 18:38:09 +000098 << ", compile_threshold=" << options->GetCompileThreshold()
99 << ", save_profiling_info=" << options->GetSaveProfilingInfo();
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800100 return jit.release();
101}
102
103bool Jit::LoadCompiler(std::string* error_msg) {
104 jit_library_handle_ = dlopen(
105 kIsDebugBuild ? "libartd-compiler.so" : "libart-compiler.so", RTLD_NOW);
106 if (jit_library_handle_ == nullptr) {
107 std::ostringstream oss;
108 oss << "JIT could not load libart-compiler.so: " << dlerror();
109 *error_msg = oss.str();
110 return false;
111 }
Nicolas Geoffray5b82d332016-02-18 14:22:32 +0000112 jit_load_ = reinterpret_cast<void* (*)(bool*)>(dlsym(jit_library_handle_, "jit_load"));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800113 if (jit_load_ == nullptr) {
114 dlclose(jit_library_handle_);
115 *error_msg = "JIT couldn't find jit_load entry point";
116 return false;
117 }
118 jit_unload_ = reinterpret_cast<void (*)(void*)>(
119 dlsym(jit_library_handle_, "jit_unload"));
120 if (jit_unload_ == nullptr) {
121 dlclose(jit_library_handle_);
122 *error_msg = "JIT couldn't find jit_unload entry point";
123 return false;
124 }
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000125 jit_compile_method_ = reinterpret_cast<bool (*)(void*, ArtMethod*, Thread*, bool)>(
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800126 dlsym(jit_library_handle_, "jit_compile_method"));
127 if (jit_compile_method_ == nullptr) {
128 dlclose(jit_library_handle_);
129 *error_msg = "JIT couldn't find jit_compile_method entry point";
130 return false;
131 }
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000132 jit_types_loaded_ = reinterpret_cast<void (*)(void*, mirror::Class**, size_t)>(
133 dlsym(jit_library_handle_, "jit_types_loaded"));
134 if (jit_types_loaded_ == nullptr) {
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000135 dlclose(jit_library_handle_);
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000136 *error_msg = "JIT couldn't find jit_types_loaded entry point";
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000137 return false;
138 }
Nicolas Geoffraya25dce92016-01-12 16:41:10 +0000139 bool will_generate_debug_symbols = false;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800140 VLOG(jit) << "Calling JitLoad interpreter_only="
141 << Runtime::Current()->GetInstrumentation()->InterpretOnly();
Nicolas Geoffray5b82d332016-02-18 14:22:32 +0000142 jit_compiler_handle_ = (jit_load_)(&will_generate_debug_symbols);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800143 if (jit_compiler_handle_ == nullptr) {
144 dlclose(jit_library_handle_);
145 *error_msg = "JIT couldn't load compiler";
146 return false;
147 }
Nicolas Geoffraya25dce92016-01-12 16:41:10 +0000148 generate_debug_info_ = will_generate_debug_symbols;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800149 return true;
150}
151
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000152bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800153 DCHECK(!method->IsRuntimeMethod());
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000154
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100155 // Don't compile the method if it has breakpoints.
Mathieu Chartierd8565452015-03-26 09:41:50 -0700156 if (Dbg::IsDebuggerActive() && Dbg::MethodHasAnyBreakpoints(method)) {
157 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to breakpoint";
158 return false;
159 }
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100160
161 // Don't compile the method if we are supposed to be deoptimized.
162 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
163 if (instrumentation->AreAllMethodsDeoptimized() || instrumentation->IsDeoptimized(method)) {
Nicolas Geoffraya42363f2015-12-17 14:57:09 +0000164 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to deoptimization";
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100165 return false;
166 }
167
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000168 // If we get a request to compile a proxy method, we pass the actual Java method
169 // of that proxy method, as the compiler does not expect a proxy method.
170 ArtMethod* method_to_compile = method->GetInterfaceMethodIfProxy(sizeof(void*));
171 if (!code_cache_->NotifyCompilationOf(method_to_compile, self, osr)) {
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100172 return false;
173 }
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000174 bool success = jit_compile_method_(jit_compiler_handle_, method_to_compile, self, osr);
175 code_cache_->DoneCompiling(method_to_compile, self);
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100176 return success;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800177}
178
179void Jit::CreateThreadPool() {
180 CHECK(instrumentation_cache_.get() != nullptr);
181 instrumentation_cache_->CreateThreadPool();
182}
183
184void Jit::DeleteThreadPool() {
185 if (instrumentation_cache_.get() != nullptr) {
Nicolas Geoffray629e9352015-11-04 17:22:16 +0000186 instrumentation_cache_->DeleteThreadPool(Thread::Current());
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800187 }
188}
189
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000190void Jit::StartProfileSaver(const std::string& filename,
Calin Juravlec90bc922016-02-24 10:13:09 +0000191 const std::vector<std::string>& code_paths,
192 const std::string& foreign_dex_profile_path,
193 const std::string& app_dir) {
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000194 if (save_profiling_info_) {
Calin Juravlec90bc922016-02-24 10:13:09 +0000195 ProfileSaver::Start(filename, code_cache_.get(), code_paths, foreign_dex_profile_path, app_dir);
Calin Juravle31f2c152015-10-23 17:56:15 +0100196 }
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000197}
198
199void Jit::StopProfileSaver() {
200 if (save_profiling_info_ && ProfileSaver::IsStarted()) {
201 ProfileSaver::Stop();
Calin Juravle31f2c152015-10-23 17:56:15 +0100202 }
203}
204
Siva Chandra05d24152016-01-05 17:43:17 -0800205bool Jit::JitAtFirstUse() {
206 if (instrumentation_cache_ != nullptr) {
207 return instrumentation_cache_->HotMethodThreshold() == 0;
208 }
209 return false;
210}
211
Nicolas Geoffray35122442016-03-02 12:05:30 +0000212bool Jit::CanInvokeCompiledCode(ArtMethod* method) {
213 return code_cache_->ContainsPc(method->GetEntryPointFromQuickCompiledCode());
214}
215
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800216Jit::~Jit() {
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000217 DCHECK(!save_profiling_info_ || !ProfileSaver::IsStarted());
Mathieu Chartiera4885cb2015-03-09 15:38:54 -0700218 if (dump_info_on_shutdown_) {
219 DumpInfo(LOG(INFO));
220 }
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800221 DeleteThreadPool();
222 if (jit_compiler_handle_ != nullptr) {
223 jit_unload_(jit_compiler_handle_);
224 }
225 if (jit_library_handle_ != nullptr) {
226 dlclose(jit_library_handle_);
227 }
228}
229
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000230void Jit::CreateInstrumentationCache(size_t compile_threshold,
231 size_t warmup_threshold,
232 size_t osr_threshold) {
Nicolas Geoffray5550ca82015-08-21 18:38:30 +0100233 instrumentation_cache_.reset(
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000234 new jit::JitInstrumentationCache(compile_threshold, warmup_threshold, osr_threshold));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800235}
236
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000237void Jit::NewTypeLoadedIfUsingJit(mirror::Class* type) {
238 jit::Jit* jit = Runtime::Current()->GetJit();
239 if (jit != nullptr && jit->generate_debug_info_) {
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000240 DCHECK(jit->jit_types_loaded_ != nullptr);
241 jit->jit_types_loaded_(jit->jit_compiler_handle_, &type, 1);
242 }
243}
244
245void Jit::DumpTypeInfoForLoadedTypes(ClassLinker* linker) {
246 struct CollectClasses : public ClassVisitor {
Mathieu Chartier1aa8ec22016-02-01 10:34:47 -0800247 bool operator()(mirror::Class* klass) override {
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000248 classes_.push_back(klass);
249 return true;
250 }
Mathieu Chartier9b1c9b72016-02-02 10:09:58 -0800251 std::vector<mirror::Class*> classes_;
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000252 };
253
254 if (generate_debug_info_) {
255 ScopedObjectAccess so(Thread::Current());
256
257 CollectClasses visitor;
258 linker->VisitClasses(&visitor);
259 jit_types_loaded_(jit_compiler_handle_, visitor.classes_.data(), visitor.classes_.size());
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000260 }
261}
262
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000263extern "C" void art_quick_osr_stub(void** stack,
264 uint32_t stack_size_in_bytes,
265 const uint8_t* native_pc,
266 JValue* result,
267 const char* shorty,
268 Thread* self);
269
270bool Jit::MaybeDoOnStackReplacement(Thread* thread,
271 ArtMethod* method,
272 uint32_t dex_pc,
273 int32_t dex_pc_offset,
274 JValue* result) {
Nicolas Geoffraye8662132016-02-15 10:00:42 +0000275 if (!kEnableOnStackReplacement) {
276 return false;
277 }
278
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000279 Jit* jit = Runtime::Current()->GetJit();
280 if (jit == nullptr) {
281 return false;
282 }
283
284 if (kRuntimeISA == kMips || kRuntimeISA == kMips64) {
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000285 VLOG(jit) << "OSR not supported on this platform: " << kRuntimeISA;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000286 return false;
287 }
288
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +0000289 if (UNLIKELY(__builtin_frame_address(0) < thread->GetStackEnd())) {
290 // Don't attempt to do an OSR if we are close to the stack limit. Since
291 // the interpreter frames are still on stack, OSR has the potential
292 // to stack overflow even for a simple loop.
293 // b/27094810.
294 return false;
295 }
296
Nicolas Geoffrayd9bc4332016-02-05 23:32:25 +0000297 // Get the actual Java method if this method is from a proxy class. The compiler
298 // and the JIT code cache do not expect methods from proxy classes.
299 method = method->GetInterfaceMethodIfProxy(sizeof(void*));
300
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000301 // Cheap check if the method has been compiled already. That's an indicator that we should
302 // osr into it.
303 if (!jit->GetCodeCache()->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) {
304 return false;
305 }
306
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000307 // Fetch some data before looking up for an OSR method. We don't want thread
308 // suspension once we hold an OSR method, as the JIT code cache could delete the OSR
309 // method while we are being suspended.
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000310 const size_t number_of_vregs = method->GetCodeItem()->registers_size_;
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000311 const char* shorty = method->GetShorty();
312 std::string method_name(VLOG_IS_ON(jit) ? PrettyMethod(method) : "");
313 void** memory = nullptr;
314 size_t frame_size = 0;
315 ShadowFrame* shadow_frame = nullptr;
316 const uint8_t* native_pc = nullptr;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000317
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000318 {
319 ScopedAssertNoThreadSuspension sts(thread, "Holding OSR method");
320 const OatQuickMethodHeader* osr_method = jit->GetCodeCache()->LookupOsrMethodHeader(method);
321 if (osr_method == nullptr) {
322 // No osr method yet, just return to the interpreter.
323 return false;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000324 }
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000325
326 CodeInfo code_info = osr_method->GetOptimizedCodeInfo();
327 StackMapEncoding encoding = code_info.ExtractEncoding();
328
329 // Find stack map starting at the target dex_pc.
330 StackMap stack_map = code_info.GetOsrStackMapForDexPc(dex_pc + dex_pc_offset, encoding);
331 if (!stack_map.IsValid()) {
332 // There is no OSR stack map for this dex pc offset. Just return to the interpreter in the
333 // hope that the next branch has one.
334 return false;
335 }
336
337 // We found a stack map, now fill the frame with dex register values from the interpreter's
338 // shadow frame.
339 DexRegisterMap vreg_map =
340 code_info.GetDexRegisterMapOf(stack_map, encoding, number_of_vregs);
341
342 frame_size = osr_method->GetFrameSizeInBytes();
343
344 // Allocate memory to put shadow frame values. The osr stub will copy that memory to
345 // stack.
346 // Note that we could pass the shadow frame to the stub, and let it copy the values there,
347 // but that is engineering complexity not worth the effort for something like OSR.
348 memory = reinterpret_cast<void**>(malloc(frame_size));
349 CHECK(memory != nullptr);
350 memset(memory, 0, frame_size);
351
352 // Art ABI: ArtMethod is at the bottom of the stack.
353 memory[0] = method;
354
355 shadow_frame = thread->PopShadowFrame();
356 if (!vreg_map.IsValid()) {
357 // If we don't have a dex register map, then there are no live dex registers at
358 // this dex pc.
359 } else {
360 for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) {
361 DexRegisterLocation::Kind location =
362 vreg_map.GetLocationKind(vreg, number_of_vregs, code_info, encoding);
363 if (location == DexRegisterLocation::Kind::kNone) {
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000364 // Dex register is dead or uninitialized.
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000365 continue;
366 }
367
368 if (location == DexRegisterLocation::Kind::kConstant) {
369 // We skip constants because the compiled code knows how to handle them.
370 continue;
371 }
372
David Srbecky7dc11782016-02-25 13:23:56 +0000373 DCHECK_EQ(location, DexRegisterLocation::Kind::kInStack);
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000374
375 int32_t vreg_value = shadow_frame->GetVReg(vreg);
376 int32_t slot_offset = vreg_map.GetStackOffsetInBytes(vreg,
377 number_of_vregs,
378 code_info,
379 encoding);
380 DCHECK_LT(slot_offset, static_cast<int32_t>(frame_size));
381 DCHECK_GT(slot_offset, 0);
382 (reinterpret_cast<int32_t*>(memory))[slot_offset / sizeof(int32_t)] = vreg_value;
383 }
384 }
385
386 native_pc = stack_map.GetNativePcOffset(encoding) + osr_method->GetEntryPoint();
387 VLOG(jit) << "Jumping to "
388 << method_name
389 << "@"
390 << std::hex << reinterpret_cast<uintptr_t>(native_pc);
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000391 }
392
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000393 {
394 ManagedStack fragment;
395 thread->PushManagedStackFragment(&fragment);
396 (*art_quick_osr_stub)(memory,
397 frame_size,
398 native_pc,
399 result,
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000400 shorty,
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000401 thread);
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000402
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000403 if (UNLIKELY(thread->GetException() == Thread::GetDeoptimizationException())) {
404 thread->DeoptimizeWithDeoptimizationException(result);
405 }
406 thread->PopManagedStackFragment(fragment);
407 }
408 free(memory);
409 thread->PushShadowFrame(shadow_frame);
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000410 VLOG(jit) << "Done running OSR code for " << method_name;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000411 return true;
412}
413
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800414} // namespace jit
415} // namespace art