Remove FramePop trace listener if no outstanding events

Previously we would leave the JvmtiMethodTraceListener installed
forever if we even had a FramePop event requested. This was to prevent
any possible UAF issues with shadow-frames. This changes it so we will
check if there are any outstanding shadow-frames when the event is
disabled. If there are not any left we will remove it and remove the
deopts. This should improve performance after a frame-pop event is
used.

Bug: 74240081
Bug: 34414072

Test: ./test.py --host -j50
Test: Debug system-server a bit and use Step-Out.

Change-Id: I5fdb8ccce95ba51d6113df12e01bb158d210a5b2
diff --git a/openjdkjvmti/events.h b/openjdkjvmti/events.h
index 8141eff..bf12cb1 100644
--- a/openjdkjvmti/events.h
+++ b/openjdkjvmti/events.h
@@ -247,6 +247,9 @@
  private:
   void SetupTraceListener(JvmtiMethodTraceListener* listener, ArtJvmtiEvent event, bool enable);
 
+  // Specifically handle the FramePop event which it might not always be possible to turn off.
+  void SetupFramePopTraceListener(bool enable);
+
   template <ArtJvmtiEvent kEvent, typename ...Args>
   ALWAYS_INLINE
   inline std::vector<impl::EventHandlerFunc<kEvent>> CollectEvents(art::Thread* thread,