[dart2wasm] Add deferred loading support to dart2wasm (5/X).
Add support for a StaticTable which holds references to known functions that need to be called across modules. For calls that target the DispatchTable we will still go through there if possible. But for any functions not referenced in that table (including any compiler generated functions) we add a separate static table. Also adds import/export support to both the DispatchTable and the StaticTable. The table will always be defined in the main module and imported into subsequent modules. Change-Id: Iedc683d1ecfe721393900913826010cdd9b2c3c4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381323 Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
@@ -21,9 +21,11 @@ abstract class BaseFunction with Indexable implements Exportable {
|
||||
final FinalizableIndex finalizableIndex;
|
||||
final FunctionType type;
|
||||
final String? functionName;
|
||||
final ModuleBuilder enclosingModule;
|
||||
String? exportedName;
|
||||
|
||||
BaseFunction(this.finalizableIndex, this.type, this.functionName);
|
||||
BaseFunction(this.enclosingModule, this.finalizableIndex, this.type,
|
||||
this.functionName);
|
||||
|
||||
@override
|
||||
String get name => functionName ?? super.name;
|
||||
@@ -44,7 +46,8 @@ class DefinedFunction extends BaseFunction implements Serializable {
|
||||
/// All local variables defined in the function, including its inputs.
|
||||
List<Local> get locals => body.locals;
|
||||
|
||||
DefinedFunction(this.body, super.finalizableIndex, super.type,
|
||||
DefinedFunction(
|
||||
super.enclosingModule, this.body, super.finalizableIndex, super.type,
|
||||
[super.functionName]);
|
||||
|
||||
@override
|
||||
@@ -85,7 +88,8 @@ class ImportedFunction extends BaseFunction implements Import {
|
||||
@override
|
||||
final String name;
|
||||
|
||||
ImportedFunction(this.module, this.name, super.finalizableIndex, super.type,
|
||||
ImportedFunction(super.enclosingModule, this.module, this.name,
|
||||
super.finalizableIndex, super.type,
|
||||
[super.functionName]);
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user