Check that classes are loaded before updating entrypoints.

We were trying to update the entrypoints of methods taken from classes
that were not yet loaded. This means we were racing the class-loading
and were sometimes reading methods that had not been fully initialized
yet.

Test: stress --cpu 60
Test: while ./test/run-test --host --jit 1916; do ; done
Bug: 66933582
Change-Id: Ib2aea9c9865f838af525366efa88adecc1744865
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 32dd69e..0282fbc 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -842,6 +842,12 @@
 
     bool operator()(art::ObjPtr<art::mirror::Class> klass)
         OVERRIDE REQUIRES(art::Locks::mutator_lock_) {
+      if (!klass->IsLoaded()) {
+        // Skip classes that aren't loaded since they might not have fully allocated and initialized
+        // their methods. Furthemore since the jvmti-plugin must have been loaded by this point
+        // these methods will definitately be using debuggable code.
+        return true;
+      }
       for (auto& m : klass->GetMethods(art::kRuntimePointerSize)) {
         const void* code = m.GetEntryPointFromQuickCompiledCode();
         if (m.IsNative() || m.IsProxyMethod()) {