blob: bdc7ee24284b49ec42b58c62b53858a5814ba41e [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 Geoffrayaee21562015-12-15 16:39:44 +000062 os << "JIT code cache size=" << PrettySize(code_cache_->CodeCacheSize()) << "\n"
63 << "JIT data cache size=" << PrettySize(code_cache_->DataCacheSize()) << "\n"
64 << "JIT current capacity=" << PrettySize(code_cache_->GetCurrentCapacity()) << "\n"
Nicolas Geoffray0a522232016-01-19 09:34:58 +000065 << "JIT number of compiled code=" << code_cache_->NumberOfCompiledCode() << "\n"
66 << "JIT total number of compilations=" << code_cache_->NumberOfCompilations() << "\n";
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070067 cumulative_timings_.Dump(os);
68}
69
70void Jit::AddTimingLogger(const TimingLogger& logger) {
71 cumulative_timings_.AddLogger(logger);
72}
73
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000074Jit::Jit() : jit_library_handle_(nullptr),
75 jit_compiler_handle_(nullptr),
76 jit_load_(nullptr),
77 jit_compile_method_(nullptr),
78 dump_info_on_shutdown_(false),
79 cumulative_timings_("JIT timings"),
80 save_profiling_info_(false),
81 generate_debug_info_(false) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080082}
83
84Jit* Jit::Create(JitOptions* options, std::string* error_msg) {
85 std::unique_ptr<Jit> jit(new Jit);
Mathieu Chartiera4885cb2015-03-09 15:38:54 -070086 jit->dump_info_on_shutdown_ = options->DumpJitInfoOnShutdown();
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080087 if (!jit->LoadCompiler(error_msg)) {
88 return nullptr;
89 }
Nicolas Geoffray0a3be162015-11-18 11:15:22 +000090 jit->code_cache_.reset(JitCodeCache::Create(
Nicolas Geoffraya25dce92016-01-12 16:41:10 +000091 options->GetCodeCacheInitialCapacity(),
92 options->GetCodeCacheMaxCapacity(),
93 jit->generate_debug_info_,
94 error_msg));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080095 if (jit->GetCodeCache() == nullptr) {
96 return nullptr;
97 }
Calin Juravle4d77b6a2015-12-01 18:38:09 +000098 jit->save_profiling_info_ = options->GetSaveProfilingInfo();
Nicolas Geoffray0a3be162015-11-18 11:15:22 +000099 LOG(INFO) << "JIT created with initial_capacity="
100 << PrettySize(options->GetCodeCacheInitialCapacity())
101 << ", max_capacity=" << PrettySize(options->GetCodeCacheMaxCapacity())
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000102 << ", compile_threshold=" << options->GetCompileThreshold()
103 << ", save_profiling_info=" << options->GetSaveProfilingInfo();
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800104 return jit.release();
105}
106
107bool Jit::LoadCompiler(std::string* error_msg) {
108 jit_library_handle_ = dlopen(
109 kIsDebugBuild ? "libartd-compiler.so" : "libart-compiler.so", RTLD_NOW);
110 if (jit_library_handle_ == nullptr) {
111 std::ostringstream oss;
112 oss << "JIT could not load libart-compiler.so: " << dlerror();
113 *error_msg = oss.str();
114 return false;
115 }
Nicolas Geoffray5b82d332016-02-18 14:22:32 +0000116 jit_load_ = reinterpret_cast<void* (*)(bool*)>(dlsym(jit_library_handle_, "jit_load"));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800117 if (jit_load_ == nullptr) {
118 dlclose(jit_library_handle_);
119 *error_msg = "JIT couldn't find jit_load entry point";
120 return false;
121 }
122 jit_unload_ = reinterpret_cast<void (*)(void*)>(
123 dlsym(jit_library_handle_, "jit_unload"));
124 if (jit_unload_ == nullptr) {
125 dlclose(jit_library_handle_);
126 *error_msg = "JIT couldn't find jit_unload entry point";
127 return false;
128 }
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000129 jit_compile_method_ = reinterpret_cast<bool (*)(void*, ArtMethod*, Thread*, bool)>(
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800130 dlsym(jit_library_handle_, "jit_compile_method"));
131 if (jit_compile_method_ == nullptr) {
132 dlclose(jit_library_handle_);
133 *error_msg = "JIT couldn't find jit_compile_method entry point";
134 return false;
135 }
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000136 jit_types_loaded_ = reinterpret_cast<void (*)(void*, mirror::Class**, size_t)>(
137 dlsym(jit_library_handle_, "jit_types_loaded"));
138 if (jit_types_loaded_ == nullptr) {
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000139 dlclose(jit_library_handle_);
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000140 *error_msg = "JIT couldn't find jit_types_loaded entry point";
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000141 return false;
142 }
Nicolas Geoffraya25dce92016-01-12 16:41:10 +0000143 bool will_generate_debug_symbols = false;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800144 VLOG(jit) << "Calling JitLoad interpreter_only="
145 << Runtime::Current()->GetInstrumentation()->InterpretOnly();
Nicolas Geoffray5b82d332016-02-18 14:22:32 +0000146 jit_compiler_handle_ = (jit_load_)(&will_generate_debug_symbols);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800147 if (jit_compiler_handle_ == nullptr) {
148 dlclose(jit_library_handle_);
149 *error_msg = "JIT couldn't load compiler";
150 return false;
151 }
Nicolas Geoffraya25dce92016-01-12 16:41:10 +0000152 generate_debug_info_ = will_generate_debug_symbols;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800153 return true;
154}
155
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000156bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800157 DCHECK(!method->IsRuntimeMethod());
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000158
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100159 // Don't compile the method if it has breakpoints.
Mathieu Chartierd8565452015-03-26 09:41:50 -0700160 if (Dbg::IsDebuggerActive() && Dbg::MethodHasAnyBreakpoints(method)) {
161 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to breakpoint";
162 return false;
163 }
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100164
165 // Don't compile the method if we are supposed to be deoptimized.
166 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
167 if (instrumentation->AreAllMethodsDeoptimized() || instrumentation->IsDeoptimized(method)) {
Nicolas Geoffraya42363f2015-12-17 14:57:09 +0000168 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to deoptimization";
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100169 return false;
170 }
171
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000172 // If we get a request to compile a proxy method, we pass the actual Java method
173 // of that proxy method, as the compiler does not expect a proxy method.
174 ArtMethod* method_to_compile = method->GetInterfaceMethodIfProxy(sizeof(void*));
175 if (!code_cache_->NotifyCompilationOf(method_to_compile, self, osr)) {
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000176 VLOG(jit) << "JIT not compiling " << PrettyMethod(method) << " due to code cache";
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100177 return false;
178 }
Nicolas Geoffrayd9994f02016-02-11 17:35:55 +0000179 bool success = jit_compile_method_(jit_compiler_handle_, method_to_compile, self, osr);
180 code_cache_->DoneCompiling(method_to_compile, self);
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100181 return success;
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800182}
183
184void Jit::CreateThreadPool() {
185 CHECK(instrumentation_cache_.get() != nullptr);
186 instrumentation_cache_->CreateThreadPool();
187}
188
189void Jit::DeleteThreadPool() {
190 if (instrumentation_cache_.get() != nullptr) {
Nicolas Geoffray629e9352015-11-04 17:22:16 +0000191 instrumentation_cache_->DeleteThreadPool(Thread::Current());
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800192 }
193}
194
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000195void Jit::StartProfileSaver(const std::string& filename,
196 const std::vector<std::string>& code_paths) {
197 if (save_profiling_info_) {
198 ProfileSaver::Start(filename, code_cache_.get(), code_paths);
Calin Juravle31f2c152015-10-23 17:56:15 +0100199 }
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000200}
201
202void Jit::StopProfileSaver() {
203 if (save_profiling_info_ && ProfileSaver::IsStarted()) {
204 ProfileSaver::Stop();
Calin Juravle31f2c152015-10-23 17:56:15 +0100205 }
206}
207
Siva Chandra05d24152016-01-05 17:43:17 -0800208bool Jit::JitAtFirstUse() {
209 if (instrumentation_cache_ != nullptr) {
210 return instrumentation_cache_->HotMethodThreshold() == 0;
211 }
212 return false;
213}
214
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800215Jit::~Jit() {
Calin Juravle4d77b6a2015-12-01 18:38:09 +0000216 DCHECK(!save_profiling_info_ || !ProfileSaver::IsStarted());
Mathieu Chartiera4885cb2015-03-09 15:38:54 -0700217 if (dump_info_on_shutdown_) {
218 DumpInfo(LOG(INFO));
219 }
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800220 DeleteThreadPool();
221 if (jit_compiler_handle_ != nullptr) {
222 jit_unload_(jit_compiler_handle_);
223 }
224 if (jit_library_handle_ != nullptr) {
225 dlclose(jit_library_handle_);
226 }
227}
228
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000229void Jit::CreateInstrumentationCache(size_t compile_threshold,
230 size_t warmup_threshold,
231 size_t osr_threshold) {
Nicolas Geoffray5550ca82015-08-21 18:38:30 +0100232 instrumentation_cache_.reset(
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000233 new jit::JitInstrumentationCache(compile_threshold, warmup_threshold, osr_threshold));
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800234}
235
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000236void Jit::NewTypeLoadedIfUsingJit(mirror::Class* type) {
237 jit::Jit* jit = Runtime::Current()->GetJit();
238 if (jit != nullptr && jit->generate_debug_info_) {
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000239 DCHECK(jit->jit_types_loaded_ != nullptr);
240 jit->jit_types_loaded_(jit->jit_compiler_handle_, &type, 1);
241 }
242}
243
244void Jit::DumpTypeInfoForLoadedTypes(ClassLinker* linker) {
245 struct CollectClasses : public ClassVisitor {
Mathieu Chartier1aa8ec22016-02-01 10:34:47 -0800246 bool operator()(mirror::Class* klass) override {
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000247 classes_.push_back(klass);
248 return true;
249 }
Mathieu Chartier9b1c9b72016-02-02 10:09:58 -0800250 std::vector<mirror::Class*> classes_;
Tamas Berghammerfffbee42016-01-15 13:09:34 +0000251 };
252
253 if (generate_debug_info_) {
254 ScopedObjectAccess so(Thread::Current());
255
256 CollectClasses visitor;
257 linker->VisitClasses(&visitor);
258 jit_types_loaded_(jit_compiler_handle_, visitor.classes_.data(), visitor.classes_.size());
Tamas Berghammer160e6df2016-01-05 14:29:02 +0000259 }
260}
261
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000262extern "C" void art_quick_osr_stub(void** stack,
263 uint32_t stack_size_in_bytes,
264 const uint8_t* native_pc,
265 JValue* result,
266 const char* shorty,
267 Thread* self);
268
269bool Jit::MaybeDoOnStackReplacement(Thread* thread,
270 ArtMethod* method,
271 uint32_t dex_pc,
272 int32_t dex_pc_offset,
273 JValue* result) {
Nicolas Geoffraye8662132016-02-15 10:00:42 +0000274 if (!kEnableOnStackReplacement) {
275 return false;
276 }
277
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000278 Jit* jit = Runtime::Current()->GetJit();
279 if (jit == nullptr) {
280 return false;
281 }
282
283 if (kRuntimeISA == kMips || kRuntimeISA == kMips64) {
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000284 VLOG(jit) << "OSR not supported on this platform: " << kRuntimeISA;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000285 return false;
286 }
287
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +0000288 if (UNLIKELY(__builtin_frame_address(0) < thread->GetStackEnd())) {
289 // Don't attempt to do an OSR if we are close to the stack limit. Since
290 // the interpreter frames are still on stack, OSR has the potential
291 // to stack overflow even for a simple loop.
292 // b/27094810.
293 return false;
294 }
295
Nicolas Geoffrayd9bc4332016-02-05 23:32:25 +0000296 // Get the actual Java method if this method is from a proxy class. The compiler
297 // and the JIT code cache do not expect methods from proxy classes.
298 method = method->GetInterfaceMethodIfProxy(sizeof(void*));
299
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000300 // Cheap check if the method has been compiled already. That's an indicator that we should
301 // osr into it.
302 if (!jit->GetCodeCache()->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) {
303 return false;
304 }
305
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000306 // Fetch some data before looking up for an OSR method. We don't want thread
307 // suspension once we hold an OSR method, as the JIT code cache could delete the OSR
308 // method while we are being suspended.
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000309 const size_t number_of_vregs = method->GetCodeItem()->registers_size_;
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000310 const char* shorty = method->GetShorty();
311 std::string method_name(VLOG_IS_ON(jit) ? PrettyMethod(method) : "");
312 void** memory = nullptr;
313 size_t frame_size = 0;
314 ShadowFrame* shadow_frame = nullptr;
315 const uint8_t* native_pc = nullptr;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000316
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000317 {
318 ScopedAssertNoThreadSuspension sts(thread, "Holding OSR method");
319 const OatQuickMethodHeader* osr_method = jit->GetCodeCache()->LookupOsrMethodHeader(method);
320 if (osr_method == nullptr) {
321 // No osr method yet, just return to the interpreter.
322 return false;
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +0000323 }
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000324
325 CodeInfo code_info = osr_method->GetOptimizedCodeInfo();
326 StackMapEncoding encoding = code_info.ExtractEncoding();
327
328 // Find stack map starting at the target dex_pc.
329 StackMap stack_map = code_info.GetOsrStackMapForDexPc(dex_pc + dex_pc_offset, encoding);
330 if (!stack_map.IsValid()) {
331 // There is no OSR stack map for this dex pc offset. Just return to the interpreter in the
332 // hope that the next branch has one.
333 return false;
334 }
335
336 // We found a stack map, now fill the frame with dex register values from the interpreter's
337 // shadow frame.
338 DexRegisterMap vreg_map =
339 code_info.GetDexRegisterMapOf(stack_map, encoding, number_of_vregs);
340
341 frame_size = osr_method->GetFrameSizeInBytes();
342
343 // Allocate memory to put shadow frame values. The osr stub will copy that memory to
344 // stack.
345 // Note that we could pass the shadow frame to the stub, and let it copy the values there,
346 // but that is engineering complexity not worth the effort for something like OSR.
347 memory = reinterpret_cast<void**>(malloc(frame_size));
348 CHECK(memory != nullptr);
349 memset(memory, 0, frame_size);
350
351 // Art ABI: ArtMethod is at the bottom of the stack.
352 memory[0] = method;
353
354 shadow_frame = thread->PopShadowFrame();
355 if (!vreg_map.IsValid()) {
356 // If we don't have a dex register map, then there are no live dex registers at
357 // this dex pc.
358 } else {
359 for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) {
360 DexRegisterLocation::Kind location =
361 vreg_map.GetLocationKind(vreg, number_of_vregs, code_info, encoding);
362 if (location == DexRegisterLocation::Kind::kNone) {
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000363 // Dex register is dead or uninitialized.
Nicolas Geoffrayd186dd82016-02-16 10:03:44 +0000364 continue;
365 }
366
367 if (location == DexRegisterLocation::Kind::kConstant) {
368 // We skip constants because the compiled code knows how to handle them.
369 continue;
370 }
371
Nicolas Geoffrayc0b27962016-02-16 12:06:05 +0000372 DCHECK(location == DexRegisterLocation::Kind::kInStack)
373 << DexRegisterLocation::PrettyDescriptor(location);
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