Call ReferenceQueue add outside of active GC block

We were calling ReferenceQueue.add within the runtime GC active block.
This caused java code to be run and could (potentially) cause
deadlocks with JVMTI and debuggers.

To fix this we collect the cleared references during the GC and only
enqueue them after FinishGC.

Test: ./test.py --host
Test: atest CtsJdwpTunnelHostTestCases # with goldfish emulator
Test: ./art/tools/run-libjdwp-tests.sh --mode=host
Bug: 132460313

(cherry picked from commit e302088f50244f10c90e5f40b6e05c9574c4cf32)

Merged-In: I276870096fb60a06afba7f850325d06709227b8e
Change-Id: I276870096fb60a06afba7f850325d06709227b8e
3 files changed