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/debugger.cc b/runtime/debugger.cc
index c042d19..02fb5b6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1375,7 +1375,7 @@
   if (c->IsStringClass()) {
     // Special case for java.lang.String.
     gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-    new_object = mirror::String::AllocEmptyString<true>(self, allocator_type);
+    new_object = mirror::String::AllocEmptyString(self, allocator_type);
   } else {
     new_object = c->AllocObject(self);
   }
@@ -1404,7 +1404,7 @@
   Thread* self = Thread::Current();
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
   ObjPtr<mirror::Array> new_array =
-      mirror::Array::Alloc<true>(self, c, length, c->GetComponentSizeShift(), allocator_type);
+      mirror::Array::Alloc(self, c, length, c->GetComponentSizeShift(), allocator_type);
   if (new_array == nullptr) {
     DCHECK(self->IsExceptionPending());
     self->ClearException();
diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc
index 050be4a..24b3a3e 100644
--- a/runtime/dex/dex_file_annotations.cc
+++ b/runtime/dex/dex_file_annotations.cc
@@ -605,7 +605,7 @@
         StackHandleScope<2> hs(self);
         uint32_t size = DecodeUnsignedLeb128(&annotation);
         Handle<mirror::Class> component_type(hs.NewHandle(array_class->GetComponentType()));
-        Handle<mirror::Array> new_array(hs.NewHandle(mirror::Array::Alloc<true>(
+        Handle<mirror::Array> new_array(hs.NewHandle(mirror::Array::Alloc(
             self, array_class.Get(), size, array_class->GetComponentSizeShift(),
             Runtime::Current()->GetHeap()->GetCurrentAllocator())));
         if (new_array == nullptr) {
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 53dea72..4d24a8c 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -219,10 +219,11 @@
     // Pass in false since the object cannot be finalizable.
     // CheckClassInitializedForObjectAlloc can cause thread suspension which means we may now be
     // instrumented.
-    return klass->Alloc</*kInstrumented=*/true, false>(self, heap->GetCurrentAllocator());
+    return klass->Alloc</*kInstrumented=*/true, /*kCheckAddFinalizer=*/false>(
+        self, heap->GetCurrentAllocator());
   }
   // Pass in false since the object cannot be finalizable.
-  return klass->Alloc<kInstrumented, false>(self, allocator_type);
+  return klass->Alloc<kInstrumented, /*kCheckAddFinalizer=*/false>(self, allocator_type);
 }
 
 // Given the context of a calling Method and an initialized class, create an instance.
@@ -233,7 +234,7 @@
                                                              gc::AllocatorType allocator_type) {
   DCHECK(klass != nullptr);
   // Pass in false since the object cannot be finalizable.
-  return klass->Alloc<kInstrumented, false>(self, allocator_type);
+  return klass->Alloc<kInstrumented, /*kCheckAddFinalizer=*/false>(self, allocator_type);
 }
 
 
@@ -296,8 +297,11 @@
                                                         klass->GetComponentSizeShift(),
                                                         heap->GetCurrentAllocator());
   }
-  return mirror::Array::Alloc<kInstrumented>(self, klass, component_count,
-                                             klass->GetComponentSizeShift(), allocator_type);
+  return mirror::Array::Alloc<kInstrumented>(self,
+                                             klass,
+                                             component_count,
+                                             klass->GetComponentSizeShift(),
+                                             allocator_type);
 }
 
 template <bool kInstrumented>
@@ -313,8 +317,11 @@
   }
   // No need to retry a slow-path allocation as the above code won't cause a GC or thread
   // suspension.
-  return mirror::Array::Alloc<kInstrumented>(self, klass, component_count,
-                                             klass->GetComponentSizeShift(), allocator_type);
+  return mirror::Array::Alloc<kInstrumented>(self,
+                                             klass,
+                                             component_count,
+                                             klass->GetComponentSizeShift(),
+                                             allocator_type);
 }
 
 template<FindFieldType type, bool access_check>
diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h
index a8618bd..6e75a1e 100644
--- a/runtime/entrypoints/entrypoint_utils.h
+++ b/runtime/entrypoints/entrypoint_utils.h
@@ -49,7 +49,7 @@
 
 // Given the context of a calling Method, use its DexCache to resolve a type to a Class. If it
 // cannot be resolved, throw an error. If it can, use it to create an instance.
-template <bool kInstrumented>
+template <bool kInstrumented = true>
 ALWAYS_INLINE inline ObjPtr<mirror::Object> AllocObjectFromCode(ObjPtr<mirror::Class> klass,
                                                                 Thread* self,
                                                                 gc::AllocatorType allocator_type)
@@ -87,7 +87,7 @@
 // it cannot be resolved, throw an error. If it can, use it to create an array.
 // When verification/compiler hasn't been able to verify access, optionally perform an access
 // check.
-template <bool kAccessCheck, bool kInstrumented>
+template <bool kAccessCheck, bool kInstrumented = true>
 ALWAYS_INLINE inline ObjPtr<mirror::Array> AllocArrayFromCode(dex::TypeIndex type_idx,
                                                               int32_t component_count,
                                                               ArtMethod* method,
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index d84225e..4e08e8c 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -1799,7 +1799,7 @@
     }
     return false;
   }
-  ObjPtr<mirror::Object> new_array = mirror::Array::Alloc<true>(
+  ObjPtr<mirror::Object> new_array = mirror::Array::Alloc(
       self,
       array_class,
       length,
diff --git a/runtime/interpreter/interpreter_switch_impl-inl.h b/runtime/interpreter/interpreter_switch_impl-inl.h
index 247fbb7..1a88f1b 100644
--- a/runtime/interpreter/interpreter_switch_impl-inl.h
+++ b/runtime/interpreter/interpreter_switch_impl-inl.h
@@ -797,14 +797,11 @@
                                                      false,
                                                      do_access_check);
     if (LIKELY(c != nullptr)) {
+      gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
       if (UNLIKELY(c->IsStringClass())) {
-        gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-        obj = mirror::String::AllocEmptyString<true>(self, allocator_type);
+        obj = mirror::String::AllocEmptyString(self, allocator_type);
       } else {
-        obj = AllocObjectFromCode<true>(
-            c.Ptr(),
-            self,
-            Runtime::Current()->GetHeap()->GetCurrentAllocator());
+        obj = AllocObjectFromCode(c, self, allocator_type);
       }
     }
     if (UNLIKELY(obj == nullptr)) {
@@ -825,7 +822,7 @@
 
   ALWAYS_INLINE void NEW_ARRAY() REQUIRES_SHARED(Locks::mutator_lock_) {
     int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
-    ObjPtr<mirror::Object> obj = AllocArrayFromCode<do_access_check, true>(
+    ObjPtr<mirror::Object> obj = AllocArrayFromCode<do_access_check>(
         dex::TypeIndex(inst->VRegC_22c()),
         length,
         shadow_frame.GetMethod(),
diff --git a/runtime/interpreter/mterp/mterp.cc b/runtime/interpreter/mterp/mterp.cc
index d4a1926..80ebf21 100644
--- a/runtime/interpreter/mterp/mterp.cc
+++ b/runtime/interpreter/mterp/mterp.cc
@@ -457,11 +457,9 @@
   if (LIKELY(c != nullptr)) {
     if (UNLIKELY(c->IsStringClass())) {
       gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-      obj = mirror::String::AllocEmptyString<true>(self, allocator_type);
+      obj = mirror::String::AllocEmptyString(self, allocator_type);
     } else {
-      obj = AllocObjectFromCode<true>(c,
-                                      self,
-                                      Runtime::Current()->GetHeap()->GetCurrentAllocator());
+      obj = AllocObjectFromCode(c, self, Runtime::Current()->GetHeap()->GetCurrentAllocator());
     }
   }
   if (UNLIKELY(obj == nullptr)) {
@@ -523,7 +521,7 @@
     REQUIRES_SHARED(Locks::mutator_lock_) {
   const Instruction* inst = Instruction::At(dex_pc_ptr);
   int32_t length = shadow_frame->GetVReg(inst->VRegB_22c(inst_data));
-  ObjPtr<mirror::Object> obj = AllocArrayFromCode<false, true>(
+  ObjPtr<mirror::Object> obj = AllocArrayFromCode</*kAccessCheck=*/ false>(
       dex::TypeIndex(inst->VRegC_22c()), length, shadow_frame->GetMethod(), self,
       Runtime::Current()->GetHeap()->GetCurrentAllocator());
   if (UNLIKELY(obj == nullptr)) {
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index 9b905ee..727cf2f 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -1358,7 +1358,8 @@
       hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 2)->AsCharArray()));
   Runtime* runtime = Runtime::Current();
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
-  result->SetL(mirror::String::AllocFromCharArray<true>(self, char_count, h_char_array, offset, allocator));
+  result->SetL(
+      mirror::String::AllocFromCharArray(self, char_count, h_char_array, offset, allocator));
 }
 
 // This allows creating the new style of String objects during compilation.
@@ -1373,8 +1374,8 @@
   Handle<mirror::String> h_string(hs.NewHandle(to_copy));
   Runtime* runtime = Runtime::Current();
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
-  result->SetL(mirror::String::AllocFromString<true>(self, h_string->GetLength(), h_string, 0,
-                                                     allocator));
+  result->SetL(
+      mirror::String::AllocFromString(self, h_string->GetLength(), h_string, 0, allocator));
 }
 
 void UnstartedRuntime::UnstartedStringFastSubstring(
@@ -1390,7 +1391,7 @@
   DCHECK_LE(start + length, h_string->GetLength());
   Runtime* runtime = Runtime::Current();
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
-  result->SetL(mirror::String::AllocFromString<true>(self, length, h_string, start, allocator));
+  result->SetL(mirror::String::AllocFromString(self, length, h_string, start, allocator));
 }
 
 // This allows getting the char array for new style of String objects during compilation.
@@ -1720,11 +1721,8 @@
       runtime->GetClassLinker()->FindArrayClass(self, element_class->AsClass());
   DCHECK(array_class != nullptr);
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
-  result->SetL(mirror::Array::Alloc<true, true>(self,
-                                                array_class,
-                                                length,
-                                                array_class->GetComponentSizeShift(),
-                                                allocator));
+  result->SetL(mirror::Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+      self, array_class, length, array_class->GetComponentSizeShift(), allocator));
 }
 
 void UnstartedRuntime::UnstartedJNIVMStackGetCallingClassLoader(
diff --git a/runtime/jni/jni_internal.cc b/runtime/jni/jni_internal.cc
index 7d2d446..af335f6 100644
--- a/runtime/jni/jni_internal.cc
+++ b/runtime/jni/jni_internal.cc
@@ -908,8 +908,8 @@
     }
     if (c->IsStringClass()) {
       gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-      return soa.AddLocalReference<jobject>(mirror::String::AllocEmptyString<true>(soa.Self(),
-                                                                              allocator_type));
+      return soa.AddLocalReference<jobject>(
+          mirror::String::AllocEmptyString(soa.Self(), allocator_type));
     }
     return soa.AddLocalReference<jobject>(c->AllocObject(soa.Self()));
   }
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,
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 399813c..410c229 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -118,11 +118,11 @@
     return nullptr;
   }
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentNonMovingAllocator();
-  ObjPtr<mirror::Array> result = mirror::Array::Alloc<true>(soa.Self(),
-                                                            array_class,
-                                                            length,
-                                                            array_class->GetComponentSizeShift(),
-                                                            allocator);
+  ObjPtr<mirror::Array> result = mirror::Array::Alloc(soa.Self(),
+                                                      array_class,
+                                                      length,
+                                                      array_class->GetComponentSizeShift(),
+                                                      allocator);
   return soa.AddLocalReference<jobject>(result);
 }
 
