Index: runtime/vm/class_finalizer.cc |
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc |
index 1db6629772b285c9dd4c0405e3d57021a52ef494..da91d67627f2f3c60e931943a4b9d3e96e595e28 100644 |
--- a/runtime/vm/class_finalizer.cc |
+++ b/runtime/vm/class_finalizer.cc |
@@ -24,7 +24,6 @@ DEFINE_FLAG(bool, reify, true, "Reify type arguments of generic types."); |
DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization."); |
DEFINE_FLAG(bool, trace_type_finalization, false, "Trace type finalization."); |
- |
bool ClassFinalizer::AllClassesFinalized() { |
ObjectStore* object_store = Isolate::Current()->object_store(); |
const GrowableObjectArray& classes = |
@@ -32,7 +31,6 @@ bool ClassFinalizer::AllClassesFinalized() { |
return classes.Length() == 0; |
} |
- |
// 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. |
@@ -55,7 +53,6 @@ static void RemoveCHAOptimizedCode( |
} |
} |
- |
void AddSuperType(const AbstractType& type, |
GrowableArray<intptr_t>* finalized_super_classes) { |
ASSERT(type.HasResolvedTypeClass()); |
@@ -77,7 +74,6 @@ void AddSuperType(const AbstractType& type, |
AddSuperType(super_type, finalized_super_classes); |
} |
- |
// Use array instead of set since we expect very few subclassed classes |
// to occur. |
static void CollectFinalizedSuperClasses( |
@@ -96,7 +92,6 @@ static void CollectFinalizedSuperClasses( |
} |
} |
- |
static void CollectImmediateSuperInterfaces(const Class& cls, |
GrowableArray<intptr_t>* cids) { |
const Array& interfaces = Array::Handle(cls.interfaces()); |
@@ -117,7 +112,6 @@ static void CollectImmediateSuperInterfaces(const Class& cls, |
} |
} |
- |
// Processing ObjectStore::pending_classes_ occurs: |
// a) when bootstrap process completes (VerifyBootstrapClasses). |
// b) after the user classes are loaded (dart_api). |
@@ -184,7 +178,6 @@ bool ClassFinalizer::ProcessPendingClasses(bool from_kernel) { |
return true; |
} |
- |
// Adds all interfaces of cls into 'collected'. Duplicate entries may occur. |
// No cycles are allowed. |
void ClassFinalizer::CollectInterfaces(const Class& cls, |
@@ -201,7 +194,6 @@ void ClassFinalizer::CollectInterfaces(const Class& cls, |
} |
} |
- |
#if !defined(DART_PRECOMPILED_RUNTIME) |
void ClassFinalizer::VerifyBootstrapClasses() { |
if (FLAG_trace_class_finalization) { |
@@ -270,7 +262,6 @@ void ClassFinalizer::VerifyBootstrapClasses() { |
} |
#endif // !defined(DART_PRECOMPILED_RUNTIME) |
- |
static bool IsLoaded(const Type& type) { |
if (type.HasResolvedTypeClass()) { |
return true; |
@@ -288,7 +279,6 @@ static bool IsLoaded(const Type& type) { |
} |
} |
- |
// Resolve unresolved_class in the library of cls, or return null. |
RawClass* ClassFinalizer::ResolveClass( |
const Class& cls, |
@@ -313,7 +303,6 @@ RawClass* ClassFinalizer::ResolveClass( |
return resolved_class.raw(); |
} |
- |
void ClassFinalizer::ResolveRedirectingFactory(const Class& cls, |
const Function& factory) { |
const Function& target = Function::Handle(factory.RedirectionTarget()); |
@@ -333,7 +322,6 @@ void ClassFinalizer::ResolveRedirectingFactory(const Class& cls, |
} |
} |
- |
void ClassFinalizer::ResolveRedirectingFactoryTarget( |
const Class& cls, |
const Function& factory, |
@@ -482,7 +470,6 @@ void ClassFinalizer::ResolveRedirectingFactoryTarget( |
factory.SetRedirectionTarget(target_target); |
} |
- |
void ClassFinalizer::ResolveTypeClass(const Class& cls, const Type& type) { |
if (type.IsFinalized()) { |
return; |
@@ -536,7 +523,6 @@ void ClassFinalizer::ResolveTypeClass(const Class& cls, const Type& type) { |
} |
} |
- |
void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) { |
if (type.IsResolved()) { |
return; |
@@ -613,7 +599,6 @@ void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) { |
} |
} |
- |
void ClassFinalizer::FinalizeTypeParameters(const Class& cls, |
PendingTypes* pending_types) { |
if (FLAG_trace_type_finalization) { |
@@ -640,7 +625,6 @@ void ClassFinalizer::FinalizeTypeParameters(const Class& cls, |
} |
} |
- |
// 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. |
@@ -719,7 +703,6 @@ void ClassFinalizer::CheckRecursiveType(const Class& cls, |
} |
} |
- |
// Expand the type arguments of the given type and finalize its full type |
// argument vector. Return the number of type arguments (0 for a raw type). |
intptr_t ClassFinalizer::ExpandAndFinalizeTypeArguments( |
@@ -839,7 +822,6 @@ intptr_t ClassFinalizer::ExpandAndFinalizeTypeArguments( |
return full_arguments.IsNull() ? 0 : full_arguments.Length(); |
} |
- |
// Finalize the type argument vector 'arguments' of the type defined by the |
// class 'cls' parameterized with the type arguments 'cls_args'. |
// The vector 'cls_args' is already initialized as a subvector at the correct |
@@ -1004,7 +986,6 @@ void ClassFinalizer::FinalizeTypeArguments(const Class& cls, |
} |
} |
- |
// Check the type argument vector 'arguments' against the corresponding bounds |
// of the type parameters of class 'cls' and, recursively, of its superclasses. |
// Replace a type argument that cannot be checked at compile time by a |
@@ -1083,9 +1064,8 @@ void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, |
} |
// Shortcut the special case where we check a type parameter against its |
// declared upper bound. |
- if (error.IsNull() && |
- !(type_arg.Equals(type_param) && |
- instantiated_bound.Equals(declared_bound))) { |
+ if (error.IsNull() && !(type_arg.Equals(type_param) && |
+ instantiated_bound.Equals(declared_bound))) { |
// If type_arg is a type parameter, its declared bound may not be |
// finalized yet. |
if (type_arg.IsTypeParameter()) { |
@@ -1120,7 +1100,6 @@ void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, |
} |
} |
- |
void ClassFinalizer::CheckTypeBounds(const Class& cls, |
const AbstractType& type) { |
Zone* zone = Thread::Current()->zone(); |
@@ -1163,7 +1142,6 @@ void ClassFinalizer::CheckTypeBounds(const Class& cls, |
} |
} |
- |
RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls, |
const AbstractType& type, |
FinalizationKind finalization, |
@@ -1349,7 +1327,6 @@ RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls, |
} |
} |
- |
void ClassFinalizer::ResolveSignature(const Class& cls, |
const Function& function) { |
AbstractType& type = AbstractType::Handle(); |
@@ -1378,7 +1355,6 @@ void ClassFinalizer::ResolveSignature(const Class& cls, |
} |
} |
- |
void ClassFinalizer::FinalizeSignature(const Class& cls, |
const Function& function, |
FinalizationKind finalization) { |
@@ -1423,7 +1399,6 @@ void ClassFinalizer::FinalizeSignature(const Class& cls, |
} |
} |
- |
// Check if an instance field, getter, or method of same name exists |
// in any super class. |
static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, |
@@ -1451,7 +1426,6 @@ static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, |
return Class::null(); |
} |
- |
// Check if an instance method of same name exists in any super class. |
static RawClass* FindSuperOwnerOfFunction(const Class& cls, |
const String& name) { |
@@ -1469,7 +1443,6 @@ static RawClass* FindSuperOwnerOfFunction(const Class& cls, |
return Class::null(); |
} |
- |
// Resolve the upper bounds of the type parameters of class cls. |
void ClassFinalizer::ResolveUpperBounds(const Class& cls) { |
const intptr_t num_type_params = cls.NumTypeParameters(); |
@@ -1488,7 +1461,6 @@ void ClassFinalizer::ResolveUpperBounds(const Class& cls) { |
} |
} |
- |
// Finalize the upper bounds of the type parameters of class cls. |
void ClassFinalizer::FinalizeUpperBounds(const Class& cls, |
FinalizationKind finalization) { |
@@ -1512,7 +1484,6 @@ void ClassFinalizer::FinalizeUpperBounds(const Class& cls, |
} |
} |
- |
void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) { |
// Note that getters and setters are explicitly listed as such in the list of |
// functions of a class, so we do not need to consider fields as implicitly |
@@ -1772,7 +1743,6 @@ void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) { |
} |
} |
- |
// Clone the type parameters of the super class and of the mixin class of this |
// mixin application class and use them as the type parameters of this mixin |
// application class. Set the type arguments of the super type, of the mixin |
@@ -1964,7 +1934,6 @@ void ClassFinalizer::CloneMixinAppTypeParameters(const Class& mixin_app_class) { |
} |
} |
- |
/* Support for mixin alias. |
Consider the following example: |
@@ -2234,7 +2203,6 @@ void ClassFinalizer::ApplyMixinAppAlias(const Class& mixin_app_class, |
} |
} |
- |
void ClassFinalizer::ApplyMixinType(const Class& mixin_app_class, |
PendingTypes* pending_types) { |
if (mixin_app_class.is_mixin_type_applied()) { |
@@ -2293,7 +2261,6 @@ void ClassFinalizer::ApplyMixinType(const Class& mixin_app_class, |
mixin_app_class.set_mixin(mixin_type); |
} |
- |
void ClassFinalizer::CreateForwardingConstructors( |
const Class& mixin_app, |
const Class& mixin_cls, |
@@ -2356,7 +2323,6 @@ void ClassFinalizer::CreateForwardingConstructors( |
} |
} |
- |
void ClassFinalizer::ApplyMixinMembers(const Class& cls) { |
Zone* zone = Thread::Current()->zone(); |
const Type& mixin_type = Type::Handle(zone, cls.mixin()); |
@@ -2456,7 +2422,6 @@ void ClassFinalizer::ApplyMixinMembers(const Class& cls) { |
} |
} |
- |
void ClassFinalizer::FinalizeTypesInClass(const Class& cls) { |
Thread* thread = Thread::Current(); |
HANDLESCOPE(thread); |
@@ -2615,7 +2580,6 @@ void ClassFinalizer::FinalizeTypesInClass(const Class& cls) { |
} |
} |
- |
void ClassFinalizer::FinalizeClass(const Class& cls) { |
Thread* thread = Thread::Current(); |
HANDLESCOPE(thread); |
@@ -2692,7 +2656,6 @@ void ClassFinalizer::FinalizeClass(const Class& cls) { |
} |
} |
- |
// Allocate instances for each enumeration value, and populate the |
// static field 'values'. |
// By allocating the instances programmatically, we save an implicit final |
@@ -2773,7 +2736,6 @@ void ClassFinalizer::AllocateEnumValues(const Class& enum_cls) { |
ASSERT(!values_list.IsNull()); |
} |
- |
bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { |
Class& test1 = Class::Handle(cls.raw()); |
Class& test2 = Class::Handle(cls.SuperClass()); |
@@ -2795,7 +2757,6 @@ bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { |
return true; |
} |
- |
// Returns false if a function type alias illegally refers to itself. |
bool ClassFinalizer::IsTypedefCycleFree(const Class& cls, |
const AbstractType& type, |
@@ -2870,7 +2831,6 @@ bool ClassFinalizer::IsTypedefCycleFree(const Class& cls, |
return true; |
} |
- |
// Returns false if the mixin illegally refers to itself. |
bool ClassFinalizer::IsMixinCycleFree(const Class& cls, |
GrowableArray<intptr_t>* visited) { |
@@ -2902,7 +2862,6 @@ bool ClassFinalizer::IsMixinCycleFree(const Class& cls, |
return true; |
} |
- |
void ClassFinalizer::CollectTypeArguments( |
const Class& cls, |
const Type& type, |
@@ -2939,7 +2898,6 @@ void ClassFinalizer::CollectTypeArguments( |
} |
} |
- |
RawType* ClassFinalizer::ResolveMixinAppType( |
const Class& cls, |
const MixinAppType& mixin_app_type) { |
@@ -3106,7 +3064,6 @@ RawType* ClassFinalizer::ResolveMixinAppType( |
return Type::New(mixin_app_class, mixin_app_args, mixin_app_type.token_pos()); |
} |
- |
// Recursively walks the graph of explicitly declared super type and |
// interfaces, resolving unresolved super types and interfaces. |
// Reports an error if there is an interface reference that cannot be |
@@ -3293,7 +3250,6 @@ void ClassFinalizer::ResolveSuperTypeAndInterfaces( |
cls.set_is_cycle_free(); |
} |
- |
// A class is marked as constant if it has one constant constructor. |
// A constant class can only have final instance fields. |
// Note: we must check for cycles before checking for const properties. |
@@ -3314,7 +3270,6 @@ void ClassFinalizer::CheckForLegalConstClass(const Class& cls) { |
} |
} |
- |
void ClassFinalizer::PrintClassInformation(const Class& cls) { |
Thread* thread = Thread::Current(); |
HANDLESCOPE(thread); |
@@ -3388,7 +3343,6 @@ void ClassFinalizer::MarkTypeMalformed(const Error& prev_error, |
} |
} |
- |
RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error, |
const Script& script, |
TokenPosition type_pos, |
@@ -3408,7 +3362,6 @@ RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error, |
return type.raw(); |
} |
- |
void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, |
const Script& script, |
const Type& type, |
@@ -3420,7 +3373,6 @@ void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, |
va_end(args); |
} |
- |
void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, |
const Script& script, |
const AbstractType& type, |
@@ -3442,13 +3394,11 @@ void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, |
} |
} |
- |
void ClassFinalizer::ReportError(const Error& error) { |
Report::LongJump(error); |
UNREACHABLE(); |
} |
- |
void ClassFinalizer::ReportErrors(const Error& prev_error, |
const Class& cls, |
TokenPosition token_pos, |
@@ -3462,7 +3412,6 @@ void ClassFinalizer::ReportErrors(const Error& prev_error, |
UNREACHABLE(); |
} |
- |
void ClassFinalizer::ReportError(const Class& cls, |
TokenPosition token_pos, |
const char* format, |
@@ -3476,7 +3425,6 @@ void ClassFinalizer::ReportError(const Class& cls, |
UNREACHABLE(); |
} |
- |
void ClassFinalizer::VerifyImplicitFieldOffsets() { |
#ifdef DEBUG |
Thread* thread = Thread::Current(); |
@@ -3550,7 +3498,6 @@ void ClassFinalizer::VerifyImplicitFieldOffsets() { |
#endif |
} |
- |
void ClassFinalizer::SortClasses() { |
Thread* T = Thread::Current(); |
Zone* Z = T->zone(); |
@@ -3624,7 +3571,6 @@ void ClassFinalizer::SortClasses() { |
RehashTypes(); // Types use cid's as part of their hashes. |
} |
- |
class CidRewriteVisitor : public ObjectVisitor { |
public: |
explicit CidRewriteVisitor(intptr_t* old_to_new_cids) |
@@ -3669,7 +3615,6 @@ class CidRewriteVisitor : public ObjectVisitor { |
intptr_t* old_to_new_cids_; |
}; |
- |
void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) { |
Isolate* I = Thread::Current()->isolate(); |
@@ -3699,7 +3644,6 @@ void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) { |
#endif |
} |
- |
class ClearTypeHashVisitor : public ObjectVisitor { |
public: |
explicit ClearTypeHashVisitor(Zone* zone) |
@@ -3731,7 +3675,6 @@ class ClearTypeHashVisitor : public ObjectVisitor { |
BoundedType& bounded_type_; |
}; |
- |
void ClassFinalizer::RehashTypes() { |
Thread* T = Thread::Current(); |
Zone* Z = T->zone(); |
@@ -3798,7 +3741,6 @@ void ClassFinalizer::RehashTypes() { |
object_store->set_canonical_type_arguments(typeargs_table.Release()); |
} |
- |
void ClassFinalizer::ClearAllCode() { |
class ClearCodeFunctionVisitor : public FunctionVisitor { |
void Visit(const Function& function) { |