Skip to content

Commit

Permalink
[tfa] Guard against recursive summary creation
Browse files Browse the repository at this point in the history
TEST=ci
Issue: #57084
Change-Id: Icacf44847cf5f53c256c62390c4c9ddfc0b80646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395400
Auto-Submit: Alexander Markov <[email protected]>
Reviewed-by: Slava Egorov <[email protected]>
Commit-Queue: Alexander Markov <[email protected]>
  • Loading branch information
alexmarkov authored and Commit Queue committed Nov 14, 2024
1 parent f856933 commit c97b84e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/vm/lib/transformations/type_flow/summary_collector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ class SummaryCollector extends RecursiveResultVisitor<TypeExpr?> {
summaryName += '::${localFunctionName(localFunction)}';
}
debugPrint("===== $summaryName =====");
if (_enclosingMember != null) {
throw 'Unable to create summary recursively, previous: $_enclosingMember, current: $summaryName';
}
assert(!member.isAbstract);
_enclosingMember = member;

Expand Down Expand Up @@ -2926,11 +2929,13 @@ class ConstantAllocationCollector implements ConstantVisitor<Type> {
for (int i = 0; i < constant.positional.length; ++i) {
final Field f = epl.getRecordPositionalField(recordShape, i);
final Type value = typeFor(constant.positional[i]);
assert(!f.isCovariantByClass);
epl.addFieldUsedInConstant(f, receiver, value);
}
constant.named.forEach((String fieldName, Constant fieldValue) {
final Field f = epl.getRecordNamedField(recordShape, fieldName);
final Type value = typeFor(fieldValue);
assert(!f.isCovariantByClass);
epl.addFieldUsedInConstant(f, receiver, value);
});
return receiver;
Expand All @@ -2941,6 +2946,7 @@ class ConstantAllocationCollector implements ConstantVisitor<Type> {
final resultClass = summaryCollector._entryPointsListener
.addAllocatedClass(constant.classNode);
constant.fieldValues.forEach((Reference fieldReference, Constant value) {
assert(!fieldReference.asField.isCovariantByClass);
summaryCollector._entryPointsListener.addFieldUsedInConstant(
fieldReference.asField, resultClass, typeFor(value));
});
Expand Down

0 comments on commit c97b84e

Please sign in to comment.