Fix interaction between JIT and instrumentation.
- The JIT needs to go through the instrumentation to update
entry points.
- The instrumention needs to know if a method got JITted
to know if needs to deoptimize.
bug:25438583
Change-Id: I4b186a1da9f4a3fb329efd052a774d5502a902a1
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 2a8cf99..dbb546d 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -456,6 +456,16 @@
return method_header;
}
+bool ArtMethod::HasAnyCompiledCode() {
+ // Check whether the JIT has compiled it.
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ if (jit != nullptr && jit->GetCodeCache()->ContainsMethod(this)) {
+ return true;
+ }
+
+ // Check whether we have AOT code.
+ return Runtime::Current()->GetClassLinker()->GetOatMethodQuickCodeFor(this) != nullptr;
+}
void ArtMethod::CopyFrom(ArtMethod* src, size_t image_pointer_size) {
memcpy(reinterpret_cast<void*>(this), reinterpret_cast<const void*>(src),