2010-03-25 00:14 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbatomic.h
* removed unnecessary parenthesis
* renamed HB_SPINLOCK_INIT_R macro to HB_SPINLOCK_INITVAL_R
+ added HB_SPINLOCK_INIT_R(l) macro
* harbour/src/vm/fm.c
* harbour/src/vm/dlmalloc.c
+ updated to DLMALLOC 2.8.4
* added OS2 support from our previous DLMALLOC version
+ updated to use our own recursive locks when available
* disabled hack which breaks strict aliasing
! added some fixes to new DLMALLOC code
TODO: Test it with MSVC win and wince builds and add _MSC_VER
based protection for __forceinline usage (I do not know
in which MSVC version it was added).
Test it with OS2 GCC and OpenWatcom builds.
Test it Darwin and some other *nixes.
* harbour/contrib/sddfb/sddfb.c
! fixed missing reference operator in isc_detach_database()
! fixed NULL used to clear connection handles
* keep references to connection handlers passed to isc_*() functions
* minor formatting
This commit is contained in:
@@ -17,6 +17,31 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-03-25 00:14 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbatomic.h
|
||||
* removed unnecessary parenthesis
|
||||
* renamed HB_SPINLOCK_INIT_R macro to HB_SPINLOCK_INITVAL_R
|
||||
+ added HB_SPINLOCK_INIT_R(l) macro
|
||||
|
||||
* harbour/src/vm/fm.c
|
||||
* harbour/src/vm/dlmalloc.c
|
||||
+ updated to DLMALLOC 2.8.4
|
||||
* added OS2 support from our previous DLMALLOC version
|
||||
+ updated to use our own recursive locks when available
|
||||
* disabled hack which breaks strict aliasing
|
||||
! added some fixes to new DLMALLOC code
|
||||
TODO: Test it with MSVC win and wince builds and add _MSC_VER
|
||||
based protection for __forceinline usage (I do not know
|
||||
in which MSVC version it was added).
|
||||
Test it with OS2 GCC and OpenWatcom builds.
|
||||
Test it Darwin and some other *nixes.
|
||||
|
||||
* harbour/contrib/sddfb/sddfb.c
|
||||
! fixed missing reference operator in isc_detach_database()
|
||||
! fixed NULL used to clear connection handles
|
||||
* keep references to connection handlers passed to isc_*() functions
|
||||
* minor formatting
|
||||
|
||||
2010-03-24 21:42 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/Makefile
|
||||
+ sdd libs ordered alphabetically like other contribs.
|
||||
|
||||
@@ -104,7 +104,7 @@ static void hb_firebirddd_init( void * cargo )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( cargo );
|
||||
|
||||
if ( ! hb_sddRegister( & firebirddd ) || ( sizeof( isc_db_handle ) != sizeof( void * ) ) )
|
||||
if ( ! hb_sddRegister( &firebirddd ) || ( sizeof( isc_db_handle ) != sizeof( void * ) ) )
|
||||
{
|
||||
hb_errInternal( HB_EI_RDDINVALID, NULL, NULL, NULL );
|
||||
HB_FUNC_EXEC( SQLBASE ); /* force SQLBASE linking */
|
||||
@@ -148,7 +148,7 @@ static HB_USHORT hb_errRT_FireBirdDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCo
|
||||
static HB_ERRCODE fbConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
isc_db_handle db = ( isc_db_handle ) 0;
|
||||
isc_db_handle hDb = ( isc_db_handle ) 0;
|
||||
char parambuf[ 520 ];
|
||||
int i;
|
||||
HB_SIZE ul;
|
||||
@@ -173,14 +173,14 @@ static HB_ERRCODE fbConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
|
||||
i += ul;
|
||||
|
||||
if ( isc_attach_database( status, ( short ) hb_arrayGetCLen( pItem, 5 ), hb_arrayGetCPtr( pItem, 5 ),
|
||||
& db, ( short ) i, parambuf ) )
|
||||
&hDb, ( short ) i, parambuf ) )
|
||||
{
|
||||
/* TODO: error code in status[1]; */
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pConnection->pSDDConn = hb_xgrab( sizeof( SDDCONN ) );
|
||||
( ( SDDCONN * ) pConnection->pSDDConn )->hDb = db;
|
||||
/* HB_TRACE( HB_TR_ALWAYS, ("db=%d", db) ); */
|
||||
( ( SDDCONN * ) pConnection->pSDDConn )->hDb = hDb;
|
||||
/* HB_TRACE( HB_TR_ALWAYS, ("hDb=%d", hDb) ); */
|
||||
return HB_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ static HB_ERRCODE fbDisconnect( SQLDDCONNECTION * pConnection )
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
||||
isc_detach_database( status, ( ( SDDCONN * ) pConnection->pSDDConn )->hDb );
|
||||
isc_detach_database( status, &( ( SDDCONN * ) pConnection->pSDDConn )->hDb );
|
||||
hb_xfree( pConnection->pSDDConn );
|
||||
return HB_SUCCESS;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ static HB_ERRCODE fbExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
|
||||
|
||||
static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
|
||||
{
|
||||
isc_db_handle hDb = ( ( SDDCONN * ) pArea->pConnection->pSDDConn )->hDb;
|
||||
isc_db_handle * phDb = &( ( SDDCONN * ) pArea->pConnection->pSDDConn )->hDb;
|
||||
SDDDATA * pSDDData;
|
||||
ISC_STATUS_ARRAY status;
|
||||
isc_tr_handle hTrans = ( isc_tr_handle ) 0;
|
||||
@@ -225,14 +225,14 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
|
||||
memset( &status, 0, sizeof( status ) );
|
||||
|
||||
/* HB_TRACE( HB_TR_ALWAYS, ("db=%d", hDb) ); */
|
||||
if ( isc_start_transaction( status, &hTrans, 1, &hDb, 0, NULL ) )
|
||||
if ( isc_start_transaction( status, &hTrans, 1, phDb, 0, NULL ) )
|
||||
{
|
||||
/* HB_TRACE( HB_TR_ALWAYS, ("hTrans=%d status=%ld %ld %ld %ld", ( int ) hTrans, ( long ) status[0], ( long ) status[1], ( long ) status[2], ( long ) status[3] ) ); */
|
||||
hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_START, "Start transaction failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) );
|
||||
return HB_FAILURE;
|
||||
}
|
||||
|
||||
if ( isc_dsql_allocate_statement( status, &hDb, &hStmt ) )
|
||||
if ( isc_dsql_allocate_statement( status, phDb, &hStmt ) )
|
||||
{
|
||||
hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTALLOC, "Allocate statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) );
|
||||
isc_rollback_transaction( status, &hTrans );
|
||||
@@ -259,7 +259,7 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
|
||||
pSqlda->sqln = uiFields;
|
||||
pSqlda->version = 1;
|
||||
|
||||
if ( isc_dsql_describe( status, & hStmt, SQL_DIALECT_V5, pSqlda ) )
|
||||
if ( isc_dsql_describe( status, &hStmt, SQL_DIALECT_V5, pSqlda ) )
|
||||
{
|
||||
hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTDESCR, "Describe statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) );
|
||||
isc_dsql_free_statement( status, &hStmt, DSQL_drop );
|
||||
@@ -440,11 +440,11 @@ static HB_ERRCODE fbClose( SQLBASEAREAP pArea )
|
||||
}
|
||||
if ( pSDDData->hStmt )
|
||||
{
|
||||
isc_dsql_free_statement( status, & pSDDData->hStmt, DSQL_drop );
|
||||
isc_dsql_free_statement( status, &pSDDData->hStmt, DSQL_drop );
|
||||
}
|
||||
if ( pSDDData->hTrans )
|
||||
{
|
||||
isc_rollback_transaction( status, & pSDDData->hTrans );
|
||||
isc_rollback_transaction( status, &pSDDData->hTrans );
|
||||
}
|
||||
hb_xfree( pSDDData );
|
||||
return HB_SUCCESS;
|
||||
@@ -463,10 +463,10 @@ static HB_ERRCODE fbGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo )
|
||||
|
||||
while ( ulRecNo > pArea->ulRecCount && ! pArea->fFetched )
|
||||
{
|
||||
isc_stmt_handle stmt = pSDDData->hStmt;
|
||||
isc_tr_handle tr = pSDDData->hTrans;
|
||||
isc_stmt_handle * phStmt = &pSDDData->hStmt;
|
||||
isc_tr_handle * phTr = &pSDDData->hTrans;
|
||||
|
||||
lErr = isc_dsql_fetch( status, &stmt, SQL_DIALECT_V5, pSDDData->pSqlda );
|
||||
lErr = isc_dsql_fetch( status, phStmt, SQL_DIALECT_V5, pSDDData->pSqlda );
|
||||
|
||||
if ( lErr == 0 )
|
||||
{
|
||||
@@ -528,19 +528,19 @@ static HB_ERRCODE fbGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo )
|
||||
else if ( lErr == 100L )
|
||||
{
|
||||
pArea->fFetched = HB_TRUE;
|
||||
if ( isc_dsql_free_statement( status, &stmt, DSQL_drop ) )
|
||||
if ( isc_dsql_free_statement( status, phStmt, DSQL_drop ) )
|
||||
{
|
||||
hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTFREE, "Statement free error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) );
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pSDDData->hStmt = NULL;
|
||||
pSDDData->hStmt = ( isc_stmt_handle ) 0;
|
||||
|
||||
if ( isc_commit_transaction( status, &tr ) )
|
||||
if ( isc_commit_transaction( status, phTr ) )
|
||||
{
|
||||
hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_COMMIT, "Transaction commit error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) );
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pSDDData->hTrans = NULL;
|
||||
pSDDData->hTrans = ( isc_tr_handle ) 0;
|
||||
|
||||
hb_xfree( pSDDData->pSqlda ); /* TODO: free is more complex */
|
||||
pSDDData->pSqlda = NULL;
|
||||
|
||||
@@ -485,20 +485,20 @@ HB_EXTERN_BEGIN
|
||||
|
||||
static _HB_INLINE_ int hb_spinlock_try_r( struct hb_spinlock_r * sl )
|
||||
{
|
||||
HB_SPINLOCK_T * l = &(sl)->lock;
|
||||
HB_SPINLOCK_T * l = &sl->lock;
|
||||
int r = 0;
|
||||
if( *l != HB_SPINLOCK_INIT )
|
||||
{
|
||||
if( (sl)->thid == HB_THREAD_SELF() )
|
||||
if( sl->thid == HB_THREAD_SELF() )
|
||||
{
|
||||
(sl)->count++;
|
||||
sl->count++;
|
||||
r = 1;
|
||||
}
|
||||
}
|
||||
else if( HB_SPINLOCK_TRY( l ) )
|
||||
{
|
||||
(sl)->thid = HB_THREAD_SELF();
|
||||
(sl)->count = 1;
|
||||
sl->thid = HB_THREAD_SELF();
|
||||
sl->count = 1;
|
||||
r = 1;
|
||||
}
|
||||
return r;
|
||||
@@ -540,22 +540,22 @@ HB_EXTERN_BEGIN
|
||||
#else
|
||||
static _HB_INLINE_ void hb_spinlock_acquire_r( struct hb_spinlock_r * sl )
|
||||
{
|
||||
HB_SPINLOCK_T * l = &(sl)->lock;
|
||||
HB_SPINLOCK_T * l = &sl->lock;
|
||||
int count = HB_SPINLOCK_REPEAT;
|
||||
for( ;; )
|
||||
{
|
||||
if( *l != HB_SPINLOCK_INIT )
|
||||
{
|
||||
if( (sl)->thid == HB_THREAD_SELF() )
|
||||
if( sl->thid == HB_THREAD_SELF() )
|
||||
{
|
||||
(sl)->count++;
|
||||
sl->count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( HB_SPINLOCK_TRY( l ) )
|
||||
{
|
||||
(sl)->thid = HB_THREAD_SELF();
|
||||
(sl)->count = 1;
|
||||
sl->thid = HB_THREAD_SELF();
|
||||
sl->count = 1;
|
||||
break;
|
||||
}
|
||||
if( --count == 0 )
|
||||
@@ -568,7 +568,8 @@ HB_EXTERN_BEGIN
|
||||
#endif
|
||||
|
||||
# define HB_SPINLOCK_R struct hb_spinlock_r
|
||||
# define HB_SPINLOCK_INIT_R { 0, 0, 0 }
|
||||
# define HB_SPINLOCK_INITVAL_R { 0, 0, 0 }
|
||||
# define HB_SPINLOCK_INIT_R(l) do { (l)->lock = 0; (l)->count = 0; (l)->thid = 0; } while( 0 )
|
||||
# define HB_SPINLOCK_TRY_R(l) hb_spinlock_try_r(l)
|
||||
# define HB_SPINLOCK_RELEASE_R(l) hb_spinlock_release_r(l)
|
||||
# define HB_SPINLOCK_ACQUIRE_R(l) hb_spinlock_acquire_r(l)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -141,7 +141,11 @@
|
||||
/* # define USE_DL_PREFIX */
|
||||
# define REALLOC_ZERO_BYTES_FREES
|
||||
# if defined( HB_MT_VM )
|
||||
# define USE_LOCKS 1
|
||||
# if defined( HB_SPINLOCK_R )
|
||||
# define USE_LOCKS 2
|
||||
# else
|
||||
# define USE_LOCKS 1
|
||||
# endif
|
||||
# if defined( HB_FM_DLMT_ALLOC )
|
||||
# define ONLY_MSPACES 1
|
||||
# define FOOTERS 1
|
||||
@@ -156,6 +160,7 @@
|
||||
# pragma warn -ngu
|
||||
# pragma warn -prc
|
||||
# pragma warn -rch
|
||||
# pragma warn -inl
|
||||
# elif defined( HB_OS_WIN_CE ) && defined( __POCC__ )
|
||||
# define ABORT TerminateProcess( GetCurrentProcess(), 0 )
|
||||
# elif defined( __POCC__ ) && !defined( InterlockedCompareExchangePointer )
|
||||
@@ -193,6 +198,7 @@
|
||||
# pragma warn +ngu
|
||||
# pragma warn +prc
|
||||
# pragma warn +rch
|
||||
# pragma warn +inl
|
||||
# elif defined( __WATCOMC__ )
|
||||
# pragma warning 13 2
|
||||
# pragma warning 367 2
|
||||
@@ -462,7 +468,7 @@ static void dlmalloc_destroy( void )
|
||||
size_t size = sp->size;
|
||||
flag_t flag = sp->sflags;
|
||||
sp = sp->next;
|
||||
if( (flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) )
|
||||
if( (flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) )
|
||||
CALL_MUNMAP(base, size);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user