diff options
author | Orion Hodson <oth@google.com> | 2018-05-17 14:03:39 +0100 |
---|---|---|
committer | Orion Hodson <oth@google.com> | 2018-05-21 15:30:48 +0100 |
commit | 3f383468e14822b9eb125d087e3e38df8b0cf1f5 (patch) | |
tree | 88cccf042559fd9fcffd3714fb9658766100391f /test/712-varhandle-invocations/util-src/generate_java.py | |
parent | 80a7c29b29c50c1c6cf40093a4552dacd4c5d638 (diff) |
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
Diffstat (limited to 'test/712-varhandle-invocations/util-src/generate_java.py')
-rw-r--r-- | test/712-varhandle-invocations/util-src/generate_java.py | 10 |
1 files changed, 7 insertions, 3 deletions
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) |