From 46ea724aba2fd957e373cb05cad57aa0808bf855 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sun, 7 Jan 2007 18:26:44 +0000 Subject: [PATCH] 2007-01-07 19:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/hvm.c * small modification to protect against creating long references chains which can hardly reduce the performance in some cases --- harbour/ChangeLog | 5 +++++ harbour/source/vm/hvm.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 02be9de1eb..ef5cc589ef 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-01-07 19:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/hvm.c + * small modification to protect against creating long references chains + which can hardly reduce the performance in some cases + 2007-01-07 05:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/makefile.bc * harbour/makefile.vc diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index da5bdfb4a1..9a382b73ca 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -5154,12 +5154,18 @@ static void hb_vmPushLocal( int iLocal ) static void hb_vmPushLocalByRef( int iLocal ) { HB_ITEM_PTR pTop = hb_stackAllocItem(); + HB_TRACE(HB_TR_DEBUG, ("hb_vmPushLocalByRef(%d)", iLocal)); /* we store its stack offset instead of a pointer to support a dynamic stack */ if( iLocal >= 0 ) { - hb_stackLocalVariable( &iLocal ); + PHB_ITEM pLocal = hb_stackLocalVariable( &iLocal ); + if( HB_IS_BYREF( pLocal ) && !HB_IS_ENUM( pLocal ) ) + { + hb_itemCopy( pTop, pLocal ); + return; + } pTop->item.asRefer.BasePtr.itemsbasePtr = hb_stackItemBasePtr(); } else @@ -5167,7 +5173,7 @@ static void hb_vmPushLocalByRef( int iLocal ) /* store direct codeblock address because an item where a codeblock * is stored can be no longer placed on the eval stack at the time * of a codeblock evaluation or variable access - */ + */ pTop->item.asRefer.BasePtr.block = hb_stackSelfItem()->item.asBlock.value; } pTop->type = HB_IT_BYREF;