Skip to content

Commit 81d8115

Browse files
authored
[compiler] Fix infinite loop due to uncached applied signatures (#33518)
When we apply new aliasing signatures we can generate new temporaries, which causes the abstract memory model to not converge. The fix is to make sure we cache the applications of these signatures. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33518). * #33571 * #33558 * #33547 * #33543 * #33533 * #33532 * #33530 * #33526 * #33522 * __->__ #33518
1 parent 8f4ce72 commit 81d8115

File tree

4 files changed

+237
-75
lines changed

4 files changed

+237
-75
lines changed

compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import {CompilerErrorDetailOptions} from '../CompilerError';
99
import {
1010
FunctionExpression,
11+
GeneratedSource,
1112
Hole,
1213
IdentifierId,
1314
ObjectMethod,
@@ -18,6 +19,7 @@ import {
1819
ValueReason,
1920
} from '../HIR';
2021
import {FunctionSignature} from '../HIR/ObjectShape';
22+
import {printSourceLocation} from '../HIR/PrintHIR';
2123

2224
/**
2325
* `AliasingEffect` describes a set of "effects" that an instruction/terminal has on one or
@@ -200,10 +202,19 @@ export function hashEffect(effect: AliasingEffect): string {
200202
return [effect.kind, effect.value.identifier.id, effect.reason].join(':');
201203
}
202204
case 'Impure':
203-
case 'Render':
205+
case 'Render': {
206+
return [effect.kind, effect.place.identifier.id].join(':');
207+
}
204208
case 'MutateFrozen':
205209
case 'MutateGlobal': {
206-
return [effect.kind, effect.place.identifier.id].join(':');
210+
return [
211+
effect.kind,
212+
effect.place.identifier.id,
213+
effect.error.severity,
214+
effect.error.reason,
215+
effect.error.description,
216+
printSourceLocation(effect.error.loc ?? GeneratedSource),
217+
].join(':');
207218
}
208219
case 'Mutate':
209220
case 'MutateConditionally':

0 commit comments

Comments
 (0)