about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-29T21·37+0300
committertazjin <tazjin@tvl.su>2023-05-25T11·28+0000
commit5d3fb33baa8da6bb8cfbd078e2b295d773a721ba (patch)
tree22ca6955ce5681a0d312f5ff2681a06ac0d189d8 /nix
parent3aea9bf5275aa96fe863cd30ee0c0ad4552bca6b (diff)
feat(tvix/eval): implement unthunking in compiler r/6204
This feature allows the compiler to detect situations where the
created thunk is useless and can be merged into the parent chunk
instead.

The only case where the compiler does this initially is when
statically optimising a select expression.

For example, previously the expression `builtins.length` compiled into
two thunks:

1. An "inner" thunk which contained an `OpConstant` that had the
   optimised `length` builtin in it.

2. An "outer" thunk which contained an `OpConstant` to access the
   inner thunk, and the trailing OpForce of the top-level program.

With this change, the inner thunk is skipped completely and the outer
chunk directly contains the `length` builtin access.

This can be applied in several situations, some easier than others,
and we will add them in as we go along.

Change-Id: Ie44521445fce1199f99b5b17712833faea9bc357
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7959
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'nix')
0 files changed, 0 insertions, 0 deletions