package wax-lib

  1. Overview
  2. Docs
Libraries for Wax, a Rust-like syntax for WebAssembly

Install

dune-project
 Dependency

Authors

Maintainers

Sources

wax-v0.2.0.tbz
sha256=4361e1324b7754a4c08ab5b505df32061f3ce0cea60443fd0d3699e0fa796b32
sha512=fcc756d2f160ba90a9aa1131f2ab22ed7f45466ccd658c21cf9df6868a6aab0cee7f404719d698a379958802f9820398f2fe0685ecc4dda018ca4f653294e39b

doc/wax-lib.conversion/Wax_conversion/Recover_loops/index.html

Module Wax_conversion.Recover_loopsSource

module_ m rewrites each function body, folding the loop shape that Ast_utils.lower_while produces — a void loop whose body is a single back-edged if (leading test) — into a high-level while loop. The (possibly synthetic) loop label is kept only when the body still branches to it once the back-edge is removed (a "continue"), so a label-less source loop round-trips label-less. A trailing-test loop (ending in a back-edged br_if) has no leading-while equivalent and is left a bare loop.

Folding is the exact inverse of the lowering, so re-lowering reproduces the original loop byte-for-byte and the rewrite always preserves runtime semantics. Meant to run on From_wasm.module_ output, after Recover_dispatch.module_ and before Sink_let.module_ (which would otherwise sink locals into the loop body and hide the shape).