Add StackVisitor::SetVRegReference().

Avoid converting ObjPtr<>s to uint32_t and back.

Test: m test-art-host-gtest
Test: testrunner.py --host --interpreter
Test: run-jdwp-tests.sh --mode=host --variant=X64
Test: run-jdwp-tests.sh --mode=host --variant=X64 --debug
Bug: 31113334
Change-Id: I4e5c1577930de58772b35179aa4281ae4bbca300
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index a4b579b..408ce69 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -814,13 +814,9 @@
       override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     switch (type_) {
       case art::Primitive::kPrimNot: {
-        uint32_t ptr_val;
-        art::ObjPtr<art::mirror::Object> obj(caller_->DecodeJObject(val_.l));
-        ptr_val = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(obj.Ptr()));
-        if (!visitor.SetVReg(method,
-                             static_cast<uint16_t>(slot_),
-                             ptr_val,
-                             art::kReferenceVReg)) {
+        if (!visitor.SetVRegReference(method,
+                                      static_cast<uint16_t>(slot_),
+                                      caller_->DecodeJObject(val_.l))) {
           return ERR(OPAQUE_FRAME);
         }
         break;