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

Side by Side Diff: vm/class_finalizer.h

Issue 8618011: Check for presence of native resolver in library for classes which have native fields only in reg... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years, 1 month 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 | « no previous file | vm/class_finalizer.cc » ('j') | vm/dart_api_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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
11 namespace dart { 11 namespace dart {
12 12
13 class Class; 13 class Class;
14 class Function; 14 class Function;
15 class RawClass; 15 class RawClass;
16 class RawType; 16 class RawType;
17 class Script; 17 class Script;
18 class String; 18 class String;
19 class Type; 19 class Type;
20 class TypeArguments; 20 class TypeArguments;
21 class UnresolvedClass; 21 class UnresolvedClass;
22 22
23 // Traverses all pending, unfinalized classes, validates and marks them as 23 // Traverses all pending, unfinalized classes, validates and marks them as
24 // finalized. 24 // finalized.
25 class ClassFinalizer : public AllStatic { 25 class ClassFinalizer : public AllStatic {
26 public: 26 public:
27 enum {
28 kGeneratingSnapshot = true,
29 kNotGeneratingSnapshot = false
30 };
31
27 // Add 'interface' to 'interface_list' if it is not already in the list and 32 // Add 'interface' to 'interface_list' if it is not already in the list and
28 // return true. Also return true if 'interface' is not added, because it is 33 // return true. Also return true if 'interface' is not added, because it is
29 // not unique, i.e. it is already in the list. 34 // not unique, i.e. it is already in the list.
30 // Return false if 'interface' conflicts with an interface already in the list 35 // Return false if 'interface' conflicts with an interface already in the list
31 // with the same class, but different type arguments. 36 // with the same class, but different type arguments.
32 // In the case of a conflict, set 'conflicting' to the existing interface. 37 // In the case of a conflict, set 'conflicting' to the existing interface.
33 static bool AddInterfaceIfUnique(GrowableArray<Type*>* interface_list, 38 static bool AddInterfaceIfUnique(GrowableArray<Type*>* interface_list,
34 Type* interface, 39 Type* interface,
35 Type* conflicting); 40 Type* conflicting);
36 41
37 // Finalize and canonicalize type while parsing. 42 // Finalize and canonicalize type while parsing.
38 // Set the error message on failure (to String::null() if no error). 43 // Set the error message on failure (to String::null() if no error).
39 static RawType* FinalizeAndCanonicalizeType(const Type& type, String* errmsg); 44 static RawType* FinalizeAndCanonicalizeType(const Type& type, String* errmsg);
40 45
41 // Pending classes are classes that need to be finalized. 46 // Pending classes are classes that need to be finalized.
42 static void AddPendingClasses(const GrowableArray<const Class*>& classes); 47 static void AddPendingClasses(const GrowableArray<const Class*>& classes);
43 48
44 // Return false if we still have classes pending to be finalized. 49 // Return false if we still have classes pending to be finalized.
45 static bool AllClassesFinalized(); 50 static bool AllClassesFinalized();
46 51
47 // Return whether class finalization failed. 52 // Return whether class finalization failed.
48 // The function returns true if the finalization was successful. 53 // The function returns true if the finalization was successful.
49 // If finalization fails, an error message is set in the sticky error field 54 // If finalization fails, an error message is set in the sticky error field
50 // in the object store. 55 // in the object store.
51 static bool FinalizePendingClasses(); 56 static bool FinalizePendingClasses() {
57 return FinalizePendingClasses(kNotGeneratingSnapshot);
58 }
59 static bool FinalizePendingClassesForSnapshotCreation() {
60 return FinalizePendingClasses(kGeneratingSnapshot);
61 }
52 62
53 // Verify that the pending classes have been properly prefinalized. This is 63 // Verify that the pending classes have been properly prefinalized. This is
54 // needed during bootstrapping where the classes have been preloaded. 64 // needed during bootstrapping where the classes have been preloaded.
55 static void VerifyBootstrapClasses(); 65 static void VerifyBootstrapClasses();
56 66
57 private: 67 private:
58 static void FinalizeClass(const Class& cls); 68 static bool FinalizePendingClasses(bool generating_snapshot);
69 static void FinalizeClass(const Class& cls, bool generating_snapshot);
59 static bool IsSuperCycleFree(const Class& cls); 70 static bool IsSuperCycleFree(const Class& cls);
60 static void CheckForLegalConstClass(const Class& cls); 71 static void CheckForLegalConstClass(const Class& cls);
61 static RawClass* ResolveClass(const Class& cls, 72 static RawClass* ResolveClass(const Class& cls,
62 const UnresolvedClass& unresolved_class); 73 const UnresolvedClass& unresolved_class);
63 static void ResolveSuperType(const Class& cls); 74 static void ResolveSuperType(const Class& cls);
64 static void ResolveFactoryClass(const Class& cls); 75 static void ResolveFactoryClass(const Class& cls);
65 static void ResolveInterfaces(const Class& cls, 76 static void ResolveInterfaces(const Class& cls,
66 GrowableArray<const Class*>* visited); 77 GrowableArray<const Class*>* visited);
67 static void FinalizeTypeArguments(const Class& cls, 78 static void FinalizeTypeArguments(const Class& cls,
68 const TypeArguments& arguments); 79 const TypeArguments& arguments);
(...skipping 14 matching lines...) Expand all
83 const char* format, ...); 94 const char* format, ...);
84 static void ReportError(const char* format, ...); 95 static void ReportError(const char* format, ...);
85 static void ReportWarning(const Script& script, 96 static void ReportWarning(const Script& script,
86 intptr_t token_index, 97 intptr_t token_index,
87 const char* format, ...); 98 const char* format, ...);
88 }; 99 };
89 100
90 } // namespace dart 101 } // namespace dart
91 102
92 #endif // VM_CLASS_FINALIZER_H_ 103 #endif // VM_CLASS_FINALIZER_H_
OLDNEW
« no previous file with comments | « no previous file | vm/class_finalizer.cc » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698