summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/jit/jit.cc2
-rw-r--r--runtime/jit/jit_code_cache.cc10
-rw-r--r--runtime/jit/jit_code_cache.h2
-rw-r--r--runtime/jit/profiling_info.h18
4 files changed, 20 insertions, 12 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 73aaf0496e..025472792d 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -208,7 +208,7 @@ bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) {
return false;
}
bool success = jit_compile_method_(jit_compiler_handle_, method_to_compile, self, osr);
- code_cache_->DoneCompiling(method_to_compile, self);
+ code_cache_->DoneCompiling(method_to_compile, self, osr);
return success;
}
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 37ff6a5dd6..820ae6acab 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -927,12 +927,12 @@ bool JitCodeCache::NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr
return false;
}
- if (info->IsMethodBeingCompiled()) {
+ if (info->IsMethodBeingCompiled(osr)) {
VLOG(jit) << PrettyMethod(method) << " is already being compiled";
return false;
}
- info->SetIsMethodBeingCompiled(true);
+ info->SetIsMethodBeingCompiled(true, osr);
return true;
}
@@ -952,10 +952,10 @@ void JitCodeCache::DoneCompilerUse(ArtMethod* method, Thread* self) {
info->DecrementInlineUse();
}
-void JitCodeCache::DoneCompiling(ArtMethod* method, Thread* self ATTRIBUTE_UNUSED) {
+void JitCodeCache::DoneCompiling(ArtMethod* method, Thread* self ATTRIBUTE_UNUSED, bool osr) {
ProfilingInfo* info = method->GetProfilingInfo(sizeof(void*));
- DCHECK(info->IsMethodBeingCompiled());
- info->SetIsMethodBeingCompiled(false);
+ DCHECK(info->IsMethodBeingCompiled(osr));
+ info->SetIsMethodBeingCompiled(false, osr);
}
size_t JitCodeCache::GetMemorySizeOfCodePointer(const void* ptr) {
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index 6faa8f15b6..9f18c700d4 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -80,7 +80,7 @@ class JitCodeCache {
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);
- void DoneCompiling(ArtMethod* method, Thread* self)
+ void DoneCompiling(ArtMethod* method, Thread* self, bool osr)
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);
diff --git a/runtime/jit/profiling_info.h b/runtime/jit/profiling_info.h
index 55d627ab48..3a71bbaec1 100644
--- a/runtime/jit/profiling_info.h
+++ b/runtime/jit/profiling_info.h
@@ -119,12 +119,18 @@ class ProfilingInfo {
InlineCache* GetInlineCache(uint32_t dex_pc);
- bool IsMethodBeingCompiled() const {
- return is_method_being_compiled_;
+ bool IsMethodBeingCompiled(bool osr) const {
+ return osr
+ ? is_osr_method_being_compiled_
+ : is_method_being_compiled_;
}
- void SetIsMethodBeingCompiled(bool value) {
- is_method_being_compiled_ = value;
+ void SetIsMethodBeingCompiled(bool value, bool osr) {
+ if (osr) {
+ is_osr_method_being_compiled_ = value;
+ } else {
+ is_method_being_compiled_ = value;
+ }
}
void SetSavedEntryPoint(const void* entry_point) {
@@ -155,7 +161,8 @@ class ProfilingInfo {
}
bool IsInUseByCompiler() const {
- return IsMethodBeingCompiled() || (current_inline_uses_ > 0);
+ return IsMethodBeingCompiled(/*osr*/ true) || IsMethodBeingCompiled(/*osr*/ false) ||
+ (current_inline_uses_ > 0);
}
private:
@@ -181,6 +188,7 @@ class ProfilingInfo {
// is implicitly guarded by the JIT code cache lock.
// TODO: Make the JIT code cache lock global.
bool is_method_being_compiled_;
+ bool is_osr_method_being_compiled_;
// When the compiler inlines the method associated to this ProfilingInfo,
// it updates this counter so that the GC does not try to clear the inline caches.