Add default argument kIsInstrumented=true.

kIsInstrumented=false is reserved for use by specialized
entrypoints which are used only when we can ensure that
the code is not instrumented. So add the default argument
to simplify all other callers.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I3419795794fec9a1733ab3ad698b6415dbac679d
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index d42f5a0..9bff169 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -54,8 +54,8 @@
   Handle<mirror::Class> h_component_type(hs.NewHandle(array_class->GetComponentType()));
   size_t component_size_shift = h_component_type->GetPrimitiveTypeSizeShift();
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  Handle<Array> new_array(hs.NewHandle(Array::Alloc<true>(
-      self, array_class.Get(), array_length, component_size_shift, allocator_type)));
+  Handle<Array> new_array(hs.NewHandle(
+      Array::Alloc(self, array_class.Get(), array_length, component_size_shift, allocator_type)));
   if (UNLIKELY(new_array == nullptr)) {
     CHECK(self->IsExceptionPending());
     return nullptr;
@@ -122,11 +122,11 @@
 template<typename T>
 ObjPtr<PrimitiveArray<T>> PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<Array> raw_array = Array::Alloc<true>(self,
-                                               GetClassRoot<PrimitiveArray<T>>(),
-                                               length,
-                                               ComponentSizeShiftWidth(sizeof(T)),
-                                               allocator_type);
+  ObjPtr<Array> raw_array = Array::Alloc(self,
+                                         GetClassRoot<PrimitiveArray<T>>(),
+                                         length,
+                                         ComponentSizeShiftWidth(sizeof(T)),
+                                         allocator_type);
   return ObjPtr<PrimitiveArray<T>>::DownCast(raw_array);
 }
 
@@ -151,7 +151,7 @@
   const auto component_size = klass->GetComponentSize();
   const auto component_shift = klass->GetComponentSizeShift();
   ObjPtr<Array> new_array =
