Inline other modules' functions only in the alias pass
Why
A call to another module's @inline function could be inlined in two places: early by the alias pass, and late while compiling to JavaScript. The late copy skipped every Lambda pass, so it kept what those passes remove, and it was inlined into a function whose refs were already assigned variables. Since the alias pass now inlines calls with parameters as arguments, the late path only gets calls through an alias, such as add from let {add} = module(List). These are now compiled as calls, until the alias pass learns to see through them. The call no longer looks up the other module's .cmj: the late path needed its stored body, and the name it returned is the field name the call already has. The backend guide gets a section on the Lambda pipeline, with its single cross-module inlining phase.
modifiedJS a call through an alias
let {length: l, add} = module(List)let r = list{}->add(l(list{1, 2, 3}))
js
Review
- What do the new tests cover?
inline_late_alias_testhas the cases that broke when a late body was simplified: functions reading a let-bound global, a known tuple or an assigned ref,Somes of known values, and refs of the caller assigned by a callback. The alias pass inlines all of them now.