-
Notifications
You must be signed in to change notification settings - Fork 5
Inlining
Dibyendu Majumdar edited this page Jul 12, 2020
·
5 revisions
Some random thoughts about inlining.
- Function that has no upvalues ... ?
- That doesn't take varargs.
- Total number of locals must be inside a range
We need to be able to establish that the function cannot be replaced. So it must not be a global. It needs to be a local function in the same chunk. We also need to ensure that the up-value representing the function has no updates - i.e. up-value / and local are both never re-assigned
TODO so what do we know at a call-site?
Maybe at AST level. Duplicate the body of the function to the call-site. Assign args. Assign return values.
The problem is it is harder to analyze the use of variables at the AST stage.
For this we need to adjust all regs of the inlined function.
Variables and blocks must still make sense after the inlining.