From 3f383468e14822b9eb125d087e3e38df8b0cf1f5 Mon Sep 17 00:00:00 2001 From: Orion Hodson Date: Thu, 17 May 2018 14:03:39 +0100 Subject: 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 --- test/712-varhandle-invocations/util-src/generate_java.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/712-varhandle-invocations/util-src/generate_java.py') diff --git a/test/712-varhandle-invocations/util-src/generate_java.py b/test/712-varhandle-invocations/util-src/generate_java.py index 9520b53844..f535b400f8 100644 --- a/test/712-varhandle-invocations/util-src/generate_java.py +++ b/test/712-varhandle-invocations/util-src/generate_java.py @@ -757,7 +757,9 @@ public class ${test_class} extends VarHandleUnitTest { """) with io.StringIO() as body_text: compatible_types = types_that_widen_to(var_type) - for value_type in VALUE_TYPES: + incompatible_types = { RANDOM.choice(list(VALUE_TYPES - compatible_types)) } + test_types = compatible_types | incompatible_types + for value_type in test_types: print("try {", file=body_text) return_type = accessor.get_return_type(var_type) if return_type: @@ -765,7 +767,7 @@ public class ${test_class} extends VarHandleUnitTest { print("vh.{0}(this".format(accessor.method_name), end="", file=body_text) num_args = accessor.get_number_of_var_type_arguments() for i in range(0, num_args): - print(", {0}({1})".format(value_type.boxing_method(), value_type.examples[i]), end="", file=body_text) + print(", SampleValues.get_{0}({1})".format(value_type.boxed_type, i), end="", file=body_text) print(");", file=body_text) if value_type in compatible_types: print(" assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.{0}));".format(accessor.access_mode), @@ -817,7 +819,9 @@ public class ${test_class} extends VarHandleUnitTest { with io.StringIO() as body_text: return_type = accessor.get_return_type(var_type) compatible_types = { return_type } - for value_type in VALUE_TYPES: + incompatible_types = { RANDOM.choice(list(VALUE_TYPES - compatible_types)) } + test_types = compatible_types | incompatible_types + for value_type in test_types: print("try {", file=body_text) print("{0} result = ({0}) ".format(value_type.boxed_type), end="", file=body_text) print("vh.{0}(this".format(accessor.method_name), end="", file=body_text) -- cgit v1.2.3-59-g8ed1b