Static and direct resolution stub.

Ensure that invoke static and direct go through a stub that causes
resolution and initialization.

Change-Id: I872900560322817d8f4378b04ac410d9ea0b3b17
diff --git a/src/dex_cache.h b/src/dex_cache.h
index a75d6f4..7ca6825 100644
--- a/src/dex_cache.h
+++ b/src/dex_cache.h
@@ -26,9 +26,15 @@
     return reinterpret_cast<Method*>(Get(MethodIndex(method_idx)));
   }
 
-  void SetResolvedDirectMethodTrampoline(uint32_t method_idx) {
-    UNIMPLEMENTED(WARNING) << "need to install a trampoline to resolve the method_idx at runtime";
-    Set(CodeIndex(method_idx),   0xffffffff);
+  void SetResolvedDirectMethodTrampoline(uint32_t method_idx, ByteArray* code_array,
+                                         InstructionSet instruction_set) {
+    DCHECK(code_array != NULL);
+    int32_t code = reinterpret_cast<int32_t>(code_array->GetData());
+    if (instruction_set == kThumb2) {
+      // Set the low-order bit so a BLX will switch to Thumb mode
+      code = code | 0x1;
+    }
+    Set(CodeIndex(method_idx), code);
     Set(MethodIndex(method_idx), method_idx);
   }