[interp] add UnsafeMov intrinsic support
authorBernhard Urban <bernhard.urban@xamarin.com>
Fri, 17 Mar 2017 16:02:02 +0000 (17:02 +0100)
committerBernhard Urban <bernhard.urban@xamarin.com>
Sat, 18 Mar 2017 18:31:49 +0000 (19:31 +0100)
mono/mini/interp/interp.c
mono/mini/interp/transform.c
mono/tests/Makefile.am

index 05ec88a1dc112bb8c8e9559c82c675c6312c8fe2..9177fa3a4bc5261d12b80a3069caddca0a5912af 100644 (file)
@@ -938,6 +938,15 @@ ves_runtime_method (MonoInvocation *frame, ThreadContext *context)
 
        mono_class_init (method->klass);
 
+       if (method->klass == mono_defaults.array_class) {
+               if (!strcmp (method->name, "UnsafeMov")) {
+                       /* TODO: layout checks */
+                       MonoType *mt = mono_method_signature (method)->ret;
+                       stackval_from_data (mt, frame->retval, (char *) frame->stack_args, FALSE);
+                       return;
+               }
+       }
+
        isinst_obj = mono_object_isinst_checked (obj, mono_defaults.array_class, &error);
        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
        if (obj && isinst_obj) {
index 43db9a14a77e94610b326b707cff3730f60daa08..4f28dec15dcaa13ffe1c96017be411f72fc90c31 100644 (file)
@@ -3308,7 +3308,7 @@ mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *cont
                                } else if (*name == 'E' && (strcmp (name, "EndInvoke") == 0)) {
                                        nm = mono_marshal_get_delegate_end_invoke (method);
                                }
-                       } 
+                       }
                        if (nm == NULL) {
                                runtime_method->code = g_malloc(sizeof(short));
                                runtime_method->code[0] = MINT_CALLRUN;
@@ -3325,6 +3325,24 @@ mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *cont
                method = nm;
                header = mono_method_get_header (nm);
                mono_os_mutex_unlock(&calc_section);
+       } else if (method->klass == mono_defaults.array_class) {
+               if (!strcmp (method->name, "UnsafeMov")) {
+                       mono_os_mutex_lock (&calc_section);
+                       if (!runtime_method->transformed) {
+                               runtime_method->code = g_malloc (sizeof (short));
+                               runtime_method->code[0] = MINT_CALLRUN;
+                               runtime_method->stack_size = sizeof (stackval); /* for tracing */
+                               runtime_method->alloca_size = runtime_method->stack_size;
+                               runtime_method->transformed = TRUE;
+                       }
+                       mono_os_mutex_unlock(&calc_section);
+                       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
+                       return NULL;
+               } else if (!strcmp (method->name, "UnsafeStore)")) {
+                       g_error ("TODO");
+               } else if (!strcmp (method->name, "UnsafeLoad)")) {
+                       g_error ("TODO");
+               }
        }
        g_assert ((signature->param_count + signature->hasthis) < 1000);
        g_assert (header->max_stack < 10000);
index 8dcef4b7b7a5343c53cc72ab577561269545c22d..9a2ac556118cf3295b49afd9fee9524f62f82953 100644 (file)
@@ -973,7 +973,6 @@ INTERP_DISABLED_TESTS = \
        delegate-delegate-exit.exe \
        delegate-exit.exe \
        delegate-with-null-target.exe \
-       delegate.exe \
        delegate1.exe \
        delegate3.exe \
        delegate5.exe \
@@ -984,7 +983,6 @@ INTERP_DISABLED_TESTS = \
        dynamic-method-finalize.2.exe \
        dynamic-method-resurrection.exe \
        dynamic-method-stack-traces.exe \
-       enum.exe \
        even-odd.exe \
        exception18.exe \
        field-access.exe \