-      Alloc<true>(self, klass, new_length, component_shift, allocator_type);  // Invalidates klass.
+      Alloc(self, klass, new_length, component_shift, allocator_type);  // Invalidates klass.
   if (LIKELY(new_array != nullptr)) {
     memcpy(new_array->GetRawData(component_size, 0),
            h_this->GetRawData(component_size, 0),
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index f0397b6..dbc5d2a 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -43,7 +43,7 @@
   // Allocates an array with the given properties, if kFillUsable is true the array will be of at
   // least component_count size, however, if there's usable space at the end of the allocation the
   // array will fill it.
-  template <bool kIsInstrumented, bool kFillUsable = false>
+  template <bool kIsInstrumented = true, bool kFillUsable = false>
   ALWAYS_INLINE static ObjPtr<Array> Alloc(Thread* self,
                                            ObjPtr<Class> array_class,
                                            int32_t component_count,
diff --git a/runtime/mirror/class-alloc-inl.h b/runtime/mirror/class-alloc-inl.h
index 03c422f..cab3c51 100644
--- a/runtime/mirror/class-alloc-inl.h
+++ b/runtime/mirror/class-alloc-inl.h
@@ -72,11 +72,11 @@
 }
 
 inline ObjPtr<Object> Class::AllocObject(Thread* self) {
-  return Alloc<true>(self, Runtime::Current()->GetHeap()->GetCurrentAllocator());
+  return Alloc(self, Runtime::Current()->GetHeap()->GetCurrentAllocator());
 }
 
 inline ObjPtr<Object> Class::AllocNonMovableObject(Thread* self) {
-  return Alloc<true>(self, Runtime::Current()->GetHeap()->GetCurrentNonMovingAllocator());
+  return Alloc(self, Runtime::Current()->GetHeap()->GetCurrentNonMovingAllocator());
 }
 
 }  // namespace mirror
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index f2ba7d0..2bae7e7 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -467,7 +467,7 @@
   bool IsPrimitiveArray() REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Creates a raw object instance but does not invoke the default constructor.
-  template<bool kIsInstrumented, bool kCheckAddFinalizer = true>
+  template<bool kIsInstrumented = true, bool kCheckAddFinalizer = true>
   ALWAYS_INLINE ObjPtr<Object> Alloc(Thread* self, gc::AllocatorType allocator_type)
       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
 
diff --git a/runtime/mirror/object_array-alloc-inl.h b/runtime/mirror/object_array-alloc-inl.h
index 8e96d9f..b417b62 100644
--- a/runtime/mirror/object_array-alloc-inl.h
+++ b/runtime/mirror/object_array-alloc-inl.h
@@ -37,11 +37,11 @@
                                                     ObjPtr<Class> object_array_class,
                                                     int32_t length,
                                                     gc::AllocatorType allocator_type) {
-  ObjPtr<Array> array = Array::Alloc<true>(self,
-                                           object_array_class,
-                                           length,
-                                           ComponentSizeShiftWidth(kHeapReferenceSize),
-                                           allocator_type);
+  ObjPtr<Array> array = Array::Alloc(self,
+                                     object_array_class,
+                                     length,
+                                     ComponentSizeShiftWidth(kHeapReferenceSize),
+                                     allocator_type);
   if (UNLIKELY(array == nullptr)) {
     return nullptr;
   }
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 1cb22f2..45a0437 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -158,17 +158,17 @@
   MutableHandle<Class> c = hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[I"));
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
   MutableHandle<Array> a = hs.NewHandle(
-      Array::Alloc<true>(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
+      Array::Alloc(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_EQ(1, a->GetLength());
 
   c.Assign(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Object;"));
-  a.Assign(Array::Alloc<true>(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
+  a.Assign(Array::Alloc(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_EQ(1, a->GetLength());
 
   c.Assign(class_linker_->FindSystemClass(soa.Self(), "[[Ljava/lang/Object;"));
-  a.Assign(Array::Alloc<true>(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
+  a.Assign(Array::Alloc(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_EQ(1, a->GetLength());
 }
@@ -179,25 +179,26 @@
   MutableHandle<Class> c = hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[B"));
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
   MutableHandle<Array> a = hs.NewHandle(
-      Array::Alloc<true, true>(soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
+      Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+          soa.Self(), c.Get(), 1, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_LE(1, a->GetLength());
 
   c.Assign(class_linker_->FindSystemClass(soa.Self(), "[I"));
-  a.Assign(
-      Array::Alloc<true, true>(soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
+  a.Assign(Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+      soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_LE(2, a->GetLength());
 
   c.Assign(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Object;"));
-  a.Assign(
-      Array::Alloc<true, true>(soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
+  a.Assign(Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+      soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_LE(2, a->GetLength());
 
   c.Assign(class_linker_->FindSystemClass(soa.Self(), "[[Ljava/lang/Object;"));
-  a.Assign(
-      Array::Alloc<true, true>(soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
+  a.Assign(Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+      soa.Self(), c.Get(), 2, c->GetComponentSizeShift(), allocator_type));
   EXPECT_TRUE(c.Get() == a->GetClass());
   EXPECT_LE(2, a->GetLength());
 }
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index 1881c57..b2b68d6 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -89,7 +89,7 @@
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
   const int32_t length_with_flag = String::GetFlaggedCount(length, compressible);
   SetStringCountVisitor visitor(length_with_flag);
-  ObjPtr<String> string = Alloc<true>(self, length_with_flag, allocator_type, visitor);
+  ObjPtr<String> string = Alloc(self, length_with_flag, allocator_type, visitor);
   if (UNLIKELY(string == nullptr)) {
     return nullptr;
   }
@@ -130,7 +130,7 @@
   const int32_t length_with_flag = String::GetFlaggedCount(length + length2, compressible);
 
   SetStringCountVisitor visitor(length_with_flag);
-  ObjPtr<String> new_string = Alloc<true>(self, length_with_flag, allocator_type, visitor);
+  ObjPtr<String> new_string = Alloc(self, length_with_flag, allocator_type, visitor);
   if (UNLIKELY(new_string == nullptr)) {
     return nullptr;
   }
@@ -167,7 +167,7 @@
                             String::AllASCII<uint16_t>(utf16_data_in, utf16_length);
   int32_t length_with_flag = String::GetFlaggedCount(utf16_length, compressible);
   SetStringCountVisitor visitor(length_with_flag);
-  ObjPtr<String> string = Alloc<true>(self, length_with_flag, allocator_type, visitor);
+  ObjPtr<String> string = Alloc(self, length_with_flag, allocator_type, visitor);
   if (UNLIKELY(string == nullptr)) {
     return nullptr;
   }
@@ -203,7 +203,7 @@
   const bool compressible = kUseStringCompression && (utf16_length == utf8_length);
   const int32_t utf16_length_with_flag = String::GetFlaggedCount(utf16_length, compressible);
   SetStringCountVisitor visitor(utf16_length_with_flag);
-  ObjPtr<String> string = Alloc<true>(self, utf16_length_with_flag, allocator_type, visitor);
+  ObjPtr<String> string = Alloc(self, utf16_length_with_flag, allocator_type, visitor);
   if (UNLIKELY(string == nullptr)) {
     return nullptr;
   }
diff --git a/runtime/mirror/string.h b/runtime/mirror/string.h
index 665446c..116ecd1 100644
--- a/runtime/mirror/string.h
+++ b/runtime/mirror/string.h
@@ -118,7 +118,7 @@
 
   ObjPtr<String> Intern() REQUIRES_SHARED(Locks::mutator_lock_);
 
-  template <bool kIsInstrumented>
+  template <bool kIsInstrumented = true>
   ALWAYS_INLINE static ObjPtr<String> AllocFromByteArray(Thread* self,
                                                          int32_t byte_length,
                                                          Handle<ByteArray> array,
@@ -127,7 +127,7 @@
                                                          gc::AllocatorType allocator_type)
       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
 
-  template <bool kIsInstrumented>
+  template <bool kIsInstrumented = true>
   ALWAYS_INLINE static ObjPtr<String> AllocFromCharArray(Thread* self,
                                                          int32_t count,
                                                          Handle<CharArray> array,
@@ -135,7 +135,7 @@
                                                          gc::AllocatorType allocator_type)
       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
 
-  template <bool kIsInstrumented>
+  template <bool kIsInstrumented = true>
   ALWAYS_INLINE static ObjPtr<String> AllocFromString(Thread* self,
                                                       int32_t string_length,
                                                       Handle<String> string,
@@ -143,7 +143,7 @@
                                                       gc::AllocatorType allocator_type)
       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
 
-  template <bool kIsInstrumented>
+  template <bool kIsInstrumented = true>
   ALWAYS_INLINE static ObjPtr<String> AllocEmptyString(Thread* self,
                                                        gc::AllocatorType allocator_type)
       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
@@ -252,7 +252,7 @@
     SetField32<false, false>(OFFSET_OF_OBJECT_MEMBER(String, hash_code_), new_hash_code);
   }
 
-  template <bool kIsInstrumented, typename PreFenceVisitor>
+  template <bool kIsInstrumented = true, typename PreFenceVisitor>
   ALWAYS_INLINE static ObjPtr<String> Alloc(Thread* self,
                                             int32_t utf16_length_with_flag,
                                             gc::AllocatorType allocator_type,