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& cls_name = String::Handle(cls.Name()); |
| 921 const String& lib_name = String::Handle(lib.url()); |
| 922 ReportError("class '%s' is trying to extend a native fields class," |
| 923 "but library '%s' has no native resolvers", |
| 924 cls_name.ToCString(), lib_name.ToCString()); |
| 925 } |
| 926 } |
915 } | 927 } |
916 | 928 |
917 | 929 |
918 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { | 930 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { |
919 Class& test1 = Class::Handle(cls.raw()); | 931 Class& test1 = Class::Handle(cls.raw()); |
920 Class& test2 = Class::Handle(cls.SuperClass()); | 932 Class& test2 = Class::Handle(cls.SuperClass()); |
921 // A finalized class has been checked for cycles. | 933 // A finalized class has been checked for cycles. |
922 // Using the hare and tortoise algorithm for locating cycles. | 934 // Using the hare and tortoise algorithm for locating cycles. |
923 while (!test1.is_finalized() && | 935 while (!test1.is_finalized() && |
924 !test2.IsNull() && !test2.is_finalized()) { | 936 !test2.IsNull() && !test2.is_finalized()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 ASSERT(msg_buffer != NULL); | 1166 ASSERT(msg_buffer != NULL); |
1155 va_list args; | 1167 va_list args; |
1156 va_start(args, format); | 1168 va_start(args, format); |
1157 OS::VSNPrint(msg_buffer, kBufferLength, format, args); | 1169 OS::VSNPrint(msg_buffer, kBufferLength, format, args); |
1158 va_end(args); | 1170 va_end(args); |
1159 isolate->long_jump_base()->Jump(1, msg_buffer); | 1171 isolate->long_jump_base()->Jump(1, msg_buffer); |
1160 UNREACHABLE(); | 1172 UNREACHABLE(); |
1161 } | 1173 } |
1162 | 1174 |
1163 } // namespace dart | 1175 } // namespace dart |
OLD | NEW |