Skip to content

Commit

Permalink
ast: Reorder SetModuleTree and SetRuleTree stages to run earlier
Browse files Browse the repository at this point in the history
These stages do not depend on any of the other stages except
ResolveRefs (which can pull in additional modules on the fly.) These
are needed for the new oracle feature so move them up in the compiler
to avoid unnecessary work.

Signed-off-by: Torin Sandall <[email protected]>
  • Loading branch information
tsandall committed May 19, 2020
1 parent e5c672c commit 79cbb16
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ast/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,14 @@ func NewCompiler() *Compiler {
// load additional modules. If any stages run before resolution, they
// need to be re-run after resolution.
{"ResolveRefs", "compile_stage_resolve_refs", c.resolveAllRefs},

{"SetModuleTree", "compile_stage_set_module_tree", c.setModuleTree},
{"SetRuleTree", "compile_stage_set_rule_tree", c.setRuleTree},
// The local variable generator must be initialized after references are
// resolved and the dynamic module loader has run but before subsequent
// stages that need to generate variables.
{"InitLocalVarGen", "compile_stage_init_local_var_gen", c.initLocalVarGen},

{"RewriteLocalVars", "compile_stage_rewrite_local_vars", c.rewriteLocalVars},
{"RewriteExprTerms", "compile_stage_rewrite_expr_terms", c.rewriteExprTerms},
{"SetModuleTree", "compile_stage_set_module_tree", c.setModuleTree},
{"SetRuleTree", "compile_stage_set_rule_tree", c.setRuleTree},
{"SetGraph", "compile_stage_set_graph", c.setGraph},
{"RewriteComprehensionTerms", "compile_stage_rewrite_comprehension_terms", c.rewriteComprehensionTerms},
{"RewriteRefsInHead", "compile_stage_rewrite_refs_in_head", c.rewriteRefsInHead},
Expand Down

0 comments on commit 79cbb16

Please sign in to comment.