You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backend: Compile captured actor class parameters statically (#2022)
This fixes#1847.
This went wrong before:
* All top-level functions must be static (i.e not represented by a dynamic
closure)
* This means that everything they may close over, even values computed in the
top-level scope (effectively by the init function) must be in static memory,
at a well-known location. For the top-level `decs`, this is done by the
`AllocHow` analysis.
* Top-level parameters were added later. They can _also_ be captured, but were
previously only allocated as locals. This was #1847.
* This did not manifest when these parameters (patterns) were “ɩ-expanded”,
e.g. if we replace the parameter `p` with `p'` and `let p = p'` in the top-level
scope. This was effectively Claudio’s work-around, that we remove here.
The fix is to choose the location of the variable of a parameter based on
whether it is captured anywhere. This is in a way a simplistic version of the
`AllocHow` analysis.
As a side-effect, this simplifies the code (no need to pass around `setters`,
we can use `Var.set_val` these days.
0 commit comments