2007-01-17 13:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/compiler/gencc.c
  * harbour/source/vm/hvm.c
    ! fixed typo in hb_xvmGreaterEqualThenIntIs() - <= was used instead
      of >=
    ! fixed :&macro() messages used in WITH OBJECT structure and -gc3
      output
    + added some missing optimizations in -gc3 output
This commit is contained in:
Przemyslaw Czerpak
2007-01-17 12:49:25 +00:00
parent c13da799ef
commit e2fde5133c
3 changed files with 73 additions and 41 deletions

View File

@@ -8,6 +8,15 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-01-17 13:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/compiler/gencc.c
* harbour/source/vm/hvm.c
! fixed typo in hb_xvmGreaterEqualThenIntIs() - <= was used instead
of >=
! fixed :&macro() messages used in WITH OBJECT structure and -gc3
output
+ added some missing optimizations in -gc3 output
2007-01-17 03:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/ctc.c
* harbour/contrib/libct/files.c

View File

@@ -79,29 +79,53 @@ static int hb_gencc_checkJumpCondAhead( LONG lValue, PFUNCTION pFunc, ULONG lPCo
{
if( HB_GENC_GETLABEL( lPCodePos + 1 ) == 0 )
{
LONG lOffset = 0;
BOOL fNot = FALSE;
int iSize = 0;
switch( pFunc->pCode[ lPCodePos + 1 ] )
{
case HB_P_JUMPFALSENEAR:
fprintf( cargo->yyc, "\tif( hb_xvm%sIntIs( %ld, &fValue ) ) break;\n",
szFunc, lValue );
fprintf( cargo->yyc, "\tif( !fValue )\n\t\tgoto lab%05ld;\n",
HB_GENC_GETLABEL( lPCodePos + 1 +
( signed char ) ( pFunc->pCode[ lPCodePos + 2 ] ) ) );
return 3;
lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 2 ] );
fNot = TRUE;
iSize = 3;
break;
case HB_P_JUMPFALSE:
fprintf( cargo->yyc, "\tif( hb_xvm%sIntIs( %ld, &fValue ) ) break;\n",
szFunc, lValue );
fprintf( cargo->yyc, "\tif( !fValue )\n\t\tgoto lab%05ld;\n",
HB_GENC_GETLABEL( lPCodePos + 1 +
HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 2 ] ) ) );
return 4;
lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 2 ] );
fNot = TRUE;
iSize = 4;
break;
case HB_P_JUMPFALSEFAR:
fprintf( cargo->yyc, "\tif( hb_xvm%sIntIs( %ld, &fValue ) ) break;\n",
szFunc, lValue );
fprintf( cargo->yyc, "\tif( !fValue )\n\t\tgoto lab%05ld;\n",
HB_GENC_GETLABEL( lPCodePos + 1 +
HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 2 ] ) ) );
return 5;
lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 2 ] );
fNot = TRUE;
iSize = 5;
break;
case HB_P_JUMPTRUENEAR:
lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 2 ] );
iSize = 3;
break;
case HB_P_JUMPTRUE:
lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 2 ] );
iSize = 4;
break;
case HB_P_JUMPTRUEFAR:
lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 2 ] );
iSize = 5;
break;
}
if( iSize )
{
fprintf( cargo->yyc, "\tif( hb_xvm%sIntIs( %ld, &fValue ) ) break;\n",
szFunc, lValue );
fprintf( cargo->yyc, "\tif( %sfValue )\n\t\tgoto lab%05ld;\n",
fNot ? "!" : "", HB_GENC_GETLABEL( lPCodePos + 1 + lOffset ) );
return iSize;
}
}
fprintf( cargo->yyc, "\tif( hb_xvm%sInt( %ld ) ) break;\n",
@@ -1688,10 +1712,14 @@ static HB_GENC_FUNC( hb_p_withobjectend )
static HB_GENC_FUNC( hb_p_withobjectmessage )
{
USHORT usSym = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
HB_GENC_LABEL();
fprintf( cargo->yyc, "\thb_xvmWithObjectMessage( symbols + %hu );\n",
HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
if( usSym == 0xFFFF )
fprintf( cargo->yyc, "\thb_xvmWithObjectMessage( NULL );\n" );
else
fprintf( cargo->yyc, "\thb_xvmWithObjectMessage( symbols + %hu );\n",
usSym );
return 3;
}

View File

@@ -574,6 +574,8 @@ HB_EXPORT int hb_vmQuit( void )
hb_dynsymRelease(); /* releases the dynamic symbol table */
hb_cdpReleaseAll(); /* releases codepages */
hb_itemClear( hb_stackReturnItem() );
/* release all known garbage */
if( hb_xquery( HB_MEM_USEDMAX ) ) /* check if fmstat is ON */
hb_gcCollectAll();
@@ -7096,7 +7098,7 @@ HB_EXPORT BOOL hb_xvmEqualIntIs( LONG lValue, BOOL * pfValue )
if( HB_IS_NIL( pItem ) )
{
* pfValue = FALSE;
hb_stackPop();
hb_stackDec();
}
else if( HB_IS_NUMINT( pItem ) )
{
@@ -7201,7 +7203,7 @@ HB_EXPORT BOOL hb_xvmNotEqualIntIs( LONG lValue, BOOL * pfValue )
if( HB_IS_NIL( pItem ) )
{
* pfValue = TRUE;
hb_stackPop();
hb_stackDec();
}
else if( HB_IS_NUMINT( pItem ) )
{
@@ -7257,13 +7259,11 @@ HB_EXPORT BOOL hb_xvmLessThenInt( LONG lValue )
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem ) )
{
HB_LONG lNumber = hb_vmPopHBLong();
hb_vmPushLogical( lNumber < ( HB_LONG ) lValue );
hb_vmPushLogical( hb_vmPopHBLong() < ( HB_LONG ) lValue );
}
else if( HB_IS_NUMERIC( pItem ) )
{
double dNumber = hb_vmPopNumber();
hb_vmPushLogical( dNumber < ( double ) lValue );
hb_vmPushLogical( hb_vmPopNumber() < ( double ) lValue );
}
else if( hb_objHasOperator( pItem, HB_OO_OP_LESS ) )
{
@@ -7352,13 +7352,11 @@ HB_EXPORT BOOL hb_xvmLessEqualThenInt( LONG lValue )
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem ) )
{
HB_LONG lNumber = hb_vmPopHBLong();
hb_vmPushLogical( lNumber <= ( HB_LONG ) lValue );
hb_vmPushLogical( hb_vmPopHBLong() <= ( HB_LONG ) lValue );
}
else if( HB_IS_NUMERIC( pItem ) )
{
double dNumber = hb_vmPopNumber();
hb_vmPushLogical( dNumber <= ( double ) lValue );
hb_vmPushLogical( hb_vmPopNumber() <= ( double ) lValue );
}
else if( hb_objHasOperator( pItem, HB_OO_OP_LESSEQUAL ) )
{
@@ -7447,13 +7445,11 @@ HB_EXPORT BOOL hb_xvmGreaterThenInt( LONG lValue )
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem ) )
{
HB_LONG lNumber = hb_vmPopHBLong();
hb_vmPushLogical( lNumber > ( HB_LONG ) lValue );
hb_vmPushLogical( hb_vmPopHBLong() > ( HB_LONG ) lValue );
}
else if( HB_IS_NUMERIC( pItem ) )
{
double dNumber = hb_vmPopNumber();
hb_vmPushLogical( dNumber > ( double ) lValue );
hb_vmPushLogical( hb_vmPopNumber() > ( double ) lValue );
}
else if( hb_objHasOperator( pItem, HB_OO_OP_GREATER ) )
{
@@ -7542,13 +7538,11 @@ HB_EXPORT BOOL hb_xvmGreaterEqualThenInt( LONG lValue )
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem ) )
{
HB_LONG lNumber = hb_vmPopHBLong();
hb_vmPushLogical( lNumber >= ( HB_LONG ) lValue );
hb_vmPushLogical( hb_vmPopHBLong() >= ( HB_LONG ) lValue );
}
else if( HB_IS_NUMERIC( pItem ) )
{
double dNumber = hb_vmPopNumber();
hb_vmPushLogical( dNumber >= ( double ) lValue );
hb_vmPushLogical( hb_vmPopNumber() >= ( double ) lValue );
}
else if( hb_objHasOperator( pItem, HB_OO_OP_GREATEREQUAL ) )
{
@@ -7585,11 +7579,11 @@ HB_EXPORT BOOL hb_xvmGreaterEqualThenIntIs( LONG lValue, BOOL * pfValue )
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem ) )
{
* pfValue = hb_vmPopHBLong() <= ( HB_LONG ) lValue;
* pfValue = hb_vmPopHBLong() >= ( HB_LONG ) lValue;
}
else if( HB_IS_NUMERIC( pItem ) )
{
* pfValue = hb_vmPopNumber() <= ( double ) lValue;
* pfValue = hb_vmPopNumber() >= ( double ) lValue;
}
else if( hb_objHasOperator( pItem, HB_OO_OP_GREATEREQUAL ) )
{
@@ -8417,7 +8411,8 @@ HB_EXPORT void hb_xvmWithObjectMessage( PHB_SYMB pSymbol )
{
HB_TRACE(HB_TR_DEBUG, ("hb_xvmWithObjectMessage(%p)", pSymbol));
hb_vmPushSymbol( pSymbol );
if( pSymbol )
hb_vmPushSymbol( pSymbol );
hb_vmPush( hb_stackWithObjectItem() );
}