Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler] Early sketch of ReactiveIR #31974

Open
wants to merge 10 commits into
base: gh/josephsavona/64/base
Choose a base branch
from
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
Contributor 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