Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: runtime/vm/class_finalizer.h

Issue 103913005: Introduce class TypeRef in the VM to fully support recursive types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
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 kResolveTypeParameters, // Resolve type parameters only. 35 kResolveTypeParameters, // Resolve type parameters only.
36 kFinalize, // Type resolution and type finalization are 36 kFinalize, // Type resolution and finalization are required.
37 // required; replace a malformed type by dynamic.
38 kCanonicalize, // Same as kFinalize, but with canonicalization. 37 kCanonicalize, // Same as kFinalize, but with canonicalization.
39 kCanonicalizeWellFormed // Error-free resolution, finalization, and 38 kCanonicalizeWellFormed // Error-free resolution, finalization, and
40 // canonicalization are required; a malformed 39 // canonicalization are required.
41 // type is marked as such.
42 }; 40 };
43 41
44 // Finalize given type while parsing class cls. 42 // Finalize given type while parsing class cls.
45 // Also canonicalize type if applicable. 43 // Also canonicalize type if applicable.
46 static RawAbstractType* FinalizeType(const Class& cls, 44 static RawAbstractType* FinalizeType(
47 const AbstractType& type, 45 const Class& cls,
48 FinalizationKind finalization); 46 const AbstractType& type,
47 FinalizationKind finalization,
48 GrowableObjectArray* pending_types = NULL);
49 49
50 // Allocate, finalize, and return a new malformed type as if it was declared 50 // Allocate, finalize, and return a new malformed type as if it was declared
51 // in class cls at the given token position. 51 // in class cls at the given token position.
52 // If not null, prepend prev_error to the error message built from the format 52 // If not null, prepend prev_error to the error message built from the format
53 // string and its arguments. 53 // string and its arguments.
54 static RawType* NewFinalizedMalformedType(const Error& prev_error, 54 static RawType* NewFinalizedMalformedType(const Error& prev_error,
55 const Script& script, 55 const Script& script,
56 intptr_t type_pos, 56 intptr_t type_pos,
57 const char* format, ...) 57 const char* format, ...)
58 PRINTF_ATTRIBUTE(4, 5); 58 PRINTF_ATTRIBUTE(4, 5);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // Verify that the classes have been properly prefinalized. This is 96 // Verify that the classes have been properly prefinalized. This is
97 // needed during bootstrapping where the classes have been preloaded. 97 // needed during bootstrapping where the classes have been preloaded.
98 static void VerifyBootstrapClasses(); 98 static void VerifyBootstrapClasses();
99 99
100 // Resolve the type and target of the redirecting factory. 100 // Resolve the type and target of the redirecting factory.
101 static void ResolveRedirectingFactory(const Class& cls, 101 static void ResolveRedirectingFactory(const Class& cls,
102 const Function& factory); 102 const Function& factory);
103 103
104 // Apply the mixin type to the mixin application class. 104 // Apply the mixin type to the mixin application class.
105 static void ApplyMixinType(const Class& mixin_app_class); 105 static void ApplyMixinType(const Class& mixin_app_class,
106 GrowableObjectArray* pending_types = NULL);
106 107
107 private: 108 private:
108 static bool IsSuperCycleFree(const Class& cls); 109 static bool IsSuperCycleFree(const Class& cls);
109 static bool IsTypeCycleFree(const Class& cls, 110 static bool IsTypeCycleFree(const Class& cls,
110 const AbstractType& type, 111 const AbstractType& type,
111 GrowableArray<intptr_t>* visited); 112 GrowableArray<intptr_t>* visited);
112 static bool IsAliasCycleFree(const Class& cls, 113 static bool IsAliasCycleFree(const Class& cls,
113 GrowableArray<intptr_t>* visited); 114 GrowableArray<intptr_t>* visited);
114 static bool IsMixinCycleFree(const Class& cls, 115 static bool IsMixinCycleFree(const Class& cls,
115 GrowableArray<intptr_t>* visited); 116 GrowableArray<intptr_t>* visited);
(...skipping 10 matching lines...) Expand all
126 static void CreateForwardingConstructors( 127 static void CreateForwardingConstructors(
127 const Class& mixin_app, 128 const Class& mixin_app,
128 const GrowableObjectArray& cloned_funcs); 129 const GrowableObjectArray& cloned_funcs);
129 static void CollectTypeArguments(const Class& cls, 130 static void CollectTypeArguments(const Class& cls,
130 const Type& type, 131 const Type& type,
131 const GrowableObjectArray& collected_args); 132 const GrowableObjectArray& collected_args);
132 static RawType* ResolveMixinAppType(const Class& cls, 133 static RawType* ResolveMixinAppType(const Class& cls,
133 const MixinAppType& mixin_app_type); 134 const MixinAppType& mixin_app_type);
134 static void ResolveSuperTypeAndInterfaces(const Class& cls, 135 static void ResolveSuperTypeAndInterfaces(const Class& cls,
135 GrowableArray<intptr_t>* visited); 136 GrowableArray<intptr_t>* visited);
136 static void FinalizeTypeParameters(const Class& cls); 137 static void FinalizeTypeParameters(const Class& cls,
138 GrowableObjectArray* pending_types = NULL);
137 static void FinalizeTypeArguments(const Class& cls, 139 static void FinalizeTypeArguments(const Class& cls,
138 const AbstractTypeArguments& arguments, 140 const AbstractTypeArguments& arguments,
139 intptr_t num_uninitialized_arguments, 141 intptr_t num_uninitialized_arguments,
140 FinalizationKind finalization, 142 Error* bound_error,
141 Error* bound_error); 143 GrowableObjectArray* pending_types);
144 static void CheckTypeBounds(const Class& cls, const Type& type);
142 static void CheckTypeArgumentBounds(const Class& cls, 145 static void CheckTypeArgumentBounds(const Class& cls,
143 const AbstractTypeArguments& arguments, 146 const AbstractTypeArguments& arguments,
144 Error* bound_error); 147 Error* bound_error);
145 static void ResolveType(const Class& cls, 148 static void ResolveType(const Class& cls,
146 const AbstractType& type, 149 const AbstractType& type,
147 FinalizationKind finalization); 150 FinalizationKind finalization);
148 static void ResolveUpperBounds(const Class& cls); 151 static void ResolveUpperBounds(const Class& cls);
149 static void FinalizeUpperBounds(const Class& cls); 152 static void FinalizeUpperBounds(const Class& cls);
150 static void ResolveAndFinalizeSignature(const Class& cls, 153 static void ResolveAndFinalizeSignature(const Class& cls,
151 const Function& function); 154 const Function& function);
(...skipping 13 matching lines...) Expand all
165 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); 168 const char* format, ...) PRINTF_ATTRIBUTE(4, 5);
166 169
167 // Verify implicit offsets recorded in the VM for direct access to fields of 170 // Verify implicit offsets recorded in the VM for direct access to fields of
168 // Dart instances (e.g: _TypedListView, _ByteDataView). 171 // Dart instances (e.g: _TypedListView, _ByteDataView).
169 static void VerifyImplicitFieldOffsets(); 172 static void VerifyImplicitFieldOffsets();
170 }; 173 };
171 174
172 } // namespace dart 175 } // namespace dart
173 176
174 #endif // VM_CLASS_FINALIZER_H_ 177 #endif // VM_CLASS_FINALIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698