I have been working on fixing things for the new ABI v2 for power and ran into a problem using mini_type_is_hfa in mini-codegen.c.

The problematic code is:

                        // FIXME: Nested float structs are aligned to 8 bytes
                        if (ftype->type == MONO_TYPE_R4)
                                return FALSE;

So if a nested structure has a float field mini_type_is_hfa returns false which breaks the v2 ABI.

Example structure from my test case:

        // This structure has nested structures within it but they are
        //  homogenous and thus should still use the special rules.
        public struct float4_nested1 {
                public float f1;
        };
        public struct float4_nested2 {
                public float f4;
        };
        [StructLayout(LayoutKind.Sequential)]
        public struct float4_nested {
                public float4_nested1 nested1;
                public float f2,f3;
                public float4_nested2 nested2;


I am not sure what the comment is referring to because this structure appears to be laid out as 4 floats in a row with no padding. I printed out some info for the class:

klass: Test_float.float4_nested
size: 16
mbr_cnt=4, mbr_size=4


If I remove those two lines from mini_type_is_hfa then it works as expected and the test case succeeds.

--

-Bill Seurer

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to