Skip to content

Commit

Permalink
refactor(compiler): move variable optimization earlier in pipeline
Browse files Browse the repository at this point in the history
Currently the variable optimization phase happens somewhat late in the process which is okay since the variables are generally static (e.g. `reference()` instruction calls). In some upcoming work we'll have variables that consume slots and require `advance` instructions. To allow for them to be optimized correctly, we need to move the variable optimization phase earlier, at least before we allocate the slots.
  • Loading branch information
crisbeto committed May 13, 2024
1 parent 85ac2de commit 02fec3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/compiler/src/template/pipeline/src/emit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const phases: Phase[] = [
{kind: Kind.Both, fn: generateNullishCoalesceExpressions},
{kind: Kind.Both, fn: expandSafeReads},
{kind: Kind.Both, fn: generateTemporaryVariables},
{kind: Kind.Both, fn: optimizeVariables},
{kind: Kind.Tmpl, fn: allocateSlots},
{kind: Kind.Tmpl, fn: resolveI18nElementPlaceholders},
{kind: Kind.Tmpl, fn: resolveI18nExpressionPlaceholders},
Expand All @@ -147,7 +148,6 @@ const phases: Phase[] = [
{kind: Kind.Tmpl, fn: removeI18nContexts},
{kind: Kind.Both, fn: countVariables},
{kind: Kind.Tmpl, fn: generateAdvance},
{kind: Kind.Both, fn: optimizeVariables},
{kind: Kind.Both, fn: nameFunctionsAndVariables},
{kind: Kind.Tmpl, fn: resolveDeferDepsFns},
{kind: Kind.Tmpl, fn: mergeNextContextExpressions},
Expand Down

0 comments on commit 02fec3a

Please sign in to comment.