dart-lang/sdk

implement deferred loading in fasta

Opened this issue · 11 comments

Tasks:

  • generate the loadlibrary instruction when calling deferred.loadLibrary
  • generate a top level method so represent a tearoff of loadLibrary (a method is needed to ensure that we preserve that two tearoffs are identical)
  • determine deferred-access patterns of dependencies used within a method (e.g. if a constant is accessed via deferred prefix, dart2js needs to know so it can put the constant in a separate output unit).
    status: done, but can be improved to be more precise and efficient by recording the information while parsing.
  • generate checks for deferred accesses.
  • generate compile-time errors for uses of deferred types in API declarations and inheritance (requires deeper changes in the outline builder)

@sigmundch any updates on this?

Just updated the comment above: we are now passing dart2js unit tests regarding correct splitting of deferred units. And I've validated that the output manually for a few small examples.

Next - I'll be validating them on a large app and move on to error checking.

quick update: runtime checks for using deferred elements before they are loaded are now inserted.

We are missing still compile-time errors (e.g. when extending a deferred class), which need to be handled likely in the outline builder stage. However, we reached the point where we have all we need to unblock the release of dart2js with kernel at this time, so I lowered the priority to P2 and unassigned myself for now. I may be able to help implement that last part if needed in the future, just wanted to make it clear that I'm not actively pursuing it at this moment.

@sigmundch any updates on this? Can we defer the remaining work past Dart2Stable?

No updates from my end - I'm no longer actively working on it and left it for the FE team to do the final steps.

Missing features are about statically checking for certain kind of errors, so if we don't want to introduce new errors past Dart2Stable, then it might be relevant to do it sooner. If we are ok reintroducing errors in a later release, then it can be done after Dart2Stable.

@sigmundch do you know if these errors are produced as expected by the analyzer?

they are

In that case, we will very likely defer this past Dart2Stable.

Moved to Dart 2.1

I will implement the missing static checks for deferred types.

This is not a feature that is connected to the Dart 2.1 release.