diff --git a/src/mono/mono/eglib/gfile-posix.c b/src/mono/mono/eglib/gfile-posix.c index 53414c659d780..f38db70c6a7b2 100644 --- a/src/mono/mono/eglib/gfile-posix.c +++ b/src/mono/mono/eglib/gfile-posix.c @@ -142,6 +142,7 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **gerror) } t = g_build_filename (g_get_tmp_dir (), tmpl, (const char*)NULL); + g_assert (t); #ifdef HOST_WASI g_critical ("g_file_open_tmp is not implemented for WASI"); diff --git a/src/mono/mono/metadata/appdomain.c b/src/mono/mono/metadata/appdomain.c index 3ed266c09798d..e41b4fb1ca8b4 100644 --- a/src/mono/mono/metadata/appdomain.c +++ b/src/mono/mono/metadata/appdomain.c @@ -612,6 +612,7 @@ try_load_from (MonoAssembly **assembly, *assembly = NULL; fullpath = g_build_filename (path1, path2, path3, path4, (const char*)NULL); + g_assert (fullpath); found = g_file_test (fullpath, G_FILE_TEST_IS_REGULAR); diff --git a/src/mono/mono/metadata/assembly.c b/src/mono/mono/metadata/assembly.c index 63677c87b6f34..49eca9772f481 100644 --- a/src/mono/mono/metadata/assembly.c +++ b/src/mono/mono/metadata/assembly.c @@ -336,6 +336,7 @@ load_in_path (const char *basename, const char** search_path, const MonoAssembly for (i = 0; search_path [i]; ++i) { fullpath = g_build_filename (search_path [i], basename, (const char*)NULL); + g_assert (fullpath); result = mono_assembly_request_open (fullpath, req, status); g_free (fullpath); if (result) @@ -1407,6 +1408,7 @@ absolute_dir (const gchar *filename) cwd = g_get_current_dir (); mixed = g_build_filename (cwd, filename, (const char*)NULL); + g_assert (mixed); parts = g_strsplit (mixed, G_DIR_SEPARATOR_S, 0); g_free (mixed); g_free (cwd); diff --git a/src/mono/mono/metadata/class.c b/src/mono/mono/metadata/class.c index 244567efeaf17..05da1332e3012 100644 --- a/src/mono/mono/metadata/class.c +++ b/src/mono/mono/metadata/class.c @@ -6785,10 +6785,13 @@ mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError if (mono_class_is_open_constructed_type (m_class_get_byval_arg (parent))) { parent = mono_class_inflate_generic_class_checked (parent, generic_inst, error); return_val_if_nok (error, NULL); + g_assert (parent); } + if (mono_class_is_ginst (parent)) { parent_inst = mono_class_get_context (parent); parent = mono_class_get_generic_class (parent)->container_class; + g_assert (parent); } mono_class_setup_vtable (parent); @@ -6808,6 +6811,7 @@ mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError if (mono_class_is_open_constructed_type (m_class_get_byval_arg (klass))) { klass = mono_class_inflate_generic_class_checked (klass, generic_inst, error); return_val_if_nok (error, NULL); + g_assert (klass); generic_inst = NULL; } @@ -6821,6 +6825,7 @@ mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError if (generic_inst) { klass = mono_class_inflate_generic_class_checked (klass, generic_inst, error); return_val_if_nok (error, NULL); + g_assert (klass); generic_inst = NULL; } @@ -6909,7 +6914,7 @@ mono_class_has_default_constructor (MonoClass *klass, gboolean public_only) * \param klass class in which the failure was detected * \param fmt \c printf -style error message string. * - * Sets a deferred failure in the class and prints a warning message. + * Sets a deferred failure in the class and prints a warning message. * The deferred failure allows the runtime to attempt setting up the class layout at runtime. * * LOCKING: Acquires the loader lock. diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 3be82b80e03af..6a3e33bc341af 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -4564,6 +4564,7 @@ ves_icall_System_Reflection_RuntimeAssembly_GetInfo (MonoQCallAssemblyHandle ass else absolute = g_build_filename (assembly->basedir, filename, (const char*)NULL); + g_assert (absolute); mono_icall_make_platform_path (absolute); const gchar *prepend = mono_icall_get_file_path_prefix (absolute); diff --git a/src/mono/mono/metadata/image.c b/src/mono/mono/metadata/image.c index dbca4e24f48e3..23333b1b2a976 100644 --- a/src/mono/mono/metadata/image.c +++ b/src/mono/mono/metadata/image.c @@ -2511,6 +2511,7 @@ mono_image_load_file_for_image_checked (MonoImage *image, uint32_t fileidx, Mono fname = mono_metadata_string_heap (image, fname_id); base_dir = g_path_get_dirname (image->name); name = g_build_filename (base_dir, fname, (const char*)NULL); + g_assert (name); res = mono_image_open (name, NULL); if (!res) goto done; diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index d6ddb751fe3a7..4b14d889b9df6 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -4243,6 +4243,8 @@ prepare_run_main (MonoMethod *method, int argc, char *argv[]) basename, (const char*)NULL); + g_assert (fullpath); + utf8_fullpath = utf8_from_external (fullpath); if(utf8_fullpath == NULL) { /* Printing the arg text will cause glib to @@ -5355,7 +5357,7 @@ MonoObjectHandle mono_object_new_handle (MonoClass *klass, MonoError *error) { MONO_REQ_GC_UNSAFE_MODE; - + if (MONO_CLASS_IS_IMPORT(klass)) { mono_error_set_not_supported (error, "Built-in COM interop is not supported on Mono."); return MONO_HANDLE_NEW (MonoObject, NULL); diff --git a/src/mono/mono/metadata/sgen-tarjan-bridge.c b/src/mono/mono/metadata/sgen-tarjan-bridge.c index 6f1fb1ec10bd9..b0c9cf1f83bae 100644 --- a/src/mono/mono/metadata/sgen-tarjan-bridge.c +++ b/src/mono/mono/metadata/sgen-tarjan-bridge.c @@ -819,8 +819,10 @@ create_scc (ScanData *data) g_error ("Invalid state when building SCC %d", other->state); } - if (other->is_bridge) + if (other->is_bridge) { + g_assert (color_data); dyn_array_ptr_add (&color_data->bridges, other->obj); + } // Maybe we should make sure we are not adding duplicates here. It is not really a problem // since we will get rid of duplicates before submitting the SCCs to the client in gather_xrefs diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 7778557fb7786..c4e318b4f5688 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -5508,10 +5508,10 @@ MONO_RESTORE_WARNING if (decoded_args->named_args_info [j].field && !strcmp (decoded_args->named_args_info [j].field->name, "EntryPoint")) { named = (const char *)decoded_args->named_args[j]->value.primitive; slen = mono_metadata_decode_value (named, &named); - + int prefix_len = (int)strlen (acfg->user_symbol_prefix); g_assert (prefix_len < 2); - + export_name = (char *)g_malloc (prefix_len + slen + 1); if (prefix_len == 1) export_name[0] = *acfg->user_symbol_prefix; @@ -5851,12 +5851,14 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, icomparable_inst = mono_class_inflate_generic_class_checked (icomparable, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (icomparable_inst); if (mono_class_is_assignable_from_internal (icomparable_inst, tclass)) { MonoClass *gcomparer_inst; gcomparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericComparer`1"); gcomparer_inst = mono_class_inflate_generic_class_checked (gcomparer, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (gcomparer_inst); add_generic_class (acfg, gcomparer_inst, FALSE, "Comparer"); } @@ -5878,6 +5880,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, iface_inst = mono_class_inflate_generic_class_checked (iface, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (iface_inst); if (mono_class_is_assignable_from_internal (iface_inst, tclass)) { MonoClass *gcomparer_inst; @@ -5885,6 +5888,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, gcomparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericEqualityComparer`1"); gcomparer_inst = mono_class_inflate_generic_class_checked (gcomparer, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (gcomparer_inst); add_generic_class (acfg, gcomparer_inst, FALSE, "EqualityComparer"); } } @@ -5906,6 +5910,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1"); enum_comparer_inst = mono_class_inflate_generic_class_checked (enum_comparer, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (enum_comparer_inst); add_generic_class (acfg, enum_comparer_inst, FALSE, "EqualityComparer"); } } @@ -5927,6 +5932,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "ObjectComparer`1"); comparer_inst = mono_class_inflate_generic_class_checked (comparer, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (comparer_inst); add_generic_class (acfg, comparer_inst, FALSE, "Comparer"); } } @@ -5950,6 +5956,7 @@ add_instances_of (MonoAotCompile *acfg, MonoClass *klass, MonoType **insts, int ctx.class_inst = mono_metadata_get_generic_inst (1, args); generic_inst = mono_class_inflate_generic_class_checked (klass, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (generic_inst); add_generic_class (acfg, generic_inst, force, ""); } } @@ -11566,6 +11573,9 @@ emit_exception_info (MonoAotCompile *acfg) char *aot_file = g_strdup_printf("%s%s", image_basename, SEQ_POINT_AOT_EXT); char *aot_file_path = g_build_filename (dir, aot_file, (const char*)NULL); + g_assert (dir); + g_assert (aot_file_path); + if (g_ensure_directory_exists (aot_file_path) == FALSE) { fprintf (stderr, "AOT : failed to create msym directory: %s\n", aot_file_path); exit (1); @@ -15345,6 +15355,8 @@ set_paths (MonoAotCompile *acfg) } acfg->tmpbasename = g_build_filename (temp_path, "temp", (const char*)NULL); + g_assert (acfg->tmpbasename); + acfg->asm_fname = g_strdup_printf ("%s.s", acfg->tmpbasename); acfg->llvm_sfile = g_strdup_printf ("%s-llvm.s", acfg->tmpbasename); @@ -15379,6 +15391,8 @@ set_paths (MonoAotCompile *acfg) /* Done later */ } else { acfg->tmpbasename = g_build_filename (acfg->aot_opts.temp_path, "temp", (const char*)NULL); + g_assert (acfg->tmpbasename); + acfg->asm_fname = g_strdup_printf ("%s.s", acfg->tmpbasename); } } @@ -15624,6 +15638,7 @@ compile_assemblies_in_child (MonoAotOptions *aot_opts, MonoAssembly **assemblies #ifdef HOST_WIN32 response_fname = g_build_filename (aot_opts->temp_path, "temp.rsp", (const char*)NULL); + g_assert (response_fname); response = fopen (response_fname, "w"); g_assert (response); #endif diff --git a/src/mono/mono/mini/mini-generic-sharing.c b/src/mono/mono/mini/mini-generic-sharing.c index cd482c75e367a..90e724bf417bf 100644 --- a/src/mono/mono/mini/mini-generic-sharing.c +++ b/src/mono/mono/mini/mini-generic-sharing.c @@ -1312,6 +1312,7 @@ get_wrapper_shared_vtype (MonoType *t) MonoClass *tuple_inst = mono_class_inflate_generic_class_checked (tuple_class, &ctx, error); mono_error_assert_ok (error); + g_assert (tuple_inst); //printf ("T: %s\n", mono_class_full_name (tuple_inst)); @@ -1411,6 +1412,7 @@ get_wrapper_shared_type_full (MonoType *t, gboolean is_field) } klass = mono_class_inflate_generic_class_checked (mono_class_get_generic_class (klass)->container_class, &ctx, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (klass); t = m_class_get_byval_arg (klass); MonoType *shared_type = get_wrapper_shared_vtype (t); @@ -4349,6 +4351,7 @@ get_shared_type (MonoType *t, MonoType *type) k = mono_class_inflate_generic_class_checked (gclass->container_class, &context, error); mono_error_assert_ok (error); /* FIXME don't swallow the error */ + g_assert (k); return mini_get_shared_gparam (t, m_class_get_byval_arg (k)); } else if (MONO_TYPE_ISSTRUCT (type)) { diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index 82a9a5a0a9eff..8274949414c27 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -404,14 +404,17 @@ void *(mono_global_codeman_reserve) (int size) global_codeman = mono_code_manager_new (); else global_codeman = mono_code_manager_new_aot (); - return mono_code_manager_reserve (global_codeman, size); + ptr = mono_code_manager_reserve (global_codeman, size); } else { mono_jit_lock (); ptr = mono_code_manager_reserve (global_codeman, size); mono_jit_unlock (); - return ptr; } + + /* Virtually all call sites for this API assume it can't return NULL. */ + g_assert (ptr); + return ptr; } /* The callback shouldn't take any locks */ @@ -2167,7 +2170,7 @@ mono_emit_jit_dump (MonoJitInfo *jinfo, gpointer code) int i; memset (&rec, 0, sizeof (rec)); - + // populating info relating debug methods dmji = mono_debug_find_method (jinfo->d.method, NULL); @@ -4540,20 +4543,20 @@ mini_llvm_init (void) } #ifdef ENSURE_PRIMARY_STACK_SIZE -/*++ - Function: - EnsureStackSize - - Abstract: - This fixes a problem on MUSL where the initial stack size reported by the - pthread_attr_getstack is about 128kB, but this limit is not fixed and - the stack can grow dynamically. The problem is that it makes the - functions ReflectionInvocation::[Try]EnsureSufficientExecutionStack - to fail for real life scenarios like e.g. compilation of corefx. - Since there is no real fixed limit for the stack, the code below - ensures moving the stack limit to a value that makes reasonable - real life scenarios work. - +/*++ + Function: + EnsureStackSize + + Abstract: + This fixes a problem on MUSL where the initial stack size reported by the + pthread_attr_getstack is about 128kB, but this limit is not fixed and + the stack can grow dynamically. The problem is that it makes the + functions ReflectionInvocation::[Try]EnsureSufficientExecutionStack + to fail for real life scenarios like e.g. compilation of corefx. + Since there is no real fixed limit for the stack, the code below + ensures moving the stack limit to a value that makes reasonable + real life scenarios work. + --*/ static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void ensure_stack_size (size_t size) @@ -4737,7 +4740,7 @@ mini_init (const char *filename) mono_w32handle_init (); #endif -#ifdef ENSURE_PRIMARY_STACK_SIZE +#ifdef ENSURE_PRIMARY_STACK_SIZE ensure_stack_size (5 * 1024 * 1024); #endif // ENSURE_PRIMARY_STACK_SIZE diff --git a/src/mono/mono/mini/mini.c b/src/mono/mono/mini/mini.c index 4463f38bcaa0f..92bf21887c59f 100644 --- a/src/mono/mono/mini/mini.c +++ b/src/mono/mono/mini/mini.c @@ -4322,6 +4322,7 @@ mini_handle_call_res_devirt (MonoMethod *cmethod) inst = mono_class_inflate_generic_class_checked (mono_class_get_iequatable_class (), &ctx, error); mono_error_assert_ok (error); + g_assert (inst); // EqualityComparer.Default returns specific types depending on T // FIXME: Special case more types: byte, string, nullable, enum ? diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index eef07e49ca199..2a218c7d4a365 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -174,7 +174,7 @@ has_intrinsic_cattr (MonoMethod *method) } static gboolean -is_SIMD_feature_supported(MonoCompile *cfg, MonoCPUFeatures feature) +is_SIMD_feature_supported(MonoCompile *cfg, MonoCPUFeatures feature) { return mini_get_cpu_features (cfg) & feature; } @@ -317,7 +317,7 @@ emit_simd_ins_for_binary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSigna if (id == SN_BitwiseAnd || id == SN_BitwiseOr || id == SN_Xor || id == SN_op_BitwiseAnd || id == SN_op_BitwiseOr || id == SN_op_ExclusiveOr) { op = OP_XBINOP_FORCEINT; - + switch (id) { case SN_BitwiseAnd: case SN_op_BitwiseAnd: @@ -419,7 +419,7 @@ emit_simd_ins_for_binary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSigna if (!COMPILE_LLVM (cfg)) return NULL; #endif - if (fsig->params [1]->type != MONO_TYPE_GENERICINST) + if (fsig->params [1]->type != MONO_TYPE_GENERICINST) return handle_mul_div_by_scalar (cfg, klass, arg_type, args [1]->dreg, args [0]->dreg, OP_IMUL); else if (fsig->params [0]->type != MONO_TYPE_GENERICINST) return handle_mul_div_by_scalar (cfg, klass, arg_type, args [0]->dreg, args [1]->dreg, OP_IMUL); @@ -564,7 +564,7 @@ emit_xequal (MonoCompile *cfg, MonoClass *klass, MonoTypeEnum element_type, Mono } else { return emit_simd_ins (cfg, klass, OP_XEQUAL, arg1->dreg, arg2->dreg); } -#else +#else MonoInst *ins = emit_simd_ins (cfg, klass, OP_XEQUAL, arg1->dreg, arg2->dreg); if (!COMPILE_LLVM (cfg)) ins->inst_c1 = mono_class_get_context (klass)->class_inst->type_argv [0]->type; @@ -648,12 +648,12 @@ emit_sum_vector (MonoCompile *cfg, MonoType *vector_type, MonoTypeEnum element_t MonoClass *vector_class = mono_class_from_mono_type_internal (vector_type); int vector_size = mono_class_value_size (vector_class, NULL); int element_size; - + guint32 nelems; mini_get_simd_type_info (vector_class, &nelems); // Override nelems for Vector3, with actual number of elements, instead of treating it as a 4-element vector (three elements + zero). - const char *klass_name = m_class_get_name (vector_class); + const char *klass_name = m_class_get_name (vector_class); if (!strcmp (klass_name, "Vector3")) nelems = 3; @@ -725,7 +725,7 @@ emit_sum_vector (MonoCompile *cfg, MonoType *vector_type, MonoTypeEnum element_t case MONO_TYPE_U1: // byte, sbyte not supported yet return NULL; - case MONO_TYPE_I2: + case MONO_TYPE_I2: case MONO_TYPE_U2: instc0 = INTRINS_SSE_PHADDW; break; @@ -757,12 +757,12 @@ emit_sum_vector (MonoCompile *cfg, MonoType *vector_type, MonoTypeEnum element_t default: { return NULL; } - } - + } + // Check if necessary SIMD intrinsics are supported on the current machine MonoCPUFeatures feature = type_enum_is_float (element_type) ? MONO_CPU_X86_SSE3 : MONO_CPU_X86_SSSE3; if (!is_SIMD_feature_supported (cfg, feature)) - return NULL; + return NULL; int vector_size = mono_class_value_size (vector_class, NULL); MonoType *etype = mono_class_get_context (vector_class)->class_inst->type_argv [0]; @@ -1061,7 +1061,7 @@ emit_hardware_intrinsics ( static MonoInst* emit_vector_insert_element ( - MonoCompile* cfg, MonoClass* vklass, MonoInst* ins, MonoTypeEnum type, MonoInst* element, + MonoCompile* cfg, MonoClass* vklass, MonoInst* ins, MonoTypeEnum type, MonoInst* element, int index, gboolean is_zero_inited) { int op = type_to_insert_op (type); @@ -1069,7 +1069,7 @@ emit_vector_insert_element ( if (is_zero_inited && is_zero_const (element)) { // element already set to zero #ifdef TARGET_ARM64 - } else if (!COMPILE_LLVM (cfg) && element->opcode == type_to_extract_op (type) && + } else if (!COMPILE_LLVM (cfg) && element->opcode == type_to_extract_op (type) && (type == MONO_TYPE_R4 || type == MONO_TYPE_R8)) { // OP_INSERT_Ix inserts from GP reg, not SIMD. Cannot optimize for int types. ins = emit_simd_ins (cfg, vklass, op, ins->dreg, element->sreg1); @@ -1397,7 +1397,7 @@ emit_msb_shift_vector_constant (MonoCompile *cfg, MonoClass *arg_class, MonoType */ static MonoInst* emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ +{ int id = lookup_intrins (sri_vector_methods, sizeof (sri_vector_methods), cmethod); if (id == -1) { //check_no_intrinsic_cattr (cmethod); @@ -1486,9 +1486,9 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi } else { if (COMPILE_LLVM (cfg)) return emit_simd_ins_for_sig (cfg, klass, OP_VECTOR_IABS, -1, arg0_type, fsig, args); - + // SSSE3 does not support i64 - if (is_SIMD_feature_supported (cfg, MONO_CPU_X86_SSSE3) && + if (is_SIMD_feature_supported (cfg, MONO_CPU_X86_SSSE3) && !(arg0_type == MONO_TYPE_I8 || (TARGET_SIZEOF_VOID_P == 8 && arg0_type == MONO_TYPE_I))) return emit_simd_ins_for_sig (cfg, klass, OP_VECTOR_IABS, -1, arg0_type, fsig, args); @@ -1496,7 +1496,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi MonoInst *neg = emit_simd_ins (cfg, klass, OP_XBINOP, zero->dreg, args [0]->dreg); neg->inst_c0 = OP_ISUB; neg->inst_c1 = arg0_type; - + MonoInst *ins = emit_simd_ins (cfg, klass, OP_XBINOP, args [0]->dreg, neg->dreg); ins->inst_c0 = OP_IMAX; ins->inst_c1 = arg0_type; @@ -1525,7 +1525,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return NULL; return emit_simd_ins_for_binary_op (cfg, klass, fsig, args, arg0_type, id); case SN_AndNot: { - if (!is_element_type_primitive (fsig->params [0])) + if (!is_element_type_primitive (fsig->params [0])) return NULL; #ifdef TARGET_ARM64 return emit_simd_ins_for_sig (cfg, klass, OP_ARM64_BIC, -1, arg0_type, fsig, args); @@ -1600,8 +1600,8 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return NULL; #if defined(TARGET_ARM64) if (!COMPILE_LLVM (cfg)) { - return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, - arg0_type == MONO_TYPE_I8 ? OP_CVT_SI_FP : OP_CVT_UI_FP, + return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, + arg0_type == MONO_TYPE_I8 ? OP_CVT_SI_FP : OP_CVT_UI_FP, MONO_TYPE_R8, fsig, args); } #endif @@ -1625,15 +1625,15 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return NULL; #endif } - case SN_ConvertToInt32: + case SN_ConvertToInt32: case SN_ConvertToUInt32: { if (arg0_type != MONO_TYPE_R4) return NULL; #if defined(TARGET_ARM64) if (!COMPILE_LLVM (cfg)) { - return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, - id == SN_ConvertToInt32 ? OP_CVT_FP_SI : OP_CVT_FP_UI, - id == SN_ConvertToInt32 ? MONO_TYPE_I4 : MONO_TYPE_U4, + return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, + id == SN_ConvertToInt32 ? OP_CVT_FP_SI : OP_CVT_FP_UI, + id == SN_ConvertToInt32 ? MONO_TYPE_I4 : MONO_TYPE_U4, fsig, args); } #endif @@ -1657,9 +1657,9 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return NULL; #if defined(TARGET_ARM64) if (!COMPILE_LLVM (cfg)) { - return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, - id == SN_ConvertToInt64 ? OP_CVT_FP_SI : OP_CVT_FP_UI, - id == SN_ConvertToInt64 ? MONO_TYPE_I8 : MONO_TYPE_U8, + return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, + id == SN_ConvertToInt64 ? OP_CVT_FP_SI : OP_CVT_FP_UI, + id == SN_ConvertToInt64 ? MONO_TYPE_I8 : MONO_TYPE_U8, fsig, args); } #endif @@ -1688,8 +1688,8 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return NULL; #if defined(TARGET_ARM64) if (!COMPILE_LLVM (cfg)) { - return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, - arg0_type == MONO_TYPE_I4 ? OP_CVT_SI_FP : OP_CVT_UI_FP, + return emit_simd_ins_for_sig (cfg, klass, OP_XUNOP, + arg0_type == MONO_TYPE_I4 ? OP_CVT_SI_FP : OP_CVT_UI_FP, MONO_TYPE_R4, fsig, args); } #endif @@ -1798,7 +1798,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi break; default: return NULL; - } + } MonoInst *dot; if (COMPILE_LLVM (cfg)) { @@ -1815,7 +1815,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi return extract_first_element (cfg, klass, arg0_type, dot->dreg); } else { instc = OP_FMUL; - } + } } else { if (arg0_type == MONO_TYPE_I1 || arg0_type == MONO_TYPE_U1) return NULL; // We don't support sum vector for byte, sbyte types yet @@ -1884,7 +1884,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi } else { arg_class = mono_class_from_mono_type_internal (fsig->params [0]); } - + // FIXME: Add support for Vector64 on arm64 https://github.com/dotnet/runtime/issues/90402 int size = mono_class_value_size (arg_class, NULL); if (size != 16) @@ -1908,10 +1908,10 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi MonoInst* ext_low_vec = emit_simd_ins_for_sig (cfg, arg_class, OP_XLOWER, 8, arg0_type, fsig, &shift_res_vec); MonoInst* sum_low_vec = emit_sum_vector (cfg, fsig->params [0], arg0_type, ext_low_vec); - + MonoInst* ext_high_vec = emit_simd_ins_for_sig (cfg, arg_class, OP_XUPPER, 8, arg0_type, fsig, &shift_res_vec); - MonoInst* sum_high_vec = emit_sum_vector (cfg, fsig->params [0], arg0_type, ext_high_vec); - + MonoInst* sum_high_vec = emit_sum_vector (cfg, fsig->params [0], arg0_type, ext_high_vec); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHL_IMM, sum_high_vec->dreg, sum_high_vec->dreg, 8); EMIT_NEW_BIALU (cfg, result_ins, OP_IOR, sum_high_vec->dreg, sum_high_vec->dreg, sum_low_vec->dreg); } else { @@ -1924,9 +1924,9 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi switch (arg0_type) { case MONO_TYPE_U2: case MONO_TYPE_I2: { - if (!is_SIMD_feature_supported (cfg, MONO_CPU_X86_SSSE3)) + if (!is_SIMD_feature_supported (cfg, MONO_CPU_X86_SSSE3)) return NULL; - + type = type_enum_is_unsigned (arg0_type) ? MONO_TYPE_U1 : MONO_TYPE_I1; MonoClass* arg_class = mono_class_from_mono_type_internal (fsig->params [0]); @@ -1994,7 +1994,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi if (index < 0 || index >= elems) { MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, args [1]->dreg, elems); MONO_EMIT_NEW_COND_EXC (cfg, GE_UN, "ArgumentOutOfRangeException"); - } + } // Bounds check is elided if we know the index is safe. int extract_op = type_to_extract_op (arg0_type); @@ -2080,7 +2080,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi case SN_GreaterThanAll: case SN_GreaterThanOrEqualAll: case SN_LessThanAll: - case SN_LessThanOrEqualAll: + case SN_LessThanOrEqualAll: is_all = TRUE; break; } @@ -2242,7 +2242,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi if (!is_element_type_primitive (fsig->params [0])) return NULL; return emit_simd_ins_for_unary_op (cfg, klass, fsig, args, arg0_type, id); - } + } case SN_Shuffle: { if (!is_element_type_primitive (fsig->params [0])) return NULL; @@ -2302,7 +2302,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi } case SN_WithElement: { int elems; - + if (!is_element_type_primitive (fsig->params [0])) return NULL; @@ -2330,7 +2330,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi } return emit_vector_insert_element (cfg, klass, args [0], arg0_type, args [2], index, FALSE); - } + } if (!COMPILE_LLVM (cfg) && fsig->params [0]->type != MONO_TYPE_GENERICINST) return NULL; @@ -2392,7 +2392,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi subop = is_upper ? OP_ARM64_UXTL2 : OP_ARM64_UXTL; else subop = is_upper ? OP_ARM64_SXTL2 : OP_ARM64_SXTL; - + MonoInst* ins = emit_simd_ins (cfg, klass, OP_XUNOP, args [0]->dreg, -1); ins->inst_c0 = subop; ins->inst_c1 = arg0_type; @@ -2642,7 +2642,7 @@ emit_sri_vector_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f return NULL; arg0_type = fsig->param_count > 0 ? get_underlying_type (fsig->params [0]) : MONO_TYPE_VOID; return emit_simd_ins_for_binary_op (cfg, klass, fsig, args, arg0_type, id); - + } case SN_op_Equality: case SN_op_Inequality: { @@ -3610,7 +3610,7 @@ emit_arm64_intrinsics ( MONO_ADD_INS (cfg->cbb, ins); return ins; } - + default: g_assert_not_reached (); // if a new API is added we need to either implement it or change IsSupported to false } @@ -5010,15 +5010,15 @@ emit_x86_intrinsics ( MONO_ADD_INS (cfg->cbb, ins); return ins; case SN_DivRem: { - g_assert (!(TARGET_SIZEOF_VOID_P == 4 && is_64bit)); // x86(no -64) cannot do divisions with 64-bit regs + g_assert (!(TARGET_SIZEOF_VOID_P == 4 && is_64bit)); // x86(no -64) cannot do divisions with 64-bit regs const MonoStackType divtype = is_64bit ? STACK_I8 : STACK_I4; const int storetype = is_64bit ? OP_STOREI8_MEMBASE_REG : OP_STOREI4_MEMBASE_REG; const int obj_size = MONO_ABI_SIZEOF (MonoObject); - // We must decide by the second argument, the first is always unsigned here + // We must decide by the second argument, the first is always unsigned here MonoTypeEnum arg1_type = fsig->param_count > 1 ? get_underlying_type (fsig->params [1]) : MONO_TYPE_VOID; MonoInst* div; - MonoInst* div2; + MonoInst* div2; if (type_enum_is_unsigned (arg1_type)) { MONO_INST_NEW (cfg, div, is_64bit ? OP_X86_LDIVREMU : OP_X86_IDIVREMU); @@ -5039,7 +5039,7 @@ emit_x86_intrinsics ( div2->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); div2->type = divtype; MONO_ADD_INS (cfg->cbb, div2); - + // TODO: Can the creation of tuple be elided? (e.g. if deconstruction is used) MonoInst* tuple = mono_compile_create_var (cfg, fsig->ret, OP_LOCAL); MonoInst* tuple_addr; diff --git a/src/mono/mono/utils/mono-path.c b/src/mono/mono/utils/mono-path.c index 4632a74556c3b..616fa183d5a55 100644 --- a/src/mono/mono/utils/mono-path.c +++ b/src/mono/mono/utils/mono-path.c @@ -44,6 +44,7 @@ mono_path_canonicalize (const char *path) } else { gchar *tmpdir = g_get_current_dir (); abspath = g_build_filename (tmpdir, path, (const char*)NULL); + g_assert (abspath); g_free (tmpdir); } @@ -128,6 +129,7 @@ resolve_symlink (const char *path) if (!g_path_is_absolute (buffer)) { dir = g_path_get_dirname (p); concat = g_build_filename (dir, buffer, (const char*)NULL); + g_assert (concat); g_free (dir); } else { concat = g_strdup (buffer);