@@ -145,12 +145,13 @@
     return nullptr;
   }
   gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::Array> result = mirror::Array::Alloc<true, true>(
-      soa.Self(),
-      array_class,
-      length,
-      array_class->GetComponentSizeShift(),
-      allocator);
+  ObjPtr<mirror::Array> result =
+      mirror::Array::Alloc</*kIsInstrumented=*/ true, /*kFillUsable=*/ true>(
+          soa.Self(),
+          array_class,
+          length,
+          array_class->GetComponentSizeShift(),
+          allocator);
   return soa.AddLocalReference<jobject>(result);
 }
 
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 2b75c59..f69d1bc 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -823,7 +823,7 @@
   // Invoke the string allocator to return an empty string for the string class.
   if (klass->IsStringClass()) {
     gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-    ObjPtr<mirror::Object> obj = mirror::String::AllocEmptyString<true>(soa.Self(), allocator_type);
+    ObjPtr<mirror::Object> obj = mirror::String::AllocEmptyString(soa.Self(), allocator_type);
     if (UNLIKELY(soa.Self()->IsExceptionPending())) {
       return nullptr;
     } else {
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index 83498f6..2d9e7dc 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -73,11 +73,11 @@
   StackHandleScope<1> hs(soa.Self());
   Handle<mirror::String> string_this(hs.NewHandle(soa.Decode<mirror::String>(java_this)));
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::String> result = mirror::String::AllocFromString<true>(soa.Self(),
-                                                                        length,
-                                                                        string_this,
-                                                                        start,
-                                                                        allocator_type);
+  ObjPtr<mirror::String> result = mirror::String::AllocFromString(soa.Self(),
+                                                                  length,
+                                                                  string_this,
+                                                                  start,
+                                                                  allocator_type);
   return soa.AddLocalReference<jstring>(result);
 }
 
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 13f8d5b..178d5da 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -47,12 +47,12 @@
     return nullptr;
   }
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::String> result = mirror::String::AllocFromByteArray<true>(soa.Self(),
-                                                                           byte_count,
-                                                                           byte_array,
-                                                                           offset,
-                                                                           high,
-                                                                           allocator_type);
+  ObjPtr<mirror::String> result = mirror::String::AllocFromByteArray(soa.Self(),
+                                                                     byte_count,
+                                                                     byte_array,
+                                                                     offset,
+                                                                     high,
+                                                                     allocator_type);
   return soa.AddLocalReference<jstring>(result);
 }
 
