2015-02-08 23:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/vm/hvm.c
+ added new PRG function:
__BreakBlock() -> {|e| Break( e ) }
* include/hbexprb.c
% replace {|e| Break( e ) } with __BreakBlock() function call.
__BreakBlock() returns exactly the same codeblock on each call
so using it save memory and improve a little bit speed because
it's not necessary to allocate new GC memory block and register
it in GC block list. Additionally in MT mode it eliminates mutex
lock necessary to register new GC block.
This commit is contained in:
@@ -10,6 +10,20 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2015-02-08 23:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* include/harbour.hbx
|
||||
* src/vm/hvm.c
|
||||
+ added new PRG function:
|
||||
__BreakBlock() -> {|e| Break( e ) }
|
||||
|
||||
* include/hbexprb.c
|
||||
% replace {|e| Break( e ) } with __BreakBlock() function call.
|
||||
__BreakBlock() returns exactly the same codeblock on each call
|
||||
so using it save memory and improve a little bit speed because
|
||||
it's not necessary to allocate new GC memory block and register
|
||||
it in GC block list. Additionally in MT mode it eliminates mutex
|
||||
lock necessary to register new GC block.
|
||||
|
||||
2015-02-08 13:19 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/rdd/workarea.c
|
||||
+ added support for field flags in dbCreate()/dbStruct().
|
||||
|
||||
@@ -1300,6 +1300,7 @@ DYNAMIC __AtPrompt
|
||||
DYNAMIC __Box
|
||||
DYNAMIC __BoxD
|
||||
DYNAMIC __BoxS
|
||||
DYNAMIC __BreakBlock
|
||||
DYNAMIC __CapLength
|
||||
DYNAMIC __CapMetrics
|
||||
DYNAMIC __Caption
|
||||
|
||||
@@ -430,8 +430,30 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock )
|
||||
switch( iMessage )
|
||||
{
|
||||
case HB_EA_REDUCE:
|
||||
{
|
||||
PHB_EXPR pExpr = pSelf->value.asCodeblock.pExprList;
|
||||
|
||||
if( pExpr && pExpr->pNext == NULL && pExpr->ExprType == HB_ET_FUNCALL &&
|
||||
pExpr->value.asFunCall.pFunName->ExprType == HB_ET_FUNNAME &&
|
||||
pExpr->value.asFunCall.pFunName->value.asSymbol.funcid == HB_F_BREAK &&
|
||||
pSelf->value.asCodeblock.pLocals != NULL )
|
||||
{
|
||||
PHB_EXPR pParms = pExpr->value.asFunCall.pParms;
|
||||
if( hb_compExprParamListLen( pParms ) == 1 &&
|
||||
pParms->value.asList.pExprList->ExprType == HB_ET_VARIABLE &&
|
||||
strcmp( pSelf->value.asCodeblock.pLocals->szName,
|
||||
pParms->value.asList.pExprList->value.asSymbol.name ) == 0 )
|
||||
{
|
||||
HB_COMP_EXPR_FREE( pSelf );
|
||||
pSelf = HB_COMP_EXPR_NEW( HB_ET_FUNCALL );
|
||||
pSelf->value.asFunCall.pParms = NULL;
|
||||
pSelf->value.asFunCall.pFunName = hb_compExprNewFunName( "__BREAKBLOCK", HB_COMP_PARAM );
|
||||
break;
|
||||
}
|
||||
}
|
||||
pSelf->value.asCodeblock.flags |= HB_BLOCK_REDUCE;
|
||||
break;
|
||||
}
|
||||
case HB_EA_ARRAY_AT:
|
||||
HB_COMP_ERROR_TYPE( pSelf );
|
||||
break;
|
||||
@@ -4541,9 +4563,9 @@ static HB_BOOL hb_compExprCodeblockPush( PHB_EXPR pSelf, int iEarlyEvalPass, HB_
|
||||
pExpr->value.asMacro.SubType |= HB_ET_MACRO_PARE;
|
||||
}
|
||||
|
||||
/* store next expression in case the current will be reduced
|
||||
/* store next expression in case the current will be reduced
|
||||
* NOTE: During reduction the expression can be replaced by the
|
||||
* new one - this will break the linked list of expressions.
|
||||
* new one - this will break the linked list of expressions.
|
||||
*/
|
||||
pNext = pExpr->pNext; /* store next expression in case the current will be reduced */
|
||||
if( ( pSelf->value.asCodeblock.flags & HB_BLOCK_REDUCE ) != 0 ||
|
||||
|
||||
@@ -12322,6 +12322,11 @@ HB_FUNC( __VMMODULESVERIFY )
|
||||
hb_vmVerifySymbols( hb_stackReturnItem() );
|
||||
}
|
||||
|
||||
HB_FUNC( __BREAKBLOCK )
|
||||
{
|
||||
hb_itemReturn( hb_breakBlock() );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_ARRAYTOPARAMS )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
Reference in New Issue
Block a user