summaryrefslogtreecommitdiffstats
path: root/runtime/entrypoints/quick
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2018-06-08 15:33:21 -0700
committerAlex Light <allight@google.com>2018-07-10 08:44:17 -0700
commit2d441b1253cca39bf3078422e8f0b2f4ec1bb408 (patch)
tree3db740023b1322749856f943c4b25b8158da8a44 /runtime/entrypoints/quick
parente824cfdcfd41d400237a806ff93caca7f2e51878 (diff)
downloadart-2d441b1253cca39bf3078422e8f0b2f4ec1bb408.tar.gz
art-2d441b1253cca39bf3078422e8f0b2f4ec1bb408.tar.bz2
art-2d441b1253cca39bf3078422e8f0b2f4ec1bb408.zip
Make instrumentation trampoline able to jump to jit code
In order to get the benefit of the instrumentation trampoline it must be able to jump to jit code. This patch adds support for doing that and adds code to ensure that we will not be jumping back and forth between the trampoline and the interpreter all the time if the jit has not yet compiled the current method. Note we also disable the jit-gc when turning on these trampolines since otherwise we could end up either sending instrumentation events multiple times or running uninitialized memory. Bug: 110263880 Test: ./test/testrunner/testrunner.py --host --runtime-option=-Xplugin:libtracefast-trampolined.so Test: ./test/testrunner/testrunner.py --host --runtime-option=-Xplugin:libtracefast-trampolined.so --runtime-option=-Xjitthreshhold:0 Test: ./test.py --host Change-Id: Ie6e92ec6367452fe4fde24d520d808b7af91d1b5
Diffstat (limited to 'runtime/entrypoints/quick')
-rw-r--r--runtime/entrypoints/quick/quick_trampoline_entrypoints.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index c894406e98..a4dea37f68 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -38,6 +38,7 @@
#include "interpreter/interpreter_common.h"
#include "interpreter/shadow_frame-inl.h"
#include "jit/jit.h"
+#include "jit/jit_code_cache.h"
#include "linear_alloc.h"
#include "method_handles.h"
#include "mirror/class-inl.h"
@@ -1107,7 +1108,20 @@ extern "C" const void* artInstrumentationMethodEntryFromCode(ArtMethod* method,
if (instrumentation->IsDeoptimized(method)) {
result = GetQuickToInterpreterBridge();
} else {
- result = instrumentation->GetQuickCodeFor(method, kRuntimePointerSize);
+ // This will get the entry point either from the oat file, the JIT or the appropriate bridge
+ // method if none of those can be found.
+ result = instrumentation->GetCodeForInvoke(method);
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ DCHECK_NE(result, GetQuickInstrumentationEntryPoint()) << method->PrettyMethod();
+ DCHECK(jit == nullptr ||
+ // Native methods come through here in Interpreter entrypoints. We might not have
+ // disabled jit-gc but that is fine since we won't return jit-code for native methods.
+ method->IsNative() ||
+ !jit->GetCodeCache()->GetGarbageCollectCode());
+ DCHECK(!method->IsNative() ||
+ jit == nullptr ||
+ !jit->GetCodeCache()->ContainsPc(result))
+ << method->PrettyMethod() << " code will jump to possibly cleaned up jit code!";
}
bool interpreter_entry = (result == GetQuickToInterpreterBridge());