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][optim] Add Effect.ConditionallyMutateIterator #32698

Merged
merged 1 commit into from
Mar 24, 2025
Merged

Conversation

mofeiZ
Copy link
Contributor

@mofeiZ mofeiZ commented Mar 20, 2025

Adds Effect.ConditionallyMutateIterator, which has the following effects:

  • capture for known array, map, and sets
  • mutate for all other values

An alternative to this approach could be to add polymorphic shape definitions

@josephsavona
Copy link
Contributor

This seems reasonable. We're definitely reaching the limits of our current approach to modeling mutability, capturing, etc. We've chatted before about an alternate model that would allow distinguishing the mutable lifetime of the values of an array/map/set separately from the collection itself, and iterators over collections separately from the collection/items. We should consider this for a BE effort later in the half/year.

mofeiZ added a commit that referenced this pull request Mar 24, 2025
…perands are globals (#32695)

Globals, module locals, and other locally defined functions may mutate
their arguments. See test fixtures for details
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32695).
* #32698
* #32697
* #32696
* __->__ #32695
mofeiZ added a commit that referenced this pull request Mar 24, 2025
…handling (#32696)

Simplify InferReferenceEffect function signature matching logic for next
PRs in stack
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32696).
* #32698
* #32697
* __->__ #32696
* #32695
github-actions bot pushed a commit that referenced this pull request Mar 24, 2025
…handling (#32696)

Simplify InferReferenceEffect function signature matching logic for next
PRs in stack
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32696).
* #32698
* #32697
* __->__ #32696
* #32695

DiffTrain build for [45463ab](45463ab)
mofeiZ added a commit that referenced this pull request Mar 24, 2025
* Adds `isConstructor: boolean` to `FunctionType`. With this PR, each
typed function can either be a constructor (currently only known
globals) or non constructor. Alternatively, we prefer to encode
polymorphic types / effects (and match the closest subtype)

* Add Map and Set globals + built-ins
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32697).
* #32698
* __->__ #32697
Adds Effect.ConditionallyMutateIterator, which has the following effects:
- capture for known array, map, and sets
- mutate for all other values

An alternative to this approach could be to add polymorphic shape definitions
github-actions bot pushed a commit that referenced this pull request Mar 24, 2025
* Adds `isConstructor: boolean` to `FunctionType`. With this PR, each
typed function can either be a constructor (currently only known
globals) or non constructor. Alternatively, we prefer to encode
polymorphic types / effects (and match the closest subtype)

* Add Map and Set globals + built-ins
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32697).
* #32698
* __->__ #32697

DiffTrain build for [a8e503d](a8e503d)
@mofeiZ mofeiZ merged commit 7c908bc into main Mar 24, 2025
22 of 24 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 24, 2025
Adds Effect.ConditionallyMutateIterator, which has the following
effects:
- capture for known array, map, and sets
- mutate for all other values

An alternative to this approach could be to add polymorphic shape
definitions

DiffTrain build for [7c908bc](7c908bc)
@poteto poteto deleted the pr32698 branch March 26, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants