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] Handle OutlinedFunctionExpression in various passes #30089

Closed
wants to merge 2 commits into from

Conversation

gsathya
Copy link
Member

@gsathya gsathya commented Jun 25, 2024

Stack from ghstack (oldest at bottom):

There's nothing interesting happening quite yet.

Note that OutlinedFunctionExpression will be created only after
InferReferenceEffects so some of the passes before will not need to
handle this HIR node.

The codegen currently doesn't handle this HIR node for now.

There's nothing interesting happening quite yet.

Note that OutlinedFunctionExpression will be created only after
InferReferenceEffects so some of the passes before will not need to
handle this HIR node.

The codegen currently doesn't handle this HIR node for now.

[ghstack-poisoned]
Copy link

vercel bot commented Jun 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 4:22pm
gsathya added a commit that referenced this pull request Jun 25, 2024
There's nothing interesting happening quite yet.

Note that OutlinedFunctionExpression will be created only after
InferReferenceEffects so some of the passes before will not need to
handle this HIR node.

The codegen currently doesn't handle this HIR node for now.

ghstack-source-id: ea697009dcb24d4ccc7c058d7579e75e1b4b90e7
Pull Request resolved: #30089
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jun 25, 2024
@react-sizebot
Copy link

react-sizebot commented Jun 25, 2024

Comparing: f5d2feb...28ec1c4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 497.93 kB 497.93 kB = 89.26 kB 89.26 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 502.75 kB 502.75 kB = 89.96 kB 89.96 kB
facebook-www/ReactDOM-prod.classic.js = 597.10 kB 597.10 kB = 105.31 kB 105.31 kB
facebook-www/ReactDOM-prod.modern.js = 571.44 kB 571.44 kB = 101.24 kB 101.24 kB
test_utils/ReactAllWarnings.js Deleted 62.88 kB 0.00 kB Deleted 15.69 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 62.88 kB 0.00 kB Deleted 15.69 kB 0.00 kB

Generated by 🚫 dangerJS against 28ec1c4

…sses"

There's nothing interesting happening quite yet.

Note that OutlinedFunctionExpression will be created only after
InferReferenceEffects so some of the passes before will not need to
handle this HIR node.

The codegen currently doesn't handle this HIR node for now.

[ghstack-poisoned]
gsathya added a commit that referenced this pull request Jun 25, 2024
There's nothing interesting happening quite yet.

Note that OutlinedFunctionExpression will be created only after
InferReferenceEffects so some of the passes before will not need to
handle this HIR node.

The codegen currently doesn't handle this HIR node for now.

ghstack-source-id: b8735178a815e9e36a23f854dcd43677f56a0153
Pull Request resolved: #30089
Copy link
Contributor

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

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

This stack looks great! Looking forward to seeing more of the outlining implementation, what we discussed in design sync makes sense though.

One extra thought: what about JSX created during a loop? So far it seems the model is around outlining functions, when what we really want to outline is JSX.

Copy link
Contributor

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

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

Actually thinking about this more i think we might want a different representation to make this more general. Rather than an outlined function which represents a function in the source + its outlined component, it seems like we could:

  • Create outlined components for complex JSX subexpressions (regardless of whether they're in a callback or in a loop)
  • Replace existing JSX instructions with calls to those outlined components

So we might be able to completely avoid new instruction variants, since the outlined functions are just a separate function to plumb through the pipeline and the the JSX expressions just get swapped in-place.

@josephsavona
Copy link
Contributor

I've implemented the alternative at #30331

@gsathya gsathya closed this Jul 25, 2024
@gsathya gsathya deleted the gh/gsathya/6/head branch July 25, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 participants