Fix setter trivial pattern matching.

Add extra rule to match "return null". Don't permit > 3 ins for the
setter pattern due to a bug in register allocation.

Change-Id: I3c0c0d9055021a68ce3454be7661c6ce047329cb
diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h
index acc7c94..afddf07 100644
--- a/src/compiler/CompilerIR.h
+++ b/src/compiler/CompilerIR.h
@@ -564,21 +564,22 @@
     {{Instruction::RETURN_VOID}, kNullMethod},
     {{Instruction::CONST, Instruction::RETURN}, kConstFunction},
     {{Instruction::CONST_4, Instruction::RETURN}, kConstFunction},
+    {{Instruction::CONST_4, Instruction::RETURN_OBJECT}, kConstFunction},
     {{Instruction::CONST_16, Instruction::RETURN}, kConstFunction},
     {{Instruction::IGET, Instruction:: RETURN}, kIGet},
-    {{Instruction::IGET_BOOLEAN, Instruction:: RETURN}, kIGetBoolean},
-    {{Instruction::IGET_OBJECT, Instruction:: RETURN}, kIGetObject},
-    {{Instruction::IGET_BYTE, Instruction:: RETURN}, kIGetByte},
-    {{Instruction::IGET_CHAR, Instruction:: RETURN}, kIGetChar},
-    {{Instruction::IGET_SHORT, Instruction:: RETURN}, kIGetShort},
-    {{Instruction::IGET_WIDE, Instruction:: RETURN_WIDE}, kIGetWide},
-    {{Instruction::IPUT, Instruction:: RETURN}, kIPut},
-    {{Instruction::IPUT_BOOLEAN, Instruction:: RETURN}, kIPutBoolean},
-    {{Instruction::IPUT_OBJECT, Instruction:: RETURN}, kIPutObject},
-    {{Instruction::IPUT_BYTE, Instruction:: RETURN}, kIPutByte},
-    {{Instruction::IPUT_CHAR, Instruction:: RETURN}, kIPutChar},
-    {{Instruction::IPUT_SHORT, Instruction:: RETURN}, kIPutShort},
-    {{Instruction::IPUT_WIDE, Instruction:: RETURN_WIDE}, kIPutWide},
+    {{Instruction::IGET_BOOLEAN, Instruction::RETURN}, kIGetBoolean},
+    {{Instruction::IGET_OBJECT, Instruction::RETURN_OBJECT}, kIGetObject},
+    {{Instruction::IGET_BYTE, Instruction::RETURN}, kIGetByte},
+    {{Instruction::IGET_CHAR, Instruction::RETURN}, kIGetChar},
+    {{Instruction::IGET_SHORT, Instruction::RETURN}, kIGetShort},
+    {{Instruction::IGET_WIDE, Instruction::RETURN_WIDE}, kIGetWide},
+    {{Instruction::IPUT, Instruction::RETURN_VOID}, kIPut},
+    {{Instruction::IPUT_BOOLEAN, Instruction::RETURN_VOID}, kIPutBoolean},
+    {{Instruction::IPUT_OBJECT, Instruction::RETURN_VOID}, kIPutObject},
+    {{Instruction::IPUT_BYTE, Instruction::RETURN_VOID}, kIPutByte},
+    {{Instruction::IPUT_CHAR, Instruction::RETURN_VOID}, kIPutChar},
+    {{Instruction::IPUT_SHORT, Instruction::RETURN_VOID}, kIPutShort},
+    {{Instruction::IPUT_WIDE, Instruction::RETURN_VOID}, kIPutWide},
 };
 
 BasicBlock* oatNewBB(CompilationUnit* cUnit, BBType blockType, int blockId);
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 8e72227..21c995f 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -118,6 +118,9 @@
     int fieldOffset;
     bool isVolatile;
     uint32_t fieldIdx = mir->dalvikInsn.vC;
+    if (cUnit->numIns > 3) {
+      return NULL;  // TODO: fix register allocation for many in arguments
+    }
     bool fastPath = fastInstance(cUnit, fieldIdx, fieldOffset, isVolatile,
                                  false);
     if (!fastPath) {