Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ import {propagateScopeDependenciesHIR} from '../HIR/PropagateScopeDependenciesHI
import {outlineJSX} from '../Optimization/OutlineJsx';
import {optimizePropsMethodCalls} from '../Optimization/OptimizePropsMethodCalls';
import {transformFire} from '../Transform';
import {buildReactiveGraph} from '../ReactiveIR/BuildReactiveGraph';
import {printReactiveGraph} from '../ReactiveIR/ReactiveIR';

export type CompilerPipelineValue =
| {kind: 'ast'; name: string; value: CodegenFunction}
Expand Down Expand Up @@ -314,6 +316,15 @@ function runWithEnvironment(
value: hir,
});

if (env.config.enableReactiveGraph) {
const reactiveGraph = buildReactiveGraph(hir);
log({
kind: 'debug',
name: 'BuildReactiveGraph',
value: printReactiveGraph(reactiveGraph),
});
}
Comment on lines +319 to +326
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that i'm experimenting with running this before constructing scope terminals, since that's where it would have to go in order to reorder to avoid unnecessary scope interleaving


alignReactiveScopesToBlockScopesHIR(hir);
log({
kind: 'hir',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ const EnvironmentConfigSchema = z.object({
*/
enableInstructionReordering: z.boolean().default(false),

/**
* Enables ReactiveGraph-based optimizations including reordering across terminal
* boundaries
*/
enableReactiveGraph: z.boolean().default(false),

/**
* Enables function outlinining, where anonymous functions that do not close over
* local variables can be extracted into top-level helper functions.
Expand Down
Loading
Loading