Currently, when passing through the AST and hoisting values into the global scope, the transformation just blindly moves each value giving it a new name. This results in duplicates, lots of duplicates. Compiling the core scheduler into JS results in multiple duplicate state definitions:
Hoisting should first normalize a value AST and then attempt to check the global scope for the normalized value before adding a new name to it. This will likely reuse a value originating from a different location in the source, but that should be fine at that stage of the compilation pipeline.
Currently, when passing through the AST and hoisting values into the global scope, the transformation just blindly moves each value giving it a new name. This results in duplicates, lots of duplicates. Compiling the core scheduler into JS results in multiple duplicate state definitions:
The same is true for continuations, especially final, leaf continuations:
Hoisting should first normalize a value AST and then attempt to check the global scope for the normalized value before adding a new name to it. This will likely reuse a value originating from a different location in the source, but that should be fine at that stage of the compilation pipeline.