Switch on implicit null pointer and stack overflow checks.

This switches on the use of implicit checks for null pointers
and stack overflows.  These use the SIGSEGV handler in the ART
runtime to detect these conditions and throw the appropriate
exceptions.

Change-Id: I4d27d4e976a58b18fb16a89572b1fb3798608449
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index b8093bc..0a35054 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -35,6 +35,13 @@
 // Static fault manger object accessed by signal handler.
 FaultManager fault_manager;
 
+extern "C" {
+void art_sigsegv_fault() {
+  // Set a breakpoint here to be informed when a SIGSEGV is unhandled by ART.
+  LOG(ERROR)<< "Caught unknown SIGSEGV in ART fault handler";
+}
+}
+
 // Signal handler called on SIGSEGV.
 static void art_fault_handler(int sig, siginfo_t* info, void* context) {
   fault_manager.HandleFault(sig, info, context);
@@ -75,7 +82,10 @@
       return;
     }
   }
-  LOG(ERROR)<< "Caught unknown SIGSEGV in ART fault handler";
+
+  // Allow the user to catch this problem with a simple breakpoint in art_sigsegv_fault.
+  art_sigsegv_fault();
+
   oldaction_.sa_sigaction(sig, info, context);
 }
 
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 9cf8785..20f910d 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -253,7 +253,7 @@
 #ifdef HAVE_ANDROID_OS
   {
     char buf[PROP_VALUE_MAX];
-    property_get("dalvik.vm.implicit_checks", buf, "none");
+    property_get("dalvik.vm.implicit_checks", buf, "null,stack");
     std::string checks(buf);
     std::vector<std::string> checkvec;
     Split(checks, ',', checkvec);
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 027feee..cbd51d4 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -535,9 +535,20 @@
     GetInstrumentation()->ForceInterpretOnly();
   }
 
-  if (options->explicit_checks_ != (ParsedOptions::kExplicitSuspendCheck |
+  bool implicit_checks_supported = false;
+  switch (kRuntimeISA) {
+  case kArm:
+  case kThumb2:
+    implicit_checks_supported = true;
+    break;
+  default:
+    break;
+  }
+
+  if (implicit_checks_supported &&
+    (options->explicit_checks_ != (ParsedOptions::kExplicitSuspendCheck |
         ParsedOptions::kExplicitNullCheck |
-        ParsedOptions::kExplicitStackOverflowCheck) || kEnableJavaStackTraceHandler) {
+        ParsedOptions::kExplicitStackOverflowCheck) || kEnableJavaStackTraceHandler)) {
     fault_manager.Init();
 
     // These need to be in a specific order.  The null point check handler must be