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

Side by Side Diff: runtime/vm/object.cc

Issue 68113013: Do not skip unfinalized interfaces while checking type bounds at finalization (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | no next file » | 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 // Check for 'direct super type' specified in the implements clause 2838 // Check for 'direct super type' specified in the implements clause
2839 // and check for transitivity at the same time. 2839 // and check for transitivity at the same time.
2840 Array& interfaces = Array::Handle(thsi.interfaces()); 2840 Array& interfaces = Array::Handle(thsi.interfaces());
2841 AbstractType& interface = AbstractType::Handle(); 2841 AbstractType& interface = AbstractType::Handle();
2842 Class& interface_class = Class::Handle(); 2842 Class& interface_class = Class::Handle();
2843 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); 2843 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle();
2844 Error& error = Error::Handle(); 2844 Error& error = Error::Handle();
2845 for (intptr_t i = 0; i < interfaces.Length(); i++) { 2845 for (intptr_t i = 0; i < interfaces.Length(); i++) {
2846 interface ^= interfaces.At(i); 2846 interface ^= interfaces.At(i);
2847 if (!interface.IsFinalized()) { 2847 if (!interface.IsFinalized()) {
2848 // We may be checking bounds at finalization time. Skipping this 2848 // We may be checking bounds at finalization time and can encounter
2849 // unfinalized interface will postpone bound checking to run time. 2849 // a still unfinalized interface.
2850 continue; 2850 ClassFinalizer::FinalizeType(
2851 thsi, interface, ClassFinalizer::kCanonicalize);
hausner 2013/11/13 20:51:46 This name threw me off, but I see it's not introdu
regis 2013/11/13 20:58:02 Ivan promised to fix it :-)
2852 interfaces.SetAt(i, interface);
2851 } 2853 }
2852 error = Error::null(); 2854 error = Error::null();
2853 if (interface.IsMalboundedWithError(&error)) { 2855 if (interface.IsMalboundedWithError(&error)) {
2854 // Return the first bound error to the caller if it requests it. 2856 // Return the first bound error to the caller if it requests it.
2855 if ((bound_error != NULL) && bound_error->IsNull()) { 2857 if ((bound_error != NULL) && bound_error->IsNull()) {
2856 ASSERT(!error.IsNull()); 2858 ASSERT(!error.IsNull());
2857 *bound_error = error.raw(); 2859 *bound_error = error.raw();
2858 } 2860 }
2859 continue; // Another interface may work better. 2861 continue; // Another interface may work better.
2860 } 2862 }
(...skipping 9519 matching lines...) Expand 10 before | Expand all | Expand 10 after
12380 const BoundedType& result = BoundedType::Handle(BoundedType::New()); 12382 const BoundedType& result = BoundedType::Handle(BoundedType::New());
12381 result.set_type(type); 12383 result.set_type(type);
12382 result.set_bound(bound); 12384 result.set_bound(bound);
12383 result.set_type_parameter(type_parameter); 12385 result.set_type_parameter(type_parameter);
12384 result.set_is_being_checked(false); 12386 result.set_is_being_checked(false);
12385 return result.raw(); 12387 return result.raw();
12386 } 12388 }
12387 12389
12388 12390
12389 const char* BoundedType::ToCString() const { 12391 const char* BoundedType::ToCString() const {
12390 const char* format = "BoundedType: type %s; bound: %s; type param: %s of %s"; 12392 const char* format = "BoundedType: type %s; bound: %s; type param: %s%s%s";
12391 const char* type_cstr = String::Handle(AbstractType::Handle( 12393 const char* type_cstr = String::Handle(AbstractType::Handle(
12392 type()).Name()).ToCString(); 12394 type()).Name()).ToCString();
12393 const char* bound_cstr = String::Handle(AbstractType::Handle( 12395 const char* bound_cstr = String::Handle(AbstractType::Handle(
12394 bound()).Name()).ToCString(); 12396 bound()).Name()).ToCString();
12395 const char* type_param_cstr = String::Handle(TypeParameter::Handle( 12397 const TypeParameter& type_param = TypeParameter::Handle(type_parameter());
12396 type_parameter()).name()).ToCString(); 12398 const char* type_param_cstr = "null";
12397 const Class& cls = Class::Handle(TypeParameter::Handle( 12399 const char* of_cstr = "";
12398 type_parameter()).parameterized_class()); 12400 const char* cls_cstr = "";
12399 const char* cls_cstr = 12401 if (!type_param.IsNull()) {
12400 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); 12402 type_param_cstr = String::Handle(type_param.name()).ToCString();
12401 intptr_t len = OS::SNPrint( 12403 const Class& cls = Class::Handle(type_param.parameterized_class());
12402 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; 12404 if (!cls.IsNull()) {
12405 of_cstr = " of ";
12406 cls_cstr = String::Handle(cls.Name()).ToCString();
12407 }
12408 }
12409 intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr, bound_cstr,
12410 type_param_cstr, of_cstr, cls_cstr) + 1;
12403 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 12411 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12404 OS::SNPrint( 12412 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, type_param_cstr,
12405 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); 12413 of_cstr, cls_cstr);
12406 return chars; 12414 return chars;
12407 } 12415 }
12408 12416
12409 12417
12410 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { 12418 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const {
12411 JSONObject jsobj(stream); 12419 JSONObject jsobj(stream);
12412 } 12420 }
12413 12421
12414 12422
12415 intptr_t MixinAppType::token_pos() const { 12423 intptr_t MixinAppType::token_pos() const {
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after
15764 return "_MirrorReference"; 15772 return "_MirrorReference";
15765 } 15773 }
15766 15774
15767 15775
15768 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15776 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15769 JSONObject jsobj(stream); 15777 JSONObject jsobj(stream);
15770 } 15778 }
15771 15779
15772 15780
15773 } // namespace dart 15781 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698