diff options
author | 2023-08-21 14:57:44 +0000 | |
---|---|---|
committer | 2023-09-15 06:32:28 +0000 | |
commit | f5575f8e6a8d159bf8304ab4711fb9887c020476 (patch) | |
tree | 8da342263986362436deaf856dcd90df56946470 | |
parent | 4ba1b021732bebda8289cbc60f3e0a2444ce6bbb (diff) |
Add a fast path for method tracing in artMethodExitHooks
Method tracing doesn't need any deoptimization checks or the return
value. So implement a fast path for this case. This has a minor (0.5%)
improvement in performance on golem benchmarks with tracing.
Bug: 259258187
Test: art/test.py --trace --stream
Change-Id: I38fd0cbd8615a5eca1a46eb500aa86d76f7dd98b
-rw-r--r-- | runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 10 | ||||
-rw-r--r-- | runtime/instrumentation.h | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index f43ab0d268..9c5fe5f096 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -2548,8 +2548,16 @@ extern "C" void artMethodExitHook(Thread* self, instrumentation::Instrumentation* instr = Runtime::Current()->GetInstrumentation(); DCHECK(instr->RunExitHooks()); - bool is_ref = false; ArtMethod* method = *sp; + if (instr->HasFastMethodExitListeners()) { + // Fast method listeners are only used for tracing which don't need any deoptimization checks + // or a return value. + JValue return_value; + instr->MethodExitEvent(self, method, /* frame= */ {}, return_value); + return; + } + + bool is_ref = false; if (instr->HasMethodExitListeners()) { StackHandleScope<1> hs(self); diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h index fde3f1a4c5..f1692cfa68 100644 --- a/runtime/instrumentation.h +++ b/runtime/instrumentation.h @@ -378,6 +378,10 @@ class Instrumentation { return have_method_exit_listeners_ != 0; } + bool HasFastMethodExitListeners() const REQUIRES_SHARED(Locks::mutator_lock_) { + return have_method_exit_listeners_ == kFastTraceListeners; + } + bool HasMethodUnwindListeners() const REQUIRES_SHARED(Locks::mutator_lock_) { return have_method_unwind_listeners_; } |