Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2011-12-05 09:00:48 +0400
committerZoltan Varga <vargaz@gmail.com>2011-12-05 09:01:06 +0400
commit3e62b6e207e7355a07f1d166b17590726cde9446 (patch)
treef645e799240aa47bd1250fb22237f8094ff0d552
parent83e5c48472262d47fa73c3c65364b87ec328d425 (diff)
Fix infinite recursion introduced by the previous patch.
-rw-r--r--mono/mini/aot-compiler.c9
-rw-r--r--mono/mini/generics.cs36
2 files changed, 45 insertions, 0 deletions
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index 29ba47f08d1..87d4d5125a1 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -189,6 +189,7 @@ typedef struct MonoAotCompile {
GString *as_args;
char *assembly_name_sym;
gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
+ GHashTable *ginst_hash;
} MonoAotCompile;
typedef struct {
@@ -2892,9 +2893,17 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth)
if (!klass->generic_class && !klass->rank)
return;
+ if (!acfg->ginst_hash)
+ acfg->ginst_hash = g_hash_table_new (NULL, NULL);
+
+ if (g_hash_table_lookup (acfg->ginst_hash, klass))
+ return;
+
if (check_type_depth (&klass->byval_arg, 0))
return;
+ g_hash_table_insert (acfg->ginst_hash, klass, klass);
+
iter = NULL;
while ((method = mono_class_get_methods (klass, &iter))) {
if (mono_method_is_generic_sharable_impl_full (method, FALSE, FALSE))
diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs
index 25fd698d615..842ddf6352d 100644
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -885,4 +885,40 @@ class Tests {
else
return 0;
}
+
+ enum DocType {
+ One,
+ Two,
+ Three
+ }
+
+ class Doc {
+ public string Name {
+ get; set;
+ }
+
+ public DocType Type {
+ get; set;
+ }
+ }
+
+ // #2155
+ public static int test_0_fullaot_sflda_cctor () {
+ List<Doc> documents = new List<Doc>();
+ documents.Add(new Doc { Name = "Doc1", Type = DocType.One } );
+ documents.Add(new Doc { Name = "Doc2", Type = DocType.Two } );
+ documents.Add(new Doc { Name = "Doc3", Type = DocType.Three } );
+ documents.Add(new Doc { Name = "Doc4", Type = DocType.One } );
+ documents.Add(new Doc { Name = "Doc5", Type = DocType.Two } );
+ documents.Add(new Doc { Name = "Doc6", Type = DocType.Three } );
+ documents.Add(new Doc { Name = "Doc7", Type = DocType.One } );
+ documents.Add(new Doc { Name = "Doc8", Type = DocType.Two } );
+ documents.Add(new Doc { Name = "Doc9", Type = DocType.Three } );
+
+ List<DocType> categories = documents.Select(d=>d.Type).Distinct().ToList<DocType>().OrderBy(d => d).ToList();
+ foreach(DocType cat in categories) {
+ List<Doc> catDocs = documents.Where(d => d.Type == cat).OrderBy(d => d.Name).ToList<Doc>();
+ }
+ return 0;
+ }
}