dart-sdk/runtime
Tess Strickland 6672353e0f [vm] Fix instantiation of default type args in closure functions.
Previously, the default type arguments for closure functions were
instantiated in the same way as other types of functions, where the
instantiator and function type arguments of the call were used. However,
the defaults for closure functions should be instantiated with the
instantiator and parent function type arguments stored within the
closure itself.

Since the instantiation of the default type arguments only depends on
the instantiator and parent function type arguments, which are shared
between partial instantiations of the same generic closure, the VM
performs this instantiation once at closure creation and caches it in
the closure object, so it can be retrieved when the default type
arguments are needed and copied to new partial instantiations of the
same closure without need for recalculation.

As a side effect, this should speed up dynamic invocation of generic
closures, since the invoke field dispatcher that implements them
previously performed this instantiation when needed on every invocation,
but now it just retrieves the cached version instead.

TEST=language/closure/type_arguments vm/dart/regress_54426

Fixes: https://github.com/dart-lang/sdk/issues/54426
Change-Id: I9baad807befa0323f3c5b66196b9664e4d78af0a
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-aot-linux-release-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-mac-product-arm64-try,vm-aot-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-01-08 13:07:16 +00:00
..
bin [VM] Minor cleanup 2023-12-21 22:35:59 +00:00
docs [pkg/vm] Create @pragma("vm:platform-const-if", <cond>) annotation 2024-01-04 14:44:29 +00:00
include Expose Dart_Null_DL from dart_api_dl.h 2023-12-11 21:06:37 +00:00
lib Reland "[vm/ffi] Express FFI call closures explicitly in AST" 2023-12-15 15:25:29 +00:00
observatory [vm] Account for --no_retain_function_objects in Code::Name. 2023-12-15 17:08:56 +00:00
platform Revert "[vm, gc] Mark through new-space." 2023-12-21 21:02:38 +00:00
tests [vm] Fix instantiation of default type args in closure functions. 2024-01-08 13:07:16 +00:00
tools [vm/ffi] Add Since annotation to Pointer + and - 2024-01-03 08:53:07 +00:00
vm [vm] Fix instantiation of default type args in closure functions. 2024-01-08 13:07:16 +00:00
.clang-tidy
.gitignore
BUILD.gn [build] Omit SDK and Git hashes on RBE. 2023-12-20 12:23:56 +00:00
codereview.settings
configs.gni [Runtime] Add extra_product_deps and extra_nonproduct_deps params to "library_for_all_configs_with_compiler" template 2023-04-14 19:51:40 +00:00
CPPLINT.cfg [cpplint] Disable runtime/references lint 2023-01-23 18:21:48 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
PRESUBMIT.py Reland "Reland "[VM] Begin supporting Perfetto file recorder"" 2023-04-18 19:39:05 +00:00
runtime_args.gni [build] Make analyze_snapshot GN target available for riscv64. 2023-12-12 18:16:59 +00:00
vm-jit.shard.cml [test] Cleanup building Fuchsia packages/components. 2023-10-31 17:11:51 +00:00
vm.shard.cml [test] Cleanup building Fuchsia packages/components. 2023-10-31 17:11:51 +00:00