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/calling_convention.h b/src/calling_convention.h
index cf12692..4e2eab7 100644
--- a/src/calling_convention.h
+++ b/src/calling_convention.h
@@ -17,6 +17,8 @@
 
   bool IsReturnAReference() const { return method_->IsReturnAReference(); }
 
+  size_t SizeOfReturnValue() const { return method_->ReturnSize(); }
+
   // Register that holds the incoming method argument
   ManagedRegister MethodRegister();
   // Register that holds result of this method
@@ -66,7 +68,7 @@
   bool IsCurrentParamInRegister();
   bool IsCurrentParamOnStack();
   bool IsCurrentParamPossiblyNull();
-  size_t CurrentParamSizeInBytes();
+  size_t CurrentParamSize();
   ManagedRegister CurrentParamRegister();
   FrameOffset CurrentParamStackOffset();
 
@@ -77,10 +79,10 @@
 // | incoming stack args    | <-- Prior SP
 // | { Spilled registers    |
 // |   & return address }   |
-// | { Saved JNI Env Data } |
+// | { Return value spill } |     (live on return slow paths)
 // | { Stack Handle Block   |
 // |   ...                  |
-// |   length/link }        |     (here to prior SP is frame size)
+// |   num. refs./link }    |     (here to prior SP is frame size)
 // | Method*                | <-- Anchor SP written to thread
 // | { Outgoing stack args  |
 // |   ... }                | <-- SP at point of call
@@ -98,6 +100,9 @@
   size_t OutArgSize();
   // Number of handles in stack handle block
   size_t HandleCount();
+  // Location where the return value of a call can be squirreled if another
+  // call is made following the native call
+  FrameOffset ReturnValueSaveLocation();
 
   // Iterator interface
   bool HasNext();
@@ -105,7 +110,7 @@
   bool IsCurrentParamAReference();
   bool IsCurrentParamInRegister();
   bool IsCurrentParamOnStack();
-  size_t CurrentParamSizeInBytes();
+  size_t CurrentParamSize();
   ManagedRegister CurrentParamRegister();
   FrameOffset CurrentParamStackOffset();