diff options
author | Frank Emrich <git@emrich.io> | 2024-01-11 21:22:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 13:22:43 -0800 |
commit | b4dee3dc05834ada8bf94e3e925186bc8b430c30 (patch) | |
tree | 19d3150e7438803274c1dfc03be56dff83309fe7 /src/ir/cost.h | |
parent | e5948a939eb6610f1cb7742df8c54f6d17389b83 (diff) | |
download | binaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.tar.gz binaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.tar.bz2 binaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.zip |
Typed continuations: resume instructions (#6083)
This PR is part of a series that adds basic support for the [typed continuations proposal](https://github.com/wasmfx/specfx).
This particular PR adds support for the `resume` instruction. The most notable missing feature is validation, which is not implemented, yet.
Diffstat (limited to 'src/ir/cost.h')
-rw-r--r-- | src/ir/cost.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ir/cost.h b/src/ir/cost.h index 0e87317a6..821e46524 100644 --- a/src/ir/cost.h +++ b/src/ir/cost.h @@ -726,6 +726,11 @@ struct CostAnalyzer : public OverriddenVisitor<CostAnalyzer, CostType> { return 8 + visit(curr->ref) + visit(curr->num); } + CostType visitResume(Resume* curr) { + // Inspired by indirect calls, but twice the cost. + return 12 + visit(curr->cont); + } + private: CostType nullCheckCost(Expression* ref) { // A nullable type requires a bounds check in most VMs. |