[dart2wasm] Start emitting binaryen.inline custom section
Binaryen introduced `binaryen.inline` which allows us to tell it inlining hints now, including "never inline" hint (see [0]) This allows us to remove the ugly mangling of wasm function names with `<noInline>` postfix. We also now pass `--strip-toolchain-annotations`: The annotations occupy size in the wasm binary and wasm runtimes ignore them (they are for `wams-opt` only). Except for IR tests: Here we want to see the annotations, so we keep them there. We also rename the package:wasm_builder classes to clearly indicate those are binaryen specific sections. We also make the ir_test.dart put it's options first, allowing the IR tests to override options if needed. [0] https://github.com/WebAssembly/binaryen/commit/3c25487214600a9 Change-Id: I96688bfaeba403a39cd5e7376f8d2889bcbae030 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510000 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
b5294b9753
commit
5cd42e6b21
@@ -166,7 +166,6 @@ const List<String> _binaryenFlags = [
|
||||
'--enable-bulk-memory',
|
||||
'--enable-threads',
|
||||
'--enable-simd',
|
||||
'--no-inline=*<noInline>*',
|
||||
'--closed-world',
|
||||
'--traps-never-happen',
|
||||
'--type-unfinalizing',
|
||||
@@ -190,7 +189,6 @@ const List<String> _binaryenFlagsMultiModule = [
|
||||
'--enable-bulk-memory',
|
||||
'--enable-threads',
|
||||
'--enable-simd',
|
||||
'--no-inline=*<noInline>*',
|
||||
'--traps-never-happen',
|
||||
'-Os',
|
||||
'-Os',
|
||||
@@ -718,15 +716,18 @@ Future<CompilationResult> _runOptPhase(
|
||||
: options.maxActiveWasmOptProcesses,
|
||||
);
|
||||
|
||||
final wasmOptFlags = <String>[
|
||||
...(options.useMultiModuleOpt ? _binaryenFlagsMultiModule : _binaryenFlags),
|
||||
if (options.stripToolchainAnnotations) '--strip-toolchain-annotations',
|
||||
];
|
||||
|
||||
await Future.wait([
|
||||
for (final moduleId in moduleIdsToOptimize)
|
||||
optPool.withResource(() async {
|
||||
await ioManager.runWasmOpt(
|
||||
codegenResult.mainWasmFile,
|
||||
moduleId,
|
||||
options.useMultiModuleOpt
|
||||
? _binaryenFlagsMultiModule
|
||||
: _binaryenFlags,
|
||||
wasmOptFlags,
|
||||
);
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -55,6 +55,7 @@ class WasmCompilerOptions {
|
||||
String? dumpKernelAfterTfa;
|
||||
bool dryRun = false;
|
||||
Uri? wasmOptPath;
|
||||
bool stripToolchainAnnotations = true;
|
||||
int maxActiveWasmOptProcesses = _defaultMaxActiveWasmOptProcesses();
|
||||
bool saveUnopt = false;
|
||||
Set<int> moduleIdsToOptimize = const {};
|
||||
|
||||
@@ -201,6 +201,12 @@ final List<Option> options = [
|
||||
defaultsTo: _d.translatorOptions.requireJsStringBuiltin,
|
||||
),
|
||||
|
||||
Flag(
|
||||
"strip-toolchain-annotations",
|
||||
(o, value) => o.stripToolchainAnnotations = value,
|
||||
defaultsTo: _d.stripToolchainAnnotations,
|
||||
),
|
||||
|
||||
UriOption("wasm-opt", (o, value) => o.wasmOptPath = value),
|
||||
// The maximum number of concurrent wasm-opt processes to run. Defaults to the
|
||||
// number of processors on the machine. Use -1 to run with no limit.
|
||||
|
||||
@@ -94,6 +94,23 @@ class FunctionCollector {
|
||||
translator.coreTypes,
|
||||
member,
|
||||
);
|
||||
final hasNeverInlineAnnotation =
|
||||
util.getWasmNeverInlinePragma(translator.coreTypes, member) ?? false;
|
||||
final bool neverInline;
|
||||
if (member is Field) {
|
||||
neverInline =
|
||||
target.isStaticFieldInitializer &&
|
||||
translator.neverInlineStaticFieldInitializer(member);
|
||||
} else if (member is Constructor) {
|
||||
neverInline =
|
||||
hasNeverInlineAnnotation &&
|
||||
(target == member.reference || target.isConstructorBodyReference);
|
||||
} else {
|
||||
member as Procedure;
|
||||
neverInline =
|
||||
hasNeverInlineAnnotation &&
|
||||
(target == member.reference || target.isBodyReference);
|
||||
}
|
||||
|
||||
// If this function is a `@pragma('wasm:import', '<module>.<name>')` we
|
||||
// import the function and return it.
|
||||
@@ -119,7 +136,8 @@ class FunctionCollector {
|
||||
ftype,
|
||||
"$importName (import)",
|
||||
)
|
||||
..isPure = hasPureAnnotation;
|
||||
..isPure = hasPureAnnotation
|
||||
..inlineHint = neverInline ? 0 : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +165,8 @@ class FunctionCollector {
|
||||
: translator.signatureForDirectCall(target);
|
||||
|
||||
final function = module.functions.define(ftype, getFunctionName(target))
|
||||
..isPure = hasPureAnnotation && !target.isCheckedEntryReference;
|
||||
..isPure = hasPureAnnotation && !target.isCheckedEntryReference
|
||||
..inlineHint = neverInline ? 0 : null;
|
||||
if (exportName != null) {
|
||||
// Add weak exports to the module as we now know they're used. Strong
|
||||
// exports have already been added.
|
||||
@@ -319,23 +338,8 @@ class FunctionCollector {
|
||||
return "$memberName (unchecked entry)";
|
||||
}
|
||||
|
||||
final noInline = translator.getPragma<bool>(
|
||||
member,
|
||||
"wasm:never-inline",
|
||||
true,
|
||||
);
|
||||
|
||||
// We add "<noInline>" to the function name. When we invoke `wasm-opt` we
|
||||
// then pass the `--no-inline=*<noInline>*` flag, which will prevent
|
||||
// binaryen from inlining those functions.
|
||||
//
|
||||
// => Effectively we make `@pragma('wasm:never-inline')` work for binaryen
|
||||
// as well.
|
||||
const noInlinePostfix = ' <noInline>';
|
||||
final inlinePostfix = noInline == true ? noInlinePostfix : '';
|
||||
|
||||
if (target.isBodyReference) {
|
||||
return "$memberName (body)$inlinePostfix";
|
||||
return "$memberName (body)";
|
||||
}
|
||||
|
||||
if (memberName.endsWith('.')) {
|
||||
@@ -348,7 +352,7 @@ class FunctionCollector {
|
||||
}
|
||||
if (target.isStaticFieldInitializer) {
|
||||
return translator.neverInlineStaticFieldInitializer(member)
|
||||
? '$memberName field initializer$noInlinePostfix'
|
||||
? '$memberName field initializer'
|
||||
: '$memberName field initializer';
|
||||
}
|
||||
return '$memberName implicit getter';
|
||||
@@ -357,11 +361,11 @@ class FunctionCollector {
|
||||
if (target.isInitializerReference) {
|
||||
return 'new $memberName (initializer)';
|
||||
} else if (target.isConstructorBodyReference) {
|
||||
return 'new $memberName (constructor body)$inlinePostfix';
|
||||
return 'new $memberName (constructor body)';
|
||||
} else if (member is Procedure && member.isFactory) {
|
||||
return 'new $memberName';
|
||||
} else {
|
||||
return '$memberName$inlinePostfix';
|
||||
return memberName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2183,10 +2183,10 @@ class Translator with KernelNodes {
|
||||
|
||||
final member = target.asMember;
|
||||
if (member.isExternal) return InliningDecision(false, 'external');
|
||||
if (getPragma<bool>(member, "wasm:never-inline", true) == true) {
|
||||
if (util.getWasmNeverInlinePragma(coreTypes, member) ?? false) {
|
||||
return InliningDecision(false, '@pragma("wasm:never-inline")');
|
||||
}
|
||||
if (getPragma<bool>(member, "wasm:prefer-inline", true) == true) {
|
||||
if (util.getWasmPreferInlinePragma(coreTypes, member) ?? false) {
|
||||
return InliningDecision(true, '@pragma("wasm:prefer-inline")');
|
||||
}
|
||||
if (member is Field) {
|
||||
|
||||
@@ -104,6 +104,24 @@ bool hasWasmWeakExportPragma(CoreTypes coreTypes, Member member) {
|
||||
return hasPragma(coreTypes, member, "wasm:weak-export");
|
||||
}
|
||||
|
||||
bool? getWasmPreferInlinePragma(CoreTypes coreTypes, Member member) {
|
||||
return getPragma<bool>(
|
||||
coreTypes,
|
||||
member,
|
||||
"wasm:prefer-inline",
|
||||
defaultValue: true,
|
||||
);
|
||||
}
|
||||
|
||||
bool? getWasmNeverInlinePragma(CoreTypes coreTypes, Member member) {
|
||||
return getPragma<bool>(
|
||||
coreTypes,
|
||||
member,
|
||||
"wasm:never-inline",
|
||||
defaultValue: true,
|
||||
);
|
||||
}
|
||||
|
||||
String? getWasmExportPragma(CoreTypes coreTypes, Member member) {
|
||||
return getPragma<String>(
|
||||
coreTypes,
|
||||
|
||||
@@ -67,18 +67,19 @@ void main(List<String> args) async {
|
||||
'bash',
|
||||
'pkg/dart2wasm/tool/compile_benchmark',
|
||||
'--extra-compiler-option=--unique-types',
|
||||
for (final option in compilerOptions)
|
||||
if (option == '--standalone')
|
||||
'--standalone'
|
||||
else
|
||||
'--extra-compiler-option=$option',
|
||||
'--no-strip-toolchain-annotations',
|
||||
'--extra-compiler-option=--no-unique-constant-names',
|
||||
'--extra-compiler-option=--enable-experimental-wasm-interop',
|
||||
// Minify interop names so that the names of these entities are more
|
||||
// stable against SDK and compiler changes.
|
||||
'--extra-compiler-option=--minify-interop-names',
|
||||
if (runFromSource) '--src',
|
||||
'--no-strip-wasm',
|
||||
for (final option in compilerOptions)
|
||||
if (option == '--standalone')
|
||||
'--standalone'
|
||||
else
|
||||
'--extra-compiler-option=$option',
|
||||
if (runFromSource) '--src',
|
||||
'-o',
|
||||
wasmFile.path,
|
||||
dartFilename,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
(type $Object <...>)
|
||||
(global $"\"fooAlwaysThrows\"" (ref $JSExternWrapper) <...>)
|
||||
(global $"\"foo\"" (ref $JSExternWrapper) <...>)
|
||||
(func $Error._throwWithCurrentStackTrace <noInline> (param $object (ref $#Top)) <...>)
|
||||
(func $Error._throwWithCurrentStackTrace (param $object (ref $#Top)) <...>)
|
||||
(func $Object (result (ref $Object)) <...>)
|
||||
(func $foo (result (ref null $#Top))
|
||||
global.get $"\"foo\""
|
||||
@@ -20,7 +20,7 @@
|
||||
ref.null none
|
||||
drop
|
||||
call $Object
|
||||
call $"Error._throwWithCurrentStackTrace <noInline>"
|
||||
call $Error._throwWithCurrentStackTrace
|
||||
unreachable
|
||||
)
|
||||
(func $print (param $object (ref null $#Top)) <...>)
|
||||
|
||||
@@ -81,17 +81,17 @@
|
||||
i32.const 0
|
||||
i32.const 106
|
||||
local.get $var1
|
||||
call $"_throwInterfaceTypeAsCheckError1 <noInline>"
|
||||
call $_throwInterfaceTypeAsCheckError1
|
||||
unreachable
|
||||
end $label0
|
||||
local.get $var0
|
||||
ref.cast $Callable
|
||||
return
|
||||
)
|
||||
(func $_throwInterfaceTypeAsCheckError1 <noInline> (param $o (ref null $#Top)) (param $isDeclaredNullable i32) (param $tId i32) (param $typeArgument0 (ref $_Type)) <...>)
|
||||
(func $Fields (param $var0 (ref $_Type)) (result (ref $Fields)) <...>)
|
||||
(func $Object._getTypeArguments (param $object (ref $#Top)) (result (ref $Array<_Type>)) <...>)
|
||||
(func $_isTypeSubtype (param $s (ref $_Type)) (param $t (ref $_Type)) (result i32) <...>)
|
||||
(func $_throwInterfaceTypeAsCheckError1 (param $o (ref null $#Top)) (param $isDeclaredNullable i32) (param $tId i32) (param $typeArgument0 (ref $_Type)) <...>)
|
||||
(func $covarianceCheckMain
|
||||
(local $fields (ref $Fields))
|
||||
global.get $_InterfaceType
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
(table $cross-module-funcs-0 (export "cross-module-funcs-0") 17 funcref)
|
||||
(elem $cross-module-funcs-0
|
||||
(set 2 (ref.func $checkLibraryIsLoadedFromLoadId))
|
||||
(set 4 (ref.func $"Error._throwWithCurrentStackTrace <noInline>"))
|
||||
(set 4 (ref.func $Error._throwWithCurrentStackTrace))
|
||||
(set 5 (ref.func $"wasm:js-string.length (import)"))
|
||||
(set 6 (ref.func $"wasm:js-string.charCodeAt (import)"))
|
||||
(set 7 (ref.func $IntegerDivisionByZeroException))
|
||||
@@ -25,12 +25,11 @@
|
||||
(set 9 (ref.func $"wasm:js-string.equals (import)"))
|
||||
(set 10 (ref.func $JSStringImpl.substring))
|
||||
(set 11 (ref.func $JSStringImpl.+))
|
||||
(set 12 (ref.func $"_throwIndexError <noInline>"))
|
||||
(set 12 (ref.func $_throwIndexError))
|
||||
(set 13 (ref.func $JSStringImpl._interpolate))
|
||||
(set 14 (ref.func $JSStringImpl.fromRefUnchecked))
|
||||
(set 15 (ref.func $JSStringImpl._interpolate2)))
|
||||
(func $Error._throwWithCurrentStackTrace <noInline> (param $var0 (ref $#Top)) <...>)
|
||||
(func $_throwIndexError <noInline> (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $Error._throwWithCurrentStackTrace (param $var0 (ref $#Top)) <...>)
|
||||
(func $IntegerDivisionByZeroException (result (ref $Object)) <...>)
|
||||
(func $JSStringImpl.+ (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl._interpolate (param $var0 (ref $Array<Object?>)) (result (ref $JSExternWrapper)) <...>)
|
||||
@@ -38,5 +37,6 @@
|
||||
(func $JSStringImpl._interpolate3 (param $var0 (ref null $#Top)) (param $var1 (ref null $#Top)) (param $var2 (ref null $#Top)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.fromRefUnchecked (param $var0 externref) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.substring (param $var0 (ref $JSExternWrapper)) (param $var1 i64) (param $var2 i64) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $_throwIndexError (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $checkLibraryIsLoadedFromLoadId (param $var0 i64) (result i32) <...>)
|
||||
)
|
||||
@@ -34,9 +34,12 @@
|
||||
(struct.new $MyConstClass))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $int.parse))
|
||||
(set 1 (ref.func $"mainImpl <noInline>"))
|
||||
(set 1 (ref.func $mainImpl))
|
||||
(set 16 (ref.func $0)))
|
||||
(func $"mainImpl <noInline>" (param $var0 i32)
|
||||
(func $null (result (ref $MyConstClass)) <...>)
|
||||
(func $int.parse (result i64) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $mainImpl (param $var0 i32)
|
||||
i64.const 0
|
||||
i32.const 2
|
||||
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
|
||||
@@ -49,7 +52,7 @@
|
||||
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
|
||||
drop
|
||||
local.get $var0
|
||||
call $"modH1Use <noInline>"
|
||||
call $modH1Use
|
||||
ref.eq
|
||||
i32.eqz
|
||||
if
|
||||
@@ -59,12 +62,11 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $"modH1Use <noInline>" (param $var0 i32) (result (ref $MyConstClass))
|
||||
(@binaryen.inline 0)
|
||||
(func $modH1Use (param $var0 i32) (result (ref $MyConstClass))
|
||||
global.get $MyConstClass
|
||||
global.get $MyConstClass_14
|
||||
local.get $var0
|
||||
select (ref $MyConstClass)
|
||||
)
|
||||
(func $null (result (ref $MyConstClass)) <...>)
|
||||
(func $int.parse (result i64) <...>)
|
||||
)
|
||||
@@ -23,8 +23,9 @@
|
||||
(struct.new $JSExternWrapper)
|
||||
(struct.new $MyConstClass))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 3 (ref.func $"modH0Use <noInline>")))
|
||||
(func $"modH0Use <noInline>" (param $var0 i32) (result (ref $MyConstClass))
|
||||
(set 3 (ref.func $modH0Use)))
|
||||
(@binaryen.inline 0)
|
||||
(func $modH0Use (param $var0 i32) (result (ref $MyConstClass))
|
||||
local.get $var0
|
||||
if (result (ref $MyConstClass))
|
||||
global.get $MyConstClass
|
||||
|
||||
@@ -16,16 +16,19 @@
|
||||
(struct.new $JSExternWrapper))
|
||||
(global $_InterfaceType (ref $_InterfaceType) <...>)
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $"useFoo <noInline>")))
|
||||
(func $"useFoo <noInline>"
|
||||
call $"useFooAsType <noInline>"
|
||||
(set 0 (ref.func $useFoo)))
|
||||
(func $Foo.printFoo (param $var0 (ref $Foo)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $useFoo
|
||||
call $useFooAsType
|
||||
i64.const 0
|
||||
i32.const 1
|
||||
call_indirect (param i64) (result i32)
|
||||
drop
|
||||
call $"useFooAsObject <noInline>"
|
||||
call $useFooAsObject
|
||||
)
|
||||
(func $"useFooAsObject <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $useFooAsObject
|
||||
(local $var0 (ref $Foo))
|
||||
i32.const 107
|
||||
i32.const 0
|
||||
@@ -36,10 +39,10 @@
|
||||
local.get $var0
|
||||
call $Foo.printFoo
|
||||
)
|
||||
(func $"useFooAsType <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $useFooAsType
|
||||
global.get $_InterfaceType
|
||||
i32.const 3
|
||||
call_indirect (param (ref null $#Top))
|
||||
)
|
||||
(func $Foo.printFoo (param $var0 (ref $Foo)) <...>)
|
||||
)
|
||||
@@ -50,8 +50,8 @@
|
||||
(global $global0 (ref $"dummy struct") <...>)
|
||||
(global $global2 (ref $#Vtable-1-1) <...>)
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $"modMainUseH0 <noInline>"))
|
||||
(set 1 (ref.func $"modH1UseH1 <noInline>")))
|
||||
(set 0 (ref.func $modMainUseH0))
|
||||
(set 1 (ref.func $modH1UseH1)))
|
||||
(func $#dummy function (ref struct) -> (ref null #Top) (param $var0 (ref struct)) (result (ref null $#Top)) <...>)
|
||||
(func $"H1 (lazy initializer)" (result (ref $H1))
|
||||
(local $var0 (ref $#Closure-1-1))
|
||||
@@ -127,7 +127,8 @@
|
||||
ref.null none
|
||||
)
|
||||
(func $instantiation constant trampoline (param $var0 (ref struct)) (param $var1 (ref null $#Top)) (result (ref null $#Top)) <...>)
|
||||
(func $"modH1UseH1 <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $modH1UseH1
|
||||
(local $var0 (ref $#Closure-0-1))
|
||||
block $label0 (result (ref $H1))
|
||||
global.get $H1
|
||||
@@ -153,7 +154,8 @@
|
||||
call_ref $type0
|
||||
drop
|
||||
)
|
||||
(func $"modMainUseH0 <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $modMainUseH0
|
||||
i64.const 0
|
||||
i32.const 7
|
||||
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
|
||||
|
||||
@@ -11,23 +11,21 @@
|
||||
(table $cross-module-funcs-0 (export "cross-module-funcs-0") 18 funcref)
|
||||
(elem $cross-module-funcs-0
|
||||
(set 3 (ref.func $checkLibraryIsLoadedFromLoadId))
|
||||
(set 4 (ref.func $"_TypeError._throwNullCheckErrorWithCurrentStack <noInline>"))
|
||||
(set 4 (ref.func $_TypeError._throwNullCheckErrorWithCurrentStack))
|
||||
(set 5 (ref.func $JSStringImpl._interpolate3))
|
||||
(set 6 (ref.func $print))
|
||||
(set 7 (ref.func $"wasm:js-string.length (import)"))
|
||||
(set 8 (ref.func $"wasm:js-string.charCodeAt (import)"))
|
||||
(set 9 (ref.func $IntegerDivisionByZeroException))
|
||||
(set 10 (ref.func $"Error._throwWithCurrentStackTrace <noInline>"))
|
||||
(set 10 (ref.func $Error._throwWithCurrentStackTrace))
|
||||
(set 11 (ref.func $"wasm:js-string.equals (import)"))
|
||||
(set 12 (ref.func $JSStringImpl.substring))
|
||||
(set 13 (ref.func $JSStringImpl.+))
|
||||
(set 14 (ref.func $"_throwIndexError <noInline>"))
|
||||
(set 14 (ref.func $_throwIndexError))
|
||||
(set 15 (ref.func $JSStringImpl._interpolate))
|
||||
(set 16 (ref.func $JSStringImpl.fromRefUnchecked))
|
||||
(set 17 (ref.func $JSStringImpl._interpolate2)))
|
||||
(func $Error._throwWithCurrentStackTrace <noInline> (param $var0 (ref $#Top)) <...>)
|
||||
(func $_TypeError._throwNullCheckErrorWithCurrentStack <noInline> <...>)
|
||||
(func $_throwIndexError <noInline> (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $Error._throwWithCurrentStackTrace (param $var0 (ref $#Top)) <...>)
|
||||
(func $IntegerDivisionByZeroException (result (ref $Object)) <...>)
|
||||
(func $JSStringImpl.+ (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl._interpolate (param $var0 (ref $Array<Object?>)) (result (ref $JSExternWrapper)) <...>)
|
||||
@@ -35,6 +33,8 @@
|
||||
(func $JSStringImpl._interpolate3 (param $var0 (ref null $#Top)) (param $var1 (ref null $#Top)) (param $var2 (ref null $#Top)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.fromRefUnchecked (param $var0 externref) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.substring (param $var0 (ref $JSExternWrapper)) (param $var1 i64) (param $var2 i64) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $_TypeError._throwNullCheckErrorWithCurrentStack <...>)
|
||||
(func $_throwIndexError (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $checkLibraryIsLoadedFromLoadId (param $var0 i64) (result i32) <...>)
|
||||
(func $print (param $var0 (ref null $#Top)) <...>)
|
||||
)
|
||||
@@ -36,71 +36,9 @@
|
||||
(global $foo1Obj (mut (ref null $Object)) <...>)
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $"runtimeTrue implicit getter"))
|
||||
(set 1 (ref.func $"foo1 <noInline>"))
|
||||
(set 2 (ref.func $"foo0 <noInline>")))
|
||||
(set 1 (ref.func $foo1))
|
||||
(set 2 (ref.func $foo0)))
|
||||
(elem $module0.dispatch0 <...>)
|
||||
(func $"foo0 <noInline>"
|
||||
call $"runtimeTrue implicit getter"
|
||||
if (result (ref $Object))
|
||||
i32.const 109
|
||||
i32.const 0
|
||||
struct.new $Object
|
||||
else
|
||||
call $Foo1
|
||||
end
|
||||
global.set $baseObj
|
||||
call $"runtimeTrue implicit getter"
|
||||
drop
|
||||
call $Foo1
|
||||
global.set $foo1Obj
|
||||
i64.const 0
|
||||
i32.const 3
|
||||
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
|
||||
drop
|
||||
call $"foo1 <noInline>"
|
||||
)
|
||||
(func $"foo1 <noInline>"
|
||||
(local $var0 (ref $Object))
|
||||
block $label0
|
||||
block $label1 (result (ref $Object))
|
||||
global.get $baseObj
|
||||
br_on_non_null $label1
|
||||
br $label0
|
||||
end $label1
|
||||
local.tee $var0
|
||||
global.get $1
|
||||
local.get $var0
|
||||
struct.get $Object $field0
|
||||
i32.const 399
|
||||
i32.add
|
||||
call_indirect $module0.dispatch0 (param (ref $Object) (ref null $#Top))
|
||||
block $label2 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label2
|
||||
br $label0
|
||||
end $label2
|
||||
global.get $2
|
||||
call $Foo1.doitDispatch
|
||||
block $label3 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label3
|
||||
br $label0
|
||||
end $label3
|
||||
drop
|
||||
call $Foo1.doitDevirt
|
||||
block $label4 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label4
|
||||
br $label0
|
||||
end $label4
|
||||
drop
|
||||
call $Foo1.doitDevirt
|
||||
return
|
||||
end $label0
|
||||
i32.const 4
|
||||
call_indirect $module0.cross-module-funcs-0
|
||||
unreachable
|
||||
)
|
||||
(func $runtimeTrue implicit getter (result i32) <...>)
|
||||
(func $Foo0.doitDispatch (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"Foo0.doitDispatch(\""
|
||||
@@ -150,4 +88,68 @@
|
||||
i32.const 6
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo0
|
||||
call $"runtimeTrue implicit getter"
|
||||
if (result (ref $Object))
|
||||
i32.const 109
|
||||
i32.const 0
|
||||
struct.new $Object
|
||||
else
|
||||
call $Foo1
|
||||
end
|
||||
global.set $baseObj
|
||||
call $"runtimeTrue implicit getter"
|
||||
drop
|
||||
call $Foo1
|
||||
global.set $foo1Obj
|
||||
i64.const 0
|
||||
i32.const 3
|
||||
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
|
||||
drop
|
||||
call $foo1
|
||||
)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo1
|
||||
(local $var0 (ref $Object))
|
||||
block $label0
|
||||
block $label1 (result (ref $Object))
|
||||
global.get $baseObj
|
||||
br_on_non_null $label1
|
||||
br $label0
|
||||
end $label1
|
||||
local.tee $var0
|
||||
global.get $1
|
||||
local.get $var0
|
||||
struct.get $Object $field0
|
||||
i32.const 399
|
||||
i32.add
|
||||
call_indirect $module0.dispatch0 (param (ref $Object) (ref null $#Top))
|
||||
block $label2 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label2
|
||||
br $label0
|
||||
end $label2
|
||||
global.get $2
|
||||
call $Foo1.doitDispatch
|
||||
block $label3 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label3
|
||||
br $label0
|
||||
end $label3
|
||||
drop
|
||||
call $Foo1.doitDevirt
|
||||
block $label4 (result (ref $Object))
|
||||
global.get $foo1Obj
|
||||
br_on_non_null $label4
|
||||
br $label0
|
||||
end $label4
|
||||
drop
|
||||
call $Foo1.doitDevirt
|
||||
return
|
||||
end $label0
|
||||
i32.const 4
|
||||
call_indirect $module0.cross-module-funcs-0
|
||||
unreachable
|
||||
)
|
||||
)
|
||||
@@ -39,32 +39,20 @@
|
||||
(set 11 (ref.func $jsExceptionStackTrace))
|
||||
(set 18 (ref.func $print))
|
||||
(set 19 (ref.func $JSStringImpl._interpolate3))
|
||||
(set 20 (ref.func $"foo0Code <noInline>"))
|
||||
(set 21 (ref.func $"_throwIndexError <noInline>"))
|
||||
(set 20 (ref.func $foo0Code))
|
||||
(set 21 (ref.func $_throwIndexError))
|
||||
(set 22 (ref.func $GrowableList._withData))
|
||||
(set 25 (ref.func $"wasm:js-string.length (import)"))
|
||||
(set 26 (ref.func $"wasm:js-string.charCodeAt (import)"))
|
||||
(set 27 (ref.func $IntegerDivisionByZeroException))
|
||||
(set 28 (ref.func $"Error._throwWithCurrentStackTrace <noInline>"))
|
||||
(set 28 (ref.func $Error._throwWithCurrentStackTrace))
|
||||
(set 29 (ref.func $"wasm:js-string.equals (import)"))
|
||||
(set 30 (ref.func $JSStringImpl.substring))
|
||||
(set 31 (ref.func $JSStringImpl.+))
|
||||
(set 32 (ref.func $JSStringImpl._interpolate))
|
||||
(set 33 (ref.func $JSStringImpl.fromRefUnchecked))
|
||||
(set 34 (ref.func $JSStringImpl._interpolate2)))
|
||||
(func $Error._throwWithCurrentStackTrace <noInline> (param $var0 (ref $#Top)) <...>)
|
||||
(func $_throwIndexError <noInline> (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $"foo0Code <noInline>" (param $var0 (ref null $#Top))
|
||||
global.get $FooConst0
|
||||
call $print
|
||||
global.get $"\"foo0Code(\""
|
||||
local.get $var0
|
||||
global.get $"\")\""
|
||||
call $JSStringImpl._interpolate3
|
||||
call $print
|
||||
global.get $0
|
||||
global.set $fooGlobal0
|
||||
)
|
||||
(func $Error._throwWithCurrentStackTrace (param $var0 (ref $#Top)) <...>)
|
||||
(func $GrowableList._withData (param $var0 (ref $_Type)) (param $var1 (ref $Array<Object?>)) (result (ref $WasmListBase)) <...>)
|
||||
(func $IntegerDivisionByZeroException (result (ref $Object)) <...>)
|
||||
(func $JSStringImpl.+ (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
@@ -78,8 +66,21 @@
|
||||
(func $_AsyncSuspendState._completeError (param $var0 (ref $_AsyncSuspendState)) (param $var1 (ref $#Top)) (param $var2 (ref $Object)) <...>)
|
||||
(func $_Future (param $var0 (ref $_Type)) (result (ref $_Future)) <...>)
|
||||
(func $_awaitHelper (param $var0 (ref $_AsyncSuspendState)) (param $var1 (ref $_Future)) <...>)
|
||||
(func $_throwIndexError (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $boxJsException (param $var0 externref) (result (ref $#Top)) <...>)
|
||||
(func $checkLibraryIsLoadedFromLoadId (param $var0 i64) (result i32) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo0Code (param $var0 (ref null $#Top))
|
||||
global.get $FooConst0
|
||||
call $print
|
||||
global.get $"\"foo0Code(\""
|
||||
local.get $var0
|
||||
global.get $"\")\""
|
||||
call $JSStringImpl._interpolate3
|
||||
call $print
|
||||
global.get $0
|
||||
global.set $fooGlobal0
|
||||
)
|
||||
(func $jsExceptionStackTrace (param $var0 externref) (result (ref $JavaScriptStack)) <...>)
|
||||
(func $loadLibraryFromLoadId (param $var0 i64) (result (ref $_Future)) <...>)
|
||||
(func $print (param $var0 (ref null $#Top)) <...>)
|
||||
|
||||
@@ -14,11 +14,15 @@
|
||||
(global $fooGlobal1 (mut (ref null $#Top))
|
||||
(ref.null none))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 3 (ref.func $"foo1Code <noInline>"))
|
||||
(set 3 (ref.func $foo1Code))
|
||||
(set 39 (ref.func $0))
|
||||
(set 40 (ref.func $1))
|
||||
(set 41 (ref.func $2)))
|
||||
(func $"foo1Code <noInline>" (param $var0 (ref null $#Top))
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo1Code (param $var0 (ref null $#Top))
|
||||
global.get $FooConst1
|
||||
i32.const 18
|
||||
call_indirect (param (ref null $#Top))
|
||||
@@ -32,7 +36,4 @@
|
||||
global.get $1
|
||||
global.set $fooGlobal1
|
||||
)
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
)
|
||||
@@ -76,7 +76,85 @@
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 17 (ref.func $foo5)))
|
||||
(elem $module0.dispatch0 <...>)
|
||||
(func $"foo5Code <noInline>" (param $var0 (ref $#Top))
|
||||
(func $fooGlobal5 implicit getter (result (ref $#Top)) <...>)
|
||||
(func $FooConst0.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst0(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst1.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst1(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst2.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst2(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst3.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst3(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst4.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst4(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst5.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst5(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConstBase.doit (param $var0 (ref null $#Top))
|
||||
global.get $"\"FooConstBase(\""
|
||||
local.get $var0
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
)
|
||||
(func $foo5 (result (ref $_Future)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo5Code (param $var0 (ref $#Top))
|
||||
(local $var1 (ref $WasmListBase))
|
||||
(local $var2 (ref $Object))
|
||||
(local $var3 i64)
|
||||
@@ -226,82 +304,5 @@
|
||||
i32.add
|
||||
call_indirect $module0.dispatch0 (param (ref $Object) (ref null $#Top))
|
||||
)
|
||||
(func $fooGlobal5 implicit getter (result (ref $#Top)) <...>)
|
||||
(func $FooConst0.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst0(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst1.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst1(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst2.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst2(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst3.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst3(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst4.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst4(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConst5.doit (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
|
||||
global.get $"\"FooConst5(\""
|
||||
local.get $var1
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
local.get $var1
|
||||
call $FooConstBase.doit
|
||||
)
|
||||
(func $FooConstBase.doit (param $var0 (ref null $#Top))
|
||||
global.get $"\"FooConstBase(\""
|
||||
local.get $var0
|
||||
global.get $"\")\""
|
||||
i32.const 19
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
||||
i32.const 18
|
||||
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
|
||||
)
|
||||
(func $foo5 (result (ref $_Future)) <...>)
|
||||
(func $int.parse (param $var0 (ref $JSExternWrapper)) (result i64) <...>)
|
||||
)
|
||||
@@ -14,11 +14,15 @@
|
||||
(global $fooGlobal2 (mut (ref null $#Top))
|
||||
(ref.null none))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 12 (ref.func $"foo2Code <noInline>"))
|
||||
(set 12 (ref.func $foo2Code))
|
||||
(set 37 (ref.func $0))
|
||||
(set 38 (ref.func $1))
|
||||
(set 42 (ref.func $2)))
|
||||
(func $"foo2Code <noInline>" (param $var0 (ref null $#Top))
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo2Code (param $var0 (ref null $#Top))
|
||||
global.get $FooConst2
|
||||
i32.const 18
|
||||
call_indirect (param (ref null $#Top))
|
||||
@@ -32,7 +36,4 @@
|
||||
global.get $2
|
||||
global.set $fooGlobal2
|
||||
)
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
)
|
||||
@@ -14,11 +14,15 @@
|
||||
(global $fooGlobal3 (mut (ref null $#Top))
|
||||
(ref.null none))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 14 (ref.func $"foo3Code <noInline>"))
|
||||
(set 14 (ref.func $foo3Code))
|
||||
(set 35 (ref.func $0))
|
||||
(set 36 (ref.func $1))
|
||||
(set 43 (ref.func $2)))
|
||||
(func $"foo3Code <noInline>" (param $var0 (ref null $#Top))
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo3Code (param $var0 (ref null $#Top))
|
||||
global.get $FooConst3
|
||||
i32.const 18
|
||||
call_indirect (param (ref null $#Top))
|
||||
@@ -32,7 +36,4 @@
|
||||
global.get $3
|
||||
global.set $fooGlobal3
|
||||
)
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
)
|
||||
@@ -14,11 +14,15 @@
|
||||
(global $fooGlobal4 (mut (ref null $#Top))
|
||||
(ref.null none))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 16 (ref.func $"foo4Code <noInline>"))
|
||||
(set 16 (ref.func $foo4Code))
|
||||
(set 23 (ref.func $0))
|
||||
(set 24 (ref.func $1))
|
||||
(set 44 (ref.func $2)))
|
||||
(func $"foo4Code <noInline>" (param $var0 (ref null $#Top))
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $foo4Code (param $var0 (ref null $#Top))
|
||||
global.get $FooConst4
|
||||
i32.const 18
|
||||
call_indirect (param (ref null $#Top))
|
||||
@@ -32,7 +36,4 @@
|
||||
global.get $4
|
||||
global.set $fooGlobal4
|
||||
)
|
||||
(func $null (result (ref null $#Top)) <...>)
|
||||
(func $null (param $var0 (ref null $#Top)) <...>)
|
||||
(func $null (result (ref $Object)) <...>)
|
||||
)
|
||||
@@ -22,23 +22,19 @@
|
||||
(elem $cross-module-funcs-0
|
||||
(set 3 (ref.func $"wasm:js-string.length (import)"))
|
||||
(set 4 (ref.func $JSStringImpl._interpolate))
|
||||
(set 5 (ref.func $"_throwIndexError <noInline>"))
|
||||
(set 5 (ref.func $_throwIndexError))
|
||||
(set 6 (ref.func $"wasm:js-string.charCodeAt (import)"))
|
||||
(set 7 (ref.func $JSStringImpl.substring))
|
||||
(set 8 (ref.func $JSStringImpl.+))
|
||||
(set 9 (ref.func $ArgumentError))
|
||||
(set 10 (ref.func $"Error._throwWithCurrentStackTrace <noInline>"))
|
||||
(set 10 (ref.func $Error._throwWithCurrentStackTrace))
|
||||
(set 11 (ref.func $JSStringImpl.fromRefUnchecked))
|
||||
(set 12 (ref.func $"_throwRangeError <noInline>"))
|
||||
(set 12 (ref.func $_throwRangeError))
|
||||
(set 13 (ref.func $_jsBigIntToString))
|
||||
(set 14 (ref.func $"wasm:js-string.equals (import)"))
|
||||
(set 15 (ref.func $JSStringImpl._interpolate4))
|
||||
(set 16 (ref.func $IntegerDivisionByZeroException))
|
||||
(set 17 (ref.func $"_TypeError._throwNullCheckErrorWithCurrentStack <noInline>")))
|
||||
(func $Error._throwWithCurrentStackTrace <noInline> (param $var0 (ref $#Top)) <...>)
|
||||
(func $_TypeError._throwNullCheckErrorWithCurrentStack <noInline> <...>)
|
||||
(func $_throwIndexError <noInline> (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $_throwRangeError <noInline> (param $var0 i64) (param $var1 i64) (param $var2 i64) (param $var3 (ref null $JSExternWrapper)) (param $var4 (ref null $JSExternWrapper)) <...>)
|
||||
(set 17 (ref.func $_TypeError._throwNullCheckErrorWithCurrentStack)))
|
||||
(func $#init
|
||||
global.get $"\"1.0\""
|
||||
i32.const 16
|
||||
@@ -60,12 +56,16 @@
|
||||
array.set $Array<WasmArray<WasmI8>?>
|
||||
)
|
||||
(func $ArgumentError (param $var0 (ref null $#Top)) (param $var1 (ref null $JSExternWrapper)) (result (ref $ArgumentError)) <...>)
|
||||
(func $Error._throwWithCurrentStackTrace (param $var0 (ref $#Top)) <...>)
|
||||
(func $IntegerDivisionByZeroException (result (ref $Object)) <...>)
|
||||
(func $JSStringImpl.+ (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl._interpolate (param $var0 (ref $Array<Object?>)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl._interpolate4 (param $var0 (ref null $#Top)) (param $var1 (ref null $#Top)) (param $var2 (ref null $#Top)) (param $var3 (ref null $#Top)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.fromRefUnchecked (param $var0 externref) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $JSStringImpl.substring (param $var0 (ref $JSExternWrapper)) (param $var1 i64) (param $var2 i64) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $_TypeError._throwNullCheckErrorWithCurrentStack <...>)
|
||||
(func $_jsBigIntToString (param $var0 i64) (param $var1 i64) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $_throwIndexError (param $var0 i64) (param $var1 i64) (param $var2 (ref null $JSExternWrapper)) <...>)
|
||||
(func $_throwRangeError (param $var0 i64) (param $var1 i64) (param $var2 i64) (param $var3 (ref null $JSExternWrapper)) (param $var4 (ref null $JSExternWrapper)) <...>)
|
||||
(data $data0 <... 2 bytes ...>)
|
||||
)
|
||||
@@ -15,7 +15,8 @@
|
||||
(global $"\"Foo<\"" (ref $JSExternWrapper) <...>)
|
||||
(elem $$.& <...>)
|
||||
(elem $$.% <...>)
|
||||
(func $"Foo.takeT (body) <noInline>" (param $var0 (ref $Foo)) (param $var1 (ref $#Top))
|
||||
(@binaryen.inline 0)
|
||||
(func $"Foo.takeT (body)" (param $var0 (ref $Foo)) (param $var1 (ref $#Top))
|
||||
(local $var2 (ref $_InterfaceType))
|
||||
global.get $"\"Foo<\""
|
||||
local.get $var0
|
||||
@@ -161,6 +162,6 @@
|
||||
end
|
||||
local.get $var0
|
||||
local.get $var1
|
||||
call $"Foo.takeT (body) <noInline>"
|
||||
call $"Foo.takeT (body)"
|
||||
)
|
||||
)
|
||||
@@ -9,8 +9,9 @@
|
||||
(table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 12 funcref)
|
||||
(table $module0.dispatch0 (import "module0" "dispatch0") 673 funcref)
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $"runTest <noInline>")))
|
||||
(func $"runTest <noInline>"
|
||||
(set 0 (ref.func $runTest)))
|
||||
(@binaryen.inline 0)
|
||||
(func $runTest
|
||||
(local $var0 (ref $WasmListBase))
|
||||
(local $var1 (ref null $#Top))
|
||||
(local $var2 (ref $Object))
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
(i32.const 84)
|
||||
(i64.const 1)
|
||||
(struct.new $BoxedInt))
|
||||
(func $"main <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $main
|
||||
global.get $1
|
||||
call $print
|
||||
i32.const 84
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
(i32.const 56)
|
||||
(global.get $".hello world")
|
||||
(struct.new $JSExternWrapper))
|
||||
(func $"main <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $main
|
||||
global.get $"\"hello world\""
|
||||
call $print
|
||||
)
|
||||
|
||||
@@ -16,11 +16,13 @@
|
||||
(global.get $".hello world")
|
||||
(struct.new $JSExternWrapper))
|
||||
(elem $module0.cross-module-funcs-0
|
||||
(set 0 (ref.func $"deferredFoo <noInline>")))
|
||||
(func $"deferredFoo <noInline>"
|
||||
call $"mainFoo <noInline>"
|
||||
(set 0 (ref.func $deferredFoo)))
|
||||
(@binaryen.inline 0)
|
||||
(func $deferredFoo
|
||||
call $mainFoo
|
||||
)
|
||||
(func $"mainFoo <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $mainFoo
|
||||
global.get $"\"hello world\""
|
||||
i32.const 1
|
||||
call_indirect (param (ref null $#Top))
|
||||
|
||||
@@ -10,29 +10,33 @@
|
||||
(global $true (ref $#Top) <...>)
|
||||
(func $boolValue implicit getter (result i32) <...>)
|
||||
(func $ktrue implicit getter (result i32) <...>)
|
||||
(func $sinkBool <noInline> (param $var0 i32) <...>)
|
||||
(func $sinkBoolNullable <noInline> (param $var0 (ref null $#Top)) <...>)
|
||||
(func $"testBoolConstant <noInline>"
|
||||
(func $sinkBool (param $var0 i32) <...>)
|
||||
(func $sinkBoolNullable (param $var0 (ref null $#Top)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $testBoolConstant
|
||||
i32.const 1
|
||||
call $"dart2wasm.M (import)"
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartBool
|
||||
call $"sinkBool <noInline>"
|
||||
call $sinkBool
|
||||
)
|
||||
(func $"testBoolConstantNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testBoolConstantNullable
|
||||
ref.null noextern
|
||||
call $"dart2wasm.N (import)"
|
||||
call $toDartNullableBool
|
||||
call $"sinkBoolNullable <noInline>"
|
||||
call $sinkBoolNullable
|
||||
)
|
||||
(func $"testBoolValue <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testBoolValue
|
||||
call $"boolValue implicit getter"
|
||||
call $"dart2wasm.M (import)"
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartBool
|
||||
call $"sinkBool <noInline>"
|
||||
call $sinkBool
|
||||
)
|
||||
(func $"testBoolValueNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testBoolValueNullable
|
||||
(local $var0 (ref null $#Top))
|
||||
global.get $"boolValueNullable initialized"
|
||||
if (result (ref null $#Top))
|
||||
@@ -66,7 +70,7 @@
|
||||
end
|
||||
call $"dart2wasm.N (import)"
|
||||
call $toDartNullableBool
|
||||
call $"sinkBoolNullable <noInline>"
|
||||
call $sinkBoolNullable
|
||||
)
|
||||
(func $toDartBool (param $var0 externref) (result i32) <...>)
|
||||
(func $toDartNullableBool (param $var0 externref) (result (ref null $#Top)) <...>)
|
||||
|
||||
@@ -11,27 +11,31 @@
|
||||
(global $doubleValueNullable (mut (ref null $BoxedDouble)) <...>)
|
||||
(func $doubleValue implicit getter (result f64) <...>)
|
||||
(func $ktrue implicit getter (result i32) <...>)
|
||||
(func $sinkDouble <noInline> (param $var0 f64) <...>)
|
||||
(func $sinkDoubleNullable <noInline> (param $var0 (ref null $BoxedDouble)) <...>)
|
||||
(func $"testDoubleConstant <noInline>"
|
||||
(func $sinkDouble (param $var0 f64) <...>)
|
||||
(func $sinkDoubleNullable (param $var0 (ref null $BoxedDouble)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $testDoubleConstant
|
||||
f64.const 1.1
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartDouble
|
||||
call $"sinkDouble <noInline>"
|
||||
call $sinkDouble
|
||||
)
|
||||
(func $"testDoubleConstantNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testDoubleConstantNullable
|
||||
ref.null noextern
|
||||
call $"dart2wasm.N (import)"
|
||||
call $toDartNullableDouble
|
||||
call $"sinkDoubleNullable <noInline>"
|
||||
call $sinkDoubleNullable
|
||||
)
|
||||
(func $"testDoubleValue <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testDoubleValue
|
||||
call $"doubleValue implicit getter"
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartDouble
|
||||
call $"sinkDouble <noInline>"
|
||||
call $sinkDouble
|
||||
)
|
||||
(func $"testDoubleValueNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testDoubleValueNullable
|
||||
(local $var0 (ref null $BoxedDouble))
|
||||
global.get $"doubleValueNullable initialized"
|
||||
if (result (ref null $BoxedDouble))
|
||||
@@ -62,7 +66,7 @@
|
||||
end
|
||||
call $"dart2wasm.N (import)"
|
||||
call $toDartNullableDouble
|
||||
call $"sinkDoubleNullable <noInline>"
|
||||
call $sinkDoubleNullable
|
||||
)
|
||||
(func $toDartDouble (param $var0 externref) (result f64) <...>)
|
||||
(func $toDartNullableDouble (param $var0 externref) (result (ref null $BoxedDouble)) <...>)
|
||||
|
||||
@@ -10,29 +10,34 @@
|
||||
(global $intValueNullable (mut (ref null $BoxedInt)) <...>)
|
||||
(func $intValue implicit getter (result i64) <...>)
|
||||
(func $ktrue implicit getter (result i32) <...>)
|
||||
(func $sinkInt <noInline> (param $var0 i64) <...>)
|
||||
(func $sinkIntNullable <noInline> (param $var0 (ref null $BoxedInt)) <...>)
|
||||
(func $"testIntConstant <noInline>"
|
||||
(func $jsifyInt (param $var0 i64) (result externref) <...>)
|
||||
(func $sinkInt (param $var0 i64) <...>)
|
||||
(func $sinkIntNullable (param $var0 (ref null $BoxedInt)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $testIntConstant
|
||||
i64.const 1
|
||||
call $jsifyInt
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartInt
|
||||
call $"sinkInt <noInline>"
|
||||
call $sinkInt
|
||||
)
|
||||
(func $"testIntConstantNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testIntConstantNullable
|
||||
ref.null noextern
|
||||
call $"dart2wasm.M (import)"
|
||||
call $toDartNullableInt
|
||||
call $"sinkIntNullable <noInline>"
|
||||
call $sinkIntNullable
|
||||
)
|
||||
(func $"testIntValue <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testIntValue
|
||||
call $"intValue implicit getter"
|
||||
call $jsifyInt
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartInt
|
||||
call $"sinkInt <noInline>"
|
||||
call $sinkInt
|
||||
)
|
||||
(func $"testIntValueNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testIntValueNullable
|
||||
(local $var0 (ref null $BoxedInt))
|
||||
global.get $"intValueNullable initialized"
|
||||
if (result (ref null $BoxedInt))
|
||||
@@ -63,9 +68,8 @@
|
||||
end
|
||||
call $"dart2wasm.M (import)"
|
||||
call $toDartNullableInt
|
||||
call $"sinkIntNullable <noInline>"
|
||||
call $sinkIntNullable
|
||||
)
|
||||
(func $jsifyInt (param $var0 i64) (result externref) <...>)
|
||||
(func $toDartInt (param $var0 externref) (result i64) <...>)
|
||||
(func $toDartNullableInt (param $var0 externref) (result (ref null $BoxedInt)) <...>)
|
||||
)
|
||||
@@ -11,35 +11,42 @@
|
||||
(global $numValueNullable (mut (ref null $#Top)) <...>)
|
||||
(func $ktrue implicit getter (result i32) <...>)
|
||||
(func $numValue implicit getter (result (ref $#Top)) <...>)
|
||||
(func $sinkNum <noInline> (param $var0 f64) <...>)
|
||||
(func $sinkNumNullable <noInline> (param $var0 (ref null $BoxedDouble)) <...>)
|
||||
(func $"testNumConstant <noInline>"
|
||||
(func $jsifyInt (result (ref extern)) <...>)
|
||||
(func $jsifyNum (param $var0 (ref $#Top)) (result externref) <...>)
|
||||
(func $sinkNum (param $var0 f64) <...>)
|
||||
(func $sinkNumNullable (param $var0 (ref null $BoxedDouble)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $testNumConstant
|
||||
call $jsifyInt
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartDouble
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testNumConstantDouble <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testNumConstantDouble
|
||||
f64.const 1.1
|
||||
call $"dart2wasm.P (import)"
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartDouble
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testNumConstantNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testNumConstantNullable
|
||||
ref.null noextern
|
||||
call $"dart2wasm.M (import)"
|
||||
call $toDartNullableDouble
|
||||
call $"sinkNumNullable <noInline>"
|
||||
call $sinkNumNullable
|
||||
)
|
||||
(func $"testNumValue <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testNumValue
|
||||
call $"numValue implicit getter"
|
||||
call $jsifyNum
|
||||
call $"dart2wasm.R (import)"
|
||||
call $toDartDouble
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testNumValueNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testNumValueNullable
|
||||
(local $var0 (ref null $#Top))
|
||||
global.get $"numValueNullable initialized"
|
||||
if (result (ref null $#Top))
|
||||
@@ -68,10 +75,8 @@
|
||||
end
|
||||
call $"dart2wasm.M (import)"
|
||||
call $toDartNullableDouble
|
||||
call $"sinkNumNullable <noInline>"
|
||||
call $sinkNumNullable
|
||||
)
|
||||
(func $jsifyInt (result (ref extern)) <...>)
|
||||
(func $jsifyNum (param $var0 (ref $#Top)) (result externref) <...>)
|
||||
(func $toDartDouble (param $var0 externref) (result f64) <...>)
|
||||
(func $toDartNullableDouble (param $var0 externref) (result (ref null $BoxedDouble)) <...>)
|
||||
)
|
||||
@@ -11,29 +11,34 @@
|
||||
(global $stringValueNullable (mut (ref null $JSExternWrapper)) <...>)
|
||||
(func $ktrue implicit getter (result i32) <...>)
|
||||
(func $new JSStringImpl.fromRef (param $var0 externref) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $sinkString <noInline> (param $var0 (ref $JSExternWrapper)) <...>)
|
||||
(func $sinkStringNullable <noInline> (param $var0 (ref null $JSExternWrapper)) <...>)
|
||||
(func $stringValue implicit getter (result (ref $JSExternWrapper)) <...>)
|
||||
(func $"testStringConstant <noInline>"
|
||||
(func $JSStringImpl.fromRefNullable (param $var0 externref) (result (ref null $JSExternWrapper)) <...>)
|
||||
(func $sinkString (param $var0 (ref $JSExternWrapper)) <...>)
|
||||
(func $sinkStringNullable (param $var0 (ref null $JSExternWrapper)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $testStringConstant
|
||||
global.get $.a
|
||||
call $"dart2wasm.P (import)"
|
||||
call $"new JSStringImpl.fromRef"
|
||||
call $"sinkString <noInline>"
|
||||
call $sinkString
|
||||
)
|
||||
(func $"testStringConstantNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testStringConstantNullable
|
||||
ref.null noextern
|
||||
call $"dart2wasm.M (import)"
|
||||
call $JSStringImpl.fromRefNullable
|
||||
call $"sinkStringNullable <noInline>"
|
||||
call $sinkStringNullable
|
||||
)
|
||||
(func $"testStringValue <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testStringValue
|
||||
call $"stringValue implicit getter"
|
||||
struct.get $JSExternWrapper $_externRef
|
||||
call $"dart2wasm.P (import)"
|
||||
call $"new JSStringImpl.fromRef"
|
||||
call $"sinkString <noInline>"
|
||||
call $sinkString
|
||||
)
|
||||
(func $"testStringValueNullable <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testStringValueNullable
|
||||
(local $var0 (ref null $JSExternWrapper))
|
||||
(local $var1 (ref null $JSExternWrapper))
|
||||
global.get $"stringValueNullable initialized"
|
||||
@@ -62,7 +67,6 @@
|
||||
end
|
||||
call $"dart2wasm.M (import)"
|
||||
call $JSStringImpl.fromRefNullable
|
||||
call $"sinkStringNullable <noInline>"
|
||||
call $sinkStringNullable
|
||||
)
|
||||
(func $JSStringImpl.fromRefNullable (param $var0 externref) (result (ref null $JSExternWrapper)) <...>)
|
||||
)
|
||||
@@ -4,9 +4,50 @@
|
||||
(func $"dart2wasm.N (import)" (import "dart2wasm" "N") (param i32))
|
||||
(func $"dart2wasm.O (import)" (import "dart2wasm" "O") (param i32))
|
||||
(func $"dart2wasm.P (import)" (import "dart2wasm" "P") (param i32 i32) (result i32))
|
||||
(func $consumeAny <noInline> <...>)
|
||||
(func $consumeInt <noInline> (param $arg i64) <...>)
|
||||
(func $"runTest <noInline>"
|
||||
(func $addInt (param $a i64) (param $b i64) (result i64)
|
||||
(local $#this i64)
|
||||
(local $#this i64)
|
||||
local.get $a
|
||||
local.set $#this
|
||||
block $label0 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label0
|
||||
end $label0
|
||||
local.get $b
|
||||
local.set $#this
|
||||
block $label1 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label1
|
||||
end $label1
|
||||
call $"dart2wasm.P (import)"
|
||||
i64.extend_i32_s
|
||||
return
|
||||
)
|
||||
(func $consumeAny <...>)
|
||||
(func $consumeInt (param $arg i64) <...>)
|
||||
(func $passIntToJS (param $a i64) (result (ref null $#Top))
|
||||
(local $#this i64)
|
||||
local.get $a
|
||||
local.set $#this
|
||||
block $label0 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label0
|
||||
end $label0
|
||||
call $"dart2wasm.O (import)"
|
||||
ref.null none
|
||||
return
|
||||
)
|
||||
(func $passWasmI32ToJS (param $a i32) (result (ref null $#Top))
|
||||
local.get $a
|
||||
call $"dart2wasm.N (import)"
|
||||
ref.null none
|
||||
return
|
||||
)
|
||||
(@binaryen.inline 0)
|
||||
(func $runTest
|
||||
(local $#this i64)
|
||||
(local $#this i64)
|
||||
(local $a i32)
|
||||
@@ -24,13 +65,13 @@
|
||||
i64.const 1
|
||||
i64.const 2
|
||||
call $addInt
|
||||
call $"consumeInt <noInline>"
|
||||
call $consumeInt
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 3
|
||||
i64.const 4
|
||||
call $addInt
|
||||
call $"consumeInt <noInline>"
|
||||
call $consumeInt
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 1
|
||||
@@ -56,7 +97,7 @@
|
||||
br $label2
|
||||
end $label2
|
||||
i64.extend_i32_s
|
||||
call $"consumeInt <noInline>"
|
||||
call $consumeInt
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 3
|
||||
@@ -82,19 +123,19 @@
|
||||
br $label5
|
||||
end $label5
|
||||
i64.extend_i32_s
|
||||
call $"consumeInt <noInline>"
|
||||
call $consumeInt
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 1
|
||||
call $passIntToJS
|
||||
local.set $var0
|
||||
call $"consumeAny <noInline>"
|
||||
call $consumeAny
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 2
|
||||
call $passIntToJS
|
||||
local.set $var1
|
||||
call $"consumeAny <noInline>"
|
||||
call $consumeAny
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 1
|
||||
@@ -106,7 +147,7 @@
|
||||
end $label6
|
||||
call $passWasmI32ToJS
|
||||
local.set $var2
|
||||
call $"consumeAny <noInline>"
|
||||
call $consumeAny
|
||||
ref.null none
|
||||
drop
|
||||
i64.const 2
|
||||
@@ -118,48 +159,8 @@
|
||||
end $label7
|
||||
call $passWasmI32ToJS
|
||||
local.set $var3
|
||||
call $"consumeAny <noInline>"
|
||||
call $consumeAny
|
||||
ref.null none
|
||||
drop
|
||||
)
|
||||
(func $addInt (param $a i64) (param $b i64) (result i64)
|
||||
(local $#this i64)
|
||||
(local $#this i64)
|
||||
local.get $a
|
||||
local.set $#this
|
||||
block $label0 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label0
|
||||
end $label0
|
||||
local.get $b
|
||||
local.set $#this
|
||||
block $label1 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label1
|
||||
end $label1
|
||||
call $"dart2wasm.P (import)"
|
||||
i64.extend_i32_s
|
||||
return
|
||||
)
|
||||
(func $passIntToJS (param $a i64) (result (ref null $#Top))
|
||||
(local $#this i64)
|
||||
local.get $a
|
||||
local.set $#this
|
||||
block $label0 (result i32)
|
||||
local.get $#this
|
||||
i32.wrap_i64
|
||||
br $label0
|
||||
end $label0
|
||||
call $"dart2wasm.O (import)"
|
||||
ref.null none
|
||||
return
|
||||
)
|
||||
(func $passWasmI32ToJS (param $a i32) (result (ref null $#Top))
|
||||
local.get $a
|
||||
call $"dart2wasm.N (import)"
|
||||
ref.null none
|
||||
return
|
||||
)
|
||||
)
|
||||
@@ -13,29 +13,37 @@
|
||||
(func $intB implicit getter (result i64) <...>)
|
||||
(func $numIntA implicit getter (result (ref $#Top)) <...>)
|
||||
(func $numIntB implicit getter (result (ref $#Top)) <...>)
|
||||
(func $"sinkDouble <noInline>" (param $var0 f64)
|
||||
(func $_maxSlow (param $var0 (ref $#Top)) (param $var1 (ref $#Top)) (result (ref $#Top)) <...>)
|
||||
(func $_minSlow (param $var0 (ref $#Top)) (param $var1 (ref $#Top)) (result (ref $#Top)) <...>)
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $sinkDouble (param $var0 f64)
|
||||
i32.const 92
|
||||
local.get $var0
|
||||
struct.new $BoxedDouble
|
||||
call $print
|
||||
)
|
||||
(func $"sinkInt <noInline>" (param $var0 i64)
|
||||
(@binaryen.inline 0)
|
||||
(func $sinkInt (param $var0 i64)
|
||||
i32.const 86
|
||||
local.get $var0
|
||||
struct.new $BoxedInt
|
||||
call $print
|
||||
)
|
||||
(func $"sinkNum <noInline>" (param $var0 (ref $#Top))
|
||||
(@binaryen.inline 0)
|
||||
(func $sinkNum (param $var0 (ref $#Top))
|
||||
local.get $var0
|
||||
call $print
|
||||
)
|
||||
(func $"testMaxDoubleDouble <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMaxDoubleDouble
|
||||
call $"doubleA implicit getter"
|
||||
call $"doubleB implicit getter"
|
||||
f64.max
|
||||
call $"sinkDouble <noInline>"
|
||||
call $sinkDouble
|
||||
)
|
||||
(func $"testMaxIntDouble <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMaxIntDouble
|
||||
i32.const 86
|
||||
call $"intA implicit getter"
|
||||
struct.new $BoxedInt
|
||||
@@ -43,9 +51,10 @@
|
||||
call $"doubleA implicit getter"
|
||||
struct.new $BoxedDouble
|
||||
call $_maxSlow
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testMaxIntInt <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMaxIntInt
|
||||
(local $var0 i64)
|
||||
(local $var1 i64)
|
||||
call $"intA implicit getter"
|
||||
@@ -56,9 +65,10 @@
|
||||
local.get $var1
|
||||
i64.ge_s
|
||||
select
|
||||
call $"sinkInt <noInline>"
|
||||
call $sinkInt
|
||||
)
|
||||
(func $"testMaxNumNum <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMaxNumNum
|
||||
(local $var0 (ref $#Top))
|
||||
(local $var1 (ref $#Top))
|
||||
(local $var2 i64)
|
||||
@@ -119,15 +129,17 @@
|
||||
local.get $var1
|
||||
call $_maxSlow
|
||||
end $label0
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testMinDoubleDouble <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMinDoubleDouble
|
||||
call $"doubleA implicit getter"
|
||||
call $"doubleB implicit getter"
|
||||
f64.min
|
||||
call $"sinkDouble <noInline>"
|
||||
call $sinkDouble
|
||||
)
|
||||
(func $"testMinIntDouble <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMinIntDouble
|
||||
i32.const 86
|
||||
call $"intA implicit getter"
|
||||
struct.new $BoxedInt
|
||||
@@ -135,9 +147,10 @@
|
||||
call $"doubleA implicit getter"
|
||||
struct.new $BoxedDouble
|
||||
call $_minSlow
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $"testMinIntInt <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMinIntInt
|
||||
(local $var0 i64)
|
||||
(local $var1 i64)
|
||||
call $"intA implicit getter"
|
||||
@@ -148,9 +161,10 @@
|
||||
local.get $var1
|
||||
i64.le_s
|
||||
select
|
||||
call $"sinkInt <noInline>"
|
||||
call $sinkInt
|
||||
)
|
||||
(func $"testMinNumNum <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $testMinNumNum
|
||||
(local $var0 (ref $#Top))
|
||||
(local $var1 (ref $#Top))
|
||||
(local $var2 i64)
|
||||
@@ -211,9 +225,6 @@
|
||||
local.get $var1
|
||||
call $_minSlow
|
||||
end $label0
|
||||
call $"sinkNum <noInline>"
|
||||
call $sinkNum
|
||||
)
|
||||
(func $_maxSlow (param $var0 (ref $#Top)) (param $var1 (ref $#Top)) (result (ref $#Top)) <...>)
|
||||
(func $_minSlow (param $var0 (ref $#Top)) (param $var1 (ref $#Top)) (result (ref $#Top)) <...>)
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
)
|
||||
@@ -5,7 +5,8 @@
|
||||
(field $field0 i32)
|
||||
(field $value f64))))
|
||||
(memory $foo.mem (import "foo" "mem") 1)
|
||||
(func $"main <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $main
|
||||
i32.const 1
|
||||
memory.grow $foo.mem
|
||||
drop
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
(global $"\"4\"" (ref $JSExternWrapper) <...>)
|
||||
(global $"\"bar(\"" (ref $JSExternWrapper) <...>)
|
||||
(global $"\"foo(\"" (ref $JSExternWrapper) <...>)
|
||||
(func $JSStringImpl._interpolate3 (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $#Top)) (param $var2 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
(@binaryen.removable.if.unused)
|
||||
(func $"foo <noInline>" (param $var0 (ref $JSExternWrapper)) (result (ref $BoxedInt))
|
||||
(@binaryen.inline 0)
|
||||
(func $foo (param $var0 (ref $JSExternWrapper)) (result (ref $BoxedInt))
|
||||
global.get $"\"foo(\""
|
||||
local.get $var0
|
||||
global.get $"\")\""
|
||||
@@ -28,14 +30,14 @@
|
||||
i64.extend_i32_u
|
||||
struct.new $BoxedInt
|
||||
)
|
||||
(func $"runApp <noInline>"
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $runApp
|
||||
global.get $"\"3\""
|
||||
call $"foo <noInline>"
|
||||
call $foo
|
||||
call $print
|
||||
global.get $"\"4\""
|
||||
call $"foo <noInline>"
|
||||
call $foo
|
||||
call $print
|
||||
)
|
||||
(func $JSStringImpl._interpolate3 (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $#Top)) (param $var2 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
)
|
||||
@@ -11,8 +11,12 @@
|
||||
(global $"\"Caught Error\"" (ref $JSExternWrapper) <...>)
|
||||
(global $"\"Caught JSAny\"" (ref $JSExternWrapper) <...>)
|
||||
(global $"\"Caught Object\"" (ref $JSExternWrapper) <...>)
|
||||
(func $f <noInline> <...>)
|
||||
(func $"tryBlocks1 <noInline>"
|
||||
(func $boxJsException (param $var0 externref) (result (ref $#Top)) <...>)
|
||||
(func $f <...>)
|
||||
(func $jsExceptionStackTrace (param $var0 externref) (result (ref $JavaScriptStack)) <...>)
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
(@binaryen.inline 0)
|
||||
(func $tryBlocks1
|
||||
(local $var0 i32)
|
||||
(local $var1 (ref $#Top))
|
||||
(local $var2 (ref $#Top))
|
||||
@@ -21,7 +25,7 @@
|
||||
block $label0
|
||||
block $label1 (result (ref $#Top)) (result (ref $#Top))
|
||||
try $label2
|
||||
call $"f <noInline>"
|
||||
call $f
|
||||
br $label0
|
||||
catch $tag0
|
||||
local.set $var3
|
||||
@@ -84,7 +88,8 @@
|
||||
call $print
|
||||
end $label0
|
||||
)
|
||||
(func $"tryBlocks2 <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $tryBlocks2
|
||||
(local $var0 (ref $#Top))
|
||||
(local $var1 (ref $#Top))
|
||||
(local $var2 (ref $#Top))
|
||||
@@ -92,7 +97,7 @@
|
||||
block $label0
|
||||
block $label1 (result (ref $#Top)) (result (ref $#Top))
|
||||
try $label2
|
||||
call $"f <noInline>"
|
||||
call $f
|
||||
br $label0
|
||||
catch $tag0
|
||||
local.set $var1
|
||||
@@ -115,14 +120,15 @@
|
||||
call $print
|
||||
end $label0
|
||||
)
|
||||
(func $"tryBlocks3 <noInline>"
|
||||
(@binaryen.inline 0)
|
||||
(func $tryBlocks3
|
||||
(local $var0 i32)
|
||||
(local $var1 (ref $#Top))
|
||||
(local $var2 (ref $#Top))
|
||||
block $label0
|
||||
block $label1
|
||||
try $label2
|
||||
call $"f <noInline>"
|
||||
call $f
|
||||
br $label0
|
||||
catch $tag0
|
||||
local.set $var2
|
||||
@@ -185,7 +191,4 @@
|
||||
call $print
|
||||
end $label0
|
||||
)
|
||||
(func $boxJsException (param $var0 externref) (result (ref $#Top)) <...>)
|
||||
(func $jsExceptionStackTrace (param $var0 externref) (result (ref $JavaScriptStack)) <...>)
|
||||
(func $print (param $var0 (ref $#Top)) <...>)
|
||||
)
|
||||
@@ -32,13 +32,16 @@ class FunctionBuilder extends ir.BaseFunction
|
||||
}
|
||||
|
||||
@override
|
||||
ir.DefinedFunction forceBuild() => ir.DefinedFunction(
|
||||
enclosingModule,
|
||||
body.build(),
|
||||
finalizableIndex,
|
||||
type,
|
||||
functionName,
|
||||
)..isPure = isPure;
|
||||
ir.DefinedFunction forceBuild() =>
|
||||
ir.DefinedFunction(
|
||||
enclosingModule,
|
||||
body.build(),
|
||||
finalizableIndex,
|
||||
type,
|
||||
functionName,
|
||||
)
|
||||
..isPure = isPure
|
||||
..inlineHint = inlineHint;
|
||||
|
||||
@override
|
||||
String toString() => functionName ?? "#$finalizableIndex";
|
||||
|
||||
@@ -44,6 +44,12 @@ abstract class BaseFunction with Indexable, Exportable {
|
||||
/// `binaryen.removable.if.unused` custom section.
|
||||
bool isPure = false;
|
||||
|
||||
/// Inline hint for this function.
|
||||
///
|
||||
/// If set, we'll emit metadata in the `binaryen.inline` custom section.
|
||||
/// Value must be in range [0..127].
|
||||
int? inlineHint;
|
||||
|
||||
BaseFunction(
|
||||
this.enclosingModule,
|
||||
this.finalizableIndex,
|
||||
@@ -116,6 +122,9 @@ class DefinedFunction extends BaseFunction implements Serializable {
|
||||
if (isPure) {
|
||||
p.writeln('(@binaryen.removable.if.unused)');
|
||||
}
|
||||
if (inlineHint != null) {
|
||||
p.writeln('(@binaryen.inline $inlineHint)');
|
||||
}
|
||||
p.write('(func ');
|
||||
p.writeFunctionReference(this);
|
||||
String? exportName;
|
||||
@@ -189,6 +198,9 @@ class ImportedFunction extends BaseFunction implements Import {
|
||||
if (isPure) {
|
||||
p.writeln('(@binaryen.removable.if.unused)');
|
||||
}
|
||||
if (inlineHint != null) {
|
||||
p.writeln('(@binaryen.inline $inlineHint)');
|
||||
}
|
||||
p.write('(func ');
|
||||
p.writeFunctionReference(this);
|
||||
p.write(' ');
|
||||
|
||||
@@ -132,7 +132,8 @@ class Module implements Serializable {
|
||||
globals,
|
||||
watchPoints,
|
||||
).serialize(s);
|
||||
RemovableIfUnusedSection(functions).serialize(s);
|
||||
BinaryenRemovableIfUnusedSection(functions).serialize(s);
|
||||
BinaryenInlineHintSection(functions).serialize(s);
|
||||
SourceMapSection(sourceMapUrl).serialize(s);
|
||||
for (final customSection in _extraCustomSections) {
|
||||
customSection.serialize(s);
|
||||
@@ -287,8 +288,16 @@ class Module implements Serializable {
|
||||
types,
|
||||
globals,
|
||||
);
|
||||
RemovableIfUnusedSection.deserialize(
|
||||
customSections.remove(RemovableIfUnusedSection.customSectionName)?.single,
|
||||
BinaryenRemovableIfUnusedSection.deserialize(
|
||||
customSections
|
||||
.remove(BinaryenRemovableIfUnusedSection.customSectionName)
|
||||
?.single,
|
||||
functions,
|
||||
);
|
||||
BinaryenInlineHintSection.deserialize(
|
||||
customSections
|
||||
.remove(BinaryenInlineHintSection.customSectionName)
|
||||
?.single,
|
||||
functions,
|
||||
);
|
||||
final sourceMapUrl = SourceMapSection.deserialize(
|
||||
|
||||
@@ -12,7 +12,8 @@ import 'serializer.dart';
|
||||
const Set<String> _reservedCustomSectionNames = {
|
||||
NameSection.customSectionName,
|
||||
SourceMapSection.customSectionName,
|
||||
RemovableIfUnusedSection.customSectionName,
|
||||
BinaryenRemovableIfUnusedSection.customSectionName,
|
||||
BinaryenInlineHintSection.customSectionName,
|
||||
};
|
||||
|
||||
abstract class Section implements Serializable {
|
||||
@@ -1103,12 +1104,12 @@ class SourceMapSection extends CustomSection {
|
||||
}
|
||||
}
|
||||
|
||||
class RemovableIfUnusedSection extends CustomSection {
|
||||
class BinaryenRemovableIfUnusedSection extends CustomSection {
|
||||
static const String customSectionName = 'binaryen.removable.if.unused';
|
||||
|
||||
final ir.Functions functions;
|
||||
|
||||
RemovableIfUnusedSection(this.functions) : super([]);
|
||||
BinaryenRemovableIfUnusedSection(this.functions) : super([]);
|
||||
|
||||
@override
|
||||
void serializeContents(Serializer s) {
|
||||
@@ -1123,7 +1124,7 @@ class RemovableIfUnusedSection extends CustomSection {
|
||||
s.writeUnsigned(function.index);
|
||||
s.writeUnsigned(1); // Number of hints
|
||||
s.writeUnsigned(0); // Offset (0 == function-level)
|
||||
s.writeUnsigned(0); // always 0
|
||||
s.writeUnsigned(0); // hint length (always 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1152,6 +1153,62 @@ class RemovableIfUnusedSection extends CustomSection {
|
||||
}
|
||||
}
|
||||
|
||||
class BinaryenInlineHintSection extends CustomSection {
|
||||
static const String customSectionName = 'binaryen.inline';
|
||||
|
||||
final ir.Functions functions;
|
||||
|
||||
BinaryenInlineHintSection(this.functions) : super([]);
|
||||
|
||||
@override
|
||||
void serializeContents(Serializer s) {
|
||||
final functionsToAnnotate = [
|
||||
...functions.imported.where((f) => f.inlineHint != null),
|
||||
...functions.defined.where((f) => f.inlineHint != null),
|
||||
];
|
||||
if (functionsToAnnotate.isNotEmpty) {
|
||||
s.writeName(customSectionName);
|
||||
s.writeUnsigned(functionsToAnnotate.length);
|
||||
for (final function in functionsToAnnotate) {
|
||||
final hint = function.inlineHint!;
|
||||
assert(hint >= 0 && hint <= 127);
|
||||
s.writeUnsigned(function.index);
|
||||
s.writeUnsigned(1); // Number of hints
|
||||
s.writeUnsigned(0); // Offset (0 == function-level)
|
||||
s.writeUnsigned(1); // hint length (always 1 for inline hint)
|
||||
s.writeByte(hint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void deserialize(Deserializer? d, ir.Functions functions) {
|
||||
if (d == null) return;
|
||||
|
||||
final count = d.readUnsigned();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final functionIndex = d.readUnsigned();
|
||||
final numHints = d.readUnsigned();
|
||||
for (int j = 0; j < numHints; j++) {
|
||||
final offset = d.readUnsigned(); // Offset (0 == function-level)
|
||||
if (offset != 0) {
|
||||
throw UnsupportedError(
|
||||
'Only function-level ($customSectionName) annotation supported.',
|
||||
);
|
||||
}
|
||||
final hintLength = d.readUnsigned();
|
||||
if (hintLength != 1) {
|
||||
throw StateError('Expected hint length 1 but got $hintLength');
|
||||
}
|
||||
final hint = d.readByte();
|
||||
if (hint < 0 || hint > 127) {
|
||||
throw StateError('Expected hint in range [0..127] but got $hint');
|
||||
}
|
||||
functions[functionIndex].inlineHint = hint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ExtraCustomSection extends CustomSection {
|
||||
final String name;
|
||||
final Uint8List bytes;
|
||||
|
||||
Reference in New Issue
Block a user