Send MinGW-Notify mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.osdn.me/mailman/listinfo/mingw-notify
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MinGW-Notify digest..."


Please do not reply to this notification; the sender address is unable to 
accept incoming e-mail.  If you wish to unsubscribe you can do so at 
https://lists.osdn.me/mailman/listinfo/mingw-notify.



Today's Topics:

   1. [mingw] #38607: Improved standards support for aligned memory
      allocators (MinGW Notification List)


----------------------------------------------------------------------

Message: 1
Date: Wed, 19 Sep 2018 11:44:47 +0100
From: MinGW Notification List <[email protected]>
Subject: [MinGW-Notify] [mingw] #38607: Improved standards support for
        aligned memory allocators
To: OSDN Ticket System <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

#38607: Improved standards support for aligned memory allocators

  Open Date: 2018-09-17 19:25
Last Update: 2018-09-19 11:44

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2018-09-19 11:44 Updated by: keith

Comment:

With regard to the suggested addition of ISO-C11's aligned_alloc(), and/or
POSIX.1's optional posix_memalign() APIs, either or both could be trivially
implemented in terms of __mingw_aligned_malloc(), were it not for one
limitation of the latter's current implementation ? a limitation shared with
Microsoft's _aligned_malloc() implementation: both of these implementations
require accompanying (non-standard) _aligned_realloc() and _aligned_free()
counterparts, which must be used when operating on the over-aligned heap, and
cannot be used to operate on the regular heap. Neither ISO-C11, nor POSIX.1
require, or specify, any such complementary APIs; it is expected that regular
realloc() and free() APIs are sufficient, regardless of heap block alignment.

The __mingw_aligned_free() API could be modified, to permit it to operate on
over-aligned heap blocks, (allocated by __mingw_aligned_malloc() or
__mingw_aligned_offset_malloc()), and on regularly aligned blocks, (allocated
by malloc()); such a modified implementation could then be used in place of
free(). As it stands, such an extended implementation of free() would require a
"heap walk", to discriminate between regularly aligned and over-aligned blocks;
this requirement precludes its deployment on Win9x, (because the _heapwalk()
API is documented to be unsupported, in all but name).

A complementary extension of the __mingw_aligned_realloc() API would not be
possible, unless the existing implementation is adapted to record alignment and
offset attributes of over-aligned heap blocks, within the block prefix ... a
modification which I identified, in my preceding comment, as a likely
requirement anyway. Such a modification could obviate the need for a heap walk,
to discriminate between regular and over-aligned heap blocks; it could also
overcome the limitation of missing Win9x support.



---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: (None)
          Type: Feature Request
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: WSL
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Microsoft introduced _aligned_malloc(), and associated functions, with
MSVCR70.DLL. Although subsequently supported in MSVCRT.DLL, from WinXP onwards,
exposure of these APIs interferes with a clean build of GCC ? not only insofar
as, having detected presence of the APIs, GCC would become dependent on WinXP
and later, thus needlessly breaking legacy support, but furthermore, the GCC
sources neglect to include the requisite <malloc.h> header file, and thus do
not build cleanly.

Legacy support for similar APIs was added to MinGW, in 2003/2004, under feature
request #260; however, it may be ill-advised to make GCC dependent on these
MinGW specific APIs, for the following reasons:???

 1. A patch, to incorporate them, would be unlikely to be accepted upstream.
 2. If the APIs are not detected, GCC will provide its own replacement
    functions.
 3. A review reveals potential flaws in the MinGW implementation.

Consequently, I suggest:?

 1. **Not** exposing the Microsoft APIs in libmsvcrt.a
 2. Reworking the MinGW implementation, to address potential flaws.
 3. Consider adding support for ISO-C11's aligned_alloc() and POSIX.1's
    posix_memalign() APIs.



-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607


------------------------------

_______________________________________________
MinGW-Notify mailing list
[email protected]
https://lists.osdn.me/mailman/listinfo/mingw-notify


End of MinGW-Notify Digest, Vol 12, Issue 5
*******************************************

Reply via email to