Implicit null/suspend checks (oat version bump)

This adds the ability to use SEGV signals
to throw NullPointerException exceptions from Java code rather
than having the compiler generate explicit comparisons and
branches.  It does this by using sigaction to trap SIGSEGV and when triggered
makes sure it's in compiled code and if so, sets the return
address to the entry point to throw the exception.

It also uses this signal mechanism to determine whether to check
for thread suspension.  Instead of the compiler generating calls
to a function to check for threads being suspended, the compiler
will now load indirect via an address in the TLS area.  To trigger
a suspend, the contents of this address are changed from something
valid to 0.  A SIGSEGV will occur and the handler will check
for a valid instruction pattern before invoking the thread
suspension check code.

If a user program taps SIGSEGV it will prevent our signal handler
working.  This will cause a failure in the runtime.

There are two signal handlers at present.  You can control them
individually using the flags -implicit-checks: on the runtime
command line.  This takes a string parameter, a comma
separated set of strings.  Each can be one of:

none        switch off
null        null pointer checks
suspend     suspend checks
all         all checks

So to switch only suspend checks on, pass:
-implicit-checks:suspend

There is also -explicit-checks to provide the reverse once
we change the default.

For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar

The default is -implicit-checks:none

There is also a property 'dalvik.vm.implicit_checks' whose value is the same
string as the command option.  The default is 'none'.  For example to switch on
null checks using the option:

setprop dalvik.vm.implicit_checks null

It only works for ARM right now.

Bumps OAT version number due to change to Thread offsets.

Bug: 13121132
Change-Id: If743849138162f3c7c44a523247e413785677370
diff --git a/runtime/thread.h b/runtime/thread.h
index eaffc3e..264a927 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -433,6 +433,10 @@
     return ThreadOffset(OFFSETOF_MEMBER(Thread, state_and_flags_));
   }
 
+  static ThreadOffset ThreadSuspendTriggerOffset() {
+    return ThreadOffset(OFFSETOF_MEMBER(Thread, suspend_trigger_));
+  }
+
   // Size of stack less any space reserved for stack overflow
   size_t GetStackSize() const {
     return stack_size_ - (stack_end_ - stack_begin_);
@@ -824,6 +828,10 @@
   PortableEntryPoints portable_entrypoints_;
   QuickEntryPoints quick_entrypoints_;
 
+  // Setting this to 0 will trigger a SEGV and thus a suspend check.  It is normally
+  // set to the address of itself.
+  uintptr_t* suspend_trigger_;
+
   // How many times has our pthread key's destructor been called?
   uint32_t thread_exit_check_count_;
 
@@ -838,6 +846,20 @@
   mirror::Object* AllocTlab(size_t bytes);
   void SetTlab(byte* start, byte* end);
 
+  // Remove the suspend trigger for this thread by making the suspend_trigger_ TLS value
+  // equal to a valid pointer.
+  // TODO: does this need to atomic?  I don't think so.
+  void RemoveSuspendTrigger() {
+    suspend_trigger_ = reinterpret_cast<uintptr_t*>(&suspend_trigger_);
+  }
+
+  // Trigger a suspend check by making the suspend_trigger_ TLS value an invalid pointer.
+  // The next time a suspend check is done, it will load from the value at this address
+  // and trigger a SIGSEGV.
+  void TriggerSuspend() {
+    suspend_trigger_ = nullptr;
+  }
+
   // Thread-local rosalloc runs. There are 34 size brackets in rosalloc
   // runs (RosAlloc::kNumOfSizeBrackets). We can't refer to the
   // RosAlloc class due to a header file circular dependency issue.