Skip to content

Commit e596d3c

Browse files
authored
Merge pull request #1127 from Unity-Technologies/unity-master-system-numerics-sizes
Fix System.Numerics sizes (case 1118631)
2 parents 88289dc + e20ed29 commit e596d3c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

mono/metadata/class.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,9 +1999,6 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
19991999
real_size = field_offsets [i] + size;
20002000
}
20012001

2002-
/* Make SIMD types as big as a SIMD register since they can be stored into using simd stores */
2003-
if (klass->simd_type)
2004-
real_size = MAX (real_size, sizeof (MonoObject) + 16);
20052002
instance_size = MAX (real_size, instance_size);
20062003

20072004
if (instance_size & (min_align - 1)) {
@@ -5837,7 +5834,9 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
58375834
if (!strncmp (name, "Vector", 6))
58385835
klass->simd_type = !strcmp (name + 6, "2d") || !strcmp (name + 6, "2ul") || !strcmp (name + 6, "2l") || !strcmp (name + 6, "4f") || !strcmp (name + 6, "4ui") || !strcmp (name + 6, "4i") || !strcmp (name + 6, "8s") || !strcmp (name + 6, "8us") || !strcmp (name + 6, "16b") || !strcmp (name + 6, "16sb");
58395836
} else if (klass->image->assembly_name && !strcmp (klass->image->assembly_name, "System.Numerics") && !strcmp (nspace, "System.Numerics")) {
5840-
if (!strcmp (name, "Vector2") || !strcmp (name, "Vector3") || !strcmp (name, "Vector4"))
5837+
/* The JIT can't handle SIMD types with != 16 size yet */
5838+
//if (!strcmp (name, "Vector2") || !strcmp (name, "Vector3") || !strcmp (name, "Vector4"))
5839+
if (!strcmp (name, "Vector4"))
58415840
klass->simd_type = 1;
58425841
}
58435842

mono/mini/simd-intrinsics.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,9 @@ emit_vector_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignatu
20812081
MonoMethodSignature *sig = mono_method_signature (cmethod);
20822082
MonoType *type = &cmethod->klass->byval_arg;
20832083

2084+
if (!cmethod->klass->simd_type)
2085+
return NULL;
2086+
20842087
/*
20852088
* Vector2/3/4 are handled the same way, since the underlying SIMD type is the same (4 * r4).
20862089
*/

0 commit comments

Comments
 (0)