dart-sdk/runtime
Alexander Markov 2ee6fcf514 [vm] Remove TypeRef
TypeRef type wraps around another type and it was used to represent
a graph of recursive types. After [0], the only use of TypeRef is
for TypeParameter.bound which may indirectly reference the same
TypeParameter.

This change replaces TypeParameter.bound with TypeParameter.owner and
removes TypeRef entirely. Various parts of the VM no longer need to
handle and support TypeRefs.

TypeParameter.owner can reference a FunctionType, Class,
or, as an optimization, it can be set to null in order to share
class type parameters among different classes.

With the exception of the 'TypeParameter.owner' back pointer,
VM types are now not recursive and can be visited without
additional tracking.

Caveats:

* Generic FunctionType cannot be cloned in a shallow way:
  when copying a FunctionType, type parameters should be cloned too
  and their owners should be updated. For that reason,
  a mapping between 'from' and 'to' function types
  (FunctionTypeMapping) is maintained during type transformations
  such as InstantiateFrom.
  FunctionType::Clone is used instead of Object::Clone where
  appropriate.

* When testing types for subtyping and equivalence, mapping
  between function types is passed to make sure
  type parameters belong to the equivalent function types.

* IL serializer needs to serialize function types as a whole before
  serializing any types potentially pointing into the middle of a
  function type (such as return type 'List<Y0>' pointing into
  the middle of a function type 'List<Y0> Function<Y0>()').

[0] https://dart-review.googlesource.com/c/sdk/+/296300

TEST=ci

Change-Id: I67c2fd0117c6183a45e183919a7847fd1af70b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294165
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-28 19:29:36 +00:00
..
bin [vm] Use PR_SET_VMA_ANON_NAME on Linux too. 2023-04-28 18:29:58 +00:00
docs [vm] Remove TypeRef 2023-04-28 19:29:36 +00:00
include [ VM ] Move class name from heap profiler report callback to allocation callback 2023-04-25 13:02:49 +00:00
lib [vm] Remove TypeRef 2023-04-28 19:29:36 +00:00
observatory [vm] Remove TypeRef 2023-04-28 19:29:36 +00:00
observatory_2 [vm] Remove TypeRef 2023-04-28 19:29:36 +00:00
platform Reland "Reland "[VM] Begin supporting Perfetto file recorder"" 2023-04-18 19:39:05 +00:00
tests [gardening] Remove test from stress testing. 2023-04-27 14:57:58 +00:00
third_party Spelling pkg analyzer lib 2023-01-25 14:08:27 +00:00
tools Update README.md 2023-04-25 18:50:20 +00:00
vm [vm] Remove TypeRef 2023-04-28 19:29:36 +00:00
.clang-tidy
.gitignore
BUILD.gn [VM/Timeline] Disable SUPPORT_PERFETTO macro to investigate flaky Flutter crashes 2023-04-24 20:32:31 +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 [standalone] Remove tcmalloc. 2023-04-18 20:56:00 +00:00