| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_CLASS_FINALIZER_H_ | 5 #ifndef VM_CLASS_FINALIZER_H_ |
| 6 #define VM_CLASS_FINALIZER_H_ | 6 #define VM_CLASS_FINALIZER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class UnresolvedClass; | 25 class UnresolvedClass; |
| 26 | 26 |
| 27 // Traverses all pending, unfinalized classes, validates and marks them as | 27 // Traverses all pending, unfinalized classes, validates and marks them as |
| 28 // finalized. | 28 // finalized. |
| 29 class ClassFinalizer : public AllStatic { | 29 class ClassFinalizer : public AllStatic { |
| 30 public: | 30 public: |
| 31 // Modes for type resolution and finalization. The ordering is relevant. | 31 // Modes for type resolution and finalization. The ordering is relevant. |
| 32 enum FinalizationKind { | 32 enum FinalizationKind { |
| 33 kIgnore, // Type is ignored and replaced by dynamic. | 33 kIgnore, // Type is ignored and replaced by dynamic. |
| 34 kDoNotResolve, // Type resolution is postponed. | 34 kDoNotResolve, // Type resolution is postponed. |
| 35 kTryResolve, // Type resolution is attempted. | 35 kResolveTypeParameters, // Resolve type parameters only. |
| 36 kFinalize, // Type resolution and type finalization are | 36 kFinalize, // Type resolution and type finalization are |
| 37 // required; a malformed type is tolerated, since | 37 // required; a malformed type is tolerated, since |
| 38 // the type may be used as a type annotation. | 38 // the type may be used as a type annotation. |
| 39 kCanonicalize, // Same as kFinalize, but with canonicalization. | 39 kCanonicalize, // Same as kFinalize, but with canonicalization. |
| 40 kCanonicalizeExpression, // Same as kCanonicalize, but do not tolerate | 40 kCanonicalizeExpression, // Same as kCanonicalize, but do not tolerate |
| 41 // wrong number of type arguments or ambiguous | 41 // wrong number of type arguments or ambiguous |
| 42 // type reference, since the type is not used as | 42 // type reference, since the type is not used as |
| 43 // a type annotation, but as a type expression. | 43 // a type annotation, but as a type expression. |
| 44 kCanonicalizeWellFormed // Error-free resolution, finalization, and | 44 kCanonicalizeWellFormed // Error-free resolution, finalization, and |
| 45 // canonicalization are required; a malformed | 45 // canonicalization are required; a malformed |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Verify that the classes have been properly prefinalized. This is | 90 // Verify that the classes have been properly prefinalized. This is |
| 91 // needed during bootstrapping where the classes have been preloaded. | 91 // needed during bootstrapping where the classes have been preloaded. |
| 92 static void VerifyBootstrapClasses(); | 92 static void VerifyBootstrapClasses(); |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 static bool IsSuperCycleFree(const Class& cls); | 95 static bool IsSuperCycleFree(const Class& cls); |
| 96 static bool IsAliasCycleFree(const Class& cls, | 96 static bool IsAliasCycleFree(const Class& cls, |
| 97 GrowableArray<intptr_t>* visited); | 97 GrowableArray<intptr_t>* visited); |
| 98 static void CheckForLegalConstClass(const Class& cls); | 98 static void CheckForLegalConstClass(const Class& cls); |
| 99 static RawClass* ResolveClass(const Class& cls, | 99 static RawClass* ResolveClass(const Class& cls, |
| 100 const UnresolvedClass& unresolved_class); | 100 const UnresolvedClass& unresolved_class, |
| 101 Error* ambiguity_error); |
| 101 static void ResolveRedirectingFactoryTarget( | 102 static void ResolveRedirectingFactoryTarget( |
| 102 const Class& cls, | 103 const Class& cls, |
| 103 const Function& factory, | 104 const Function& factory, |
| 104 const GrowableObjectArray& visited_factories); | 105 const GrowableObjectArray& visited_factories); |
| 105 static void CloneTypeParameters(const Class& mixapp_class); | 106 static void CloneTypeParameters(const Class& mixapp_class); |
| 106 static void ApplyMixinTypes(const Class& cls); | 107 static void ApplyMixinTypes(const Class& cls); |
| 107 static void ApplyMixin(const Class& cls); | 108 static void ApplyMixin(const Class& cls); |
| 108 static void CollectTypeArguments(const Class& cls, | 109 static void CollectTypeArguments(const Class& cls, |
| 109 const Type& type, | 110 const Type& type, |
| 110 const GrowableObjectArray& collected_args); | 111 const GrowableObjectArray& collected_args); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); | 145 static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); |
| 145 | 146 |
| 146 // Verify implicit offsets recorded in the VM for direct access to fields of | 147 // Verify implicit offsets recorded in the VM for direct access to fields of |
| 147 // Dart instances (e.g: _TypedListView, _ByteDataView). | 148 // Dart instances (e.g: _TypedListView, _ByteDataView). |
| 148 static void VerifyImplicitFieldOffsets(); | 149 static void VerifyImplicitFieldOffsets(); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace dart | 152 } // namespace dart |
| 152 | 153 |
| 153 #endif // VM_CLASS_FINALIZER_H_ | 154 #endif // VM_CLASS_FINALIZER_H_ |
| OLD | NEW |