Merge "Remove InvokeVirtualOrInterface event from instrumentation."
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 43d0b10..300a009 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -843,16 +843,6 @@
return;
}
- // Call-back for when we get an invokevirtual or an invokeinterface.
- void InvokeVirtualOrInterface(art::Thread* self ATTRIBUTE_UNUSED,
- art::Handle<art::mirror::Object> this_object ATTRIBUTE_UNUSED,
- art::ArtMethod* caller ATTRIBUTE_UNUSED,
- uint32_t dex_pc ATTRIBUTE_UNUSED,
- art::ArtMethod* callee ATTRIBUTE_UNUSED)
- REQUIRES_SHARED(art::Locks::mutator_lock_) override {
- return;
- }
-
private:
EventHandler* const event_handler_;
};
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index b108920..b679cbe 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -256,17 +256,6 @@
<< " " << dex_pc << ", " << dex_pc_offset;
}
- // We only care about invokes in the Jit.
- void InvokeVirtualOrInterface(Thread* thread ATTRIBUTE_UNUSED,
- Handle<mirror::Object> this_object ATTRIBUTE_UNUSED,
- ArtMethod* method,
- uint32_t dex_pc,
- ArtMethod* target ATTRIBUTE_UNUSED)
- override REQUIRES_SHARED(Locks::mutator_lock_) {
- LOG(ERROR) << "Unexpected invoke event in debugger " << ArtMethod::PrettyMethod(method)
- << " " << dex_pc;
- }
-
// TODO Might be worth it to post ExceptionCatch event.
void ExceptionHandled(Thread* thread ATTRIBUTE_UNUSED,
Handle<mirror::Throwable> throwable ATTRIBUTE_UNUSED) override {
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index 03fd964..4937132 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -160,7 +160,6 @@
have_exception_thrown_listeners_(false),
have_watched_frame_pop_listeners_(false),
have_branch_listeners_(false),
- have_invoke_virtual_or_interface_listeners_(false),
have_exception_handled_listeners_(false),
deoptimized_methods_lock_("deoptimized methods lock", kGenericBottomLock),
deoptimization_enabled_(false),
@@ -562,11 +561,6 @@
branch_listeners_,
listener,
&have_branch_listeners_);
- PotentiallyAddListenerTo(kInvokeVirtualOrInterface,
- events,
- invoke_virtual_or_interface_listeners_,
- listener,
- &have_invoke_virtual_or_interface_listeners_);
PotentiallyAddListenerTo(kDexPcMoved,
events,
dex_pc_listeners_,
@@ -649,11 +643,6 @@
branch_listeners_,
listener,
&have_branch_listeners_);
- PotentiallyRemoveListenerFrom(kInvokeVirtualOrInterface,
- events,
- invoke_virtual_or_interface_listeners_,
- listener,
- &have_invoke_virtual_or_interface_listeners_);
PotentiallyRemoveListenerFrom(kDexPcMoved,
events,
dex_pc_listeners_,
@@ -1213,21 +1202,6 @@
}
}
-void Instrumentation::InvokeVirtualOrInterfaceImpl(Thread* thread,
- ObjPtr<mirror::Object> this_object,
- ArtMethod* caller,
- uint32_t dex_pc,
- ArtMethod* callee) const {
- Thread* self = Thread::Current();
- StackHandleScope<1> hs(self);
- Handle<mirror::Object> thiz(hs.NewHandle(this_object));
- for (InstrumentationListener* listener : invoke_virtual_or_interface_listeners_) {
- if (listener != nullptr) {
- listener->InvokeVirtualOrInterface(thread, thiz, caller, dex_pc, callee);
- }
- }
-}
-
void Instrumentation::WatchedFramePopImpl(Thread* thread, const ShadowFrame& frame) const {
for (InstrumentationListener* listener : watched_frame_pop_listeners_) {
if (listener != nullptr) {
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index e5d8800..b3fae25 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -143,14 +143,6 @@
int32_t dex_pc_offset)
REQUIRES_SHARED(Locks::mutator_lock_) = 0;
- // Call-back for when we get an invokevirtual or an invokeinterface.
- virtual void InvokeVirtualOrInterface(Thread* thread,
- Handle<mirror::Object> this_object,
- ArtMethod* caller,
- uint32_t dex_pc,
- ArtMethod* callee)
- REQUIRES_SHARED(Locks::mutator_lock_) = 0;
-
// Call-back when a shadow_frame with the needs_notify_pop_ boolean set is popped off the stack by
// either return or exceptions. Normally instrumentation listeners should ensure that there are
// shadow-frames by deoptimizing stacks.
@@ -193,7 +185,6 @@
kFieldWritten = 0x20,
kExceptionThrown = 0x40,
kBranch = 0x80,
- kInvokeVirtualOrInterface = 0x100,
kWatchedFramePop = 0x200,
kExceptionHandled = 0x400,
};
@@ -377,10 +368,6 @@
return have_branch_listeners_;
}
- bool HasInvokeVirtualOrInterfaceListeners() const REQUIRES_SHARED(Locks::mutator_lock_) {
- return have_invoke_virtual_or_interface_listeners_;
- }
-
bool HasWatchedFramePopListeners() const REQUIRES_SHARED(Locks::mutator_lock_) {
return have_watched_frame_pop_listeners_;
}
@@ -393,8 +380,8 @@
return have_dex_pc_listeners_ || have_method_entry_listeners_ || have_method_exit_listeners_ ||
have_field_read_listeners_ || have_field_write_listeners_ ||
have_exception_thrown_listeners_ || have_method_unwind_listeners_ ||
- have_branch_listeners_ || have_invoke_virtual_or_interface_listeners_ ||
- have_watched_frame_pop_listeners_ || have_exception_handled_listeners_;
+ have_branch_listeners_ || have_watched_frame_pop_listeners_ ||
+ have_exception_handled_listeners_;
}
// Any instrumentation *other* than what is needed for Jit profiling active?
@@ -470,17 +457,6 @@
}
}
- void InvokeVirtualOrInterface(Thread* thread,
- mirror::Object* this_object,
- ArtMethod* caller,
- uint32_t dex_pc,
- ArtMethod* callee) const
- REQUIRES_SHARED(Locks::mutator_lock_) {
- if (UNLIKELY(HasInvokeVirtualOrInterfaceListeners())) {
- InvokeVirtualOrInterfaceImpl(thread, this_object, caller, dex_pc, callee);
- }
- }
-
// Inform listeners that a branch has been taken (only supported by the interpreter).
void WatchedFramePopped(Thread* thread, const ShadowFrame& frame) const
REQUIRES_SHARED(Locks::mutator_lock_) {
@@ -598,12 +574,6 @@
REQUIRES_SHARED(Locks::mutator_lock_);
void BranchImpl(Thread* thread, ArtMethod* method, uint32_t dex_pc, int32_t offset) const
REQUIRES_SHARED(Locks::mutator_lock_);
- void InvokeVirtualOrInterfaceImpl(Thread* thread,
- ObjPtr<mirror::Object> this_object,
- ArtMethod* caller,
- uint32_t dex_pc,
- ArtMethod* callee) const
- REQUIRES_SHARED(Locks::mutator_lock_);
void WatchedFramePopImpl(Thread* thread, const ShadowFrame& frame) const
REQUIRES_SHARED(Locks::mutator_lock_);
void FieldReadEventImpl(Thread* thread,
@@ -683,9 +653,6 @@
// Do we have any branch listeners? Short-cut to avoid taking the instrumentation_lock_.
bool have_branch_listeners_ GUARDED_BY(Locks::mutator_lock_);
- // Do we have any invoke listeners? Short-cut to avoid taking the instrumentation_lock_.
- bool have_invoke_virtual_or_interface_listeners_ GUARDED_BY(Locks::mutator_lock_);
-
// Do we have any exception handled listeners? Short-cut to avoid taking the
// instrumentation_lock_.
bool have_exception_handled_listeners_ GUARDED_BY(Locks::mutator_lock_);
@@ -709,8 +676,6 @@
std::list<InstrumentationListener*> method_exit_listeners_ GUARDED_BY(Locks::mutator_lock_);
std::list<InstrumentationListener*> method_unwind_listeners_ GUARDED_BY(Locks::mutator_lock_);
std::list<InstrumentationListener*> branch_listeners_ GUARDED_BY(Locks::mutator_lock_);
- std::list<InstrumentationListener*> invoke_virtual_or_interface_listeners_
- GUARDED_BY(Locks::mutator_lock_);
std::list<InstrumentationListener*> dex_pc_listeners_ GUARDED_BY(Locks::mutator_lock_);
std::list<InstrumentationListener*> field_read_listeners_ GUARDED_BY(Locks::mutator_lock_);
std::list<InstrumentationListener*> field_write_listeners_ GUARDED_BY(Locks::mutator_lock_);
diff --git a/runtime/instrumentation_test.cc b/runtime/instrumentation_test.cc
index 9146245..31cfeb6 100644
--- a/runtime/instrumentation_test.cc
+++ b/runtime/instrumentation_test.cc
@@ -50,7 +50,6 @@
received_exception_thrown_event(false),
received_exception_handled_event(false),
received_branch_event(false),
- received_invoke_virtual_or_interface_event(false),
received_watched_frame_pop(false) {}
virtual ~TestInstrumentationListener() {}
@@ -146,15 +145,6 @@
received_branch_event = true;
}
- void InvokeVirtualOrInterface(Thread* thread ATTRIBUTE_UNUSED,
- Handle<mirror::Object> this_object ATTRIBUTE_UNUSED,
- ArtMethod* caller ATTRIBUTE_UNUSED,
- uint32_t dex_pc ATTRIBUTE_UNUSED,
- ArtMethod* callee ATTRIBUTE_UNUSED)
- override REQUIRES_SHARED(Locks::mutator_lock_) {
- received_invoke_virtual_or_interface_event = true;
- }
-
void WatchedFramePop(Thread* thread ATTRIBUTE_UNUSED, const ShadowFrame& frame ATTRIBUTE_UNUSED)
override REQUIRES_SHARED(Locks::mutator_lock_) {
received_watched_frame_pop = true;
@@ -172,7 +162,6 @@
received_exception_thrown_event = false;
received_exception_handled_event = false;
received_branch_event = false;
- received_invoke_virtual_or_interface_event = false;
received_watched_frame_pop = false;
}
@@ -187,7 +176,6 @@
bool received_exception_thrown_event;
bool received_exception_handled_event;
bool received_branch_event;
- bool received_invoke_virtual_or_interface_event;
bool received_watched_frame_pop;
private:
@@ -382,8 +370,6 @@
return instr->HasExceptionHandledListeners();
case instrumentation::Instrumentation::kBranch:
return instr->HasBranchListeners();
- case instrumentation::Instrumentation::kInvokeVirtualOrInterface:
- return instr->HasInvokeVirtualOrInterfaceListeners();
case instrumentation::Instrumentation::kWatchedFramePop:
return instr->HasWatchedFramePopListeners();
default:
@@ -434,9 +420,6 @@
case instrumentation::Instrumentation::kBranch:
instr->Branch(self, method, dex_pc, -1);
break;
- case instrumentation::Instrumentation::kInvokeVirtualOrInterface:
- instr->InvokeVirtualOrInterface(self, obj, method, dex_pc, method);
- break;
case instrumentation::Instrumentation::kWatchedFramePop:
instr->WatchedFramePopped(self, frame);
break;
@@ -477,8 +460,6 @@
return listener.received_exception_handled_event;
case instrumentation::Instrumentation::kBranch:
return listener.received_branch_event;
- case instrumentation::Instrumentation::kInvokeVirtualOrInterface:
- return listener.received_invoke_virtual_or_interface_event;
case instrumentation::Instrumentation::kWatchedFramePop:
return listener.received_watched_frame_pop;
default:
@@ -636,10 +617,6 @@
TestEvent(instrumentation::Instrumentation::kBranch);
}
-TEST_F(InstrumentationTest, InvokeVirtualOrInterfaceEvent) {
- TestEvent(instrumentation::Instrumentation::kInvokeVirtualOrInterface);
-}
-
TEST_F(InstrumentationTest, DeoptimizeDirectMethod) {
ScopedObjectAccess soa(Thread::Current());
jobject class_loader = LoadDex("Instrumentation");
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index a598b8f..1e4239e 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -188,15 +188,6 @@
return !self->IsExceptionPending();
}
}
- } else {
- // TODO: Remove the InvokeVirtualOrInterface instrumentation, as it was only used by the JIT.
- if (type == kVirtual || type == kInterface) {
- instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
- if (UNLIKELY(instrumentation->HasInvokeVirtualOrInterfaceListeners())) {
- instrumentation->InvokeVirtualOrInterface(
- self, receiver.Ptr(), sf_method, shadow_frame.GetDexPC(), called_method);
- }
- }
}
return DoCall<is_range, do_access_check>(called_method, self, shadow_frame, inst, inst_data,
result);
@@ -300,12 +291,6 @@
receiver, shadow_frame.GetMethod(), shadow_frame.GetDexPC(), called_method);
jit->AddSamples(self, shadow_frame.GetMethod(), 1, /*with_backedges*/false);
}
- instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
- // TODO: Remove the InvokeVirtualOrInterface instrumentation, as it was only used by the JIT.
- if (UNLIKELY(instrumentation->HasInvokeVirtualOrInterfaceListeners())) {
- instrumentation->InvokeVirtualOrInterface(
- self, receiver.Ptr(), shadow_frame.GetMethod(), shadow_frame.GetDexPC(), called_method);
- }
// No need to check since we've been quickened.
return DoCall<is_range, false>(called_method, self, shadow_frame, inst, inst_data, result);
}
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 0e8d318..4ee983d 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -888,15 +888,6 @@
LOG(ERROR) << "Unexpected branch event in tracing" << ArtMethod::PrettyMethod(method);
}
-void Trace::InvokeVirtualOrInterface(Thread*,
- Handle<mirror::Object>,
- ArtMethod* method,
- uint32_t dex_pc,
- ArtMethod*) {
- LOG(ERROR) << "Unexpected invoke event in tracing" << ArtMethod::PrettyMethod(method)
- << " " << dex_pc;
-}
-
void Trace::WatchedFramePop(Thread* self ATTRIBUTE_UNUSED,
const ShadowFrame& frame ATTRIBUTE_UNUSED) {
LOG(ERROR) << "Unexpected WatchedFramePop event in tracing";
diff --git a/runtime/trace.h b/runtime/trace.h
index 5d96493..926a34f 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -224,12 +224,6 @@
uint32_t dex_pc,
int32_t dex_pc_offset)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!*unique_methods_lock_) override;
- void InvokeVirtualOrInterface(Thread* thread,
- Handle<mirror::Object> this_object,
- ArtMethod* caller,
- uint32_t dex_pc,
- ArtMethod* callee)
- REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!*unique_methods_lock_) override;
void WatchedFramePop(Thread* thread, const ShadowFrame& frame)
REQUIRES_SHARED(Locks::mutator_lock_) override;
// Reuse an old stack trace if it exists, otherwise allocate a new one.
diff --git a/tools/tracefast-plugin/tracefast.cc b/tools/tracefast-plugin/tracefast.cc
index 4ea5b2d..98f7ea5 100644
--- a/tools/tracefast-plugin/tracefast.cc
+++ b/tools/tracefast-plugin/tracefast.cc
@@ -111,13 +111,6 @@
int32_t dex_pc_offset ATTRIBUTE_UNUSED)
override REQUIRES_SHARED(art::Locks::mutator_lock_) { }
- void InvokeVirtualOrInterface(art::Thread* thread ATTRIBUTE_UNUSED,
- art::Handle<art::mirror::Object> this_object ATTRIBUTE_UNUSED,
- art::ArtMethod* caller ATTRIBUTE_UNUSED,
- uint32_t dex_pc ATTRIBUTE_UNUSED,
- art::ArtMethod* callee ATTRIBUTE_UNUSED)
- override REQUIRES_SHARED(art::Locks::mutator_lock_) { }
-
void WatchedFramePop(art::Thread* thread ATTRIBUTE_UNUSED,
const art::ShadowFrame& frame ATTRIBUTE_UNUSED)
override REQUIRES_SHARED(art::Locks::mutator_lock_) { }