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

Change-Id: I276870096fb60a06afba7f850325d06709227b8e
3 files changed