Support for synchronized native methods.

This change adds support for synchronized native methods by using
calls to MonitorEnter and MonitorExit on the JNIEnv*. There is
some tidying of the assembler and a straw man JNIEnv implementation.
The JNIEnv implementation just warns when MonitorEnter/Exit are called
and doesn't adhere to the correct JNIEnv layout.

Change-Id: I90ed6ec8f85f5b01b929f16e0dbdecadd0b01359
diff --git a/src/assembler_arm.cc b/src/assembler_arm.cc
index 91c259e..a519e35 100644
--- a/src/assembler_arm.cc
+++ b/src/assembler_arm.cc
@@ -1336,6 +1336,11 @@
   StoreToOffset(kStoreWord, src.AsCoreRegister(), SP, dest.Int32Value());
 }
 
+void Assembler::StoreRawPtr(FrameOffset dest, ManagedRegister src) {
+  CHECK(src.IsCoreRegister());
+  StoreToOffset(kStoreWord, src.AsCoreRegister(), SP, dest.Int32Value());
+}
+
 void Assembler::CopyRef(FrameOffset dest, FrameOffset src,
                         ManagedRegister scratch) {
   LoadFromOffset(kLoadWord, scratch.AsCoreRegister(), SP, src.Int32Value());
@@ -1468,8 +1473,7 @@
 }
 
 void Assembler::LoadReferenceFromStackHandle(ManagedRegister out_reg,
-                                             ManagedRegister in_reg,
-                                             FrameOffset shb_offset) {
+                                             ManagedRegister in_reg) {
   CHECK(out_reg.IsCoreRegister());
   CHECK(in_reg.IsCoreRegister());
   Label null_arg;
@@ -1477,8 +1481,8 @@
     LoadImmediate(out_reg.AsCoreRegister(), 0, EQ);
   }
   cmp(in_reg.AsCoreRegister(), ShifterOperand(0));
-  LoadFromOffset(kLoadWord, out_reg.AsCoreRegister(), in_reg.AsCoreRegister(),
-                 shb_offset.Int32Value(), NE);
+  LoadFromOffset(kLoadWord, out_reg.AsCoreRegister(),
+                 in_reg.AsCoreRegister(), 0, NE);
 }
 
 void Assembler::ValidateRef(ManagedRegister src, bool could_be_null) {
@@ -1489,7 +1493,7 @@
   // TODO: not validating references
 }
 
-void Assembler::Call(ManagedRegister base, MemberOffset offset,
+void Assembler::Call(ManagedRegister base, Offset offset,
                      ManagedRegister scratch) {
   CHECK(base.IsCoreRegister());
   CHECK(scratch.IsCoreRegister());
@@ -1499,13 +1503,4 @@
   // TODO: place reference map on call
 }
 
-// Emit code that will lock the reference in the given register
-void Assembler::LockReferenceOnStack(FrameOffset fr_offs) {
-  LOG(FATAL) << "TODO";
-}
-// Emit code that will unlock the reference in the given register
-void Assembler::UnLockReferenceOnStack(FrameOffset fr_offs) {
-  LOG(FATAL) << "TODO";
-}
-
 }  // namespace art