GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — [compiler] Add fallthrough to branch terminal by josephsavona · Pull Request #30814 · react/react Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. [ghstack-poisoned]
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. [ghstack-poisoned]
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. [ghstack-poisoned]
| case 'logical': | ||
| case 'sequence': | ||
| case 'ternary': { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, I'm guessing that this is to support something like useMemo(..., [(a ?? b)?.c]). Not technically necessary for DropManualMemo as we're only tracking named variables, but this makes sense to have in a utility function
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yup exactly
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (last !== undefined && last.value.kind === 'StoreLocal') { | ||
| optionals.add(last.value.value.identifier.id); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This feels slightly weird since DropManualMemo runs before we enter ssa, so both consequent (the optional read) and alternate (undefined) write to the same identifier ID. There is also no phi join, so reads to the OptionalExpression rvalue is also guaranteed to use the same identifier ID (and this works)
(I'm guessing that passes after SSA will need to track phis as well -- reading the rest of the stack now)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah I looked at using the phi to figure out which values is optional. First, as you noted we aren't in SSA so we don't have phis yet. Second, the phis end up in weird places for nested optionals, because with nested optionals the alternate actually goes to the outermost fallthrough. So we just look at where the consequent assigns to in order to figure out what the optional value was.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. ghstack-source-id: d48c623 Pull Request resolved: #30814
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. ghstack-source-id: 064178d Pull Request resolved: react/react#30814
**breaking change for canary users: Bumps peer dependency of React from `19.0.0-rc-7771d3a7-20240827` to `19.0.0-rc-94e652d5-20240912`** [diff react/react@7771d3a7...94e652d5](react/react@7771d3a...94e652d) <details> <summary>React upstream changes</summary> - react/react#30952 - react/react#30950 - react/react#30946 - react/react#30934 - react/react#30947 - react/react#30945 - react/react#30938 - react/react#30936 - react/react#30879 - react/react#30888 - react/react#30931 - react/react#30930 - react/react#30832 - react/react#30929 - react/react#30926 - react/react#30925 - react/react#30905 - react/react#30900 - react/react#30910 - react/react#30906 - react/react#30899 - react/react#30919 - react/react#30708 - react/react#30907 - react/react#30897 - react/react#30896 - react/react#30895 - react/react#30887 - react/react#30889 - react/react#30893 - react/react#30892 - react/react#30891 - react/react#30882 - react/react#30881 - react/react#30870 - react/react#30849 - react/react#30878 - react/react#30865 - react/react#30869 - react/react#30875 - react/react#30800 - react/react#30762 - react/react#30831 - react/react#30866 - react/react#30853 - react/react#30850 - react/react#30847 - react/react#30842 - react/react#30837 - react/react#30848 - react/react#30844 - react/react#30839 - react/react#30802 - react/react#30841 - react/react#30827 - react/react#30826 - react/react#30825 - react/react#30824 - react/react#30840 - react/react#30838 - react/react#30836 - react/react#30819 - react/react#30816 - react/react#30814 - react/react#30813 - react/react#30812 - react/react#30811 </details> --------- Co-authored-by: vercel-release-bot <[email protected]>
Branch terminals didn't have a fallthrough because they correspond to an outer terminal (optional, logical, etc) that has the "real" fallthrough. But understanding how branch terminals correspond to these outer terminals requires knowing the branch fallthrough. For example, `foo?.bar?.baz` creates terminals along the lines of: ``` bb0: optional fallthrough=bb4 bb1: optional fallthrough=bb3 bb2: ... branch ... (fallthrough=bb3) ... bb3: ... branch ... (fallthrough=bb4) ... bb4: ... ``` Without a fallthrough on `branch` terminals, it's unclear that the optional from bb0 has its branch node in bb3. With the fallthroughs, we can see look for a branch with the same fallthrough as the outer optional terminal to match them up. ghstack-source-id: d48c623 Pull Request resolved: react#30814
00d44bef
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.