Skip to content

Commit fe88b47

Browse files
authored
Unify imported and non-imported things (#1678)
Fixes #1649 This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import. For convenient iteration, there are a few helpers like ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) { .. use global .. }); as often iteration only cares about imported or defined (non-imported) things.
1 parent a53356a commit fe88b47

File tree

314 files changed

+2141
-2534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+2141
-2534
lines changed

bin/wasm.js

Lines changed: 62 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-js.sh

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ export_function "_BinaryenLoopId"
190190
export_function "_BinaryenBreakId"
191191
export_function "_BinaryenSwitchId"
192192
export_function "_BinaryenCallId"
193-
export_function "_BinaryenCallImportId"
194193
export_function "_BinaryenCallIndirectId"
195194
export_function "_BinaryenGetLocalId"
196195
export_function "_BinaryenSetLocalId"
@@ -373,7 +372,6 @@ export_function "_BinaryenLoop"
373372
export_function "_BinaryenBreak"
374373
export_function "_BinaryenSwitch"
375374
export_function "_BinaryenCall"
376-
export_function "_BinaryenCallImport"
377375
export_function "_BinaryenCallIndirect"
378376
export_function "_BinaryenGetLocal"
379377
export_function "_BinaryenSetLocal"
@@ -434,11 +432,6 @@ export_function "_BinaryenCallGetTarget"
434432
export_function "_BinaryenCallGetNumOperands"
435433
export_function "_BinaryenCallGetOperand"
436434

437-
# 'CallImport' expression operations
438-
export_function "_BinaryenCallImportGetTarget"
439-
export_function "_BinaryenCallImportGetNumOperands"
440-
export_function "_BinaryenCallImportGetOperand"
441-
442435
# 'CallIndirect' expression operations
443436
export_function "_BinaryenCallIndirectGetTarget"
444437
export_function "_BinaryenCallIndirectGetNumOperands"
@@ -546,7 +539,6 @@ export_function "_BinaryenAddFunctionImport"
546539
export_function "_BinaryenAddTableImport"
547540
export_function "_BinaryenAddMemoryImport"
548541
export_function "_BinaryenAddGlobalImport"
549-
export_function "_BinaryenRemoveImport"
550542
export_function "_BinaryenAddFunctionExport"
551543
export_function "_BinaryenAddTableExport"
552544
export_function "_BinaryenAddMemoryExport"
@@ -594,12 +586,10 @@ export_function "_BinaryenFunctionRunPasses"
594586
export_function "_BinaryenFunctionSetDebugLocation"
595587

596588
# 'Import' operations
597-
export_function "_BinaryenImportGetKind"
598-
export_function "_BinaryenImportGetModule"
599-
export_function "_BinaryenImportGetBase"
600-
export_function "_BinaryenImportGetName"
601-
export_function "_BinaryenImportGetGlobalType"
602-
export_function "_BinaryenImportGetFunctionType"
589+
export_function "_BinaryenGlobalImportGetModule"
590+
export_function "_BinaryenGlobalImportGetBase"
591+
export_function "_BinaryenFunctionImportGetModule"
592+
export_function "_BinaryenFunctionImportGetBase"
603593

604594
# 'Export' operations
605595
export_function "_BinaryenExportGetKind"

scripts/fuzz_relooper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@
131131
)
132132
};
133133
BinaryenExpressionRef debugger;
134-
if (1) debugger = BinaryenCallImport(module, "print", args, 1,
135-
BinaryenNone());
134+
if (1) debugger = BinaryenCall(module, "print", args, 1,
135+
BinaryenNone());
136136
else debugger = BinaryenNop(module);
137137
138138
// return the decision. need to subtract 4 that we just added,
@@ -177,7 +177,7 @@
177177
BinaryenConst(module, BinaryenLiteralInt32(%d))
178178
};
179179
BinaryenExpressionRef list[] = {
180-
BinaryenCallImport(module, "print", args, 1, BinaryenNone()),
180+
BinaryenCall(module, "print", args, 1, BinaryenNone()),
181181
BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0,
182182
BinaryenInt32()))
183183
};

0 commit comments

Comments
 (0)