@@ -64,11 +64,11 @@
   StackHandleScope<1> hs(soa.Self());
   Handle<mirror::CharArray> char_array(hs.NewHandle(soa.Decode<mirror::CharArray>(java_data)));
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::String> result = mirror::String::AllocFromCharArray<true>(soa.Self(),
-                                                                           char_count,
-                                                                           char_array,
-                                                                           offset,
-                                                                           allocator_type);
+  ObjPtr<mirror::String> result = mirror::String::AllocFromCharArray(soa.Self(),
+                                                                     char_count,
+                                                                     char_array,
+                                                                     offset,
+                                                                     allocator_type);
   return soa.AddLocalReference<jstring>(result);
 }
 
@@ -81,11 +81,11 @@
   StackHandleScope<1> hs(soa.Self());
   Handle<mirror::String> string(hs.NewHandle(soa.Decode<mirror::String>(to_copy)));
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::String> result = mirror::String::AllocFromString<true>(soa.Self(),
-                                                                        string->GetLength(),
-                                                                        string,
-                                                                        0,
-                                                                        allocator_type);
+  ObjPtr<mirror::String> result = mirror::String::AllocFromString(soa.Self(),
+                                                                  string->GetLength(),
+                                                                  string,
+                                                                  /*offset=*/ 0,
+                                                                  allocator_type);
   return soa.AddLocalReference<jstring>(result);
 }
 
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 8133193..8a3d540 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1089,7 +1089,7 @@
   CHECK(klass != nullptr);
   gc::AllocatorType allocator_type = runtime->GetHeap()->GetCurrentAllocator();
   ObjPtr<mirror::Throwable> exception_object = ObjPtr<mirror::Throwable>::DownCast(
-      klass->Alloc</* kIsInstrumented= */ true>(self, allocator_type));
+      klass->Alloc(self, allocator_type));
   CHECK(exception_object != nullptr);
   *exception = GcRoot<mirror::Throwable>(exception_object);
   // Initialize the "detailMessage" field.
diff --git a/runtime/string_builder_append.cc b/runtime/string_builder_append.cc
index 5a34e93..85b70eb 100644
--- a/runtime/string_builder_append.cc
+++ b/runtime/string_builder_append.cc
@@ -355,7 +355,7 @@
     return nullptr;
   }
   gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
-  ObjPtr<mirror::String> result = mirror::String::Alloc</*kIsInstrumented=*/ true>(
+  ObjPtr<mirror::String> result = mirror::String::Alloc(
       self, length_with_flag, allocator_type, builder);
 
   return result;
diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc
index aea2211..7ad741a 100644
--- a/runtime/transaction_test.cc
+++ b/runtime/transaction_test.cc
@@ -145,11 +145,12 @@
   Runtime::Current()->EnterTransactionMode();
 
   // Allocate an array during transaction.
-  Handle<mirror::Array> h_obj(
-      hs.NewHandle(
-          mirror::Array::Alloc<true>(soa.Self(), h_klass.Get(), kArraySize,
-                                     h_klass->GetComponentSizeShift(),
-                                     Runtime::Current()->GetHeap()->GetCurrentAllocator())));
+  Handle<mirror::Array> h_obj = hs.NewHandle(
+      mirror::Array::Alloc(soa.Self(),
+                           h_klass.Get(),
+                           kArraySize,
+                           h_klass->GetComponentSizeShift(),
+                           Runtime::Current()->GetHeap()->GetCurrentAllocator()));
   ASSERT_TRUE(h_obj != nullptr);
   ASSERT_OBJ_PTR_EQ(h_obj->GetClass(), h_klass.Get());
   Runtime::Current()->RollbackAndExitTransactionMode();