Skip to content

Commit d2ac49a

Browse files
minokiclaude
andcommitted
Add CpsBoxing pass for inserting BoxOp/UnboxOp at type boundaries
Add a new CPS transformation pass that inserts explicit Box/Unbox operations at function boundaries for unboxed primitive types (int32, int64, word32, word64, real, char, char16, char32, bool). This is preparation for the WasmGC backend where all polymorphic positions must use a uniform boxed representation. The pass: - Converts unboxed function params to BoxedType with UnboxOp at entry - Boxes unboxed values at App/AppCont call sites with BoxOp - Transforms resultTy for unboxed return types to BoxedType - Eliminates typeOnly abstractions (like erase-poly) - Maintains a type environment for type variable tracking - Transforms ExnTag payloadTy and ESImportDec types via goTy Currently commented out in the pipeline as the WasmGC backend is not yet implemented. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 93c56e4 commit d2ac49a

File tree

4 files changed

+555
-0
lines changed

4 files changed

+555
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ sources = \
6767
src/cps/unpack-record-parameter.sml \
6868
src/cps/eta.sml \
6969
src/cps/erase-poly.sml \
70+
src/cps/boxing.sml \
7071
src/backend.sml \
7172
src/nested.sml \
7273
src/lua/syntax.sml \

0 commit comments

Comments
 (0)