File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5151#include " support/sorted_vector.h"
5252#include " wasm-builder.h"
5353#include " wasm.h"
54+ #include " wasm-type.h"
5455
5556namespace wasm {
5657
@@ -590,8 +591,7 @@ struct DAE : public Pass {
590591
591592 // If this is exported, we cannot refine to an exact type without the
592593 // custom descriptors feature being enabled.
593- if (isExported && module ->features .hasReferenceTypes () &&
594- !module ->features .hasCustomDescriptors ()) {
594+ if (isExported && !module ->features .hasCustomDescriptors ()) {
595595 // Remove exactness.
596596 std::vector<Type> inexact;
597597 for (auto t : newType) {
@@ -603,12 +603,20 @@ struct DAE : public Pass {
603603 }
604604 }
605605
606- func->setResults (newType);
606+ // We must explicitly subtype the old type.
607+ TypeBuilder builder (1 );
608+ builder.setHeapType (0 , Signature (func->getParams (), newType));
609+ builder.setSubType (0 , func->type );
610+ auto result = builder.build ();
611+ assert (!result.getError ());
612+ func->type = (*result)[0 ];
613+
607614 for (auto * call : calls) {
608615 if (call->type != Type::unreachable) {
609616 call->type = newType;
610617 }
611618 }
619+
612620 return true ;
613621 }
614622};
You can’t perform that action at this time.
0 commit comments