diff options
Diffstat (limited to 'src/passes/SignatureRefining.cpp')
-rw-r--r-- | src/passes/SignatureRefining.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passes/SignatureRefining.cpp b/src/passes/SignatureRefining.cpp index bde1c4fb9..0574df434 100644 --- a/src/passes/SignatureRefining.cpp +++ b/src/passes/SignatureRefining.cpp @@ -81,6 +81,10 @@ struct SignatureRefining : public Pass { ModuleUtils::ParallelFunctionAnalysis<Info, Mutable> analysis( *module, [&](Function* func, Info& info) { if (func->imported()) { + // Avoid changing the types of imported functions. Spec and VM support + // for that is not yet stable. + // TODO: optimize this when possible in the future + info.canModify = false; return; } info.calls = std::move(FindAll<Call>(func->body).list); @@ -111,6 +115,11 @@ struct SignatureRefining : public Pass { // Add the function's return LUB to the one for the heap type of that // function. allInfo[func->type].resultsLUB.combine(info.resultsLUB); + + // If one function cannot be modified, that entire type cannot be. + if (!info.canModify) { + allInfo[func->type].canModify = false; + } } // We cannot alter the signature of an exported function, as the outside may |