Compare commits

...

9 Commits

Author SHA1 Message Date
Mike Vitousek
78a438606f Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 16:26:16 -07:00
Mike Vitousek
99c2bc4474 Update base for Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 16:26:15 -07:00
Mike Vitousek
9147afb22a Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 15:49:41 -07:00
Mike Vitousek
970bf7a22f Update base for Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 15:49:41 -07:00
Mike Vitousek
08034ad4a2 Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 13:16:08 -07:00
Mike Vitousek
b1de114fe5 Update base for Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 13:16:07 -07:00
Mike Vitousek
82e25e2f92 Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 11:09:06 -07:00
Mike Vitousek
551c78a908 Update base for Update on "[compiler] Add nullable abstract value field to places and phis"
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 11:09:05 -07:00
Mike Vitousek
6a77fd2ff7 [compiler] Add nullable abstract value field to places and phis
Test Plan:
This PR starts the process of tracking abstract values (and therefore value kinds) on a per-place basis and persisting that into the place data structure. Here, we simply add a nullable field for abstract values to all places and phis--it will be populated in the next PR.

[ghstack-poisoned]
2024-09-16 10:54:44 -07:00
9 changed files with 23 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ export function lower(
kind: 'Identifier',
identifier: builder.resolveBinding(ref),
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: ref.loc ?? GeneratedSource,
});
@@ -113,6 +114,7 @@ export function lower(
kind: 'Identifier',
identifier: binding.identifier,
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: param.node.loc ?? GeneratedSource,
};
@@ -126,6 +128,7 @@ export function lower(
kind: 'Identifier',
identifier: builder.makeTemporary(param.node.loc ?? GeneratedSource),
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: param.node.loc ?? GeneratedSource,
};
@@ -144,6 +147,7 @@ export function lower(
kind: 'Identifier',
identifier: builder.makeTemporary(param.node.loc ?? GeneratedSource),
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: param.node.loc ?? GeneratedSource,
};
@@ -460,6 +464,7 @@ function lowerStatement(
});
const place: Place = {
effect: Effect.Unknown,
abstractValue: null,
identifier: identifier.identifier,
kind: 'Identifier',
reactive: false,
@@ -853,6 +858,7 @@ function lowerStatement(
} else {
const place: Place = {
effect: Effect.Unknown,
abstractValue: null,
identifier: binding.identifier,
kind: 'Identifier',
reactive: false,
@@ -1264,6 +1270,7 @@ function lowerStatement(
handlerBindingPath.node.loc ?? GeneratedSource,
),
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: handlerBindingPath.node.loc ?? GeneratedSource,
};
@@ -3428,6 +3435,7 @@ function lowerIdentifier(
kind: 'Identifier',
identifier: binding.identifier,
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: exprLoc,
};
@@ -3449,6 +3457,7 @@ function buildTemporaryPlace(builder: HIRBuilder, loc: SourceLocation): Place {
kind: 'Identifier',
identifier: builder.makeTemporary(loc),
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc,
};
@@ -3511,6 +3520,7 @@ function lowerIdentifierForAssignment(
kind: 'Identifier',
identifier: binding.identifier,
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc,
};

View File

@@ -761,6 +761,7 @@ function _staticInvariantInstructionValueHasLocation(
export type Phi = {
kind: 'Phi';
id: Identifier;
abstractValue: AbstractValue | null;
operands: Map<BlockId, Identifier>;
};
@@ -1110,6 +1111,7 @@ export type Place = {
kind: 'Identifier';
identifier: Identifier;
effect: Effect;
abstractValue: AbstractValue | null;
reactive: boolean;
loc: SourceLocation;
};

View File

@@ -895,6 +895,7 @@ export function createTemporaryPlace(
kind: 'Identifier',
identifier: makeTemporaryIdentifier(env.nextIdentifierId, loc),
reactive: false,
abstractValue: null,
effect: Effect.Unknown,
loc: GeneratedSource,
};

View File

@@ -86,6 +86,7 @@ export function mergeConsecutiveBlocks(fn: HIRFunction): void {
kind: 'Identifier',
identifier: phi.id,
effect: Effect.ConditionallyMutate,
abstractValue: null,
reactive: false,
loc: GeneratedSource,
},
@@ -95,6 +96,7 @@ export function mergeConsecutiveBlocks(fn: HIRFunction): void {
kind: 'Identifier',
identifier: operand,
effect: Effect.Read,
abstractValue: null,
reactive: false,
loc: GeneratedSource,
},

View File

@@ -833,6 +833,8 @@ export function printPattern(pattern: Pattern | Place | SpreadPattern): string {
export function printPlace(place: Place): string {
const items = [
place.abstractValue?.kind,
place.abstractValue ? ' ' : '',
place.effect,
' ',
printIdentifier(place.identifier),

View File

@@ -268,6 +268,7 @@ function getManualMemoizationReplacement(
kind: 'Identifier',
identifier: fn.identifier,
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc,
},
@@ -420,6 +421,7 @@ export function dropManualMemoization(func: HIRFunction): void {
kind: 'Identifier',
identifier: fnPlace.identifier,
effect: Effect.Unknown,
abstractValue: null,
reactive: false,
loc: fnPlace.loc,
};

View File

@@ -237,6 +237,7 @@ class Transform extends ReactiveFunctionTransform<State> {
place: {
kind: 'Identifier',
effect: Effect.ConditionallyMutate,
abstractValue: null,
loc,
reactive: true,
identifier: earlyReturnValue.value,
@@ -308,6 +309,7 @@ class Transform extends ReactiveFunctionTransform<State> {
kind: 'Identifier',
identifier: earlyReturnValue.value,
effect: Effect.Capture,
abstractValue: null,
loc,
reactive: true,
},

View File

@@ -191,6 +191,7 @@ class SSABuilder {
const phi: Phi = {
kind: 'Phi',
id: newId,
abstractValue: null,
operands: predDefs,
};

View File

@@ -250,6 +250,7 @@ function validateInferredDep(
identifier: dep.identifier,
loc: GeneratedSource,
effect: Effect.Read,
abstractValue: null,
reactive: false,
},
},