From 22b6c06fce27e4c7f5976ddd6ba3a5bf375fba22 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 4 Sep 2006 17:45:53 +0000 Subject: [PATCH] 2006-09-04 19:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/TODO + added simpler example for memory leak in macro compiler: ? type("user input") * harbour/source/macro/macro.y * replaced TABs with SPACEs * harbour/source/vm/classes.c * added some TRACE() messages + added support for executing functions with :EXEC() registered dynamically after creating * harbour/source/vm/hvm.c * minor modification --- harbour/ChangeLog | 16 ++++++++++++++++ harbour/TODO | 7 +++++++ harbour/source/macro/macro.y | 2 +- harbour/source/vm/classes.c | 31 ++++++++++++++++++++++++++----- harbour/source/vm/hvm.c | 4 ++-- 5 files changed, 52 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c2130ccbdc..abd8f18c17 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,22 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ + +2006-09-05 12:44 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu) + * harbour/source/debug/debugger.prg + ! Fixed and made multiplatform the filename extension handling parts. + + * harbour/source/vm/memvars.c + ! Comment minor fixes. + + * harbour/harbour.spec + * harbour/make_xmingw.sh + * harbour/make_bsd.sh + * harbour/make_drw.sh + ! xharbour -> harbour + +2006-09-04 19:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/TODO + added simpler example for memory leak in macro compiler: ? type("user input") diff --git a/harbour/TODO b/harbour/TODO index d5ee27484c..0313d1fb6c 100644 --- a/harbour/TODO +++ b/harbour/TODO @@ -262,6 +262,13 @@ Detail...: An error in the evaluated macro cause memory leak. | obj\b32\macroy.c#3799 | source\vm\MACRO.C#153 `- + This is simpler example of the same problem: + + --tt2b.prg-- + proc test + ? type("user input") + return + Status...: Open. ======================================================================= diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 2a9b1b60ad..17068aa8ed 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -340,7 +340,7 @@ MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 ); { /* invalid variable name */ - HB_TRACE(HB_TR_DEBUG, ("macro -> invalid variable name: %s", $1)); + HB_TRACE(HB_TR_DEBUG, ("macro -> invalid variable name: %s", $1)); hb_xfree( $1 ); YYABORT; diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index 760113d428..9dcc2c090e 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -393,8 +393,13 @@ static void hb_clsDictInit( PCLASS pClass, USHORT uiHashKey ) static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) { - PMETHOD pMethod = pClass->pMethods + hb_clsMsgBucket( pMsg, pClass->uiHashKey - 1 ); - USHORT uiBucket = BUCKETSIZE; + PMETHOD pMethod; + USHORT uiBucket; + + HB_TRACE(HB_TR_DEBUG, ("hb_clsFindMsg(%p,%p)", pClass, pMsg)); + + pMethod = pClass->pMethods + hb_clsMsgBucket( pMsg, pClass->uiHashKey - 1 ); + uiBucket = BUCKETSIZE; do { @@ -409,6 +414,8 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) { + HB_TRACE(HB_TR_DEBUG, ("hb_clsAllocMsg(%p,%p)", pClass, pMsg)); + do { PMETHOD pMethod = pClass->pMethods + hb_clsMsgBucket( pMsg, pClass->uiHashKey - 1 ); @@ -429,8 +436,13 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) { - PMETHOD pMethod = pClass->pMethods + hb_clsMsgBucket( pMsg, pClass->uiHashKey - 1 ); - USHORT uiBucket = BUCKETSIZE; + PMETHOD pMethod; + USHORT uiBucket; + + HB_TRACE(HB_TR_DEBUG, ("hb_clsFreeMsg(%p,%p)", pClass, pMsg)); + + pMethod = pClass->pMethods + hb_clsMsgBucket( pMsg, pClass->uiHashKey - 1 ); + uiBucket = BUCKETSIZE; do { @@ -456,11 +468,14 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) while( --uiBucket ); } + static void hb_clsAddInitValue( PCLASS pClass, PHB_ITEM pItem, USHORT uiType, USHORT uiData ) { PINITDATA pInitData; + HB_TRACE(HB_TR_DEBUG, ("hb_clsAddInitValue(%p,%p,%hu,%hu)", pClass, pMsg, uiType, uiData)); + if( ! pClass->uiInitDatas ) pClass->pInitData = ( PINITDATA ) hb_xgrab( sizeof( INITDATA ) ); else @@ -1090,7 +1105,13 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, PHB_STACK_STATE p else if( HB_IS_SYMBOL( pObject ) ) { if( pMsg == s___msgExec.pDynSym ) - return pObject->item.asSymbol.value; + { + if( ! pObject->item.asSymbol.value->value.pFunPtr && + pObject->item.asSymbol.value->pDynSym ) + return pObject->item.asSymbol.value->pDynSym->pSymbol; + else + return pObject->item.asSymbol.value; + } else if( pMsg == s___msgName.pDynSym ) { hb_itemPutC( hb_stackReturnItem(), diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 2399acbef4..2e06ee21d1 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -4273,8 +4273,8 @@ static void hb_vmFrame( BYTE bLocals, BYTE bParams ) iTotal = bLocals + bParams; if( iTotal ) { - int i = iTotal - hb_pcount(); - while( i-- > 0 ) + iTotal -= hb_pcount(); + while( --iTotal >= 0 ) hb_vmPushNil(); } }