diff --git a/ChangeLog.txt b/ChangeLog.txt index 43817f28c5..dced4524a3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,17 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2015-09-02 16:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/hbdefs.h + * changed reference 32-bit reference counters in Win64 builds to 64-bit + ones. It resolves problems with data alignment in memory allocated + by hb_xgrab(). + + * src/vm/asort.c + * removed hack for MinGW64 build from new array sort code, + after switching to 64bit reference counters it should not + be longer necessary because allocated that has 64bit alignment + 2015-09-02 15:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbapifs.h * src/rtl/filebuf.c diff --git a/include/hbdefs.h b/include/hbdefs.h index 27369f36c2..91b42c7ea6 100644 --- a/include/hbdefs.h +++ b/include/hbdefs.h @@ -556,16 +556,22 @@ typedef HB_MAXUINT HB_VMMAXUINT; /* typedef USHORT HB_TYPE; */ typedef HB_U32 HB_TYPE; -/* type of reference counter */ -typedef unsigned long HB_COUNTER; -#if ULONG_MAX <= UINT32_MAX -# define HB_COUNTER_SIZE 4 -#else -# define HB_COUNTER_SIZE 8 -#endif - +/* type of file attributes */ typedef HB_U32 HB_FATTR; +/* type of reference counter */ +#if defined( HB_OS_WIN_64 ) + typedef HB_ULONGLONG HB_COUNTER; +# define HB_COUNTER_SIZE 8 +#else + typedef unsigned long HB_COUNTER; +# if ULONG_MAX <= UINT32_MAX +# define HB_COUNTER_SIZE 4 +# else +# define HB_COUNTER_SIZE 8 +# endif +#endif + /* type for memory pointer diff */ #if defined( HB_OS_WIN_64 ) typedef HB_LONGLONG HB_PTRDIFF; @@ -575,6 +581,7 @@ typedef HB_U32 HB_FATTR; typedef unsigned long HB_PTRUINT; #endif +/* type for file offsets */ #if defined( HB_LONG_LONG_OFF ) || ULONG_MAX == ULONGLONG_MAX typedef HB_LONG HB_FOFFSET; /* we can add hack with double as work around what should diff --git a/src/vm/asort.c b/src/vm/asort.c index a63c85d31a..b2723feb42 100644 --- a/src/vm/asort.c +++ b/src/vm/asort.c @@ -281,13 +281,7 @@ static void hb_arraySortStart( PHB_BASEARRAY pBaseArray, PHB_ITEM pBlock, pBuffer = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 2 * nCount ); for( nPos = 0; nPos < nCount; ++nPos ) - { -#ifdef __MINGW64__ - /* added dummy function call to disable buggy optimization in MinGW64 */ - hb_gcDummyMark( NULL ); -#endif pBuffer[ nPos ] = nStart + nPos; - } if( hb_arraySortDO( pBaseArray, pBlock, pBuffer, &pBuffer[ nCount ], nCount ) ) pPos = ( pDest = pBuffer ) + nCount;