-
Notifications
You must be signed in to change notification settings - Fork 48.7k
[compiler] InferMutationAliasingRanges precisely models which values mutate when #33401
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
Closed
+281
−79
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8ed07a1
[compiler] InferMutationAliasingRanges precisely models which values …
josephsavona fd84db6
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 7cee071
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona fb69850
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 8245621
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona cc20b46
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 4cdb34c
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 8594e3d
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona e375b4a
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 33688ad
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona c1f1699
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona db6a063
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona db4b307
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona 01d9db8
Update on "[compiler] InferMutationAliasingRanges precisely models wh…
josephsavona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...s__/fixtures/compiler/new-mutability/ssa-renaming-ternary-destruction.expect.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @enablePropagateDepsInHIR @enableNewMutationAliasingModel | ||
function useFoo(props) { | ||
let x = []; | ||
x.push(props.bar); | ||
// todo: the below should memoize separately from the above | ||
// my guess is that the phi causes the different `x` identifiers | ||
// to get added to an alias group. this is where we need to track | ||
// the actual state of the alias groups at the time of the mutation | ||
props.cond ? (({x} = {x: {}}), ([x] = [[]]), x.push(props.foo)) : null; | ||
return x; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: useFoo, | ||
params: [{cond: false, foo: 2, bar: 55}], | ||
sequentialRenders: [ | ||
{cond: false, foo: 2, bar: 55}, | ||
{cond: false, foo: 3, bar: 55}, | ||
{cond: true, foo: 3, bar: 55}, | ||
], | ||
}; | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR @enableNewMutationAliasingModel | ||
function useFoo(props) { | ||
const $ = _c(5); | ||
let x; | ||
if ($[0] !== props.bar) { | ||
x = []; | ||
x.push(props.bar); | ||
$[0] = props.bar; | ||
$[1] = x; | ||
} else { | ||
x = $[1]; | ||
} | ||
if ($[2] !== props.cond || $[3] !== props.foo) { | ||
props.cond ? (([x] = [[]]), x.push(props.foo)) : null; | ||
$[2] = props.cond; | ||
$[3] = props.foo; | ||
$[4] = x; | ||
} else { | ||
x = $[4]; | ||
} | ||
return x; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: useFoo, | ||
params: [{ cond: false, foo: 2, bar: 55 }], | ||
sequentialRenders: [ | ||
{ cond: false, foo: 2, bar: 55 }, | ||
{ cond: false, foo: 3, bar: 55 }, | ||
{ cond: true, foo: 3, bar: 55 }, | ||
], | ||
}; | ||
|
||
``` | ||
|
||
### Eval output | ||
(kind: ok) [55] | ||
[55] | ||
[3] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this todo is fixed, among other issues