2006-02-14 13:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>

* include/hbexprc.c
   * source/compiler/exproptc.c
   * source/macro/macroc.c
      * disabled optimalization of compound assignment for fields
This commit is contained in:
Ryszard Glab
2006-02-14 12:29:11 +00:00
parent 09985cd70d
commit 0e182c922d
4 changed files with 116 additions and 93 deletions

View File

@@ -8,6 +8,13 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* fixed <-x-> match marker
2006-02-14 13:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* include/hbexprc.c
* source/compiler/exproptc.c
* source/macro/macroc.c
* disabled optimalization of compound assignment for fields
2006-02-14 11:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* include/hbapiitm.h
* include/hbcomp.h

View File

@@ -153,61 +153,66 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq )
bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) &&
( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE ) )
{
/* NOTE: direct type change */
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol );
if( pSelf->value.asOperator.pRight->ExprType == HB_ET_NUMERIC ||
pSelf->value.asOperator.pRight->ExprType == HB_ET_STRING ||
pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) )
{
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
if( pSelf->value.asOperator.pRight->ExprType == HB_ET_NUMERIC ||
pSelf->value.asOperator.pRight->ExprType == HB_ET_STRING )
{
/* NOTE: direct type change */
pSelf->value.asOperator.pRight->ExprType = HB_ET_VARREF;
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQ;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQ;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQ;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQ;
break;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQ;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQ;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQ;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQ;
break;
int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol );
if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) )
{
/* NOTE: direct type change */
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
pSelf->value.asOperator.pRight->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQ;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQ;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQ;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQ;
break;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
{
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
/* NOTE: direct type change */
pSelf->value.asOperator.pRight->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQ;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQ;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQ;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQ;
break;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
}
/* push old value */
@@ -267,55 +272,66 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq )
bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) &&
( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE ) )
{
/* NOTE: direct type change */
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol );
if( pSelf->value.asOperator.pRight->ExprType == HB_ET_NUMERIC ||
pSelf->value.asOperator.pRight->ExprType == HB_ET_STRING )
if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) )
{
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
if( pSelf->value.asOperator.pRight->ExprType == HB_ET_NUMERIC ||
pSelf->value.asOperator.pRight->ExprType == HB_ET_STRING )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQPOP;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQPOP;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQPOP;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQPOP;
break;
/* NOTE: direct type change */
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQPOP;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQPOP;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQPOP;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQPOP;
break;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
{
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
/* NOTE: direct type change */
pSelf->value.asOperator.pRight->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQPOP;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQPOP;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQPOP;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQPOP;
break;
int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol );
if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) )
{
/* NOTE: direct type change */
pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF;
pSelf->value.asOperator.pRight->ExprType = HB_ET_VARREF;
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE );
switch( bOpEq )
{
case HB_P_PLUS:
bOpEq = HB_P_PLUSEQPOP;
break;
case HB_P_MINUS:
bOpEq = HB_P_MINUSEQPOP;
break;
case HB_P_MULT:
bOpEq = HB_P_MULTEQPOP;
break;
case HB_P_DIVIDE:
bOpEq = HB_P_DIVEQPOP;
break;
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
}
HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq );
return;
}
}

View File

@@ -5,6 +5,6 @@
/* hbexprc.c is also included from ../macro/macro.c
* However it produces a slighty different code if used in
* macro compiler (there is an additional parameter passed to some functions)
* 1.6 - ignore this magic number - this is used to force compilation
* 1.7 - ignore this magic number - this is used to force compilation
*/
#include "hbexprc.c"

View File

@@ -5,7 +5,7 @@
/* hbexprc.c is also included from ../compiler/exproptc.c
* However it produces a slighty different code if used in
* macro compiler (there is an additional parameter passed to some functions)
* 1.5 - ignore this magic number - this is used to force compilation
* 1.6 - ignore this magic number - this is used to force compilation
*/
#define HB_MACRO_SUPPORT