From afdd2cb9104254ded6b507bfbbe5ada541e8be9d Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Wed, 21 Dec 2022 12:04:01 +0000 Subject: [PATCH] [hir] Add Effect.Store Effect.Store is exactly like Effect.Mutate, the only difference is that Store aliases one into a another value. There is no practical difference between Effect.Mutate and Effect.Store currently. --- compiler/forget/src/HIR/HIR.ts | 2 ++ compiler/forget/src/HIR/InferMutableLifetimes.ts | 1 + compiler/forget/src/HIR/InferReferenceEffects.ts | 16 ++++++++++++++-- .../alias-nested-member-path-mutate.expect.md | 8 ++++---- .../hir/alias-nested-member-path.expect.md | 8 ++++---- .../fixtures/hir/assignment-variations.expect.md | 4 ++-- ...dependently-memoize-object-property.expect.md | 4 ++-- .../hir/mutable-lifetime-with-aliasing.expect.md | 4 ++-- .../fixtures/hir/property-assignment.expect.md | 4 ++-- .../hir/reactive-scope-grouping.expect.md | 4 ++-- .../ssa-property-alias-alias-mutate-if.expect.md | 8 ++++---- .../fixtures/hir/ssa-property-alias-if.expect.md | 8 ++++---- .../hir/ssa-property-alias-mutate-if.expect.md | 8 ++++---- ...ssa-property-alias-mutate-inside-if.expect.md | 8 ++++---- .../hir/ssa-property-alias-mutate.expect.md | 4 ++-- .../fixtures/hir/ssa-property-mutate-2.expect.md | 4 ++-- .../hir/ssa-property-mutate-alias.expect.md | 4 ++-- .../fixtures/hir/ssa-property-mutate.expect.md | 4 ++-- .../fixtures/hir/ssa-property.expect.md | 4 ++-- .../hir/transitive-alias-fields.expect.md | 12 ++++++------ .../fixtures/hir/type-test-field-store.expect.md | 4 ++-- .../fixtures/hir/type-test-polymorphic.expect.md | 8 ++++---- 22 files changed, 73 insertions(+), 58 deletions(-) diff --git a/compiler/forget/src/HIR/HIR.ts b/compiler/forget/src/HIR/HIR.ts index 35d69199c7..36c5990da0 100644 --- a/compiler/forget/src/HIR/HIR.ts +++ b/compiler/forget/src/HIR/HIR.ts @@ -376,6 +376,8 @@ export enum Effect { Read = "read", // This reference may write to (mutate) the value Mutate = "mutate", + // This reference may alias to (mutate) the value + Store = "store", } export type ReactiveScope = { diff --git a/compiler/forget/src/HIR/InferMutableLifetimes.ts b/compiler/forget/src/HIR/InferMutableLifetimes.ts index 881ad9ea4a..a0d2b7a7b3 100644 --- a/compiler/forget/src/HIR/InferMutableLifetimes.ts +++ b/compiler/forget/src/HIR/InferMutableLifetimes.ts @@ -72,6 +72,7 @@ function inferPlace(place: Place, instr: Instruction) { case Effect.Read: case Effect.Freeze: return; + case Effect.Store: case Effect.Mutate: { place.identifier.mutableRange.end = makeInstructionId(instr.id + 1); return; diff --git a/compiler/forget/src/HIR/InferReferenceEffects.ts b/compiler/forget/src/HIR/InferReferenceEffects.ts index d3481aaba9..82f83a23e9 100644 --- a/compiler/forget/src/HIR/InferReferenceEffects.ts +++ b/compiler/forget/src/HIR/InferReferenceEffects.ts @@ -270,6 +270,18 @@ class Environment { } break; } + case Effect.Store: { + // TODO(gsn): Uncomment the invariant once + // https://github.com/facebook/react-forget/pull/908#discussion_r1054294337 + // is fixed. + // + // invariant( + // valueKind === ValueKind.Mutable, + // `expected valueKind to be 'Mutable' but found to be '${valueKind}'` + // ); + effect = Effect.Store; + break; + } case Effect.Read: { effect = Effect.Read; break; @@ -575,10 +587,10 @@ function inferBlock(env: Environment, block: BasicBlock) { env.define(lvalue.place, instrValue); } else if (instrValue.memberPath === null) { // no-op: `a.b.c = d` - env.reference(lvalue.place, Effect.Mutate); + env.reference(lvalue.place, Effect.Store); } else { // no-op: `a.b.c = d.e.f` - env.reference(lvalue.place, Effect.Mutate); + env.reference(lvalue.place, Effect.Store); } } continue; diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md index bec0c01fec..82990ba470 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md @@ -19,9 +19,9 @@ function component() { bb0: [1] Const mutate z$5_@0[1:7] = Array [] [2] Const mutate y$6_@0:TObject[1:7] = Object { } - [3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0 + [3] Reassign store y$6_@0.z[1:7] = read z$5_@0 [4] Const mutate x$7_@0:TObject[1:7] = Object { } - [5] Reassign mutate x$7_@0.y[1:7] = read y$6_@0:TObject + [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z) [7] Return ``` @@ -33,9 +33,9 @@ function component( ) { [1] Const mutate z$5_@0[1:7] = Array [] [2] Const mutate y$6_@0:TObject[1:7] = Object { } - [3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0 + [3] Reassign store y$6_@0.z[1:7] = read z$5_@0 [4] Const mutate x$7_@0:TObject[1:7] = Object { } - [5] Reassign mutate x$7_@0.y[1:7] = read y$6_@0:TObject + [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z) return } diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md index f503b73597..fcb1cae51e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md @@ -19,9 +19,9 @@ function component() { bb0: [1] Const mutate z$4_@0 = Array [] [2] Const mutate y$5_@1:TObject[2:4] = Object { } - [3] Reassign mutate y$5_@1.z[2:4] = read z$4_@0 + [3] Reassign store y$5_@1.z[2:4] = read z$4_@0 [4] Const mutate x$6_@2:TObject[4:6] = Object { } - [5] Reassign mutate x$6_@2.y[4:6] = read y$5_@1:TObject + [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject [6] Return freeze x$6_@2:TObject ``` @@ -35,11 +35,11 @@ function component( } scope @1 [2:4] deps=[read z$4_@0] out=[y$5_@1] { [2] Const mutate y$5_@1:TObject[2:4] = Object { } - [3] Reassign mutate y$5_@1.z[2:4] = read z$4_@0 + [3] Reassign store y$5_@1.z[2:4] = read z$4_@0 } scope @2 [4:6] deps=[read y$5_@1:TObject] out=[x$6_@2] { [4] Const mutate x$6_@2:TObject[4:6] = Object { } - [5] Reassign mutate x$6_@2.y[4:6] = read y$5_@1:TObject + [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject } return freeze x$6_@2:TObject } diff --git a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md index a65ad7961e..cf4fb1f48c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md @@ -64,7 +64,7 @@ function f$0() { bb0: [1] Const mutate $6:TPrimitive = 1 [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive - [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive + [3] Reassign store a$5_@0.b.c[0:6] = read $7:TPrimitive [4] Const mutate $8:TPrimitive = 2 [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive [6] Return @@ -78,7 +78,7 @@ function g( ) { [1] Const mutate $6:TPrimitive = 1 [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive - [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive + [3] Reassign store a$5_@0.b.c[0:6] = read $7:TPrimitive [4] Const mutate $8:TPrimitive = 2 [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive return diff --git a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md index 825db2fe3d..16edfe5dcc 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md @@ -18,7 +18,7 @@ function foo(a, b, c) { bb0: [1] Const mutate x$9_@0:TObject[1:4] = Object { a: read a$6 } [2] Const mutate t6$10_@1 = Array [read b$7, read c$8] - [3] Reassign mutate x$9_@0.y[1:4] = read t6$10_@1 + [3] Reassign store x$9_@0.y[1:4] = read t6$10_@1 [4] Return freeze x$9_@0:TObject ``` @@ -35,7 +35,7 @@ function foo( scope @1 [2:3] deps=[read b$7, read c$8] out=[$10_@1] { [2] Const mutate $10_@1 = Array [read b$7, read c$8] } - [3] Reassign mutate x$9_@0.y[1:4] = read $10_@1 + [3] Reassign store x$9_@0.y[1:4] = read $10_@1 } return freeze x$9_@0:TObject } diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md index d5c3b4d32b..8c77655861 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md @@ -69,7 +69,7 @@ bb0: [3] Const mutate c$13_@2:TObject = Object { } [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject } [5] Const mutate x$15_@1:TObject[2:15] = Object { } - [6] Reassign mutate x$15_@1.b[2:15] = read b$12_@1 + [6] Reassign store x$15_@1.b[2:15] = read b$12_@1 [7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) [8] If (read a$11_@0:TObject) then:bb1 else:bb1 fallthrough=bb1 bb1: @@ -106,7 +106,7 @@ function Component( } [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject } [5] Const mutate x$15_@1:TObject[2:15] = Object { } - [6] Reassign mutate x$15_@1.b[2:15] = read b$12_@1 + [6] Reassign store x$15_@1.b[2:15] = read b$12_@1 [7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) if (read a$11_@0:TObject) { } diff --git a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md index 52e4fd4fd8..0f844de5dc 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md @@ -19,7 +19,7 @@ function Component(props) { bb0: [1] Const mutate x$7_@0:TObject[1:6] = Object { } [2] Const mutate y$8_@0[1:6] = Array [] - [3] Reassign mutate x$7_@0.y[1:6] = read y$8_@0 + [3] Reassign store x$7_@0.y[1:6] = read y$8_@0 [4] Const mutate child$9_@0[1:6] = JSX [5] Call mutate x$7_@0.y.push(read props$6.p0) [6] Const mutate t5$10_@1 = JSX {read child$9_@0} @@ -35,7 +35,7 @@ function Component( scope @0 [1:6] deps=[read props$6.p0] out=[x$7_@0, child$9_@0] { [1] Const mutate x$7_@0:TObject[1:6] = Object { } [2] Const mutate y$8_@0[1:6] = Array [] - [3] Reassign mutate x$7_@0.y[1:6] = read y$8_@0 + [3] Reassign store x$7_@0.y[1:6] = read y$8_@0 [4] Const mutate child$9_@0[1:6] = JSX [5] Call mutate x$7_@0.y.push(read props$6.p0) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md index 5e8e225b2c..67162e5f64 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md @@ -22,7 +22,7 @@ bb0: [2] Const mutate y$5_@1[2:5] = Array [] [3] Const mutate z$6_@1:TObject[2:5] = Object { } [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) - [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1 + [5] Reassign store x$4_@0.y[1:6] = read y$5_@1 [6] Return freeze x$4_@0:TObject ``` @@ -38,7 +38,7 @@ function foo( [3] Const mutate z$6_@1:TObject[2:5] = Object { } [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) } - [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1 + [5] Reassign store x$4_@0.y[1:6] = read y$5_@1 } return freeze x$4_@0:TObject } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md index 7cecf3a318..7228cdecfb 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md @@ -28,12 +28,12 @@ bb0: bb2: predecessor blocks: bb0 [4] Const mutate y$10_@0:TObject[1:11] = Object { } - [5] Reassign mutate x$9_@0.y[1:11] = read y$10_@0:TObject + [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject [6] Goto bb1 bb3: predecessor blocks: bb0 [7] Const mutate z$11_@0:TObject[1:11] = Object { } - [8] Reassign mutate x$9_@0.z[1:11] = read z$11_@0:TObject + [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject [9] Goto bb1 bb1: predecessor blocks: bb2 bb3 @@ -52,10 +52,10 @@ function foo( [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject if (read a$7) { [4] Const mutate y$10_@0:TObject[1:11] = Object { } - [5] Reassign mutate x$9_@0.y[1:11] = read y$10_@0:TObject + [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject } else { [7] Const mutate z$11_@0:TObject[1:11] = Object { } - [8] Reassign mutate x$9_@0.z[1:11] = read z$11_@0:TObject + [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject } [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md index 91677488f9..49ed7cf4aa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md @@ -25,12 +25,12 @@ bb0: bb2: predecessor blocks: bb0 [3] Const mutate y$7_@1:TObject = Object { } - [4] Reassign mutate x$6_@0.y[1:9] = read y$7_@1:TObject + [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject [5] Goto bb1 bb3: predecessor blocks: bb0 [6] Const mutate z$8_@2:TObject = Object { } - [7] Reassign mutate x$6_@0.z[1:9] = read z$8_@2:TObject + [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject [8] Goto bb1 bb1: predecessor blocks: bb2 bb3 @@ -49,12 +49,12 @@ function foo( scope @1 [3:4] deps=[] out=[y$7_@1] { [3] Const mutate y$7_@1:TObject = Object { } } - [4] Reassign mutate x$6_@0.y[1:9] = read y$7_@1:TObject + [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject } else { scope @2 [6:7] deps=[] out=[z$8_@2] { [6] Const mutate z$8_@2:TObject = Object { } } - [7] Reassign mutate x$6_@0.z[1:9] = read z$8_@2:TObject + [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject } } return freeze x$6_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md index 8f33db2205..9f99a2eced 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md @@ -26,12 +26,12 @@ bb0: bb2: predecessor blocks: bb0 [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject + [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject [5] Goto bb1 bb3: predecessor blocks: bb0 [6] Const mutate z$9_@0:TObject[1:10] = Object { } - [7] Reassign mutate x$7_@0.z[1:10] = read z$9_@0:TObject + [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject [8] Goto bb1 bb1: predecessor blocks: bb2 bb3 @@ -49,10 +49,10 @@ function foo( [1] Const mutate x$7_@0:TObject[1:10] = Object { } if (read a$6) { [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject + [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject } else { [6] Const mutate z$9_@0:TObject[1:10] = Object { } - [7] Reassign mutate x$7_@0.z[1:10] = read z$9_@0:TObject + [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject } [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md index f47e963968..59d1fe7c91 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md @@ -26,13 +26,13 @@ bb0: bb2: predecessor blocks: bb0 [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject + [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject) [6] Goto bb1 bb3: predecessor blocks: bb0 [7] Const mutate z$9_@1:TObject = Object { } - [8] Reassign mutate x$7_@0.z[1:10] = read z$9_@1:TObject + [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject [9] Goto bb1 bb1: predecessor blocks: bb2 bb3 @@ -49,13 +49,13 @@ function foo( [1] Const mutate x$7_@0:TObject[1:10] = Object { } if (read a$6) { [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject + [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject) } else { scope @1 [7:8] deps=[] out=[z$9_@1] { [7] Const mutate z$9_@1:TObject = Object { } } - [8] Reassign mutate x$7_@0.z[1:10] = read z$9_@1:TObject + [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject } } return freeze x$7_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md index b178687f5f..edf61fa7d9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md @@ -22,7 +22,7 @@ bb0: [1] Const mutate a$5_@0:TObject[1:6] = Object { } [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject [3] Const mutate y$7_@0:TObject[1:6] = Object { } - [4] Reassign mutate y$7_@0.x[1:6] = read x$6_@0:TObject + [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) [6] Return freeze y$7_@0:TObject ``` @@ -36,7 +36,7 @@ function foo( [1] Const mutate a$5_@0:TObject[1:6] = Object { } [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject [3] Const mutate y$7_@0:TObject[1:6] = Object { } - [4] Reassign mutate y$7_@0.x[1:6] = read x$6_@0:TObject + [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) } return freeze y$7_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md index 4b80c3bdd3..bc9fb05665 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md @@ -18,7 +18,7 @@ function foo() { bb0: [1] Const mutate x$4_@0[1:5] = Array [] [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0 + [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 [4] Call mutate mutate$3:TFunction(mutate x$4_@0) [5] Return freeze y$5_@0:TObject ``` @@ -31,7 +31,7 @@ function foo( scope @0 [1:5] deps=[] out=[y$5_@0] { [1] Const mutate x$4_@0[1:5] = Array [] [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0 + [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 [4] Call mutate mutate$3:TFunction(mutate x$4_@0) } return freeze y$5_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md index caf3562f38..7338e9aa0a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md @@ -22,7 +22,7 @@ bb0: [1] Const mutate a$5_@0:TObject[1:6] = Object { } [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject [3] Const mutate x$7_@0[1:6] = Array [] - [4] Reassign mutate y$6_@0.x[1:6] = read x$7_@0 + [4] Reassign store y$6_@0.x[1:6] = read x$7_@0 [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) [6] Return freeze y$6_@0:TObject ``` @@ -36,7 +36,7 @@ function foo( [1] Const mutate a$5_@0:TObject[1:6] = Object { } [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject [3] Const mutate x$7_@0[1:6] = Array [] - [4] Reassign mutate y$6_@0.x[1:6] = read x$7_@0 + [4] Reassign store y$6_@0.x[1:6] = read x$7_@0 [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) } return freeze y$6_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md index 4495bced5a..a34a301b10 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md @@ -18,7 +18,7 @@ function foo() { bb0: [1] Const mutate x$4_@0[1:5] = Array [] [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0 + [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject) [5] Return freeze y$5_@0:TObject ``` @@ -31,7 +31,7 @@ function foo( scope @0 [1:5] deps=[] out=[y$5_@0] { [1] Const mutate x$4_@0[1:5] = Array [] [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0 + [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject) } return freeze y$5_@0:TObject diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md index 7cd141438a..9d4989455e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md @@ -17,7 +17,7 @@ function foo() { bb0: [1] Const mutate x$3_@0 = Array [] [2] Const mutate y$4_@1:TObject[2:4] = Object { } - [3] Reassign mutate y$4_@1.x[2:4] = read x$3_@0 + [3] Reassign store y$4_@1.x[2:4] = read x$3_@0 [4] Return freeze y$4_@1:TObject ``` @@ -31,7 +31,7 @@ function foo( } scope @1 [2:4] deps=[read x$3_@0] out=[y$4_@1] { [2] Const mutate y$4_@1:TObject[2:4] = Object { } - [3] Reassign mutate y$4_@1.x[2:4] = read x$3_@0 + [3] Reassign store y$4_@1.x[2:4] = read x$3_@0 } return freeze y$4_@1:TObject } diff --git a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md index d82370f934..6d64e5d287 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md @@ -25,9 +25,9 @@ bb0: [2] Const mutate p$7_@0:TObject[1:9] = Object { } [3] Const mutate q$8_@0:TObject[1:9] = Object { } [4] Const mutate y$9_@0:TObject[1:9] = Object { } - [5] Reassign mutate x$6_@0.y[1:9] = read y$9_@0:TObject - [6] Reassign mutate p$7_@0.y[1:9] = read x$6_@0.y - [7] Reassign mutate q$8_@0.y[1:9] = read p$7_@0.y + [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject + [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y + [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject) [9] Return ``` @@ -41,9 +41,9 @@ function component( [2] Const mutate p$7_@0:TObject[1:9] = Object { } [3] Const mutate q$8_@0:TObject[1:9] = Object { } [4] Const mutate y$9_@0:TObject[1:9] = Object { } - [5] Reassign mutate x$6_@0.y[1:9] = read y$9_@0:TObject - [6] Reassign mutate p$7_@0.y[1:9] = read x$6_@0.y - [7] Reassign mutate q$8_@0.y[1:9] = read p$7_@0.y + [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject + [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y + [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject) return } diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md index 3d95311bd0..405abdaa1d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md @@ -17,7 +17,7 @@ function component() { bb0: [1] Const mutate x$4_@0:TObject[1:4] = Object { } [2] Const mutate q$5_@1:TObject = Object { } - [3] Reassign mutate x$4_@0.t[1:4] = read q$5_@1:TObject + [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject [4] Const mutate z$6:TObject = read x$4_@0.t [5] Return ``` @@ -32,7 +32,7 @@ function component( scope @1 [2:3] deps=[] out=[q$5_@1] { [2] Const mutate q$5_@1:TObject = Object { } } - [3] Reassign mutate x$4_@0.t[1:4] = read q$5_@1:TObject + [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject } [4] Const mutate z$6:TObject = read x$4_@0.t return diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md index 52fcdd7014..b60864b6ed 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md @@ -26,9 +26,9 @@ bb0: [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive [3] Const mutate o$8_@1:TObject = Object { } [4] Const mutate x$9_@2:TObject[4:8] = Object { } - [5] Reassign mutate x$9_@2.t[4:8] = read p$7_@0:TPrimitive + [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive [6] Const mutate z$10_@2:TPrimitive[4:8] = read x$9_@2.t - [7] Reassign mutate x$9_@2.t[4:8] = read o$8_@1:TObject + [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject [8] Const mutate y$11:TPoly = read x$9_@2.t [9] Return ``` @@ -47,9 +47,9 @@ function component( } scope @2 [4:8] deps=[read p$7_@0:TPrimitive, read o$8_@1:TObject] out=[x$9_@2] { [4] Const mutate x$9_@2:TObject[4:8] = Object { } - [5] Reassign mutate x$9_@2.t[4:8] = read p$7_@0:TPrimitive + [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive [6] Const mutate z$10_@2:TPrimitive[4:8] = read x$9_@2.t - [7] Reassign mutate x$9_@2.t[4:8] = read o$8_@1:TObject + [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject } [8] Const mutate y$11:TPoly = read x$9_@2.t return