2008-12-22 16:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/ChangeLog
! cleaned some typos in my recent ChangeLog entries
* harbour/include/hbvm.h
* harbour/include/hbvmpub.h
* harbour/include/hbsetup.h
* harbour/include/hbapi.h
* harbour/include/hbapierr.h
* added some function attributes which can improve code optimization
or introduce some additional warnings.
Now it works only in GCC builds.
* harbour/source/vm/hvm.c
! fixed missing double decimal places initialization in some number
negating
! fixed setting number of decimal places in plus and minus operations
if integer overflow forces conversion to double item
* some minor optimizations
* harbour/source/rtl/rat.c
* formatting
This commit is contained in:
@@ -8,6 +8,29 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2008-12-22 16:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/ChangeLog
|
||||
! cleaned some typos in my recent ChangeLog entries
|
||||
|
||||
* harbour/include/hbvm.h
|
||||
* harbour/include/hbvmpub.h
|
||||
* harbour/include/hbsetup.h
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/include/hbapierr.h
|
||||
* added some function attributes which can improve code optimization
|
||||
or introduce some additional warnings.
|
||||
Now it works only in GCC builds.
|
||||
|
||||
* harbour/source/vm/hvm.c
|
||||
! fixed missing double decimal places initialization in some number
|
||||
negating
|
||||
! fixed setting number of decimal places in plus and minus operations
|
||||
if integer overflow forces conversion to double item
|
||||
* some minor optimizations
|
||||
|
||||
* harbour/source/rtl/rat.c
|
||||
* formatting
|
||||
|
||||
2008-12-20 09:36 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/gtwvg/gtwvg.h
|
||||
! Seperated PHB_GTWVT structure for GUI elements as PHB_GUIDATA + PHB_GTWVT.
|
||||
@@ -67,10 +90,10 @@
|
||||
* harbour/source/pp/hbpp.c
|
||||
* accept empty $Id keywords in ChangeLog file. It allows to compile
|
||||
Harbour from source taken directly from SVN as tarball without
|
||||
keyword expanding, f.e. by:
|
||||
keyword expanding, f.e. from:
|
||||
http://harbour-project.svn.sourceforge.net/viewvc/
|
||||
harbour-project/trunk/harbour.tar.gz?view=tar
|
||||
In such case revision number is not unknown and set arbitrary to -1
|
||||
In such case revision number is unknown and set arbitrary to -1
|
||||
* change -q parameter to accept 0, 1 and 2 levels to disable standard
|
||||
messages and also warning/error ones
|
||||
|
||||
@@ -97,7 +120,7 @@
|
||||
* harbour/source/rtl/hbtoken.c
|
||||
* changed the behavior of " " token delimiter - now it works as
|
||||
any other tokens. The old behavior can be still reach using empty
|
||||
string "" as token delimiter. "" is not default token.
|
||||
string "" as token delimiter. "" is now default token.
|
||||
|
||||
* harbour/utils/hbtest/hbtest.prg
|
||||
* change error object to text conversion in hbtest so now it detects also
|
||||
|
||||
@@ -457,9 +457,9 @@ typedef ULONG HB_VMHANDLE;
|
||||
extern HB_EXPORT void hb_xinit( void ); /* Initialize fixed memory subsystem */
|
||||
extern HB_EXPORT void hb_xexit( void ); /* Deinitialize fixed memory subsystem */
|
||||
extern HB_EXPORT void * hb_xalloc( ULONG ulSize ); /* allocates memory, returns NULL on failure */
|
||||
extern HB_EXPORT void * hb_xgrab( ULONG ulSize ); /* allocates memory, exits on failure */
|
||||
extern HB_EXPORT void * hb_xgrab( ULONG ulSize ) HB_MALLOC_ATTR HB_ALLOC_SIZE_ATTR( 1 ); /* allocates memory, exits on failure */
|
||||
extern HB_EXPORT void hb_xfree( void * pMem ); /* frees memory */
|
||||
extern HB_EXPORT void * hb_xrealloc( void * pMem, ULONG ulSize ); /* reallocates memory */
|
||||
extern HB_EXPORT void * hb_xrealloc( void * pMem, ULONG ulSize ) HB_ALLOC_SIZE_ATTR( 2 ); /* reallocates memory */
|
||||
extern HB_EXPORT ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */
|
||||
extern HB_EXPORT ULONG hb_xquery( USHORT uiMode ); /* Query different types of memory information */
|
||||
extern HB_EXPORT void hb_xsetfilename( char * szValue );
|
||||
|
||||
@@ -164,7 +164,7 @@ extern HB_EXPORT PHB_ITEM hb_errRT_SubstParams( const char *szSubSystem, ULONG
|
||||
extern HB_EXPORT PHB_ITEM hb_errRT_FileError( PHB_ITEM pError, const char * szSubSystem,
|
||||
ULONG ulGenCode, ULONG ulSubCode,
|
||||
const char * szFileName );
|
||||
|
||||
|
||||
extern HB_EXPORT USHORT hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, ULONG ulArgCount, ... );
|
||||
extern HB_EXPORT USHORT hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, USHORT uiOsCode, USHORT uiFlags, ULONG ulArgCount, ... );
|
||||
extern HB_EXPORT PHB_ITEM hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, ULONG ulArgCount, ... );
|
||||
@@ -172,8 +172,8 @@ extern HB_EXPORT void hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCo
|
||||
extern HB_EXPORT USHORT hb_errRT_TERM ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, USHORT uiOSCode, USHORT uiFlags );
|
||||
extern HB_EXPORT USHORT hb_errRT_DBCMD ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation );
|
||||
extern HB_EXPORT USHORT hb_errRT_DBCMD_Ext ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, USHORT uiFlags );
|
||||
|
||||
extern HB_EXPORT void hb_errInternal ( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 );
|
||||
|
||||
extern HB_EXPORT void hb_errInternal ( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 ) HB_NORETURN_ATTR;
|
||||
extern void hb_errInternalRaw ( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 );
|
||||
|
||||
/* Low-level error handling */
|
||||
|
||||
@@ -404,23 +404,34 @@
|
||||
#if defined( __GNUC__ )
|
||||
#define HB_PRINTF_FORMAT( _nStr, _nParam ) \
|
||||
__attribute__ (( format (printf, _nStr, _nParam)))
|
||||
#define HB_ALLOC_SIZE_ATTR( _nParam ) \
|
||||
__attribute__ (( alloc (_nParam)))
|
||||
#define HB_MALLOC_ATTR \
|
||||
__attribute__ (( malloc ))
|
||||
#define HB_NORETURN_ATTR \
|
||||
__attribute__ (( noreturn ))
|
||||
|
||||
#define HB_HOT_ATTR \
|
||||
__attribute__ (( hot ))
|
||||
#define HB_COLD_ATTR \
|
||||
__attribute__ (( cold ))
|
||||
# if ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 1 ) )
|
||||
#define HB_FLATTEN_ATTR \
|
||||
__attribute__ (( flatten ))
|
||||
# else
|
||||
#define HB_FLATTEN_ATTR
|
||||
# endif
|
||||
# if ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3 ) )
|
||||
#define HB_ALLOC_SIZE_ATTR( _nParam ) \
|
||||
__attribute__ (( alloc_size (_nParam)))
|
||||
# else
|
||||
#define HB_ALLOC_SIZE_ATTR( _nParam )
|
||||
# endif
|
||||
#else
|
||||
#define HB_PRINTF_FORMAT( _nStr, _nParam )
|
||||
#define HB_ALLOC_SIZE_ATTR( _nParam )
|
||||
#define HB_MALLOC_ATTR
|
||||
#define HB_NORETURN_ATTR
|
||||
#define HB_HOT_ATTR
|
||||
#define HB_COLD_ATTR
|
||||
#define HB_FLATTEN_ATTR
|
||||
#define HB_ALLOC_SIZE_ATTR( _nParam )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ extern HB_EXPORT void hb_vmAtInit( HB_INIT_FUNC pFunc, void * cargo );
|
||||
extern HB_EXPORT void hb_vmAtExit( HB_INIT_FUNC pFunc, void * cargo );
|
||||
|
||||
/* Harbour virtual machine functions */
|
||||
extern HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */
|
||||
extern HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) HB_FLATTEN_ATTR; /* invokes the virtual machine */
|
||||
extern HB_EXPORT PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* old module symbols initialization */
|
||||
extern HB_EXPORT PHB_SYMB hb_vmProcessSymbolsEx( PHB_SYMB pSymbols, USHORT uiSymbols, const char * szModuleName, ULONG ulID, USHORT uiPcodeVer ); /* module symbols initialization with extended information */
|
||||
extern HB_EXPORT PHB_SYMB hb_vmProcessDynLibSymbols( PHB_SYMB pSymbols, USHORT uiSymbols, const char * szModuleName, ULONG ulID, USHORT uiPcodeVer ); /* module symbols initialization with extended information */
|
||||
|
||||
@@ -227,7 +227,7 @@ typedef struct _HB_FUNC_LIST
|
||||
|
||||
#define HB_FS_INITEXIT ( HB_FS_INIT | HB_FS_EXIT )
|
||||
|
||||
extern HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */
|
||||
extern HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) HB_FLATTEN_ATTR; /* invokes the virtual machine */
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ HB_FUNC( HB_RAT )
|
||||
}
|
||||
else
|
||||
lStart = 0;
|
||||
|
||||
|
||||
if( ISNUM( 4 ) )
|
||||
{
|
||||
long lEnd = hb_parnl( 4 );
|
||||
|
||||
@@ -161,8 +161,6 @@ static void hb_vmVFrame( USHORT usLocals, BYTE bParams ); /* increases the st
|
||||
static void hb_vmSFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */
|
||||
static void hb_vmStatics( PHB_SYMB pSym, USHORT uiStatics ); /* increases the global statics array to hold a PRG statics */
|
||||
static void hb_vmInitThreadStatics( USHORT uiCount, const BYTE * pCode ); /* mark thread static variables */
|
||||
static void hb_vmEndBlock( void ); /* copies the last codeblock pushed value into the return value */
|
||||
static void hb_vmRetValue( void ); /* pops the latest stack value into stack.Return */
|
||||
/* Push */
|
||||
static void hb_vmPushAlias( void ); /* pushes the current workarea number */
|
||||
static void hb_vmPushAliasedField( PHB_SYMB ); /* pushes an aliased field on the eval stack */
|
||||
@@ -1570,7 +1568,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
hb_vmSend( HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ) );
|
||||
w += 3;
|
||||
|
||||
/* Is This OK??? */
|
||||
/* Small opt */
|
||||
if( pCode[ w ] == HB_P_POP )
|
||||
w++;
|
||||
else
|
||||
@@ -1582,6 +1580,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
hb_vmSend( pCode[ w + 1 ] );
|
||||
w += 2;
|
||||
|
||||
/* Small opt */
|
||||
if( pCode[ w ] == HB_P_POP )
|
||||
w++;
|
||||
else
|
||||
@@ -1650,11 +1649,6 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
break;
|
||||
}
|
||||
|
||||
case HB_P_RETVALUE:
|
||||
hb_vmRetValue();
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_LOCALNAME:
|
||||
#ifndef HB_NO_DEBUG
|
||||
hb_vmLocalName( HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ),
|
||||
@@ -1681,9 +1675,15 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
while( pCode[ w++ ] ) {};
|
||||
break;
|
||||
|
||||
case HB_P_RETVALUE:
|
||||
hb_stackPopReturn();
|
||||
hb_stackReturnItem()->type &= ~HB_IT_MEMOFLAG;
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_ENDBLOCK:
|
||||
HB_TRACE(HB_TR_INFO, ("HB_P_ENDBLOCK"));
|
||||
hb_vmEndBlock();
|
||||
hb_stackPopReturn();
|
||||
/* manually inlined hb_vmRequestEndProc() for some C compilers
|
||||
* which does not make such optimisation
|
||||
*/
|
||||
@@ -2905,6 +2905,7 @@ static void hb_vmNegate( void )
|
||||
pItem->type = HB_IT_DOUBLE;
|
||||
pItem->item.asDouble.value = -dValue;
|
||||
pItem->item.asDouble.length = HB_DBL_LENGTH( -dValue );
|
||||
pItem->item.asDouble.decimal = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -2924,6 +2925,7 @@ static void hb_vmNegate( void )
|
||||
pItem->type = HB_IT_DOUBLE;
|
||||
pItem->item.asDouble.value = -dValue;
|
||||
pItem->item.asDouble.length = HB_DBL_LENGTH( -dValue );
|
||||
pItem->item.asDouble.decimal = 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -2967,7 +2969,11 @@ static void hb_vmPlus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIte
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemPutND( pResult, ( double ) lNumber1 + ( double ) lNumber2 );
|
||||
double dResult = ( double ) lNumber1 + ( double ) lNumber2;
|
||||
pResult->type = HB_IT_DOUBLE;
|
||||
pResult->item.asDouble.value = dResult;
|
||||
pResult->item.asDouble.length = HB_DBL_LENGTH( dResult );
|
||||
pResult->item.asDouble.decimal = 0;
|
||||
}
|
||||
}
|
||||
else if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
|
||||
@@ -3050,7 +3056,11 @@ static void hb_vmMinus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIt
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemPutND( pResult, ( double ) lNumber1 - ( double ) lNumber2 );
|
||||
double dResult = ( double ) lNumber1 - ( double ) lNumber2;
|
||||
pResult->type = HB_IT_DOUBLE;
|
||||
pResult->item.asDouble.value = dResult;
|
||||
pResult->item.asDouble.length = HB_DBL_LENGTH( dResult );
|
||||
pResult->item.asDouble.decimal = 0;
|
||||
}
|
||||
}
|
||||
else if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
|
||||
@@ -3122,17 +3132,17 @@ static void hb_vmMult( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIte
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmMult(%p,%p,%p)", pResult, pItem1, pItem2));
|
||||
|
||||
/* if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) )
|
||||
#if HB_LONG_MAX > HB_INT_MAX * HB_INT_MAX && \
|
||||
HB_LONG_MIN < HB_INT_MIN * HB_INT_MIN && 1
|
||||
if( HB_IS_INTEGER( pItem1 ) && HB_IS_INTEGER( pItem2 ) )
|
||||
{
|
||||
HB_LONG lNumber1 = HB_ITEM_GET_NUMINTRAW( pItem1 )
|
||||
HB_LONG lNumber2 = HB_ITEM_GET_NUMINTRAW( pItem2 );
|
||||
HB_LONG lResult = lNumber1 * lNumber2;
|
||||
if( lNumber2 == 0 || lResult / lNumber2 == lNumber1 )
|
||||
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
|
||||
else
|
||||
hb_itemPutNLen( pResult, ( double ) lNumber1 * lNumber2, 0, 0 );
|
||||
HB_LONG lResult = ( HB_LONG ) pItem1->item.asInteger.value *
|
||||
( HB_LONG ) pItem2->item.asInteger.value;
|
||||
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
|
||||
}
|
||||
else */ if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
|
||||
else
|
||||
#endif
|
||||
if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
|
||||
{
|
||||
int iDec1, iDec2;
|
||||
double dNumber1 = hb_itemGetNDDec( pItem1, &iDec1 );
|
||||
@@ -6017,25 +6027,6 @@ static void hb_vmInitThreadStatics( USHORT uiCount, const BYTE * pCode )
|
||||
}
|
||||
#endif
|
||||
|
||||
static void hb_vmEndBlock( void )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmEndBlock()"));
|
||||
|
||||
hb_stackPopReturn();
|
||||
}
|
||||
|
||||
static void hb_vmRetValue( void )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmRetValue()"));
|
||||
|
||||
hb_stackPopReturn();
|
||||
hb_stackReturnItem()->type &= ~HB_IT_MEMOFLAG;
|
||||
}
|
||||
|
||||
/* ------------------------------- */
|
||||
/* Push */
|
||||
/* ------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user