Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ir/module-splitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,11 @@ void ModuleSplitter::setupTablePatching() {
// so we should export and import the active table here.
auto secondaryTable =
secondary.getTableOrNull(tableManager.activeTable->name);
if (!secondaryTable) {
if (secondaryTable) {
// In case it's already in the secondary module, sync the initial/max
secondaryTable->initial = tableManager.activeTable->initial;
secondaryTable->max = tableManager.activeTable->max;
} else {
secondaryTable =
ModuleUtils::copyTable(tableManager.activeTable, secondary);
makeImportExport(*tableManager.activeTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

;; PRIMARY: (import "placeholder.deferred" "1" (func $placeholder_1))

;; PRIMARY: (table $table 2 funcref)
(table $table 1 funcref)
;; PRIMARY: (table $table 2 2 funcref)
(table $table 1 1 funcref)
(elem (global.get $base) $keep)
;; PRIMARY: (elem $0 (global.get $base) $keep $placeholder_1)

Expand All @@ -40,7 +40,7 @@
(func $keep
(call $split)
)
;; SECONDARY: (import "primary" "table" (table $table 1 funcref))
;; SECONDARY: (import "primary" "table" (table $table 2 2 funcref))

;; SECONDARY: (import "primary" "global" (global $base i32))

Expand Down
Loading