Move Heap::GetInstances to use Handles

Prevent moving GC bugs from VisitObjects. Fix JDWP tests.

Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X32' --debug

Bug: 31113334
Change-Id: Ie7f51f1980ec0c1eddc3b59c3e49564eacb3be85
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 796b51d..6d37140 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -342,9 +342,10 @@
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Implements JDWP RT_Instances.
-  void GetInstances(Handle<mirror::Class> c,
+  void GetInstances(VariableSizedHandleScope& scope,
+                    Handle<mirror::Class> c,
                     int32_t max_count,
-                    std::vector<ObjPtr<mirror::Object>>& instances)
+                    std::vector<Handle<mirror::Object>>& instances)
       REQUIRES(!Locks::heap_bitmap_lock_, !*gc_complete_lock_)
       REQUIRES_SHARED(Locks::mutator_lock_);