Disable most remoting code under DISABLE_REMOTING.
[mono.git] / mono / mini / method-to-ir.c
index f365d1ff88b757a5bf435ca4334bac31a876c16b..010021c3d7d5a1ff78dc06811a538ffde2c53d39 100644 (file)
@@ -2413,7 +2413,7 @@ static MonoInst*
 mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSignature *sig,
                                                        MonoInst **args, MonoInst *this, MonoInst *imt_arg, MonoInst *rgctx_arg)
 {
-       gboolean might_be_remote;
+       gboolean might_be_remote = FALSE;
        gboolean virtual = this != NULL;
        gboolean enable_for_aot = TRUE;
        int context_used;
@@ -2437,6 +2437,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
 
        context_used = mini_method_check_context_used (cfg, method);
 
+#ifndef DISABLE_REMOTING
        might_be_remote = this && sig->hasthis &&
                (mono_class_is_marshalbyref (method->klass) || method->klass == mono_defaults.object_class) &&
                !(method->flags & METHOD_ATTRIBUTE_VIRTUAL) && (!MONO_CHECK_THIS (this) || context_used);
@@ -2450,14 +2451,17 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
 
                return mono_emit_calli (cfg, sig, args, addr, NULL, NULL);
        }
+#endif
 
        need_unbox_trampoline = method->klass == mono_defaults.object_class || (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE);
 
        call = mono_emit_call_args (cfg, sig, args, FALSE, virtual, FALSE, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
 
+#ifndef DISABLE_REMOTING
        if (might_be_remote)
                call->method = mono_marshal_get_remoting_invoke_with_check (method);
        else
+#endif
                call->method = method;
        call->inst.flags |= MONO_INST_HAS_METHOD;
        call->inst.inst_left = this;
@@ -2506,6 +2510,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
                         * the method is not virtual, we just need to ensure this is not null
                         * and then we can call the method directly.
                         */
+#ifndef DISABLE_REMOTING
                        if (mono_class_is_marshalbyref (method->klass) || method->klass == mono_defaults.object_class) {
                                /* 
                                 * The check above ensures method is not gshared, this is needed since
@@ -2513,6 +2518,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
                                 */
                                method = call->method = mono_marshal_get_remoting_invoke_with_check (method);
                        }
+#endif
 
                        if (!method->string_ctor)
                                MONO_EMIT_NEW_CHECK_THIS (cfg, this_reg);
@@ -9329,6 +9335,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        if (op == CEE_STFLD) {
                                if (target_type_is_incompatible (cfg, field->type, sp [1]))
                                        UNVERIFIED;
+#ifndef DISABLE_REMOTING
                                if ((mono_class_is_marshalbyref (klass) && !MONO_CHECK_THIS (sp [0])) || mono_class_is_contextbound (klass) || klass == mono_defaults.marshalbyrefobject_class) {
                                        MonoMethod *stfld_wrapper = mono_marshal_get_stfld_wrapper (field->type); 
                                        MonoInst *iargs [5];
@@ -9355,7 +9362,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        } else {
                                                mono_emit_method_call (cfg, stfld_wrapper, iargs, NULL);
                                        }
-                               } else {
+                               } else
+#endif
+                               {
                                        MonoInst *store;
 
                                        MONO_EMIT_NULL_CHECK (cfg, sp [0]->dreg);
@@ -9393,6 +9402,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                break;
                        }
 
+#ifndef DISABLE_REMOTING
                        if (is_instance && ((mono_class_is_marshalbyref (klass) && !MONO_CHECK_THIS (sp [0])) || mono_class_is_contextbound (klass) || klass == mono_defaults.marshalbyrefobject_class)) {
                                MonoMethod *wrapper = (op == CEE_LDFLDA) ? mono_marshal_get_ldflda_wrapper (field->type) : mono_marshal_get_ldfld_wrapper (field->type); 
                                MonoInst *iargs [4];
@@ -9419,7 +9429,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        ins = mono_emit_method_call (cfg, wrapper, iargs, NULL);
                                        *sp++ = ins;
                                }
-                       } else if (is_instance) {
+                       } else 
+#endif
+                       if (is_instance) {
                                if (sp [0]->type == STACK_VTYPE) {
                                        MonoInst *var;