Use g_assertion_message instead of exit to kill an iOS app.
[mono.git] / mono / mini / aot-runtime.c
index 881922975a34a432613ea4c3488f7b38fcf17962..0a51626141dfc6f64b9af4413a05d1a0e7671186 100644 (file)
@@ -415,35 +415,52 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
        }
        case MONO_AOT_TYPEREF_VAR: {
                MonoType *t;
-               MonoGenericContainer *container;
+               MonoGenericContainer *container = NULL;
                int type = decode_value (p, &p);
                int num = decode_value (p, &p);
-               gboolean is_method = decode_value (p, &p);
+               gboolean has_container = decode_value (p, &p);
+               int serial = 0;
 
-               if (is_method) {
-                       MonoMethod *method_def;
-                       g_assert (type == MONO_TYPE_MVAR);
-                       method_def = decode_resolve_method_ref (module, p, &p);
-                       if (!method_def)
-                               return NULL;
-
-                       container = mono_method_get_generic_container (method_def);
+               if (has_container) {
+                       gboolean is_method = decode_value (p, &p);
+                       
+                       if (is_method) {
+                               MonoMethod *method_def;
+                               g_assert (type == MONO_TYPE_MVAR);
+                               method_def = decode_resolve_method_ref (module, p, &p);
+                               if (!method_def)
+                                       return NULL;
+
+                               container = mono_method_get_generic_container (method_def);
+                       } else {
+                               MonoClass *class_def;
+                               g_assert (type == MONO_TYPE_VAR);
+                               class_def = decode_klass_ref (module, p, &p);
+                               if (!class_def)
+                                       return NULL;
+                               container = class_def->generic_container;
+                       }
                } else {
-                       MonoClass *class_def;
-                       g_assert (type == MONO_TYPE_VAR);
-                       class_def = decode_klass_ref (module, p, &p);
-                       if (!class_def)
-                               return NULL;
-
-                       container = class_def->generic_container;
+                       serial = decode_value (p, &p);
                }
 
-               g_assert (container);
-
                // FIXME: Memory management
                t = g_new0 (MonoType, 1);
                t->type = type;
-               t->data.generic_param = mono_generic_container_get_param (container, num);
+
+               if (container) {
+                       t->data.generic_param = mono_generic_container_get_param (container, num);
+                       g_assert (serial == 0);
+               } else {
+                       /* Anonymous */
+                       MonoGenericParam *par = (MonoGenericParam*)g_new0 (MonoGenericParamFull, 1);
+                       par->num = num;
+                       par->serial = serial;
+                       // FIXME:
+                       par->image = mono_defaults.corlib;
+                       t->data.generic_param = par;
+               }
 
                // FIXME: Maybe use types directly to avoid
                // the overhead of creating MonoClass-es
@@ -1360,11 +1377,16 @@ check_usable (MonoAssembly *assembly, MonoAotFileInfo *info, char **out_msg)
        }
 
        mono_arch_cpu_optimizations (&excluded_cpu_optimizations);
-       if (!(excluded_cpu_optimizations & info->opts)) {
+       if (info->opts & excluded_cpu_optimizations) {
                msg = g_strdup_printf ("compiled with unsupported CPU optimizations");
                usable = FALSE;
        }
 
+       if (!mono_aot_only && (info->simd_opts & ~mono_arch_cpu_enumerate_simd_versions ())) {
+               msg = g_strdup_printf ("compiled with unsupported SIMD extensions");
+               usable = FALSE;
+       }
+
        blob = info->blob;
 
        if (info->gc_name_index != -1) {
@@ -2478,7 +2500,7 @@ MonoJitInfo *
 mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
 {
        int pos, left, right, offset, offset1, offset2, code_len;
-       int method_index, table_len, is_wrapper;
+       int method_index, table_len;
        guint32 token;
        MonoAotModule *amodule = image->aot_module;
        MonoMethod *method;
@@ -2600,14 +2622,9 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
                        }
 
                        p = amodule->blob + table [(pos * 2) + 1];
-                       is_wrapper = decode_value (p, &p);
-                       if (is_wrapper)
-                               /* Happens when a random address is passed in which matches a not-yey called wrapper encoded using its name */
-                               return NULL;
-                       g_assert (!is_wrapper);
                        method = decode_resolve_method_ref (amodule, p, &p);
                        if (!method)
-                               /* Ditto */
+                               /* Happens when a random address is passed in which matches a not-yey called wrapper encoded using its name */
                                return NULL;
                } else {
                        token = mono_metadata_make_token (MONO_TABLE_METHOD, method_index + 1);