From d6d715445625446f24132cf032806cebc16bd2a3 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 13 Mar 2010 00:26:30 +0000 Subject: [PATCH] 2010-03-13 01:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbstack.h * harbour/src/vm/estack.c % declare hb_stack TLS pointer in MT HVM as static when HVM is compiled with HB_HVM_ALL=yes * harbour/src/compiler/hbcomp.c ! added protection against multiple freeing the same expression on some errors in compiled code. It's necessary after removing reference counters which made such protection indirectly. It fixed bug reported by Teo. * harbour/include/hbsetup.h ! check GCC version for hot and cold function attribute macros --- harbour/ChangeLog | 15 +++++++++++++++ harbour/include/hbsetup.h | 10 ++++++---- harbour/include/hbstack.h | 14 +++++++++++--- harbour/src/compiler/hbcomp.c | 2 ++ harbour/src/vm/estack.c | 6 +----- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0c82719229..3e038d8592 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,21 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-13 01:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbstack.h + * harbour/src/vm/estack.c + % declare hb_stack TLS pointer in MT HVM as static when HVM is compiled + with HB_HVM_ALL=yes + + * harbour/src/compiler/hbcomp.c + ! added protection against multiple freeing the same expression on + some errors in compiled code. It's necessary after removing reference + counters which made such protection indirectly. It fixed bug reported + by Teo. + + * harbour/include/hbsetup.h + ! check GCC version for hot and cold function attribute macros + 2010-03-12 14:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/doc/en/class_qapplication.txt * contrib/hbqt/qtgui/QApplication.cpp diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index c96ab97792..0e0ed6bd07 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -468,10 +468,6 @@ __attribute__ (( format (printf, _nStr, _nParam))) #define HB_MALLOC_ATTR \ __attribute__ (( malloc )) - #define HB_HOT_ATTR \ - __attribute__ (( hot )) - #define HB_COLD_ATTR \ - __attribute__ (( cold )) #define HB_PURE_ATTR \ __attribute__ (( pure )) #define HB_CONST_ATTR \ @@ -494,8 +490,14 @@ !defined( __ICC ) && !defined( __OPENCC__ ) #define HB_ALLOC_SIZE_ATTR( _nParam ) \ __attribute__ (( alloc_size (_nParam))) + #define HB_HOT_ATTR \ + __attribute__ (( hot )) + #define HB_COLD_ATTR \ + __attribute__ (( cold )) # else #define HB_ALLOC_SIZE_ATTR( _nParam ) + #define HB_HOT_ATTR + #define HB_COLD_ATTR # endif #define HB_RESTRICT __restrict diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index d9e776e64a..4b4021e72e 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -194,10 +194,18 @@ typedef struct #if defined( HB_STACK_MACROS ) # if defined( HB_MT_VM ) # if defined( HB_USE_TLS ) -# if defined( __BORLANDC__ ) - extern PHB_STACK HB_TLS_ATTR hb_stack_ptr; +# if defined( HB_STACK_LOCAL_MACROS ) +# if defined( __BORLANDC__ ) + static PHB_STACK HB_TLS_ATTR hb_stack_ptr; +# else + static HB_TLS_ATTR PHB_STACK hb_stack_ptr; +# endif # else - extern HB_TLS_ATTR PHB_STACK hb_stack_ptr; +# if defined( __BORLANDC__ ) + extern PHB_STACK HB_TLS_ATTR hb_stack_ptr; +# else + extern HB_TLS_ATTR PHB_STACK hb_stack_ptr; +# endif # endif # else extern HB_TLS_KEY hb_stack_key; diff --git a/harbour/src/compiler/hbcomp.c b/harbour/src/compiler/hbcomp.c index 932d211618..a72f30cd70 100644 --- a/harbour/src/compiler/hbcomp.c +++ b/harbour/src/compiler/hbcomp.c @@ -88,6 +88,8 @@ static void hb_compExprDealloc( HB_COMP_DECL, HB_EXPR_PTR pExpr ) } hb_xfree( pExpItm ); } + else + pExpr->ExprType = HB_ET_NONE; } static HB_EXPR_PTR hb_compExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) diff --git a/harbour/src/vm/estack.c b/harbour/src/vm/estack.c index 849b269178..0278867167 100644 --- a/harbour/src/vm/estack.c +++ b/harbour/src/vm/estack.c @@ -87,14 +87,12 @@ # ifdef HB_USE_TLS /* compiler has native support for TLS */ -# if defined( HB_STACK_MACROS ) +# if defined( HB_STACK_MACROS ) && !defined( HB_STACK_LOCAL_MACROS ) # if defined( __BORLANDC__ ) PHB_STACK HB_TLS_ATTR hb_stack_ptr = NULL; # else HB_TLS_ATTR PHB_STACK hb_stack_ptr = NULL; # endif -# else - static HB_TLS_ATTR PHB_STACK hb_stack_ptr = NULL; # endif # define hb_stack_alloc() do { hb_stack_ptr = ( PHB_STACK ) \ @@ -136,8 +134,6 @@ /* no MT mode */ # if defined( HB_STACK_MACROS ) && !defined( HB_STACK_LOCAL_MACROS ) HB_STACK hb_stack; -# elif !defined( __cplusplus ) - static HB_STACK hb_stack; # endif # define hb_stack_alloc()