ART: Faster 712-varhandle-invocations

Reduce number of allocations when running 712-varhandle-invocations as
it timeouts under gcstress.

In the runtime, avoid allocating a MethodType when raising a
WrongMethodTypeException when dispatching an erroneous VarHandle
accessor.

In the test, limit the number of incorrect types tested in boxing test
portion of 712 which is particularly slow. And pre-allocate boxed
values and share across sub-tests.

The total time to run 712-varhandle-invocations is reduced by 45% on
host and 33% on angler.

Test: art/test/run-test --host --64 --gcstress 712
Bug: 73275005
Change-Id: If5b323a61291d490f51638d416c2529874282f1c
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 8fd95ed..657a78b 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -880,11 +880,14 @@
 
 void ThrowWrongMethodTypeException(ObjPtr<mirror::MethodType> expected_type,
                                    ObjPtr<mirror::MethodType> actual_type) {
-  ThrowException("Ljava/lang/invoke/WrongMethodTypeException;",
-                 nullptr,
-                 StringPrintf("Expected %s but was %s",
-                              expected_type->PrettyDescriptor().c_str(),
-                              actual_type->PrettyDescriptor().c_str()).c_str());
+  ThrowWrongMethodTypeException(expected_type->PrettyDescriptor(), actual_type->PrettyDescriptor());
+}
+
+void ThrowWrongMethodTypeException(const std::string& expected_descriptor,
+                                   const std::string& actual_descriptor) {
+  std::ostringstream msg;
+  msg << "Expected " << expected_descriptor << " but was " << actual_descriptor;
+  ThrowException("Ljava/lang/invoke/WrongMethodTypeException;",  nullptr, msg.str().c_str());
 }
 
 }  // namespace art