Merge pull request #3199 from lambdageek/dev/proxy-setter
[mono.git] / mono / mini / aot-runtime.c
index b5d7ab9d36b25dd3a7cc51f8a289a8e0d7aa3cab..2f818c6821cef511e12f349739f013f8de8e7116 100644 (file)
@@ -56,6 +56,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-digest.h>
+#include <mono/utils/mono-threads-coop.h>
 
 #include "mini.h"
 #include "seq-points.h"
@@ -921,12 +922,6 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                        }
                        break;
                }
-               case MONO_WRAPPER_LDFLD_REMOTE:
-                       ref->method = mono_marshal_get_ldfld_remote_wrapper (NULL);
-                       break;
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       ref->method = mono_marshal_get_stfld_remote_wrapper (NULL);
-                       break;
 #endif
                case MONO_WRAPPER_ALLOC: {
                        int atype = decode_value (p, &p);
@@ -1784,17 +1779,6 @@ check_usable (MonoAssembly *assembly, MonoAotFileInfo *info, guint8 *blob, char
                msg = g_strdup_printf ("not compiled with --aot=llvmonly");
                usable = FALSE;
        }
-#ifdef TARGET_ARM
-       /* mono_arch_find_imt_method () requires this */
-       if ((info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM) && !mono_use_llvm) {
-               msg = g_strdup_printf ("compiled against LLVM");
-               usable = FALSE;
-       }
-       if (!(info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM) && mono_use_llvm) {
-               msg = g_strdup_printf ("not compiled against LLVM");
-               usable = FALSE;
-       }
-#endif
        if (mini_get_debug_options ()->mdb_optimizations && !(info->flags & MONO_AOT_FILE_FLAG_DEBUG) && !full_aot) {
                msg = g_strdup_printf ("not compiled for debugging");
                usable = FALSE;
@@ -2015,6 +1999,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                find_symbol (sofile, globals, "mono_aot_file_info", (gpointer*)&info);
        }
 
+       // Copy aotid to MonoImage
+       memcpy(&assembly->image->aotid, info->aotid, 16);
+
        if (version_symbol) {
                /* Old file format */
                version = atoi (version_symbol);
@@ -4522,7 +4509,15 @@ mono_aot_get_method_checked (MonoDomain *domain, MonoMethod *method, MonoError *
                        if (info->subtype == WRAPPER_SUBTYPE_ARRAY_ACCESSOR) {
                                MonoMethod *array_method = info->d.array_accessor.method;
                                if (MONO_TYPE_IS_REFERENCE (&array_method->klass->element_class->byval_arg)) {
-                                       MonoClass *obj_array_class = mono_array_class_get (mono_defaults.object_class, 1);
+                                       int rank;
+
+                                       if (!strcmp (array_method->name, "Set"))
+                                               rank = mono_method_signature (array_method)->param_count - 1;
+                                       else if (!strcmp (array_method->name, "Get") || !strcmp (array_method->name, "Address"))
+                                               rank = mono_method_signature (array_method)->param_count;
+                                       else
+                                               g_assert_not_reached ();
+                                       MonoClass *obj_array_class = mono_array_class_get (mono_defaults.object_class, rank);
                                        MonoMethod *m = mono_class_get_method_from_name (obj_array_class, array_method->name, mono_method_signature (array_method)->param_count);
                                        g_assert (m);
 
@@ -4605,7 +4600,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
 
        gpointer res = mono_aot_get_method_checked (domain, method, &error);
        /* This is external only, so its ok to raise here */
-       mono_error_raise_exception (&error);
+       mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */
        return res;
 }
 
@@ -5836,7 +5831,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
 
 gpointer
 mono_aot_get_method_checked (MonoDomain *domain,
-                                                        MonoMethod *method, MonoError *error);
+                                                        MonoMethod *method, MonoError *error)
 {
        mono_error_init (error);
        return NULL;