Skip to content

Commit 30c6e81

Browse files
natebiggsCommit Queue
authored and
Commit Queue
committed
[dart2wasm] Clean up unused implementedBy list for ClassInfo.
These were used for lazily computed ClassInfo.repr struct representation. But this is now eagerly computed so implementedBy is no longer used. Change-Id: Ie8d28b110a1a7d109cc6e759b9cbe69c646829b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368763 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Nate Biggs <[email protected]> Reviewed-by: Ömer Ağacan <[email protected]>
1 parent dbcf23a commit 30c6e81

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

pkg/dart2wasm/lib/class_info.dart

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ class ClassInfo {
159159

160160
ClassInfo? _repr;
161161

162-
/// All classes which implement this class. This is used to compute `repr`.
163-
final List<ClassInfo> implementedBy = [];
164-
165162
/// Nullabe Wasm ref type for this class.
166163
final w.RefType nullableType;
167164

@@ -175,9 +172,7 @@ class ClassInfo {
175172
ClassInfo(this.cls, this.classId, this.depth, this.struct, this.superInfo,
176173
{this.typeParameterMatch = const {}})
177174
: nullableType = w.RefType.def(struct, nullable: true),
178-
nonNullableType = w.RefType.def(struct, nullable: false) {
179-
implementedBy.add(this);
180-
}
175+
nonNullableType = w.RefType.def(struct, nullable: false);
181176

182177
void _addField(w.FieldType fieldType, [int? expectedIndex]) {
183178
assert(expectedIndex == null || expectedIndex == struct.fields.length);
@@ -294,7 +289,6 @@ class ClassInfoCollector {
294289
info = ClassInfo(cls, classId, superInfo.depth + 1, struct, superInfo);
295290
// Mark Top type as implementing Object to force the representation
296291
// type of Object to be Top.
297-
info.implementedBy.add(topInfo);
298292
} else {
299293
// Recursively initialize all supertypes before initializing this class.
300294
_createStructForClass(classIds, superclass);
@@ -339,16 +333,6 @@ class ClassInfoCollector {
339333
m.types.defineStruct(cls.name, superType: superInfo.struct);
340334
info = ClassInfo(cls, classId, superInfo.depth + 1, struct, superInfo,
341335
typeParameterMatch: typeParameterMatch);
342-
343-
// Mark all interfaces as being implemented by this class. This is
344-
// needed to calculate representation types.
345-
for (Supertype interface in cls.implementedTypes) {
346-
ClassInfo? interfaceInfo = translator.classInfo[interface.classNode];
347-
while (interfaceInfo != null) {
348-
interfaceInfo.implementedBy.add(info);
349-
interfaceInfo = interfaceInfo.superInfo;
350-
}
351-
}
352336
}
353337
translator.classesSupersFirst.add(info);
354338
translator.classes[classId] = info;
@@ -498,7 +482,7 @@ class ClassInfoCollector {
498482
}
499483
final classId = classIdNumbering.classIds[cls]!;
500484
final info = translator.classes[classId];
501-
info._repr = representation ?? translator.classes[classId];
485+
info._repr = representation ?? info;
502486
}
503487

504488
// Now that the representation types for all classes have been computed,

0 commit comments

Comments
 (0)