June 28th, 2024

CPS in Hoot

The Hoot Scheme-to-Wasm compiler uses CPS transformation to handle push calls in WebAssembly. Strategies like generic slicing and CPS transformation are explored, enabling features like Fibers and promise integration. Performance impact is under evaluation.

Read original articleLink Icon
CPS in Hoot

The article discusses the Hoot Scheme-to-Wasm compiler's use of the continuation-passing-style (CPS) transformation. Hoot faces challenges in implementing push calls due to WebAssembly's support for tail calls but not push calls. Various strategies are explored, including generic slicing, instrumented slicing, and CPS transformation. Hoot adopts the CPS transformation approach with stack-allocated return closures, allowing for delimited continuations. The article delves into technical details such as splitting functions, saving variables, calling conventions, and the relationship between Guile's CPS soup and Hoot's CPS transformation. While the CPS transformation may introduce overhead, it enables features like Fibers and JavaScript promise integration without relying on external tools. The performance impact of the CPS transformation is still being evaluated, but it shows promise in enhancing functionality.

Link Icon 3 comments
By @ashton314 - 5 months
Tangent: when I opened this, I thought, “hot diggity, that is one fine serif font!” Then I looked closer and realized it’s the same font I’m using on my blog: Valkyrie by Matthew Butterick [1]. Nice to see such lovely typography on the web!

[1]: https://mbtype.com/fonts/valkyrie/

By @shrubble - 5 months
Note that Wingo is the one that re-architected Guile Scheme to its current setup, which is a vm with JIT. Hoot is Guile Scheme compiled to WASM.
By @Decabytes - 5 months
Does anyone know if an effort to get Guile to run in Windows without wsl. I feel like guile is the only other scheme with an ecosystem to rival Racket, but I’d love it if I could support Windows users as well