Revert "[VM/compiler] Do not load member signatures from kernel file in JIT mode."
This reverts commit d4b12d6b039341fc4c8ad3a92910bc93d4ae6025.
Reason for revert: Breaks mockito mocks mocking null-safe classes from non-null-safe tests. I am not intending to submit it, just need a commit id of a revert
Original change's description:
> [VM/compiler] Do not load member signatures from kernel file in JIT mode.
>
> The number of CFE-generated member signatures can be quite large (see buganizer #162073826).
> CFE now provides a reference from member signatures to their origin (see https://dart-review.googlesource.com/c/sdk/+/157498).
>
> This CL bypasses loading of member signatures in JIT mode and uses their origin as target in interface calls. AOT mode is not modified.
>
> Fix the implementation of --print-classes flag.
>
> Change-Id: Ief3e4e58a67bc3321a55d184b3c62ce62cd78689
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158145
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,regis@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I775a11244cc971b7aade594aadf2394636c95a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158387
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 34cc58e..f535c91 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -213,6 +213,12 @@
}
}
+ if (FLAG_print_classes) {
+ for (intptr_t i = 0; i < class_array.Length(); i++) {
+ cls ^= class_array.At(i);
+ PrintClassInformation(cls);
+ }
+ }
// Clear pending classes array.
class_array = GrowableObjectArray::New();
object_store->set_pending_classes(class_array);
@@ -1155,9 +1161,6 @@
}
// Mark as loaded and finalized.
cls.Finalize();
- if (FLAG_print_classes) {
- PrintClassInformation(cls);
- }
FinalizeMemberTypes(cls);
if (cls.is_enum_class()) {
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index 1785105..718c6df 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -2002,11 +2002,8 @@
NameIndex KernelReaderHelper::ReadInterfaceMemberNameReference() {
NameIndex name_index = reader_.ReadCanonicalNameReference();
- NameIndex origin_name_index = reader_.ReadCanonicalNameReference();
- if (!FLAG_precompiled_mode && origin_name_index != NameIndex::kInvalidName) {
- // Reference to a skipped member signature target, return the origin target.
- return origin_name_index;
- }
+ reader_
+ .ReadCanonicalNameReference(); // read interface target origin reference
return name_index;
}
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index a992ff3..092af49 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -1947,16 +1947,7 @@
ProcedureHelper procedure_helper(&helper_);
procedure_helper.ReadUntilExcluding(ProcedureHelper::kAnnotations);
- // CFE adds 'member signature' abstract functions to a legacy class deriving
- // or implementing an opted-in interface. The signature of these functions is
- // legacy erased and used as the target of interface calls. They are used for
- // static reasoning about the program by CFE, but not really needed by the VM.
- // In certain situations (e.g. issue 162073826), a large number of these
- // additional functions can cause strain on the VM. They are therefore skipped
- // in jit mode and their associated origin function is used instead as
- // interface call target.
- if (procedure_helper.IsRedirectingFactoryConstructor() ||
- (!FLAG_precompiled_mode && procedure_helper.IsMemberSignature())) {
+ if (procedure_helper.IsRedirectingFactoryConstructor()) {
helper_.SetOffset(procedure_end);
return;
}