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
3 files changed