Fixed issue in structural redefinition around class init

On non-x86 ISAs class initialization is two stage with a class first
being 'kInitialized' and later being 'kVisiblyInitialized'. This has
to do with the memory model of non-x86 ISAs. Because we did not follow
this process correctly we could hit check-failures on non-x86 targets
if the redefined class was not fully initialized when being redefined.

To fix this we force the class-linker to bring the initialization
state of the newly created class all the way to visibly initialized
before allowing the redefinition to take place.

Test: ./test.py --target
Bug: 134162467
Bug: 141236848
Change-Id: I466861270b957a0fe6a90bda0bdabece950f99b2
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 10b9da1..93fb8a3 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -387,6 +387,15 @@
   }
 }
 
+void ClassLinker::ForceClassInitialized(Thread* self, Handle<mirror::Class> klass) {
+  ClassLinker::VisiblyInitializedCallback* cb = MarkClassInitialized(self, klass);
+  if (cb != nullptr) {
+    cb->MakeVisible(self);
+  }
+  ScopedThreadSuspension sts(self, ThreadState::kSuspended);
+  MakeInitializedClassesVisiblyInitialized(self, /*wait=*/true);
+}
+
 ClassLinker::VisiblyInitializedCallback* ClassLinker::MarkClassInitialized(
     Thread* self, Handle<mirror::Class> klass) {
   if (kRuntimeISA == InstructionSet::kX86 || kRuntimeISA == InstructionSet::kX86_64) {