Skip to content

compute deferred dependencies in fasta #35005

Closed
@sigmundch

Description

@sigmundch

(this is summarizing some of the discussion I had with @peter-ahe-google this week)

The deferred loading splitting algorithm in dart2js requires 2 pieces of information:

  • direct dependencies between entities
  • deferred dependencies between entities

We derive the former directly from the AST, but the latter is today computed using some backward reverse engineering: we look at library dependencies, compute the export scopes, and then try to match which direct dependencies would have gone through a deferred import (see https://github.com/dart-lang/sdk/blob/master/pkg/compiler/lib/src/kernel/deferred_load.dart#L23)

This computation is inefficient and redundant with work the CFE already did while resolving the program.

We would like this information to be encoded in the IR in a way that is stable and easy to extract. For example, today the representation of the CheckLibraryIsLoaded is separate from the access and it doesn't indicate which access it is protecting. We did so by design to allow kernel transformations to optimize checks away (e.g hoist them and share them).

My preference is to not derive this information from implicit invariants in the IR. Instead, I propose that we encode the information as data on members or metadata stored on the side. The data we need is basically for each method/initializer, which references to other static methods and constructors are deferred and what deferred prefix/import was used to reach it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions