Remove suspend point from field loading

The error was that we had a partially constructed field array when we
got suspended by moving GC. This caused the already allocated fields
to not get updated, and be stale roots the next GC. Fixes test 125
with GSS collector.

Change-Id: I7278def915f540b6a9d12677a6ba61637f5949a2
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 935c401..0d92fc2 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1927,7 +1927,6 @@
   ArtField* sfields = num_sfields != 0 ? AllocArtFieldArray(self, num_sfields) : nullptr;
   for (size_t i = 0; it.HasNextStaticField(); i++, it.Next()) {
     CHECK_LT(i, num_sfields);
-    self->AllowThreadSuspension();
     LoadField(it, klass, &sfields[i]);
   }
   klass->SetSFields(sfields);
@@ -1938,13 +1937,14 @@
   ArtField* ifields = num_ifields != 0 ? AllocArtFieldArray(self, num_ifields) : nullptr;
   for (size_t i = 0; it.HasNextInstanceField(); i++, it.Next()) {
     CHECK_LT(i, num_ifields);
-    self->AllowThreadSuspension();
     LoadField(it, klass, &ifields[i]);
   }
   klass->SetIFields(ifields);
   klass->SetNumInstanceFields(num_ifields);
   DCHECK_EQ(klass->NumInstanceFields(), num_ifields);
-
+  // Note: We cannot have thread suspension until the field arrays are setup or else
+  // Class::VisitFieldRoots may miss some fields.
+  self->AllowThreadSuspension();
   // Load methods.
   if (it.NumDirectMethods() != 0) {
     // TODO: append direct methods to class object