From 158a2ad09df4e78bc8c81aa8365c5ca7f3f1816f Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 19 Oct 2019 11:58:49 +0200 Subject: [PATCH] [netcore] Remove unused code for Array.Unsafe[Mov/Load/Store] intrinsics Commit migrated from https://github.com/mono/mono/commit/67c8d0d812d5045ca084d24ad271233685a6c899 --- src/mono/mono/mini/interp/interp.c | 6 ++++++ src/mono/mono/mini/interp/transform.c | 6 ++++++ src/mono/mono/mini/intrinsics.c | 2 ++ src/mono/mono/mini/method-to-ir.c | 2 ++ src/mono/mono/mini/mini.h | 2 ++ .../System.Private.CoreLib/src/System/Array.cs | 21 --------------------- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 5447e4d..6575d5b 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -1481,6 +1481,7 @@ interp_delegate_ctor (MonoObjectHandle this_obj, MonoObjectHandle target, gpoint * runtime specifies that the implementation of the method is automatically * provided by the runtime and is primarily used for the methods of delegates. */ +#ifndef ENABLE_NETCORE static MONO_NEVER_INLINE MonoException* ves_imethod (InterpFrame *frame, MonoMethod *method, MonoMethodSignature *sig, stackval *sp, stackval *retval) { @@ -1501,6 +1502,7 @@ ves_imethod (InterpFrame *frame, MonoMethod *method, MonoMethodSignature *sig, s m_class_get_name_space (method->klass), m_class_get_name (method->klass), method->name); } +#endif #if DEBUG_INTERP static char* @@ -3654,6 +3656,7 @@ common_vcall: MINT_IN_BREAK; } MINT_IN_CASE(MINT_CALLRUN) { +#ifndef ENABLE_NETCORE MonoMethod *target_method = (MonoMethod*) frame->imethod->data_items [ip [1]]; MonoMethodSignature *sig = (MonoMethodSignature*) frame->imethod->data_items [ip [2]]; stackval *retval; @@ -3674,6 +3677,9 @@ common_vcall: sp++; } ip += 3; +#else + g_assert_not_reached (); +#endif MINT_IN_BREAK; } MINT_IN_CASE(MINT_RET) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 7327016..45c2f35 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1486,8 +1486,10 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas interp_emit_ldelema (td, target_method->klass, check_class); td->ip += 5; return TRUE; +#ifndef ENABLE_NETCORE } else if (!strcmp (tm, "UnsafeMov") || !strcmp (tm, "UnsafeLoad")) { *op = MINT_CALLRUN; +#endif } else if (!strcmp (tm, "Get")) { interp_emit_ldelema (td, target_method->klass, NULL); interp_emit_ldobj (td, m_class_get_element_class (target_method->klass)); @@ -2401,10 +2403,12 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target #endif } +#ifndef ENABLE_NETCORE if (op == MINT_CALLRUN) { td->last_ins->data [0] = get_data_item_index (td, target_method); td->last_ins->data [1] = get_data_item_index (td, mono_method_signature_internal (target_method)); } +#endif } else if (!calli && !is_virtual && jit_call_supported (target_method, csignature)) { interp_add_ins (td, MINT_JIT_CALL); td->last_ins->data [0] = get_data_item_index (td, (void *)mono_interp_get_imethod (domain, target_method, error)); @@ -6161,12 +6165,14 @@ get_inst_stack_usage (TransformData *td, InterpInst *ins, int *pop, int *push) *push = opcode == MINT_CALL || opcode == MINT_CALLVIRT || opcode == MINT_CALLVIRT_FAST; break; } +#ifndef ENABLE_NETCORE case MINT_CALLRUN: { MonoMethodSignature *csignature = (MonoMethodSignature*) td->data_items [ins->data [1]]; *pop = csignature->param_count + csignature->hasthis; *push = csignature->ret->type != MONO_TYPE_VOID; break; } +#endif case MINT_CALLI: case MINT_CALLI_NAT: case MINT_CALLI_NAT_FAST: { diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index db08645..5849fda 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -1989,6 +1989,7 @@ emit_array_unsafe_mov (MonoCompile *cfg, MonoMethodSignature *fsig, MonoInst **a return NULL; } +#ifndef ENABLE_NETCORE MonoInst* mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) { @@ -2003,6 +2004,7 @@ mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoM return NULL; } +#endif MonoInst* mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field) diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 60fd0bf..964e55f 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -7240,6 +7240,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b if ((m_class_get_parent (cmethod->klass) == mono_defaults.multicastdelegate_class) && !strcmp (cmethod->name, "Invoke")) delegate_invoke = TRUE; +#ifndef ENABLE_NETCORE if ((cfg->opt & MONO_OPT_INTRINS) && (ins = mini_emit_inst_for_sharable_method (cfg, cmethod, fsig, sp))) { if (!MONO_TYPE_IS_VOID (fsig->ret)) { mini_type_to_eval_stack_type ((cfg), fsig->ret, ins); @@ -7250,6 +7251,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b mono_tailcall_print ("missed tailcall intrins_sharable %s -> %s\n", method->name, cmethod->name); goto call_end; } +#endif /* * Implement a workaround for the inherent races involved in locking: diff --git a/src/mono/mono/mini/mini.h b/src/mono/mono/mini/mini.h index 0bb8e4e..ec8518a 100644 --- a/src/mono/mono/mini/mini.h +++ b/src/mono/mono/mini/mini.h @@ -2261,7 +2261,9 @@ void mini_emit_memory_copy (MonoCompile *cfg, MonoInst *dest, MonoI MonoInst* mini_emit_array_store (MonoCompile *cfg, MonoClass *klass, MonoInst **sp, gboolean safety_checks); MonoInst* mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); MonoInst* mini_emit_inst_for_ctor (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); +#ifndef ENABLE_NETCORE MonoInst* mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); +#endif MonoInst* mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field); MonoInst* mini_handle_enum_has_flag (MonoCompile *cfg, MonoClass *klass, MonoInst *enum_this, int enum_val_reg, MonoInst *enum_flag); diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Array.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Array.cs index f823a5a..001aba2 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Array.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Array.cs @@ -470,27 +470,6 @@ namespace System return Marshal.GetArrayElementSize (GetType ()); } - // - // Moved value from instance into target of different type with no checks (JIT intristics) - // - // Restrictions: - // - // S and R must either: - // both be blitable valuetypes - // both be reference types (IOW, an unsafe cast) - // S and R cannot be float or double - // S and R must either: - // both be a struct - // both be a scalar - // S and R must either: - // be of same size - // both be a scalar of size <= 4 - // - internal static R UnsafeMov (S instance) - { - return (R)(object) instance; - } - [MethodImplAttribute (MethodImplOptions.InternalCall)] extern static void ClearInternal (Array a, int index, int count); -- 2.7.4