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

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

Issue 2952743003: Fix type argument finalization of some recursive generic types (fixes #29949). (Closed)
Patch Set: Created 3 years, 6 months 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/hash_table.h" 8 #include "vm/hash_table.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 ref_super_type_arg.ToCString()); 973 ref_super_type_arg.ToCString());
974 } 974 }
975 CheckRecursiveType(cls, ref_super_type_arg, pending_types); 975 CheckRecursiveType(cls, ref_super_type_arg, pending_types);
976 pending_types->Add(ref_super_type_arg); 976 pending_types->Add(ref_super_type_arg);
977 const Class& super_cls = 977 const Class& super_cls =
978 Class::Handle(ref_super_type_arg.type_class()); 978 Class::Handle(ref_super_type_arg.type_class());
979 const TypeArguments& super_args = 979 const TypeArguments& super_args =
980 TypeArguments::Handle(ref_super_type_arg.arguments()); 980 TypeArguments::Handle(ref_super_type_arg.arguments());
981 // Mark as finalized before finalizing to avoid cycles. 981 // Mark as finalized before finalizing to avoid cycles.
982 ref_super_type_arg.SetIsFinalized(); 982 ref_super_type_arg.SetIsFinalized();
983 // Since the instantiator is different, do not pass the current 983 // Although the instantiator is different between cls and super_cls,
984 // instantiation trail, but create a new one by passing NULL. 984 // we still need to pass the current instantiation trail as to avoid
985 // divergence. Finalizing the type arguments of super_cls may indeed
986 // recursively require instantiating the same type_refs already
987 // present in the trail (see issue #29949).
985 FinalizeTypeArguments( 988 FinalizeTypeArguments(
986 super_cls, super_args, 989 super_cls, super_args,
987 super_cls.NumTypeArguments() - super_cls.NumTypeParameters(), 990 super_cls.NumTypeArguments() - super_cls.NumTypeParameters(),
988 bound_error, pending_types, NULL); 991 bound_error, pending_types, instantiation_trail);
989 if (FLAG_trace_type_finalization) { 992 if (FLAG_trace_type_finalization) {
990 THR_Print("Finalized instantiated TypeRef '%s': '%s'\n", 993 THR_Print("Finalized instantiated TypeRef '%s': '%s'\n",
991 String::Handle(super_type_arg.Name()).ToCString(), 994 String::Handle(super_type_arg.Name()).ToCString(),
992 ref_super_type_arg.ToCString()); 995 ref_super_type_arg.ToCString());
993 } 996 }
994 } 997 }
995 } 998 }
996 } 999 }
997 arguments.SetTypeAt(i, super_type_arg); 1000 arguments.SetTypeAt(i, super_type_arg);
998 } 1001 }
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 ProgramVisitor::VisitFunctions(&function_visitor); 3807 ProgramVisitor::VisitFunctions(&function_visitor);
3805 3808
3806 class ClearCodeClassVisitor : public ClassVisitor { 3809 class ClearCodeClassVisitor : public ClassVisitor {
3807 void Visit(const Class& cls) { cls.DisableAllocationStub(); } 3810 void Visit(const Class& cls) { cls.DisableAllocationStub(); }
3808 }; 3811 };
3809 ClearCodeClassVisitor class_visitor; 3812 ClearCodeClassVisitor class_visitor;
3810 ProgramVisitor::VisitClasses(&class_visitor); 3813 ProgramVisitor::VisitClasses(&class_visitor);
3811 } 3814 }
3812 3815
3813 } // namespace dart 3816 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/regress_29949_test.dart » ('j') | tests/language/regress_29949_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698