OSDN Git Service

Perform write barrier on declaring class when adding instrumentation
authorMathieu Chartier <mathieuc@google.com>
Fri, 2 Oct 2015 20:08:39 +0000 (13:08 -0700)
committerMathieu Chartier <mathieuc@google.com>
Fri, 2 Oct 2015 20:49:47 +0000 (13:49 -0700)
Since the instrumentation is marked from the declaring class we need
to mark the card so that mod-union tables and card rescanning know
about the update.

This fixes some moving GC crashes on eng builds.

Bug: 24133607

(cherry picked from commit b5bba5966045258fd8b755fb65e381cd7fb9c311)

Change-Id: Ibe8430e32e161d33ce0a6782e8dc252e5c86c8da

runtime/jit/jit_instrumentation.cc

index e9c16c1..9b9c5d2 100644 (file)
@@ -111,6 +111,9 @@ void JitInstrumentationListener::InvokeVirtualOrInterface(Thread* thread,
   DCHECK(this_object != nullptr);
   ProfilingInfo* info = caller->GetProfilingInfo(sizeof(void*));
   if (info != nullptr) {
+    // Since the instrumentation is marked from the declaring class we need to mark the card so
+    // that mod-union tables and card rescanning know about the update.
+    Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(caller->GetDeclaringClass());
     info->AddInvokeInfo(thread, dex_pc, this_object->GetClass());
   }
 }