[Mono-dev] Unwanted freeing of generic types

Neale Ferguson neale at sinenomine.net
Fri Aug 18 00:40:31 UTC 2017


I was going to as I was going to push some other s390x specific enhancements but it appears I've been preempted. I'm going to look at some of the other areas identified in that PR. S390x has hardware support for decimal arithmetic.

Thanks for your help in keeping me on the right path when I'd convinced myself that I saw things that weren't there.


-------- Original message --------
From: Zoltan Varga <vargaz at gmail.com>
Date: 8/17/17 20:25 (GMT-05:00)
To: Neale Ferguson <neale at sinenomine.net>
Cc: Aleksey Kliger <alklig at microsoft.com>, Mono-Devel <mono-devel-list at lists.ximian.com>
Subject: Re: [Mono-dev] Unwanted freeing of generic types

Hi,

  Nine catch, could you submit a PR with the fix ?

            Zoltan

On Thu, Aug 17, 2017 at 4:54 PM, Neale Ferguson <neale at sinenomine.net<mailto:neale at sinenomine.net>> wrote:

In threads.c we defined SpecialStaticOffset:


typedef union {

        struct {

#if G_BYTE_ORDER != G_LITTLE_ENDIAN

                guint32 type : 1;

                guint32 offset : 25;

                guint32 index : 6;

#else

                guint32 index : 6;

                guint32 offset : 25;

                guint32 type : 1;

#endif

        } fields;

        guint32 raw;

} SpecialStaticOffset;


However, the MAKE_SPECIAL_STATIC_OFFSET macro assumes little endian:


#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \

        ((SpecialStaticOffset) { .fields = { (type), (offset), (index) } }.raw)


Therefore the offset value that was being returned was incorrect and we'd choose the wrong bitset. To fix this:


#if G_BYTE_ORDER != G_LITTLE_ENDIAN

#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \

        ((SpecialStaticOffset) { .fields = { (type), (offset), (index) } }.raw)

#else

#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \

        ((SpecialStaticOffset) { .fields = { (index), (offset), (type) } }.raw)

#endif


Making this change results in the failing (crashing) test - generics-special2.2 - to work as it should.


Neale

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.dot.net<mailto:Mono-devel-list at lists.dot.net>
http://lists.dot.net/mailman/listinfo/mono-devel-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20170818/2dcfb638/attachment-0001.html>


More information about the Mono-devel-list mailing list