2009-07-17 16:19 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
% improved macrocompiler speed by reducing number of memory
allocations for compiled subexpressions
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-07-17 16:19 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/macro/macro.y
|
||||
* harbour/source/macro/macro.yyc
|
||||
% improved macrocompiler speed by reducing number of memory
|
||||
allocations for compiled subexpressions
|
||||
|
||||
2009-07-17 13:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* bin/hb-func.sh
|
||||
- Deleted reference to hbfm lib.
|
||||
|
||||
@@ -723,9 +723,12 @@ void yyerror( HB_MACRO_PTR pMacro, const char * s )
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
#define HB_MEXPR_PREALLOC 8
|
||||
|
||||
typedef struct HB_MEXPR_
|
||||
{
|
||||
HB_EXPR Expression;
|
||||
int count;
|
||||
HB_EXPR Expressions[ HB_MEXPR_PREALLOC ];
|
||||
struct HB_MEXPR_ *pPrev;
|
||||
}
|
||||
HB_MEXPR, * HB_MEXPR_PTR;
|
||||
@@ -742,10 +745,16 @@ HB_MIDENT, * HB_MIDENT_PTR;
|
||||
*/
|
||||
static HB_EXPR_PTR hb_macroExprAlloc( HB_COMP_DECL )
|
||||
{
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) hb_xgrab( sizeof( HB_MEXPR ) );
|
||||
pMExpr->pPrev = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
HB_MACRO_DATA->pExprLst = ( void * ) pMExpr;
|
||||
return &pMExpr->Expression;
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
|
||||
if( !pMExpr || pMExpr->count >= HB_MEXPR_PREALLOC )
|
||||
{
|
||||
pMExpr = ( HB_MEXPR_PTR ) hb_xgrab( sizeof( HB_MEXPR ) );
|
||||
pMExpr->pPrev = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
pMExpr->count = 0;
|
||||
HB_MACRO_DATA->pExprLst = ( void * ) pMExpr;
|
||||
}
|
||||
return &pMExpr->Expressions[ pMExpr->count++ ];
|
||||
}
|
||||
|
||||
static void hb_macroIdentNew( HB_COMP_DECL, char * szIdent )
|
||||
@@ -812,7 +821,8 @@ static void hb_macroLstFree( HB_MACRO_PTR pMacro )
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) pMacro->pExprLst;
|
||||
do
|
||||
{
|
||||
hb_macroExprDelete( pMacro, &pMExpr->Expression );
|
||||
while( pMExpr->count )
|
||||
hb_macroExprFree( pMacro, &pMExpr->Expressions[ --pMExpr->count ] );
|
||||
pMExpr = pMExpr->pPrev;
|
||||
}
|
||||
while( pMExpr );
|
||||
|
||||
@@ -3061,9 +3061,12 @@ void yyerror( HB_MACRO_PTR pMacro, const char * s )
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
#define HB_MEXPR_PREALLOC 8
|
||||
|
||||
typedef struct HB_MEXPR_
|
||||
{
|
||||
HB_EXPR Expression;
|
||||
int count;
|
||||
HB_EXPR Expressions[ HB_MEXPR_PREALLOC ];
|
||||
struct HB_MEXPR_ *pPrev;
|
||||
}
|
||||
HB_MEXPR, * HB_MEXPR_PTR;
|
||||
@@ -3080,10 +3083,16 @@ HB_MIDENT, * HB_MIDENT_PTR;
|
||||
*/
|
||||
static HB_EXPR_PTR hb_macroExprAlloc( HB_COMP_DECL )
|
||||
{
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) hb_xgrab( sizeof( HB_MEXPR ) );
|
||||
pMExpr->pPrev = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
HB_MACRO_DATA->pExprLst = ( void * ) pMExpr;
|
||||
return &pMExpr->Expression;
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
|
||||
if( !pMExpr || pMExpr->count >= HB_MEXPR_PREALLOC )
|
||||
{
|
||||
pMExpr = ( HB_MEXPR_PTR ) hb_xgrab( sizeof( HB_MEXPR ) );
|
||||
pMExpr->pPrev = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst;
|
||||
pMExpr->count = 0;
|
||||
HB_MACRO_DATA->pExprLst = ( void * ) pMExpr;
|
||||
}
|
||||
return &pMExpr->Expressions[ pMExpr->count++ ];
|
||||
}
|
||||
|
||||
static void hb_macroIdentNew( HB_COMP_DECL, char * szIdent )
|
||||
@@ -3150,7 +3159,8 @@ static void hb_macroLstFree( HB_MACRO_PTR pMacro )
|
||||
HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) pMacro->pExprLst;
|
||||
do
|
||||
{
|
||||
hb_macroExprDelete( pMacro, &pMExpr->Expression );
|
||||
while( pMExpr->count )
|
||||
hb_macroExprFree( pMacro, &pMExpr->Expressions[ --pMExpr->count ] );
|
||||
pMExpr = pMExpr->pPrev;
|
||||
}
|
||||
while( pMExpr );
|
||||
|
||||
Reference in New Issue
Block a user