From 49a289a1a3d02869a60ed0117fa226f7011f5683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Tue, 24 Mar 2020 23:34:35 +0100 Subject: [PATCH] 2020-03-24 23:34 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * config/linux/clang.mk ! fixed rule for dynamic library * src/3rd/png/Makefile + added -DPNG_ARM_NEON_OPT=0 to build flags * contrib/3rd/sqlite3/sqlite3.c * contrib/3rd/sqlite3/sqlite3.diff ! pacified warning * contrib/gtwvg/gtwvgd.c * contrib/gtwvg/wvgwing.c ! fixed missing break/return in case statements - please verify it. * contrib/hbct/dattime3.c * added #define _DEFAULT_SOURCE necessay in new Linux distors * contrib/hblzf/3rd/liblzf/liblzf.diff * contrib/hblzf/3rd/liblzf/lzfP.h * do not use nested #define in #if statements - some C compilers do not support it * contrib/hbssl/bio.c ! tuned #if condition * contrib/hbmisc/hbeditc.c * simpliefied for condition and pacified warning * contrib/hbodbc/hbodbc.hbp * contrib/sddodbc/sddodbc.hbp + added check for iodbc library * utils/hbmk2/hbmk2.prg + added support for clang in android builds * include/hbdefs.h + added check for __BYTE_ORDER__ macro used in some new lib C implementations * include/hbapi.h * include/hbdefs.h * include/hbstack.h * include/hbvmpub.h * src/vm/classes.c * src/vm/dynsym.c * src/vm/estack.c * src/vm/memvars.c + extended the size of dynamic symbol table from 65535 to 4294967295. Adopting class code I decided to keep current algorithm of method indexes hashing with only some minor modifications. It's very fast anyhow it may cause noticeable (though static) quite big memory allocation for class definitions in applications using millions of symbols and which increase dynamic symbol table at runtime loading new classes dynamically form .hrb, .dll, .so or other dynamic libraries supported by Harbour. It's random and rather impossible to exploit situation in real life anyhow I cannot exclude it so I'd like to report it in ChangeLog. The solution is very simple, i.e. it's enough to use classic divide et impera algorithm using symbol numbers to find method definition anyhow it will be slower then current one and address only very seldom hypothetical situations so I decided to not implement it. Such static memory cost begins to be completely unimportant in the world of 64-bit architectures and extremely big memory address space. The modification was sponsored by TRES company. * src/vm/estack.c ! fixed __mvClear() in MT builds - due to stupid typo GetList variable was removed in MT programs by CLEAR MEMORY command (__mvClear()) So far noone reported it and I've found it analyzing the code before increasing symbol table size. * contrib/hbwin/hbolesrv.c * updated for new size of dynamic symbol table --- ChangeLog.txt | 74 ++++++++++++++++++++++++++++ config/linux/clang.mk | 2 +- contrib/3rd/sqlite3/sqlite3.c | 3 +- contrib/3rd/sqlite3/sqlite3.diff | 16 ++++-- contrib/gtwvg/gtwvgd.c | 3 +- contrib/gtwvg/wvgwing.c | 1 + contrib/hbct/dattime3.c | 3 ++ contrib/hblzf/3rd/liblzf/liblzf.diff | 52 ++++++++++++++----- contrib/hblzf/3rd/liblzf/lzfP.h | 17 +++++-- contrib/hbmisc/hbeditc.c | 7 +-- contrib/hbodbc/hbodbc.hbp | 1 + contrib/hbssl/bio.c | 2 +- contrib/hbwin/hbolesrv.c | 2 +- contrib/sddodbc/sddodbc.hbp | 1 + include/hbapi.h | 4 +- include/hbdefs.h | 11 +++-- include/hbstack.h | 8 +-- include/hbvmpub.h | 2 +- src/3rd/png/Makefile | 1 + src/vm/classes.c | 46 ++++++++--------- src/vm/dynsym.c | 64 ++++++++++++------------ src/vm/estack.c | 51 ++++++++++--------- src/vm/memvars.c | 6 +-- utils/hbmk2/hbmk2.prg | 14 ++++-- 24 files changed, 268 insertions(+), 123 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 92f1a71313..8f21287a05 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -92,6 +92,80 @@ 2016-07-04 19:01 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) https://github.com/harbour/core/commit/8465bce36bbfab6026673f1c597a91028f96079a +2020-03-24 23:34 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * config/linux/clang.mk + ! fixed rule for dynamic library + + * src/3rd/png/Makefile + + added -DPNG_ARM_NEON_OPT=0 to build flags + + * contrib/3rd/sqlite3/sqlite3.c + * contrib/3rd/sqlite3/sqlite3.diff + ! pacified warning + + * contrib/gtwvg/gtwvgd.c + * contrib/gtwvg/wvgwing.c + ! fixed missing break/return in case statements - please verify it. + + * contrib/hbct/dattime3.c + * added #define _DEFAULT_SOURCE necessay in new Linux distors + + * contrib/hblzf/3rd/liblzf/liblzf.diff + * contrib/hblzf/3rd/liblzf/lzfP.h + * do not use nested #define in #if statements - some C compilers do not + support it + + * contrib/hbssl/bio.c + ! tuned #if condition + + * contrib/hbmisc/hbeditc.c + * simpliefied for condition and pacified warning + + * contrib/hbodbc/hbodbc.hbp + * contrib/sddodbc/sddodbc.hbp + + added check for iodbc library + + * utils/hbmk2/hbmk2.prg + + added support for clang in android builds + + * include/hbdefs.h + + added check for __BYTE_ORDER__ macro used in some new lib C + implementations + + * include/hbapi.h + * include/hbdefs.h + * include/hbstack.h + * include/hbvmpub.h + * src/vm/classes.c + * src/vm/dynsym.c + * src/vm/estack.c + * src/vm/memvars.c + + extended the size of dynamic symbol table from 65535 to 4294967295. + Adopting class code I decided to keep current algorithm of method indexes + hashing with only some minor modifications. It's very fast anyhow it may + cause noticeable (though static) quite big memory allocation for class + definitions in applications using millions of symbols and which increase + dynamic symbol table at runtime loading new classes dynamically form .hrb, + .dll, .so or other dynamic libraries supported by Harbour. It's random + and rather impossible to exploit situation in real life anyhow I cannot + exclude it so I'd like to report it in ChangeLog. The solution is very + simple, i.e. it's enough to use classic divide et impera algorithm using + symbol numbers to find method definition anyhow it will be slower then + current one and address only very seldom hypothetical situations so I + decided to not implement it. Such static memory cost begins to be + completely unimportant in the world of 64-bit architectures and extremely + big memory address space. + The modification was sponsored by TRES company. + + * src/vm/estack.c + ! fixed __mvClear() in MT builds - due to stupid typo GetList variable + was removed in MT programs by CLEAR MEMORY command (__mvClear()) + So far noone reported it and I've found it analyzing the code before + increasing symbol table size. + + * contrib/hbwin/hbolesrv.c + * updated for new size of dynamic symbol table + 2019-12-03 11:42 UTC+0100 Maurizio la Cecilia (m.lacecilia/at/gmail.com) * ChangeLog.txt * restored UTF-8 encoding after previous wrong commit (Sorry!!!) diff --git a/config/linux/clang.mk b/config/linux/clang.mk index 1fae39827a..254b0758d8 100644 --- a/config/linux/clang.mk +++ b/config/linux/clang.mk @@ -59,6 +59,6 @@ DFLAGS += -shared $(LIBPATHS) DY_OUT := -o$(subst x,x, ) DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) -DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT) +DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && ([ "$(@F)" = "$(notdir $(DYN_FILE_NVR))" ] || $(LN) $(@F) $(DYN_FILE_NVR)) && ([ "$(@F)" = "$(notdir $(DYN_FILE_CPT))" ] || $(LN) $(@F) $(DYN_FILE_CPT)) include $(TOP)$(ROOT)config/rules.mk diff --git a/contrib/3rd/sqlite3/sqlite3.c b/contrib/3rd/sqlite3/sqlite3.c index f7fface35c..f7d0bc6133 100644 --- a/contrib/3rd/sqlite3/sqlite3.c +++ b/contrib/3rd/sqlite3/sqlite3.c @@ -73689,7 +73689,8 @@ static int vdbeSorterIterRead( /* Copy as much data as is available in the buffer into the start of ** p->aAlloc[]. */ - memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); + if( nAvail > 0 ) + memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); p->iReadOff += nAvail; nRem = nByte - nAvail; diff --git a/contrib/3rd/sqlite3/sqlite3.diff b/contrib/3rd/sqlite3/sqlite3.diff index 0f8f884eaa..8d5a26c8d1 100644 --- a/contrib/3rd/sqlite3/sqlite3.diff +++ b/contrib/3rd/sqlite3/sqlite3.diff @@ -1,6 +1,6 @@ -diff -urN sqlite3.orig/sqlite3.c sqlite3/sqlite3.c ---- sqlite3.orig/sqlite3.c 2014-02-02 19:05:51.208012486 +0100 -+++ sqlite3/sqlite3.c 2014-02-02 19:05:51.216012487 +0100 +diff --strip-trailing-cr -urN sqlite3.orig/sqlite3.c sqlite3/sqlite3.c +--- sqlite3.orig/sqlite3.c 2013-12-06 15:05:16.000000000 +0000 ++++ sqlite3/sqlite3.c 2019-04-22 18:53:05.000000000 +0000 @@ -27008,7 +27008,11 @@ ** is the same technique used by glibc to implement posix_fallocate() ** on systems that do not have a real fallocate() system call. @@ -34,3 +34,13 @@ diff -urN sqlite3.orig/sqlite3.c sqlite3/sqlite3.c uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); uTm.dwHighDateTime= (DWORD)(t64 >> 32); osFileTimeToLocalFileTime(&uTm,&lTm); +@@ -73680,7 +73689,8 @@ + + /* Copy as much data as is available in the buffer into the start of + ** p->aAlloc[]. */ +- memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); ++ if( nAvail > 0 ) ++ memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); + p->iReadOff += nAvail; + nRem = nByte - nAvail; + diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index aa31be0422..c2f763981a 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -2013,8 +2013,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_itemPutNInt( pEvParams, ( HB_MAXINT ) ( HB_PTRUINT ) hWnd ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_PAINT, pEvParams ); } - return 0; } + return 0; case WM_HSCROLL: { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -2115,6 +2115,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case WM_LBUTTONUP: SetFocus( hWnd ); + /* fallthrough */ case WM_RBUTTONDOWN: case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: diff --git a/contrib/gtwvg/wvgwing.c b/contrib/gtwvg/wvgwing.c index 7bf5e637de..4bfa09fea9 100644 --- a/contrib/gtwvg/wvgwing.c +++ b/contrib/gtwvg/wvgwing.c @@ -477,6 +477,7 @@ HB_FUNC( WVG_STATUSBARCREATEPANEL ) hb_retl( HB_TRUE ); return; } + break; } case -1: { diff --git a/contrib/hbct/dattime3.c b/contrib/hbct/dattime3.c index 38a39eb88d..e60889845d 100644 --- a/contrib/hbct/dattime3.c +++ b/contrib/hbct/dattime3.c @@ -49,6 +49,9 @@ #ifndef _SVID_SOURCE #define _SVID_SOURCE #endif +#ifndef _DEFAULT_SOURCE +#define _DEFAULT_SOURCE +#endif #include "hbapi.h" #include "hbdate.h" diff --git a/contrib/hblzf/3rd/liblzf/liblzf.diff b/contrib/hblzf/3rd/liblzf/liblzf.diff index 492ce65e4e..3216e862ba 100644 --- a/contrib/hblzf/3rd/liblzf/liblzf.diff +++ b/contrib/hblzf/3rd/liblzf/liblzf.diff @@ -1,6 +1,6 @@ -diff -urN liblzf.orig/lzf_c.c liblzf/lzf_c.c ---- liblzf.orig/lzf_c.c 2011-06-12 13:27:46.566657457 +0200 -+++ liblzf/lzf_c.c 2011-06-12 13:27:46.566657457 +0200 +diff --strip-trailing-cr -urN liblzf.orig/lzf_c.c liblzf/lzf_c.c +--- liblzf.orig/lzf_c.c 2010-06-01 09:11:20.000000000 +0000 ++++ liblzf/lzf_c.c 2017-02-02 15:09:36.000000000 +0000 @@ -120,7 +120,7 @@ * special workaround for it. */ @@ -10,9 +10,9 @@ diff -urN liblzf.orig/lzf_c.c liblzf/lzf_c.c #else unsigned long off; #endif -diff -urN liblzf.orig/lzf.h liblzf/lzf.h ---- liblzf.orig/lzf.h 2011-06-12 13:27:46.564657718 +0200 -+++ liblzf/lzf.h 2011-06-12 13:27:46.564657718 +0200 +diff --strip-trailing-cr -urN liblzf.orig/lzf.h liblzf/lzf.h +--- liblzf.orig/lzf.h 2008-08-25 01:40:29.000000000 +0000 ++++ liblzf/lzf.h 2017-02-02 15:09:36.000000000 +0000 @@ -37,6 +37,10 @@ #ifndef LZF_H #define LZF_H @@ -34,15 +34,45 @@ diff -urN liblzf.orig/lzf.h liblzf/lzf.h + #endif -diff -urN liblzf.orig/lzfP.h liblzf/lzfP.h ---- liblzf.orig/lzfP.h 2011-06-12 13:27:46.568657801 +0200 -+++ liblzf/lzfP.h 2011-06-12 13:27:46.568657801 +0200 -@@ -141,7 +141,7 @@ +diff --strip-trailing-cr -urN liblzf.orig/lzfP.h liblzf/lzfP.h +--- liblzf.orig/lzfP.h 2010-06-01 08:16:09.000000000 +0000 ++++ liblzf/lzfP.h 2019-05-23 06:43:27.000000000 +0000 +@@ -79,7 +79,11 @@ + * Unconditionally aligning does not cost very much, so do it if unsure + */ + #ifndef STRICT_ALIGN +-# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) ++# if defined(__i386) || defined (__amd64) ++# define STRICT_ALIGN 0 ++# else ++# define STRICT_ALIGN 1 ++# endif + #endif + + /* +@@ -141,15 +145,22 @@ #endif #ifndef LZF_USE_OFFSETS -# if defined (WIN32) +-# define LZF_USE_OFFSETS defined(_M_X64) +# if defined (WIN32) || defined(_WIN32) - # define LZF_USE_OFFSETS defined(_M_X64) ++# if defined(_M_X64) ++# define LZF_USE_OFFSETS 1 ++# endif # else # if __cplusplus > 199711L + # include + # else + # include + # endif +-# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) ++# if (UINTPTR_MAX > 0xffffffffU) ++# define LZF_USE_OFFSETS 1 ++# endif ++# endif ++# ifndef LZF_USE_OFFSETS ++# define LZF_USE_OFFSETS 0 + # endif + #endif + diff --git a/contrib/hblzf/3rd/liblzf/lzfP.h b/contrib/hblzf/3rd/liblzf/lzfP.h index 97c56b2c88..5b0f4a89a0 100644 --- a/contrib/hblzf/3rd/liblzf/lzfP.h +++ b/contrib/hblzf/3rd/liblzf/lzfP.h @@ -79,7 +79,11 @@ * Unconditionally aligning does not cost very much, so do it if unsure */ #ifndef STRICT_ALIGN -# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) +# if defined(__i386) || defined (__amd64) +# define STRICT_ALIGN 0 +# else +# define STRICT_ALIGN 1 +# endif #endif /* @@ -142,14 +146,21 @@ using namespace std; #ifndef LZF_USE_OFFSETS # if defined (WIN32) || defined(_WIN32) -# define LZF_USE_OFFSETS defined(_M_X64) +# if defined(_M_X64) +# define LZF_USE_OFFSETS 1 +# endif # else # if __cplusplus > 199711L # include # else # include # endif -# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) +# if (UINTPTR_MAX > 0xffffffffU) +# define LZF_USE_OFFSETS 1 +# endif +# endif +# ifndef LZF_USE_OFFSETS +# define LZF_USE_OFFSETS 0 # endif #endif diff --git a/contrib/hbmisc/hbeditc.c b/contrib/hbmisc/hbeditc.c index 1f8cc6f961..d52712026c 100644 --- a/contrib/hbmisc/hbeditc.c +++ b/contrib/hbmisc/hbeditc.c @@ -123,13 +123,10 @@ static HB_ISIZ Prev( PHB_EDITOR pEd, HB_ISIZ adres ) { HB_ISIZ i; - for( i = adres; i >= 0; i-- ) + for( i = adres - 3; i >= 0; i-- ) { if( pEd->begin[ i ] == '\n' ) - { - if( i < adres - 2 ) - return i + 1; - } + return i + 1; } return 0; } diff --git a/contrib/hbodbc/hbodbc.hbp b/contrib/hbodbc/hbodbc.hbp index e161ea5f3a..08fb22d9ee 100644 --- a/contrib/hbodbc/hbodbc.hbp +++ b/contrib/hbodbc/hbodbc.hbp @@ -14,6 +14,7 @@ -depcontrol=odbc:force{allwin&!msvcarm} -depincpath=odbc:/usr/include -depincpath=odbc:/usr/local/include +-depincpath=odbc:/usr/include/iodbc ${hb_name}.hbx diff --git a/contrib/hbssl/bio.c b/contrib/hbssl/bio.c index 4ca18dba51..ab3a143192 100644 --- a/contrib/hbssl/bio.c +++ b/contrib/hbssl/bio.c @@ -762,7 +762,7 @@ HB_FUNC( BIO_GET_CONN_INT_PORT ) OPENSSL_VERSION_NUMBER == 0x1000112fL /* 1.0.1r */ /* Fix for header regression */ hb_retnl( BIO_ctrl( bio, BIO_C_GET_CONNECT, 3, NULL ) ); -#elif OPENSSL_VERSION_NUMBER >= 0x10101000L +#elif OPENSSL_VERSION_NUMBER >= 0x1010007fL const BIO_ADDR * ba = BIO_get_conn_address( bio ); hb_retnl( ba ? hb_socketNToHS( BIO_ADDR_rawport( ba ) ) : 0 ); #else diff --git a/contrib/hbwin/hbolesrv.c b/contrib/hbwin/hbolesrv.c index 9fe23aa858..23dbe8b5ef 100644 --- a/contrib/hbwin/hbolesrv.c +++ b/contrib/hbwin/hbolesrv.c @@ -93,7 +93,7 @@ static DISPID hb_dynsymToDispId( PHB_DYNS pDynSym ) static PHB_DYNS hb_dispIdToDynsym( DISPID dispid ) { if( ( LONG ) dispid > 0 ) - return hb_dynsymFromNum( ( int ) dispid ); + return hb_dynsymFromNum( ( HB_SYMCNT ) dispid ); else return NULL; } diff --git a/contrib/sddodbc/sddodbc.hbp b/contrib/sddodbc/sddodbc.hbp index f37607a612..718d255d69 100644 --- a/contrib/sddodbc/sddodbc.hbp +++ b/contrib/sddodbc/sddodbc.hbp @@ -16,6 +16,7 @@ rddsql.hbc -depcontrol=odbc:force{allwin&!msvcarm} -depincpath=odbc:/usr/include -depincpath=odbc:/usr/local/include +-depincpath=odbc:/usr/include/iodbc ${hb_name}.hbx diff --git a/include/hbapi.h b/include/hbapi.h index e2974fed58..5b7154acf2 100644 --- a/include/hbapi.h +++ b/include/hbapi.h @@ -1040,8 +1040,8 @@ extern HB_EXPORT HB_BOOL hb_dynsymIsFunction( PHB_DYNS pDynSym ); extern HB_EXPORT HB_BOOL hb_dynsymIsMemvar( PHB_DYNS pDynSym ); extern HB_EXPORT int hb_dynsymAreaHandle( PHB_DYNS pDynSym ); /* return work area number bound with given dynamic symbol */ extern HB_EXPORT void hb_dynsymSetAreaHandle( PHB_DYNS pDynSym, int iArea ); /* set work area number for a given dynamic symbol */ -extern HB_EXPORT int hb_dynsymToNum( PHB_DYNS pDynSym ); -extern HB_EXPORT PHB_DYNS hb_dynsymFromNum( int iSymNum ); +extern HB_EXPORT HB_SYMCNT hb_dynsymToNum( PHB_DYNS pDynSym ); +extern HB_EXPORT PHB_DYNS hb_dynsymFromNum( HB_SYMCNT iSymNum ); #ifdef _HB_API_INTERNAL_ extern PHB_ITEM hb_dynsymGetMemvar( PHB_DYNS pDynSym ); /* return memvar handle number bound with given dynamic symbol */ extern void hb_dynsymSetMemvar( PHB_DYNS pDynSym, PHB_ITEM pMemvar ); /* set memvar handle for a given dynamic symbol */ diff --git a/include/hbdefs.h b/include/hbdefs.h index 7808eda21e..28d2c351e6 100644 --- a/include/hbdefs.h +++ b/include/hbdefs.h @@ -466,6 +466,8 @@ typedef HB_UCHAR HB_U8; typedef HB_MAXINT HB_VMMAXINT; typedef HB_MAXUINT HB_VMMAXUINT; +typedef HB_U32 HB_SYMCNT; + #define HB_DBL_LIM_INT(d) ( HB_VMINT_MIN <= (d) && (d) <= HB_VMINT_MAX ) #define HB_DBL_LIM_LONG(d) ( (HB_MAXDBL) HB_VMLONG_MIN <= (HB_MAXDBL) (d) && (HB_MAXDBL) (d) <= (HB_MAXDBL) HB_VMLONG_MAX ) #define HB_LIM_INT(l) ( HB_VMINT_MIN <= (l) && (l) <= HB_VMINT_MAX ) @@ -669,19 +671,22 @@ typedef HB_U32 HB_FATTR; # define HB_BIG_ENDIAN -# elif ( defined( __BYTE_ORDER ) && defined( __LITTLE_ENDIAN ) && __BYTE_ORDER == __LITTLE_ENDIAN ) || \ +# elif ( defined( __BYTE_ORDER__ ) && defined( __LITTLE_ENDIAN__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__ ) || \ + ( defined( __BYTE_ORDER ) && defined( __LITTLE_ENDIAN ) && __BYTE_ORDER == __LITTLE_ENDIAN ) || \ ( defined( _BYTE_ORDER ) && defined( _LITTLE_ENDIAN ) && _BYTE_ORDER == _LITTLE_ENDIAN ) || \ ( defined( BYTE_ORDER ) && defined( LITTLE_ENDIAN ) && BYTE_ORDER == LITTLE_ENDIAN ) # define HB_LITTLE_ENDIAN -# elif ( defined( __BYTE_ORDER ) && defined( __BIG_ENDIAN ) && __BYTE_ORDER == __BIG_ENDIAN ) || \ +# elif ( defined( __BYTE_ORDER__ ) && defined( __BIG_ENDIAN__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__ ) || \ + ( defined( __BYTE_ORDER ) && defined( __BIG_ENDIAN ) && __BYTE_ORDER == __BIG_ENDIAN ) || \ ( defined( _BYTE_ORDER ) && defined( _BIG_ENDIAN ) && _BYTE_ORDER == _BIG_ENDIAN ) || \ ( defined( BYTE_ORDER ) && defined( BIG_ENDIAN ) && BYTE_ORDER == BIG_ENDIAN ) # define HB_BIG_ENDIAN -# elif ( defined( __BYTE_ORDER ) && defined( __PDP_ENDIAN ) && __BYTE_ORDER == __PDP_ENDIAN ) || \ +# elif ( defined( __BYTE_ORDER__ ) && defined( __PDP_ENDIAN__ ) && __BYTE_ORDER__ == __PDP_ENDIAN__ ) || \ + ( defined( __BYTE_ORDER ) && defined( __PDP_ENDIAN ) && __BYTE_ORDER == __PDP_ENDIAN ) || \ ( defined( _BYTE_ORDER ) && defined( _PDP_ENDIAN ) && _BYTE_ORDER == _PDP_ENDIAN ) || \ ( defined( BYTE_ORDER ) && defined( PDP_ENDIAN ) && BYTE_ORDER == PDP_ENDIAN ) diff --git a/include/hbstack.h b/include/hbstack.h index eba76643c4..95924e5c20 100644 --- a/include/hbstack.h +++ b/include/hbstack.h @@ -173,7 +173,7 @@ typedef struct #if defined( HB_MT_VM ) int iUnlocked; /* counter for nested hb_vmUnlock() calls */ PHB_DYN_HANDLES pDynH; /* dynamic symbol handles */ - int iDynH; /* number of dynamic symbol handles */ + HB_SYMCNT uiDynH; /* number of dynamic symbol handles */ void * pStackLst; /* this stack entry in stack linked list */ HB_IOERRORS IOErrors; /* MT safe buffer for IO errors */ HB_TRACEINFO traceInfo; /* MT safe buffer for HB_TRACE data */ @@ -359,8 +359,8 @@ extern void hb_stackUpdateAllocator( void *, PHB_ALLOCUPDT_FUNC, int ); extern void hb_stackListSet( void * pStackLst ); extern void hb_stackIdSetActionRequest( void * pStackID, HB_USHORT uiAction ); extern PHB_DYN_HANDLES hb_stackGetDynHandle( PHB_DYNS pDynSym ); - extern int hb_stackDynHandlesCount( void ); - extern void hb_stackClearMemvars( int ); + extern HB_SYMCNT hb_stackDynHandlesCount( void ); + extern void hb_stackClearMemvars( HB_SYMCNT ); extern HB_BOOL hb_stackQuitState( void ); extern void hb_stackSetQuitState( HB_USHORT uiState ); extern int hb_stackUnlock( void ); @@ -409,7 +409,7 @@ extern void hb_stackUpdateAllocator( void *, PHB_ALLOCUPDT_FUNC, int ); #if defined( HB_MT_VM ) # define hb_stackList() ( hb_stack.pStackLst ) # define hb_stackListSet( p ) do { hb_stack.pStackLst = ( p ); } while( 0 ) -# define hb_stackDynHandlesCount() ( hb_stack.iDynH ) +# define hb_stackDynHandlesCount() ( hb_stack.uiDynH ) # define hb_stackQuitState( ) ( hb_stack.uiQuitState != 0 ) # define hb_stackSetQuitState( n ) do { hb_stack.uiQuitState = ( n ); } while( 0 ) # define hb_stackUnlock() ( ++hb_stack.iUnlocked ) diff --git a/include/hbvmpub.h b/include/hbvmpub.h index 2463df486a..0082e769da 100644 --- a/include/hbvmpub.h +++ b/include/hbvmpub.h @@ -135,7 +135,7 @@ struct _HB_SYMB; void * pMemvar; /* memvar pointer ( publics & privates ) */ HB_USHORT uiArea; /* Workarea number */ # endif /* ! HB_MT_VM */ - HB_USHORT uiSymNum; /* dynamic symbol number */ + HB_SYMCNT uiSymNum; /* dynamic symbol number */ # if ! defined( HB_NO_PROFILER ) HB_ULONG ulCalls; /* profiler support */ HB_ULONG ulTime; /* profiler support */ diff --git a/src/3rd/png/Makefile b/src/3rd/png/Makefile index 30b988961d..cd9578bef4 100644 --- a/src/3rd/png/Makefile +++ b/src/3rd/png/Makefile @@ -48,6 +48,7 @@ ifeq ($(filter $(HB_COMPILER),poccarm xcc tcc),) ifneq ($(filter $(HB_COMPILER),pocc pocc64 poccarm),) HB_CFLAGS += -DPNG_ALLOCATED endif + HB_CFLAGS += -DPNG_ARM_NEON_OPT=0 include $(TOP)$(ROOT)config/lib.mk else diff --git a/src/vm/classes.c b/src/vm/classes.c index b3aeb59692..c8a9572d09 100644 --- a/src/vm/classes.c +++ b/src/vm/classes.c @@ -167,10 +167,10 @@ typedef struct HB_USHORT uiFriendSyms; /* Number of friend function's symbols */ HB_USHORT uiFriendModule; /* Number of friend symbols in pFriendModule */ HB_USHORT uiMutexOffset; /* Offset in instance area to SYNC method mutex */ - HB_USHORT uiHashKey; + HB_SYMCNT uiHashKey; #ifdef HB_MSG_POOL - HB_USHORT * puiMsgIdx; HB_USHORT uiMethodCount; + HB_SYMCNT * puiMsgIdx; #endif } CLASS, * PCLASS; @@ -179,7 +179,7 @@ typedef struct #define BUCKETMASK ( BUCKETSIZE - 1 ) #define HASHBITS 3 #define HASH_KEY ( ( 1 << HASHBITS ) - 1 ) -#define HASH_KEYMAX ( 1 << ( 16 - BUCKETBITS ) ) +#define HASH_KEYMAX ( 1 << ( 32 - BUCKETBITS ) ) #define hb_clsInited(p) ( (p)->pMethods != NULL ) #define hb_clsBucketPos( p, m ) ( ( (p)->uiSymNum & (m) ) << BUCKETBITS ) @@ -374,7 +374,7 @@ static PHB_ITEM s_pClassMtx = NULL; /* --- */ #if 0 -static HB_USHORT hb_clsBucketPos( PHB_DYNS pMsg, HB_USHORT uiMask ) +static HB_SYMCNT hb_clsBucketPos( PHB_DYNS pMsg, HB_SYMCNT uiMask ) { /* we can use PHB_DYNS address as base for hash key. * This value is perfectly unique and we do not need anything more @@ -408,7 +408,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) HB_SIZE nNewHashKey, nLimit, n; #ifdef HB_MSG_POOL - HB_USHORT * puiMsgIdx; + HB_SYMCNT * puiMsgIdx; #else PMETHOD pNewMethods; #endif @@ -425,15 +425,15 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) hb_errInternal( 6002, "Could not realloc class message in __clsDictRealloc()", NULL, NULL ); #ifdef HB_MSG_POOL - puiMsgIdx = ( HB_USHORT * ) hb_xgrabz( ( nNewHashKey << BUCKETBITS ) * sizeof( HB_USHORT ) ); + puiMsgIdx = ( HB_SYMCNT * ) hb_xgrabz( ( nNewHashKey << BUCKETBITS ) * sizeof( HB_SYMCNT ) ); for( n = 0; n < nLimit; n++ ) { - HB_USHORT uiMsg = pClass->puiMsgIdx[ n ]; + HB_SYMCNT uiMsg = pClass->puiMsgIdx[ n ]; if( pClass->puiMsgIdx[ n ] ) { - HB_USHORT uiBucket = BUCKETSIZE; - HB_USHORT * puiIdx = puiMsgIdx + hb_clsBucketPos( + HB_SYMCNT uiBucket = BUCKETSIZE; + HB_SYMCNT * puiIdx = puiMsgIdx + hb_clsBucketPos( pClass->pMethods[ uiMsg ].pMessage, nNewHashKey - 1 ); do { @@ -457,7 +457,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) } while( n < nLimit ); - pClass->uiHashKey = ( HB_USHORT ) ( nNewHashKey - 1 ); + pClass->uiHashKey = ( HB_SYMCNT ) ( nNewHashKey - 1 ); hb_xfree( pClass->puiMsgIdx ); pClass->puiMsgIdx = puiMsgIdx; @@ -472,7 +472,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) if( pMessage ) { PMETHOD pMethod = pNewMethods + hb_clsBucketPos( pMessage, nNewHashKey - 1 ); - HB_USHORT uiBucket = BUCKETSIZE; + HB_SYMCNT uiBucket = BUCKETSIZE; do { @@ -496,7 +496,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) } while( n < nLimit ); - pClass->uiHashKey = ( HB_USHORT ) ( nNewHashKey - 1 ); + pClass->uiHashKey = ( HB_SYMCNT ) ( nNewHashKey - 1 ); hb_xfree( pClass->pMethods ); pClass->pMethods = pNewMethods; #endif @@ -504,7 +504,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) return HB_TRUE; } -static void hb_clsDictInit( PCLASS pClass, HB_USHORT uiHashKey ) +static void hb_clsDictInit( PCLASS pClass, HB_SYMCNT uiHashKey ) { HB_SIZE nSize; @@ -512,8 +512,8 @@ static void hb_clsDictInit( PCLASS pClass, HB_USHORT uiHashKey ) pClass->uiHashKey = uiHashKey; #ifdef HB_MSG_POOL - nSize = ( ( ( HB_SIZE ) uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_USHORT ); - pClass->puiMsgIdx = ( HB_USHORT * ) hb_xgrabz( nSize ); + nSize = ( ( ( HB_SIZE ) uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_SYMCNT ); + pClass->puiMsgIdx = ( HB_SYMCNT * ) hb_xgrabz( nSize ); pClass->uiMethodCount = 1; pClass->pMethods = ( PMETHOD ) hb_xgrabz( sizeof( METHOD ) ); @@ -527,7 +527,7 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) { #ifdef HB_MSG_POOL - HB_USHORT uiBucket, * puiMsgIdx; + HB_SYMCNT uiBucket, * puiMsgIdx; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); @@ -547,7 +547,7 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) #else PMETHOD pMethod; - HB_USHORT uiBucket; + HB_SYMCNT uiBucket; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); @@ -576,7 +576,7 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) #ifdef HB_MSG_POOL - HB_USHORT uiBucket = BUCKETSIZE, * puiMsgIdx = pClass->puiMsgIdx + + HB_SYMCNT uiBucket = BUCKETSIZE, * puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); do @@ -598,7 +598,7 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) #else PMETHOD pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); - HB_USHORT uiBucket = BUCKETSIZE; + HB_SYMCNT uiBucket = BUCKETSIZE; do { @@ -637,7 +637,7 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) { #ifdef HB_MSG_POOL - HB_USHORT uiBucket, * puiMsgIdx; + HB_SYMCNT uiBucket, * puiMsgIdx; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); @@ -664,7 +664,7 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) #else PMETHOD pMethod; - HB_USHORT uiBucket; + HB_SYMCNT uiBucket; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); @@ -1027,7 +1027,7 @@ static void hb_clsCopyClass( PCLASS pClsDst, PCLASS pClsSrc ) nLimit = hb_clsMthNum( pClsSrc ); #ifdef HB_MSG_POOL memcpy( pClsDst->puiMsgIdx, pClsSrc->puiMsgIdx, - ( ( ( HB_SIZE ) pClsSrc->uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_USHORT ) ); + ( ( ( HB_SIZE ) pClsSrc->uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_SYMCNT ) ); pClsDst->uiMethodCount = pClsSrc->uiMethodCount; pClsDst->pMethods = ( PMETHOD ) hb_xrealloc( pClsDst->pMethods, nLimit * sizeof( METHOD ) ); @@ -1836,7 +1836,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, } #ifdef HB_MSG_POOL { - HB_USHORT uiBucket = BUCKETSIZE, * puiMsgIdx = + HB_SYMCNT uiBucket = BUCKETSIZE, * puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); do diff --git a/src/vm/dynsym.c b/src/vm/dynsym.c index 708ad8ede9..80e13cc34d 100644 --- a/src/vm/dynsym.c +++ b/src/vm/dynsym.c @@ -84,18 +84,18 @@ HB_SYM_HOLDER, * PHB_SYM_HOLDER; static PDYNHB_ITEM s_pDynItems = NULL; /* Pointer to dynamic items */ -static HB_USHORT s_uiDynSymbols = 0; /* Number of symbols present */ +static HB_SYMCNT s_uiDynSymbols = 0; /* Number of symbols present */ static PHB_SYM_HOLDER s_pAllocSyms = NULL;/* symbols allocated dynamically */ /* table index for dynamic symbol to number conversions */ static PDYNHB_ITEM s_pDynIndex = NULL; -static int s_iDynIdxSize = 0; +static HB_SYMCNT s_uiDynIdxSize = 0; /* Insert new symbol into dynamic symbol table. * In MT mode caller should protected it by HB_DYNSYM_LOCK() */ -static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_UINT uiPos ) +static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_SYMCNT uiPos ) { PHB_DYNS pDynSym; @@ -130,9 +130,9 @@ static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_UINT uiPos ) * If not found set position for insert operation. * In MT mode caller should protected it by HB_DYNSYM_LOCK() */ -static PHB_DYNS hb_dynsymPos( const char * szName, HB_UINT * puiPos ) +static PHB_DYNS hb_dynsymPos( const char * szName, HB_SYMCNT * puiPos ) { - HB_UINT uiFirst, uiLast, uiMiddle; + HB_SYMCNT uiFirst, uiLast, uiMiddle; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymPos(%s, %p)", szName, ( void * ) puiPos ) ); @@ -188,7 +188,7 @@ static PHB_SYMB hb_symbolAlloc( const char * szName ) /* Find symbol in dynamic symbol table */ PHB_DYNS hb_dynsymFind( const char * szName ) { - HB_UINT uiFirst, uiLast; + HB_SYMCNT uiFirst, uiLast; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymFind(%s)", szName ) ); @@ -199,7 +199,7 @@ PHB_DYNS hb_dynsymFind( const char * szName ) while( uiFirst < uiLast ) { - HB_UINT uiMiddle = ( uiFirst + uiLast ) >> 1; + HB_SYMCNT uiMiddle = ( uiFirst + uiLast ) >> 1; int iCmp = strcmp( s_pDynItems[ uiMiddle ].pDynSym->pSymbol->szName, szName ); if( iCmp == 0 ) @@ -238,7 +238,7 @@ PHB_SYMB hb_symbolNew( const char * szName ) PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ) { PHB_DYNS pDynSym; - HB_UINT uiPos; + HB_SYMCNT uiPos; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymNew(%p)", ( void * ) pSymbol ) ); @@ -358,7 +358,7 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ) PHB_DYNS hb_dynsymGetCase( const char * szName ) { PHB_DYNS pDynSym; - HB_UINT uiPos; + HB_SYMCNT uiPos; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymGetCase(%s)", szName ) ); @@ -525,43 +525,43 @@ HB_LONG hb_dynsymCount( void ) return s_uiDynSymbols; } -int hb_dynsymToNum( PHB_DYNS pDynSym ) +HB_SYMCNT hb_dynsymToNum( PHB_DYNS pDynSym ) { - int iSymNum; + HB_SYMCNT uiSymNum; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymToNum(%p)", ( void * ) pDynSym ) ); HB_DYNSYM_LOCK(); - iSymNum = pDynSym->uiSymNum; + uiSymNum = pDynSym->uiSymNum; - if( iSymNum > s_iDynIdxSize ) + if( uiSymNum > s_uiDynIdxSize ) { s_pDynIndex = ( PDYNHB_ITEM ) - hb_xrealloc( s_pDynIndex, iSymNum * sizeof( DYNHB_ITEM ) ); - memset( &s_pDynIndex[ s_iDynIdxSize ], 0, ( iSymNum - s_iDynIdxSize ) * - sizeof( DYNHB_ITEM ) ); - s_iDynIdxSize = iSymNum; + hb_xrealloc( s_pDynIndex, uiSymNum * sizeof( DYNHB_ITEM ) ); + memset( &s_pDynIndex[ s_uiDynIdxSize ], 0, ( uiSymNum - s_uiDynIdxSize ) * + sizeof( DYNHB_ITEM ) ); + s_uiDynIdxSize = uiSymNum; } - if( s_pDynIndex[ iSymNum - 1 ].pDynSym == NULL ) - s_pDynIndex[ iSymNum - 1 ].pDynSym = pDynSym; + if( s_pDynIndex[ uiSymNum - 1 ].pDynSym == NULL ) + s_pDynIndex[ uiSymNum - 1 ].pDynSym = pDynSym; HB_DYNSYM_UNLOCK(); - return iSymNum; + return uiSymNum; } -PHB_DYNS hb_dynsymFromNum( int iSymNum ) +PHB_DYNS hb_dynsymFromNum( HB_SYMCNT uiSymNum ) { PHB_DYNS pDynSym; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymFromNum(%d)", iSymNum ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymFromNum(%d)", uiSymNum ) ); HB_DYNSYM_LOCK(); - pDynSym = iSymNum > 0 && iSymNum <= s_iDynIdxSize ? - s_pDynIndex[ iSymNum - 1 ].pDynSym : NULL; + pDynSym = uiSymNum > 0 && uiSymNum <= s_uiDynIdxSize ? + s_pDynIndex[ uiSymNum - 1 ].pDynSym : NULL; HB_DYNSYM_UNLOCK(); @@ -571,7 +571,7 @@ PHB_DYNS hb_dynsymFromNum( int iSymNum ) void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo ) { PHB_DYNS pDynSym = NULL; - HB_USHORT uiPos = 0; + HB_SYMCNT uiPos = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymEval(%p, %p)", ( void * ) pFunction, Cargo ) ); @@ -605,7 +605,7 @@ void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo ) void hb_dynsymProtectEval( PHB_DYNS_FUNC pFunction, void * Cargo ) { - HB_USHORT uiPos = 0; + HB_SYMCNT uiPos = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymProtectEval(%p, %p)", ( void * ) pFunction, Cargo ) ); @@ -626,11 +626,11 @@ void hb_dynsymRelease( void ) HB_DYNSYM_LOCK(); - if( s_iDynIdxSize ) + if( s_uiDynIdxSize ) { hb_xfree( s_pDynIndex ); s_pDynIndex = NULL; - s_iDynIdxSize = 0; + s_uiDynIdxSize = 0; } if( s_uiDynSymbols ) @@ -671,7 +671,7 @@ HB_FUNC( __DYNSGETNAME ) /* Get name of symbol: cSymbol = __dynsymGetName( dsInd HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGetIndex( cSymbol ) */ { HB_STACK_TLS_PRELOAD - HB_UINT uiPos = 0; + HB_SYMCNT uiPos = 0; const char * szName = hb_parc( 1 ); if( szName ) @@ -772,7 +772,7 @@ HB_FUNC( __DYNSP2NAME ) /* internal function used to debug dynamic symbol integrity */ static int hb_dynsymVerify( void ) { - HB_USHORT uiPos = 0; + HB_SYMCNT uiPos = 0; int iResult = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymVerify()" ) ); @@ -782,7 +782,7 @@ static int hb_dynsymVerify( void ) while( iResult == 0 && uiPos < s_uiDynSymbols ) { PHB_DYNS pDynSym = s_pDynItems[ uiPos ].pDynSym; - HB_UINT uiAt; + HB_SYMCNT uiAt; int iCmp; if( uiPos > 0 && @@ -791,7 +791,7 @@ static int hb_dynsymVerify( void ) iResult = iCmp == 0 ? -1 : -2; else if( hb_dynsymPos( pDynSym->pSymbol->szName, &uiAt ) != pDynSym ) iResult = -3; - else if( uiAt != ( HB_UINT ) uiPos ) + else if( uiAt != uiPos ) iResult = -4; else ++uiPos; diff --git a/src/vm/estack.c b/src/vm/estack.c index 74286dd121..ecc84718f4 100644 --- a/src/vm/estack.c +++ b/src/vm/estack.c @@ -235,11 +235,11 @@ static void hb_stack_free( PHB_STACK pStack ) hb_xfree( pStack->pDirBuffer ); pStack->pDirBuffer = NULL; } - if( pStack->iDynH ) + if( pStack->uiDynH ) { hb_xfree( pStack->pDynH ); pStack->pDynH = NULL; - pStack->iDynH = 0; + pStack->uiDynH = 0; } #endif } @@ -396,50 +396,53 @@ void hb_stackIdSetActionRequest( void * pStackId, HB_USHORT uiAction ) } #undef hb_stackDynHandlesCount -int hb_stackDynHandlesCount( void ) +HB_SYMCNT hb_stackDynHandlesCount( void ) { HB_STACK_TLS_PRELOAD HB_TRACE( HB_TR_DEBUG, ( "hb_stackDynHandlesCount()" ) ); - return hb_stack.iDynH; + return hb_stack.uiDynH; } PHB_DYN_HANDLES hb_stackGetDynHandle( PHB_DYNS pDynSym ) { HB_STACK_TLS_PRELOAD - int iDynSym; + HB_SYMCNT uiDynSym; HB_TRACE( HB_TR_DEBUG, ( "hb_stackGetDynHandle()" ) ); - iDynSym = pDynSym->uiSymNum; - if( iDynSym > hb_stack.iDynH ) + uiDynSym = pDynSym->uiSymNum; + if( uiDynSym > hb_stack.uiDynH ) { hb_stack.pDynH = ( PHB_DYN_HANDLES ) hb_xrealloc( hb_stack.pDynH, - iDynSym * sizeof( HB_DYN_HANDLES ) ); - memset( &hb_stack.pDynH[ hb_stack.iDynH ], 0, - ( iDynSym - hb_stack.iDynH ) * sizeof( HB_DYN_HANDLES ) ); - hb_stack.iDynH = iDynSym; + uiDynSym * sizeof( HB_DYN_HANDLES ) ); + memset( &hb_stack.pDynH[ hb_stack.uiDynH ], 0, + ( uiDynSym - hb_stack.uiDynH ) * sizeof( HB_DYN_HANDLES ) ); + hb_stack.uiDynH = uiDynSym; } - return &hb_stack.pDynH[ iDynSym - 1 ]; + return &hb_stack.pDynH[ uiDynSym - 1 ]; } -void hb_stackClearMemvars( int iExcept ) +void hb_stackClearMemvars( HB_SYMCNT uiExcept ) { HB_STACK_TLS_PRELOAD - int iDynSym; + HB_SYMCNT uiDynSym; - HB_TRACE( HB_TR_DEBUG, ( "hb_stackClearMemvars(%d)", iExcept ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stackClearMemvars(%d)", uiExcept ) ); - iDynSym = hb_stack.iDynH; - while( --iDynSym >= 0 ) + uiDynSym = hb_stack.uiDynH; + while( uiDynSym > 0 ) { - if( hb_stack.pDynH[ iDynSym ].pMemvar && iDynSym != iExcept ) + if( uiDynSym-- != uiExcept ) { - PHB_ITEM pMemvar = ( PHB_ITEM ) hb_stack.pDynH[ iDynSym ].pMemvar; - hb_stack.pDynH[ iDynSym ].pMemvar = NULL; - hb_memvarValueDecRef( pMemvar ); + if( hb_stack.pDynH[ uiDynSym ].pMemvar ) + { + PHB_ITEM pMemvar = ( PHB_ITEM ) hb_stack.pDynH[ uiDynSym ].pMemvar; + hb_stack.pDynH[ uiDynSym ].pMemvar = NULL; + hb_memvarValueDecRef( pMemvar ); + } } } } @@ -1320,11 +1323,11 @@ static void hb_stackIsMemvarRef( PHB_STACK pStack ) /* 2. Mark all visible memvars (PRIVATEs and PUBLICs) */ #if defined( HB_MT_VM ) { - int iDynSym = pStack->iDynH; + HB_SYMCNT uiDynSym = pStack->uiDynH; - while( --iDynSym >= 0 ) + while( uiDynSym > 0 ) { - PHB_ITEM pMemvar = ( PHB_ITEM ) pStack->pDynH[ iDynSym ].pMemvar; + PHB_ITEM pMemvar = ( PHB_ITEM ) pStack->pDynH[ --uiDynSym ].pMemvar; if( pMemvar && HB_IS_GCITEM( pMemvar ) ) hb_gcItemRef( pMemvar ); } diff --git a/src/vm/memvars.c b/src/vm/memvars.c index 18f673b7bf..662c798f18 100644 --- a/src/vm/memvars.c +++ b/src/vm/memvars.c @@ -834,10 +834,10 @@ void hb_memvarsClear( HB_BOOL fAll ) #else /* this is a little bit hacked but many times faster version * of memvars clearing because it scans only given thread stack - * not global dynamic symbol table. It noticeable reduce the cost - * of HVM thread releasing. + * not global dynamic symbol table. It noticeable reduces the cost + * of HVM thread releasing [druzus]. */ - hb_stackClearMemvars( pGetList ? ( int ) pGetList->uiSymNum : -1 ); + hb_stackClearMemvars( pGetList ? pGetList->uiSymNum : 0 ); #endif } diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index 481cd732da..5433198393 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -1857,7 +1857,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit CASE hbmk[ _HBMK_cPLAT ] == "sunos" aCOMPSUP := { "gcc", "sunpro", "pcc" } CASE hbmk[ _HBMK_cPLAT ] == "android" - aCOMPSUP := { "gcc", "gccarm" } + aCOMPSUP := { "gcc", "gccarm", "clang" } CASE hbmk[ _HBMK_cPLAT ] == "vxworks" aCOMPSUP := { "gcc", "diab" } CASE hbmk[ _HBMK_cPLAT ] == "aix" @@ -3978,6 +3978,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "minix" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "android" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "beos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "qnx" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "android" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; @@ -4037,8 +4038,13 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], cBin_CompCPP, "icc" ) AAdd( hbmk[ _HBMK_aOPTC ], "-D_GNU_SOURCE" ) CASE hbmk[ _HBMK_cCOMP ] == "clang" - cBin_CompC := hbmk[ _HBMK_cCCPREFIX ] + "clang" + hbmk[ _HBMK_cCCSUFFIX ] - cBin_CompCPP := cBin_CompC + IF hbmk[ _HBMK_cPLAT ] == "android" + cBin_CompCPP := hbmk[ _HBMK_cCCPREFIX ] + "clang++" + hbmk[ _HBMK_cCCSUFFIX ] + cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], cBin_CompCPP, hbmk[ _HBMK_cCCPREFIX ] + "clang" + hbmk[ _HBMK_cCCSUFFIX ] ) + ELSE + cBin_CompC := hbmk[ _HBMK_cCCPREFIX ] + "clang" + hbmk[ _HBMK_cCCSUFFIX ] + cBin_CompCPP := cBin_CompC + ENDIF CASE hbmk[ _HBMK_cCOMP ] == "pcc" cBin_CompC := hbmk[ _HBMK_cCCPREFIX ] + "pcc" + hbmk[ _HBMK_cCCSUFFIX ] CASE hbmk[ _HBMK_cCOMP ] == "open64" @@ -15801,7 +15807,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lMore, lLong ) { "hpux" , "gcc" }, ; { "beos" , "gcc" }, ; { "qnx" , "gcc" }, ; - { "android" , "gcc, gccarm" }, ; + { "android" , "gcc, gccarm, clang" }, ; { "vxworks" , "gcc, diab" }, ; { "symbian" , "gcc" }, ; { "cygwin" , "gcc" }, ;