Skip to content

[dart2js] New rti tracking issue #37715

@rakudrama

Description

@rakudrama

This is a general tracking issue for new rti implementation tasks.

Testing:

  • Run modular and some unit tests with new-rti

Correctness:

  • Full function type parsing and subtyping
  • Full generic function type parsing
  • Full generic function type subtyping
  • Full generic function type toString()
  • Pass new rti for element type to generator bodies
  • Access new rti in forwarding stubs
  • Generic function instantiation - creating and calling
  • Generic function instantiation - closure type and subtyping
  • Reify erased type variables correctly

Basic performance:

Other optimizations:

  • Make more classes have their type available through .$ti. Getter for $ti on Object, Closure, BoundClosure, StaticClosure. Object uses dynamic constructor's name, Closure could use cached version. THIS SEEMS TO BE VERY DIFFICULT. Defining a getter for Object.prototype.$ti seems to prevent using $ti as a normal property in subclasses. We could work around this by using a different name, but that throws out what we are looking for - a single megamorphic dispatch to most types. The 'different name' is just alternate syntax for H._instanceType(x).
  • Is there some more direct way to cache the constructor name version?
  • Reduce $ti._eval$1("1") --> $ti._rest[0]
  • Reduce $ti._rest[0] --> $ti._precomputed1.
  • Use instanceof
    The current general-is-test works (and fails) until instances of the class are created, which implies that the constructor is loaded.
    • Install instanceof predicates on Rti objects for types where instanceof works, and type flows to is-check. This should be done in the deferred unit that declares the class constructor. findType("Foo")._is=function(o){return o instanceof X.Foo}
    • Generate instanceof directly like for old Rti. This would be restricted to code where the constructor is available, e.g. the class constructor is in the same deferred unit as the usage (in old Rti this is OK because the class constructor is the type).
  • x as T --> x under branch where x is T is true. Old rti does this, relying on GVN of x and T,

Cleanup:

JS interop fix:

  • Cleanup JSArray<dynamic> --> JSArray<any>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions