@@ -370,9 +370,10 @@ void ModuleSplitter::setupJSPI() {
370370 primary.removeExport (LOAD_SECONDARY_MODULE);
371371 } else {
372372 // Add an imported function to load the secondary module.
373- auto import = Builder::makeFunction (ModuleSplitting::LOAD_SECONDARY_MODULE,
374- Signature (Type::none, Type::none),
375- {});
373+ auto import = Builder::makeFunction (
374+ ModuleSplitting::LOAD_SECONDARY_MODULE,
375+ Type (Signature (Type::none, Type::none), NonNullable, Exact),
376+ {});
376377 import ->module = ENV;
377378 import ->base = ModuleSplitting::LOAD_SECONDARY_MODULE;
378379 primary.addFunction (std::move (import ));
@@ -689,14 +690,15 @@ void ModuleSplitter::indirectCallsToSecondaryFunctions() {
689690 Builder builder (*getModule ());
690691 Index secIndex = parent.funcToSecondaryIndex .at (curr->target );
691692 auto * func = parent.secondaries .at (secIndex)->getFunction (curr->target );
692- auto tableSlot = parent.tableManager .getSlot (curr->target , func->type );
693+ auto tableSlot =
694+ parent.tableManager .getSlot (curr->target , func->type .getHeapType ());
693695
694696 replaceCurrent (parent.maybeLoadSecondary (
695697 builder,
696698 builder.makeCallIndirect (tableSlot.tableName ,
697699 tableSlot.makeExpr (parent.primary ),
698700 curr->operands ,
699- func->type ,
701+ func->type . getHeapType () ,
700702 curr->isReturn )));
701703 }
702704 };
@@ -786,7 +788,8 @@ void ModuleSplitter::setupTablePatching() {
786788 primary, std::string (" placeholder_" ) + placeholder->base .toString ());
787789 placeholder->hasExplicitName = true ;
788790 placeholder->type = secondaryFunc->type ;
789- elem = Builder (primary).makeRefFunc (placeholder->name , placeholder->type );
791+ elem = Builder (primary).makeRefFunc (placeholder->name ,
792+ placeholder->type .getHeapType ());
790793 primary.addFunction (std::move (placeholder));
791794 });
792795
@@ -827,7 +830,8 @@ void ModuleSplitter::setupTablePatching() {
827830 // primarySeg->data[i] is a placeholder, so use the secondary
828831 // function.
829832 auto * func = replacement->second ;
830- auto * ref = Builder (secondary).makeRefFunc (func->name , func->type );
833+ auto * ref = Builder (secondary).makeRefFunc (func->name ,
834+ func->type .getHeapType ());
831835 secondaryElems.push_back (ref);
832836 ++replacement;
833837 } else if (auto * get = primarySeg->data [i]->dynCast <RefFunc>()) {
@@ -869,7 +873,7 @@ void ModuleSplitter::setupTablePatching() {
869873 }
870874 auto * func = curr->second ;
871875 currData.push_back (
872- Builder (secondary).makeRefFunc (func->name , func->type ));
876+ Builder (secondary).makeRefFunc (func->name , func->type . getHeapType () ));
873877 }
874878 if (currData.size ()) {
875879 finishSegment ();
0 commit comments