Revert "[vm] Reduce size of Class objects in AOT and PRODUCT modes"
This reverts commit 2852408881936600ad881cb7ee19342054fabce3.
Reason for revert: failures on Flutter engine tests.
Issue: https://github.com/flutter/flutter/issues/80801
Original change's description:
> [vm] Reduce size of Class objects in AOT and PRODUCT modes
>
> This change conditionally removes certain fields from Class objects
> in AOT and PRODUCT modes.
>
> Flutter gallery in release-sizeopt mode:
> Snapshot size -0.47% (arm64), -0.44% (arm)
> Heap size of snapshot objects -4.1% (arm64), -4.3% (arm)
>
> On a large Flutter application compiled in --dwarf-stack-traces mode:
> Heap size of Class objects -26%
> Heap size of all snapshot objects -3.6%
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/44020
> Change-Id: I795c625b71558cd2f336f92fc326c36fd339cd4b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195700
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=vegorov@google.com,rmacnak@google.com,alexmarkov@google.com,sstrickl@google.com
Change-Id: I0dbf1d5fc139f3654ce52f185b799c09bba66de7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/44020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196102
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index e429842..9d182ed 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -36,15 +36,6 @@
return classes.Length() == 0;
}
-#if defined(DART_PRECOMPILED_RUNTIME)
-
-bool ClassFinalizer::ProcessPendingClasses() {
- ASSERT(AllClassesFinalized());
- return true;
-}
-
-#else
-
// Removes optimized code once we load more classes, since CHA based
// optimizations may have become invalid.
// Only methods which owner classes where subclasses can be invalid.
@@ -229,6 +220,7 @@
return true;
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::VerifyBootstrapClasses() {
if (FLAG_trace_class_finalization) {
OS::PrintErr("VerifyBootstrapClasses START.\n");
@@ -294,6 +286,7 @@
}
IsolateGroup::Current()->heap()->Verify();
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeTypeParameters(const Class& cls,
FinalizationKind finalization) {
@@ -317,8 +310,6 @@
}
}
-#endif // defined(DART_PRECOMPILED_RUNTIME)
-
// This function reports a compilation error if the recursive 'type' T being
// finalized is a non-contractive type, i.e. if the induced type set S of P is
// not finite, where P is the instantiation of T with its own type parameters.
@@ -542,11 +533,7 @@
TrailPtr trail) {
ASSERT(arguments.Length() >= cls.NumTypeArguments());
if (!cls.is_type_finalized()) {
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
FinalizeTypeParameters(cls, kFinalize);
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
AbstractType& super_type = AbstractType::Handle(cls.super_type());
if (!super_type.IsNull()) {
@@ -864,8 +851,6 @@
return signature.ptr();
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
#if defined(TARGET_ARCH_X64)
static bool IsPotentialExactGeneric(const AbstractType& type) {
// TODO(dartbug.com/34170) Investigate supporting this for fields with types
@@ -971,7 +956,6 @@
cls = type.type_class();
}
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeTypesInClass(const Class& cls) {
Thread* thread = Thread::Current();
@@ -981,9 +965,6 @@
return;
}
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
if (cls.is_type_finalized()) {
return;
@@ -1019,10 +1000,8 @@
cls.set_is_type_finalized();
RegisterClassInHierarchy(thread->zone(), cls);
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::RegisterClassInHierarchy(Zone* zone, const Class& cls) {
auto& type = AbstractType::Handle(zone, cls.super_type());
auto& other_cls = Class::Handle(zone);
@@ -1046,7 +1025,6 @@
other_cls.AddDirectImplementor(cls, /* is_mixin = */ i == mixin_index);
}
}
-#endif // defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeClass(const Class& cls) {
ASSERT(cls.is_type_finalized());
@@ -1054,9 +1032,6 @@
return;
}
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
Thread* thread = Thread::Current();
HANDLESCOPE(thread);
@@ -1073,6 +1048,7 @@
}
#endif // defined(SUPPORT_TIMELINE)
+#if !defined(DART_PRECOMPILED_RUNTIME)
// If loading from a kernel, make sure that the class is fully loaded.
ASSERT(cls.IsTopLevel() || (cls.kernel_offset() > 0));
if (!cls.is_loaded()) {
@@ -1081,6 +1057,7 @@
return;
}
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Ensure super class is finalized.
const Class& super = Class::Handle(cls.SuperClass());
@@ -1107,11 +1084,8 @@
if (cls.IsTopLevel()) {
cls.set_is_allocate_finalized();
}
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
ErrorPtr ClassFinalizer::AllocateFinalizeClass(const Class& cls) {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
ASSERT(cls.is_finalized());
@@ -1287,8 +1261,6 @@
}
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
void ClassFinalizer::ReportError(const Error& error) {
Report::LongJump(error);
UNREACHABLE();
@@ -1304,8 +1276,6 @@
UNREACHABLE();
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
void ClassFinalizer::VerifyImplicitFieldOffsets() {
#ifdef DEBUG
Thread* thread = Thread::Current();
@@ -1691,6 +1661,9 @@
}
void ClassFinalizer::ClearAllCode(bool including_nonchanging_cids) {
+#ifdef DART_PRECOMPILED_RUNTIME
+ UNREACHABLE();
+#else
auto const thread = Thread::Current();
auto const isolate_group = thread->isolate_group();
SafepointWriteRwLocker ml(thread, isolate_group->program_lock());
@@ -1732,8 +1705,7 @@
auto& null_code = Code::Handle(zone);
object_store->set_build_method_extractor_code(null_code);
}
+#endif // !DART_PRECOMPILED_RUNTIME
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
} // namespace dart
diff --git a/runtime/vm/class_finalizer.h b/runtime/vm/class_finalizer.h
index db2b973..623bdb5 100644
--- a/runtime/vm/class_finalizer.h
+++ b/runtime/vm/class_finalizer.h
@@ -34,13 +34,11 @@
// Return false if we still have classes pending to be finalized.
static bool AllClassesFinalized();
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Useful for sorting classes to make dispatch faster.
static void SortClasses();
static void RemapClassIds(intptr_t* old_to_new_cid);
static void RehashTypes();
static void ClearAllCode(bool including_nonchanging_cids = false);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Return whether processing pending classes (ObjectStore::pending_classes_)
// failed. The function returns true if the processing was successful.
@@ -54,16 +52,12 @@
// is an anonymous top level class).
static void FinalizeTypesInClass(const Class& cls);
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Register class in the lists of direct subclasses and direct implementors.
static void RegisterClassInHierarchy(Zone* zone, const Class& cls);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Ensures members of the class are loaded, class layout is finalized and size
// registered in class table.
static void FinalizeClass(const Class& cls);
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Makes class instantiatable and usable by generated code.
static ErrorPtr AllocateFinalizeClass(const Class& cls);
@@ -73,6 +67,7 @@
// Returns Error::null() if there is no loading error.
static ErrorPtr LoadClassMembers(const Class& cls);
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Verify that the classes have been properly prefinalized. This is
// needed during bootstrapping where the classes have been preloaded.
static void VerifyBootstrapClasses();
@@ -86,13 +81,10 @@
FinalizationKind finalization = kCanonicalize,
PendingTypes* pending_types = NULL);
-#if !defined(DART_PRECOMPILED_RUNTIME)
static void AllocateEnumValues(const Class& enum_cls);
static void FinalizeTypeParameters(
const Class& cls,
FinalizationKind finalization = kCanonicalize);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
static intptr_t ExpandAndFinalizeTypeArguments(const AbstractType& type,
PendingTypes* pending_types);
static void FinalizeTypeArguments(const Class& cls,
@@ -102,20 +94,15 @@
TrailPtr trail);
static void CheckRecursiveType(const AbstractType& type,
PendingTypes* pending_types);
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
static void FinalizeMemberTypes(const Class& cls);
static void PrintClassInformation(const Class& cls);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
static void ReportError(const Error& error);
static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2);
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Verify implicit offsets recorded in the VM for direct access to fields of
// Dart instances (e.g: _TypedListView, _ByteDataView).
static void VerifyImplicitFieldOffsets();
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
};
} // namespace dart
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index e75d799..540bcf9 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -302,10 +302,8 @@
s->Write<int32_t>(Class::target_type_arguments_field_offset_in_words(cls));
s->Write<int16_t>(cls->untag()->num_type_arguments_);
s->Write<uint16_t>(cls->untag()->num_native_fields_);
- if (s->kind() != Snapshot::kFullAOT) {
- s->WriteTokenPosition(cls->untag()->token_pos_);
- s->WriteTokenPosition(cls->untag()->end_token_pos_);
- }
+ s->WriteTokenPosition(cls->untag()->token_pos_);
+ s->WriteTokenPosition(cls->untag()->end_token_pos_);
s->Write<uint32_t>(cls->untag()->state_bits_);
// In AOT, the bitmap of unboxed fields should also be serialized
@@ -398,11 +396,8 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->num_type_arguments_ = d->Read<int16_t>();
cls->untag()->num_native_fields_ = d->Read<uint16_t>();
-#if !defined(DART_PRECOMPILED_RUNTIME)
- ASSERT(d->kind() != Snapshot::kFullAOT);
cls->untag()->token_pos_ = d->ReadTokenPosition();
cls->untag()->end_token_pos_ = d->ReadTokenPosition();
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->state_bits_ = d->Read<uint32_t>();
if (FLAG_precompiled_mode) {
@@ -439,11 +434,8 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->num_type_arguments_ = d->Read<int16_t>();
cls->untag()->num_native_fields_ = d->Read<uint16_t>();
-#if !defined(DART_PRECOMPILED_RUNTIME)
- ASSERT(d->kind() != Snapshot::kFullAOT);
cls->untag()->token_pos_ = d->ReadTokenPosition();
cls->untag()->end_token_pos_ = d->ReadTokenPosition();
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->state_bits_ = d->Read<uint32_t>();
table->AllocateIndex(class_id);
diff --git a/runtime/vm/compilation_trace.h b/runtime/vm/compilation_trace.h
index 14996ec..aa4a6b7 100644
--- a/runtime/vm/compilation_trace.h
+++ b/runtime/vm/compilation_trace.h
@@ -10,8 +10,6 @@
#include "vm/program_visitor.h"
#include "vm/zone_text_buffer.h"
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
namespace dart {
class CompilationTraceSaver : public FunctionVisitor {
@@ -136,6 +134,4 @@
} // namespace dart
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
#endif // RUNTIME_VM_COMPILATION_TRACE_H_
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 1337ee3..5af8a8b 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -3330,12 +3330,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 84;
-static constexpr dart::compiler::target::word Class_super_type_offset = 40;
+ 88;
+static constexpr dart::compiler::target::word Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 96;
+ Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word Closure_context_offset = 20;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 12;
@@ -3688,7 +3688,7 @@
static constexpr dart::compiler::target::word Array_header_size = 12;
static constexpr dart::compiler::target::word Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 120;
+static constexpr dart::compiler::target::word Class_InstanceSize = 124;
static constexpr dart::compiler::target::word Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word Code_InstanceSize = 76;
@@ -3860,12 +3860,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 156;
-static constexpr dart::compiler::target::word Class_super_type_offset = 80;
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 168;
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -4224,7 +4224,7 @@
static constexpr dart::compiler::target::word Array_header_size = 24;
static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 192;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word Code_InstanceSize = 144;
@@ -4395,12 +4395,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 84;
-static constexpr dart::compiler::target::word Class_super_type_offset = 40;
+ 88;
+static constexpr dart::compiler::target::word Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 96;
+ Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word Closure_context_offset = 20;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 12;
@@ -4750,7 +4750,7 @@
static constexpr dart::compiler::target::word Array_header_size = 12;
static constexpr dart::compiler::target::word Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 120;
+static constexpr dart::compiler::target::word Class_InstanceSize = 124;
static constexpr dart::compiler::target::word Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word Code_InstanceSize = 76;
@@ -4922,12 +4922,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 156;
-static constexpr dart::compiler::target::word Class_super_type_offset = 80;
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 168;
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -5287,7 +5287,7 @@
static constexpr dart::compiler::target::word Array_header_size = 24;
static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 192;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word Code_InstanceSize = 144;
@@ -5458,12 +5458,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 52;
+ 56;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 88;
-static constexpr dart::compiler::target::word Class_super_type_offset = 44;
+ 92;
+static constexpr dart::compiler::target::word Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 100;
+ Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -5993,12 +5993,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 52;
+ 56;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 88;
-static constexpr dart::compiler::target::word Class_super_type_offset = 44;
+ 92;
+static constexpr dart::compiler::target::word Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 100;
+ Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -6536,10 +6536,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 72;
+ AOT_Class_num_type_arguments_offset = 88;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 84;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 20;
@@ -6942,7 +6942,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 92;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 108;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 88;
@@ -7133,10 +7133,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 140;
+ AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 152;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -7542,7 +7542,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 160;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -7736,10 +7736,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 140;
+ AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 152;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -8146,7 +8146,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 160;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -8337,10 +8337,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 76;
+ AOT_Class_num_type_arguments_offset = 92;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 88;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -8746,7 +8746,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 96;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -8937,10 +8937,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 76;
+ AOT_Class_num_type_arguments_offset = 92;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 88;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -9347,7 +9347,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 96;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -9537,12 +9537,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
4;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 48;
+ AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 60;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 40;
+ AOT_Class_num_type_arguments_offset = 88;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 72;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 20;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 12;
@@ -9938,7 +9938,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 80;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 108;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 64;
@@ -10127,12 +10127,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 116;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 80;
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 128;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -10531,7 +10531,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 136;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -10723,12 +10723,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 116;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 80;
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 128;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -11128,7 +11128,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 136;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -11317,12 +11317,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 52;
+ AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 64;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
+ AOT_Class_num_type_arguments_offset = 92;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 76;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -11721,7 +11721,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -11910,12 +11910,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 52;
+ AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 64;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
+ AOT_Class_num_type_arguments_offset = 92;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 76;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -12315,7 +12315,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index a00fa04..9c0926e 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2829,8 +2829,8 @@
result ^= raw;
}
Object::VerifyBuiltinVtable<FakeObject>(FakeObject::kClassId);
- NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
- NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
+ result.set_token_pos(TokenPosition::kNoSource);
+ result.set_end_token_pos(TokenPosition::kNoSource);
result.set_instance_size(FakeObject::InstanceSize(),
compiler::target::RoundedAllocationSize(
TargetFakeObject::InstanceSize()));
@@ -2865,7 +2865,6 @@
return result.ptr();
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
static void ReportTooManyTypeArguments(const Class& cls) {
Report::MessageF(Report::kError, Script::Handle(cls.script()),
cls.token_pos(), Report::AtLocation,
@@ -2874,12 +2873,8 @@
String::Handle(cls.Name()).ToCString());
UNREACHABLE();
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_num_type_arguments(intptr_t value) const {
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
if (!Utils::IsInt(16, value)) {
ReportTooManyTypeArguments(*this);
}
@@ -2889,7 +2884,6 @@
DEBUG_ASSERT(old_value == kUnknownNumTypeArguments || old_value == value);
StoreNonPointer<int16_t, int16_t, std::memory_order_relaxed>(
&untag()->num_type_arguments_, value);
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
void Class::set_num_type_arguments_unsafe(intptr_t value) const {
@@ -3278,15 +3272,10 @@
return num_type_args;
}
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
- return 0;
-#else
num_type_args = ComputeNumTypeArguments();
ASSERT(num_type_args != kUnknownNumTypeArguments);
set_num_type_arguments(num_type_args);
return num_type_args;
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
static TypeArgumentsPtr InstantiateTypeArgumentsToBounds(
@@ -3954,15 +3943,6 @@
set_is_finalized();
}
-#if defined(DEBUG)
-static bool IsMutatorOrAtSafepoint() {
- Thread* thread = Thread::Current();
- return thread->IsMutatorThread() || thread->IsAtSafepoint();
-}
-#endif
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
class CHACodeArray : public WeakCodeReferences {
public:
explicit CHACodeArray(const Class& cls)
@@ -3996,6 +3976,13 @@
DISALLOW_COPY_AND_ASSIGN(CHACodeArray);
};
+#if defined(DEBUG)
+static bool IsMutatorOrAtSafepoint() {
+ Thread* thread = Thread::Current();
+ return thread->IsMutatorThread() || thread->IsAtSafepoint();
+}
+#endif
+
void Class::RegisterCHACode(const Code& code) {
if (FLAG_trace_cha) {
THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
@@ -4026,20 +4013,6 @@
DisableCHAOptimizedCode(Class::Handle());
}
-ArrayPtr Class::dependent_code() const {
- DEBUG_ASSERT(
- IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
- return untag()->dependent_code();
-}
-
-void Class::set_dependent_code(const Array& array) const {
- DEBUG_ASSERT(
- IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- untag()->set_dependent_code(array.ptr());
-}
-
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
bool Class::TraceAllocation(IsolateGroup* isolate_group) const {
#ifndef PRODUCT
auto class_table = isolate_group->shared_class_table();
@@ -4063,6 +4036,18 @@
#endif
}
+ArrayPtr Class::dependent_code() const {
+ DEBUG_ASSERT(
+ IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
+ return untag()->dependent_code();
+}
+
+void Class::set_dependent_code(const Array& array) const {
+ DEBUG_ASSERT(
+ IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
+ untag()->set_dependent_code(array.ptr());
+}
+
// Conventions:
// * For throwing a NSM in a class klass we use its runtime type as receiver,
// i.e., klass.RareType().
@@ -4392,10 +4377,6 @@
if (is_finalized()) {
return Error::null();
}
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
- return Error::null();
-#else
SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
if (is_finalized()) {
return Error::null();
@@ -4412,7 +4393,6 @@
}
}
return error.ptr();
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
// Ensure that code outdated by finalized class is cleaned up, new instance of
@@ -4439,11 +4419,7 @@
if (is_allocate_finalized()) {
return Error::null();
}
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
error ^= ClassFinalizer::AllocateFinalizeClass(*this);
-#endif // defined(DART_PRECOMPILED_RUNTIME)
return error.ptr();
}
@@ -4559,8 +4535,8 @@
// Here kIllegalCid means not-yet-assigned.
Object::VerifyBuiltinVtable<FakeInstance>(index == kIllegalCid ? kInstanceCid
: index);
- NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
- NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
+ result.set_token_pos(TokenPosition::kNoSource);
+ result.set_end_token_pos(TokenPosition::kNoSource);
const intptr_t host_instance_size = FakeInstance::InstanceSize();
const intptr_t target_instance_size = compiler::target::RoundedAllocationSize(
TargetFakeInstance::InstanceSize());
@@ -4607,7 +4583,7 @@
result.set_library(lib);
result.set_name(name);
result.set_script(script);
- NOT_IN_PRECOMPILED(result.set_token_pos(token_pos));
+ result.set_token_pos(token_pos);
// The size gets initialized to 0. Once the class gets finalized the class
// finalizer will set the correct size.
@@ -4965,7 +4941,6 @@
untag()->set_script(value.ptr());
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_token_pos(TokenPosition token_pos) const {
ASSERT(!token_pos.IsClassifying());
StoreNonPointer(&untag()->token_pos_, token_pos);
@@ -4975,7 +4950,6 @@
ASSERT(!token_pos.IsClassifying());
StoreNonPointer(&untag()->end_token_pos_, token_pos);
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
int32_t Class::SourceFingerprint() const {
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -5088,8 +5062,6 @@
untag()->set_interfaces(value.ptr());
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
void Class::AddDirectImplementor(const Class& implementor,
bool is_mixin) const {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
@@ -5148,8 +5120,6 @@
untag()->set_direct_subclasses(subclasses.ptr());
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
ArrayPtr Class::constants() const {
return untag()->constants();
}
@@ -5197,7 +5167,6 @@
return type.ptr();
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_allocation_stub(const Code& value) const {
// Never clear the stub as it may still be a target, but will be GC-d if
// not referenced.
@@ -5205,12 +5174,8 @@
ASSERT(untag()->allocation_stub() == Code::null());
untag()->set_allocation_stub(value.ptr());
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Class::DisableAllocationStub() const {
-#if defined(DART_PRECOMPILED_RUNTIME)
- UNREACHABLE();
-#else
{
const Code& existing_stub = Code::Handle(allocation_stub());
if (existing_stub.IsNull()) {
@@ -5228,7 +5193,6 @@
existing_stub.DisableStubCode();
// Disassociate the existing stub from class.
untag()->set_allocation_stub(Code::null());
-#endif // defined(DART_PRECOMPILED_RUNTIME)
}
bool Class::IsDartFunctionClass() const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index f43d2d0..7e106a5 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1053,29 +1053,10 @@
ScriptPtr script() const { return untag()->script(); }
void set_script(const Script& value) const;
- TokenPosition token_pos() const {
-#if defined(DART_PRECOMPILED_RUNTIME)
- return TokenPosition::kNoSource;
-#else
- return untag()->token_pos_;
-#endif // defined(DART_PRECOMPILED_RUNTIME)
- }
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
+ TokenPosition token_pos() const { return untag()->token_pos_; }
void set_token_pos(TokenPosition value) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
- TokenPosition end_token_pos() const {
-#if defined(DART_PRECOMPILED_RUNTIME)
- return TokenPosition::kNoSource;
-#else
- return untag()->end_token_pos_;
-#endif // defined(DART_PRECOMPILED_RUNTIME)
- }
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
+ TokenPosition end_token_pos() const { return untag()->end_token_pos_; }
void set_end_token_pos(TokenPosition value) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
int32_t SourceFingerprint() const;
@@ -1214,7 +1195,6 @@
}
void set_interfaces(const Array& value) const;
-#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
// Returns the list of classes directly implementing this class.
GrowableObjectArrayPtr direct_implementors() const {
DEBUG_ASSERT(
@@ -1224,14 +1204,9 @@
GrowableObjectArrayPtr direct_implementors_unsafe() const {
return untag()->direct_implementors();
}
-#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
void set_direct_implementors(const GrowableObjectArray& implementors) const;
void AddDirectImplementor(const Class& subclass, bool is_mixin) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
// Returns the list of classes having this class as direct superclass.
GrowableObjectArrayPtr direct_subclasses() const {
DEBUG_ASSERT(
@@ -1241,12 +1216,8 @@
GrowableObjectArrayPtr direct_subclasses_unsafe() const {
return untag()->direct_subclasses();
}
-#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
void set_direct_subclasses(const GrowableObjectArray& subclasses) const;
void AddDirectSubclass(const Class& subclass) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Check if this class represents the class of null.
bool IsNullClass() const { return id() == kNullCid; }
@@ -1467,10 +1438,8 @@
StoreNonPointer(&untag()->num_native_fields_, value);
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
CodePtr allocation_stub() const { return untag()->allocation_stub(); }
void set_allocation_stub(const Code& value) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
intptr_t kernel_offset() const {
#if defined(DART_PRECOMPILED_RUNTIME)
@@ -1570,7 +1539,6 @@
static ClassPtr NewPointerClass(intptr_t class_id,
IsolateGroup* isolate_group);
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Register code that has used CHA for optimization.
// TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class,
// leaf method, ...).
@@ -1587,7 +1555,6 @@
// are finalized.
ArrayPtr dependent_code() const;
void set_dependent_code(const Array& array) const;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
bool TraceAllocation(IsolateGroup* isolate_group) const;
void SetTraceAllocation(bool trace_allocation) const;
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index 4bb663a..c5a7965 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
#include "vm/program_visitor.h"
#include "vm/closure_functions_cache.h"
@@ -291,6 +289,7 @@
walker.VisitWorklist();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
// A base class for deduplication of objects. T is the type of canonical objects
// being stored, whereas S is a trait appropriate for a DirectChainedHashMap
// based set containing those canonical objects.
@@ -1350,8 +1349,10 @@
DedupInstructionsVisitor visitor(zone);
WalkProgram(zone, isolate_group, &visitor);
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ProgramVisitor::Dedup(Thread* thread) {
+#if !defined(DART_PRECOMPILED_RUNTIME)
auto const isolate_group = thread->isolate_group();
StackZone stack_zone(thread);
HANDLESCOPE(thread);
@@ -1393,6 +1394,7 @@
DedupInstructions(zone, isolate_group);
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
}
#if defined(DART_PRECOMPILER)
@@ -1558,8 +1560,6 @@
return visitor.hash();
}
-#endif // defined(DART_PRECOMPILER)
+#endif // defined(DART_PRECOMPILED_RUNTIME)
} // namespace dart
-
-#endif // defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/program_visitor.h b/runtime/vm/program_visitor.h
index fa57326..b310625 100644
--- a/runtime/vm/program_visitor.h
+++ b/runtime/vm/program_visitor.h
@@ -5,8 +5,6 @@
#ifndef RUNTIME_VM_PROGRAM_VISITOR_H_
#define RUNTIME_VM_PROGRAM_VISITOR_H_
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
#include "vm/allocation.h"
namespace dart {
@@ -106,6 +104,7 @@
#endif
private:
+#if !defined(DART_PRECOMPILED_RUNTIME)
static void BindStaticCalls(Zone* zone, IsolateGroup* isolate_group);
static void ShareMegamorphicBuckets(Zone* zone, IsolateGroup* isolate_group);
static void NormalizeAndDedupCompressedStackMaps(Zone* zone,
@@ -120,10 +119,9 @@
static void DedupCodeSourceMaps(Zone* zone, IsolateGroup* isolate_group);
static void DedupLists(Zone* zone, IsolateGroup* isolate_group);
static void DedupInstructions(Zone* zone, IsolateGroup* isolate_group);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
};
} // namespace dart
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
#endif // RUNTIME_VM_PROGRAM_VISITOR_H_
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 308284a..7753a7a 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -905,7 +905,7 @@
VISIT_FROM(CompressedObjectPtr, name)
COMPRESSED_POINTER_FIELD(StringPtr, name)
- NOT_IN_PRODUCT(COMPRESSED_POINTER_FIELD(StringPtr, user_name))
+ COMPRESSED_POINTER_FIELD(StringPtr, user_name)
COMPRESSED_POINTER_FIELD(ArrayPtr, functions)
COMPRESSED_POINTER_FIELD(ArrayPtr, functions_hash_table)
COMPRESSED_POINTER_FIELD(ArrayPtr, fields)
@@ -922,49 +922,26 @@
COMPRESSED_POINTER_FIELD(TypePtr, declaration_type)
// Cache for dispatcher functions.
COMPRESSED_POINTER_FIELD(ArrayPtr, invocation_dispatcher_cache)
-
-#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
+ // Stub code for allocation of instances.
+ COMPRESSED_POINTER_FIELD(CodePtr, allocation_stub)
// Array of Class.
COMPRESSED_POINTER_FIELD(GrowableObjectArrayPtr, direct_implementors)
// Array of Class.
COMPRESSED_POINTER_FIELD(GrowableObjectArrayPtr, direct_subclasses)
-#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
- // Stub code for allocation of instances.
- COMPRESSED_POINTER_FIELD(CodePtr, allocation_stub)
// CHA optimized codes.
COMPRESSED_POINTER_FIELD(ArrayPtr, dependent_code)
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
-#if defined(DART_PRECOMPILED_RUNTIME)
-#if defined(PRODUCT)
- VISIT_TO(CompressedObjectPtr, invocation_dispatcher_cache)
-#else
- VISIT_TO(CompressedObjectPtr, direct_subclasses)
-#endif // defined(PRODUCT)
-#else
VISIT_TO(CompressedObjectPtr, dependent_code)
-#endif // defined(DART_PRECOMPILED_RUNTIME)
-
CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
#if defined(PRODUCT)
- return reinterpret_cast<CompressedObjectPtr*>(
- &invocation_dispatcher_cache_);
-#else
- return reinterpret_cast<CompressedObjectPtr*>(&direct_subclasses_);
-#endif // defined(PRODUCT)
- case Snapshot::kFull:
- case Snapshot::kFullCore:
-#if !defined(DART_PRECOMPILED_RUNTIME)
return reinterpret_cast<CompressedObjectPtr*>(&allocation_stub_);
#endif
+ case Snapshot::kFull:
+ case Snapshot::kFullCore:
+ return reinterpret_cast<CompressedObjectPtr*>(&direct_subclasses_);
case Snapshot::kFullJIT:
-#if !defined(DART_PRECOMPILED_RUNTIME)
return reinterpret_cast<CompressedObjectPtr*>(&dependent_code_);
-#endif
case Snapshot::kMessage:
case Snapshot::kNone:
case Snapshot::kInvalid:
@@ -974,8 +951,8 @@
return NULL;
}
- NOT_IN_PRECOMPILED(TokenPosition token_pos_);
- NOT_IN_PRECOMPILED(TokenPosition end_token_pos_);
+ TokenPosition token_pos_;
+ TokenPosition end_token_pos_;
classid_t id_; // Class Id, also index in the class table.
int16_t num_type_arguments_; // Number of type arguments in flattened vector.
@@ -1000,7 +977,9 @@
// Offset of the next instance field (target).
int32_t target_next_field_offset_in_words_;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#if !defined(DART_PRECOMPILED_RUNTIME)
uint32_t kernel_offset_;
#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index faea10f..7329337 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -10,6 +10,7 @@
#define COMMON_CLASSES_AND_FIELDS(F) \
F(Class, name_) \
+ F(Class, user_name_) \
F(Class, functions_) \
F(Class, functions_hash_table_) \
F(Class, fields_) \
@@ -22,6 +23,10 @@
F(Class, constants_) \
F(Class, declaration_type_) \
F(Class, invocation_dispatcher_cache_) \
+ F(Class, allocation_stub_) \
+ F(Class, direct_implementors_) \
+ F(Class, direct_subclasses_) \
+ F(Class, dependent_code_) \
F(PatchClass, patched_class_) \
F(PatchClass, origin_class_) \
F(PatchClass, script_) \
@@ -192,24 +197,15 @@
#define AOT_CLASSES_AND_FIELDS(F)
-#define AOT_NON_PRODUCT_CLASSES_AND_FIELDS(F) \
- F(Class, direct_implementors_) \
- F(Class, direct_subclasses_)
-
#define JIT_CLASSES_AND_FIELDS(F) \
- F(Class, allocation_stub_) \
- F(Class, dependent_code_) \
- F(Class, direct_implementors_) \
- F(Class, direct_subclasses_) \
F(Code, active_instructions_) \
F(Code, deopt_info_array_) \
F(Code, static_calls_target_table_) \
F(ICData, receivers_static_type_) \
F(Function, unoptimized_code_) \
- F(Field, type_test_cache_)
+ F(Field, type_test_cache_) \
#define NON_PRODUCT_CLASSES_AND_FIELDS(F) \
- F(Class, user_name_) \
F(ReceivePort, debug_name_) \
F(ReceivePort, allocation_location_)
@@ -244,9 +240,6 @@
#if defined(DART_PRECOMPILED_RUNTIME)
AOT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
-#if !defined(PRODUCT)
- AOT_NON_PRODUCT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
-#endif
#else
JIT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
#endif
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index 0afa895..a78d1b0 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -162,6 +162,7 @@
}
return static_calls_table.ptr();
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
CodePtr StubCode::GetAllocationStubForClass(const Class& cls) {
Thread* thread = Thread::Current();
@@ -178,6 +179,7 @@
return object_store->allocate_unhandled_exception_stub();
}
Code& stub = Code::Handle(zone, cls.allocation_stub());
+#if !defined(DART_PRECOMPILED_RUNTIME)
if (stub.IsNull()) {
compiler::ObjectPoolBuilder object_pool_builder;
Precompiler* precompiler = Precompiler::Instance();
@@ -245,6 +247,7 @@
}
#endif // !PRODUCT
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
return stub.ptr();
}
@@ -283,7 +286,6 @@
UNREACHABLE();
return Code::null();
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
#if !defined(TARGET_ARCH_IA32)
CodePtr StubCode::GetBuildMethodExtractorStub(
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 6dcedc5..a946cd5 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -61,10 +61,8 @@
VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR);
#undef STUB_CODE_ACCESSOR
-#if !defined(DART_PRECOMPILED_RUNTIME)
static CodePtr GetAllocationStubForClass(const Class& cls);
static CodePtr GetAllocationStubForTypedData(classid_t class_id);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
#if !defined(TARGET_ARCH_IA32)
static CodePtr GetBuildMethodExtractorStub(compiler::ObjectPoolBuilder* pool);