OLD | NEW |
---|---|
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 #include "vm/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
6 | 6 |
7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
905 } | 905 } |
906 // Mark as finalized before resolving type parameter upper bounds and member | 906 // Mark as finalized before resolving type parameter upper bounds and member |
907 // types in order to break cycles. | 907 // types in order to break cycles. |
908 cls.Finalize(); | 908 cls.Finalize(); |
909 ResolveAndFinalizeUpperBounds(cls); | 909 ResolveAndFinalizeUpperBounds(cls); |
910 ResolveAndFinalizeMemberTypes(cls); | 910 ResolveAndFinalizeMemberTypes(cls); |
911 // Run additional checks after all types are finalized. | 911 // Run additional checks after all types are finalized. |
912 if (cls.is_const()) { | 912 if (cls.is_const()) { |
913 CheckForLegalConstClass(cls); | 913 CheckForLegalConstClass(cls); |
914 } | 914 } |
915 // Check to ensure we don't have classes with native fields in libraries | |
916 // which do not have a native resolver. | |
917 if (cls.num_native_fields() != 0) { | |
918 const Library& lib = Library::Handle(cls.library()); | |
919 if (lib.native_entry_resolver() == NULL) { | |
920 const String& name = String::Handle(cls.Name()); | |
921 ReportError("class '%s' is invalid, it is extending an invalid class.\n", | |
Anton Muhin
2011/11/15 12:22:23
very nice check, but message looks slightly mislea
siva
2011/11/15 19:42:49
Done.
| |
922 name.ToCString()); | |
923 } | |
924 } | |
915 } | 925 } |
916 | 926 |
917 | 927 |
918 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { | 928 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { |
919 Class& test1 = Class::Handle(cls.raw()); | 929 Class& test1 = Class::Handle(cls.raw()); |
920 Class& test2 = Class::Handle(cls.SuperClass()); | 930 Class& test2 = Class::Handle(cls.SuperClass()); |
921 // A finalized class has been checked for cycles. | 931 // A finalized class has been checked for cycles. |
922 // Using the hare and tortoise algorithm for locating cycles. | 932 // Using the hare and tortoise algorithm for locating cycles. |
923 while (!test1.is_finalized() && | 933 while (!test1.is_finalized() && |
924 !test2.IsNull() && !test2.is_finalized()) { | 934 !test2.IsNull() && !test2.is_finalized()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 ASSERT(msg_buffer != NULL); | 1164 ASSERT(msg_buffer != NULL); |
1155 va_list args; | 1165 va_list args; |
1156 va_start(args, format); | 1166 va_start(args, format); |
1157 OS::VSNPrint(msg_buffer, kBufferLength, format, args); | 1167 OS::VSNPrint(msg_buffer, kBufferLength, format, args); |
1158 va_end(args); | 1168 va_end(args); |
1159 isolate->long_jump_base()->Jump(1, msg_buffer); | 1169 isolate->long_jump_base()->Jump(1, msg_buffer); |
1160 UNREACHABLE(); | 1170 UNREACHABLE(); |
1161 } | 1171 } |
1162 | 1172 |
1163 } // namespace dart | 1173 } // namespace dart |
OLD | NEW |