OSDN Git Service

Add handle wrapper for interpreter iget/iput quick
authorMathieu Chartier <mathieuc@google.com>
Thu, 27 Oct 2016 05:57:02 +0000 (22:57 -0700)
committerMathieu Chartier <mathieuc@google.com>
Thu, 27 Oct 2016 06:18:55 +0000 (23:18 -0700)
JDWP has thread suspension in instrumentation listeners. The fix is
to use handle wrappers here. This change fixes JDWP tests.

Bug: 31113334

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

Change-Id: Ic7dcb1201ec44946e8002547b2f7f5645b4dea48

runtime/interpreter/interpreter_common.cc

index f212cda..1ed3d55 100644 (file)
@@ -163,6 +163,9 @@ bool DoIGetQuick(ShadowFrame& shadow_frame, const Instruction* inst, uint16_t in
                                                         field_offset.Uint32Value());
     DCHECK(f != nullptr);
     DCHECK(!f->IsStatic());
+    StackHandleScope<1> hs(Thread::Current());
+    // Save obj in case the instrumentation event has thread suspension.
+    HandleWrapperObjPtr<mirror::Object> h = hs.NewHandleWrapper(&obj);
     instrumentation->FieldReadEvent(Thread::Current(),
                                     obj.Ptr(),
                                     shadow_frame.GetMethod(),
@@ -392,6 +395,9 @@ bool DoIPutQuick(const ShadowFrame& shadow_frame, const Instruction* inst, uint1
     DCHECK(f != nullptr);
     DCHECK(!f->IsStatic());
     JValue field_value = GetFieldValue<field_type>(shadow_frame, vregA);
+    StackHandleScope<1> hs(Thread::Current());
+    // Save obj in case the instrumentation event has thread suspension.
+    HandleWrapperObjPtr<mirror::Object> h = hs.NewHandleWrapper(&obj);
     instrumentation->FieldWriteEvent(Thread::Current(),
                                      obj.Ptr(),
                                      shadow_frame.GetMethod(),