Skip to content

Commit

Permalink
[vm] Canonicalize empty Class::interfaces_.
Browse files Browse the repository at this point in the history
TEST=ci
Change-Id: I921eb1796b5e142aba8a8f8649a0105ef0e396e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243380
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
  • Loading branch information
rmacnak-google authored and Commit Bot committed May 2, 2022
1 parent c9840a0 commit 706e62a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions runtime/vm/kernel_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1377,15 +1377,19 @@ void KernelLoader::LoadPreliminaryClass(ClassHelper* class_helper,

// Build implemented interface types
intptr_t interface_count = helper_.ReadListLength();
const Array& interfaces =
Array::Handle(Z, Array::New(interface_count, Heap::kOld));
for (intptr_t i = 0; i < interface_count; i++) {
const AbstractType& type =
T.BuildTypeWithoutFinalization(); // read ith type.
interfaces.SetAt(i, type);
if (interface_count == 0) {
klass->set_interfaces(Object::empty_array());
} else {
const Array& interfaces =
Array::Handle(Z, Array::New(interface_count, Heap::kOld));
for (intptr_t i = 0; i < interface_count; i++) {
const AbstractType& type =
T.BuildTypeWithoutFinalization(); // read ith type.
interfaces.SetAt(i, type);
}
klass->set_interfaces(interfaces);
}
class_helper->SetJustRead(ClassHelper::kImplementedClasses);
klass->set_interfaces(interfaces);

if (class_helper->is_abstract()) klass->set_is_abstract();

Expand Down

0 comments on commit 706e62a

Please sign in to comment.