Update CodeAndDirectMethods

Update the CodeAndDirectMethods table following a
call to the unresolved target stub.  Removes a previous
change that tried to do this in ResolveMethod.

Change-Id: I078d3c006a54ca124f217b01b60d0bd813e189e4
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 61af24d..7ca0361 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -2626,9 +2626,6 @@
   }
   if (resolved != NULL) {
     dex_cache->SetResolvedMethod(method_idx, resolved);
-    if (is_direct && resolved->GetCode() != NULL) {
-      dex_cache->GetCodeAndDirectMethods()->SetResolvedDirectMethod(method_idx, resolved);
-    }
   } else {
     ThrowNoSuchMethodError(is_direct ? "direct" : "virtual", klass, name, signature);
   }
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index a8243e2..9b32d69 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -399,6 +399,10 @@
   }
   // Resolve method filling in dex cache
   Method* called = linker->ResolveMethod(method_idx, *caller_sp, true);
+  // Update CodeAndDirectMethod table
+  Method* caller = *caller_sp;
+  DexCache* dex_cache = caller->GetDeclaringClass()->GetDexCache();
+  dex_cache->GetCodeAndDirectMethods()->SetResolvedDirectMethod(method_idx, called);
   if (LIKELY(!thread->IsExceptionPending())) {
     // We got this far, ensure that the declaring class is initialized
     linker->EnsureInitialized(called->GetDeclaringClass(), true);