tear-off of function's call method might be expensive #31746
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-stale
Closed as the issue or PR is assumed stale
dart2js would like to minimize the extra metadata required for generic methods.
The Kernel instruction Instantiation, used to bind generic type arguments of a generic closure, currently is inserted at specific points - tear-off of instance method, escape of local or top-level method, use of an anonymous closure. At these points we can identify the target or set of targets fairly precisely and thus create metadata for supporting instantiation for specific methods.
However, there is a leak - the
call
method of functions can be torn off. Sinceget:call
for a function returns the function itself, this means that any generic function that can flow to the tear-off site might be partially-applied by the injected Instantiation instruction. This would mean that more generic functions would need to support being instantiated - e.g. any function compatible withfun
below:I propose that we disallow tear-offs of the
call
method until we can measure the impact of this information leak.Related: #31665
The text was updated successfully, but these errors were encountered: