2009-11-22 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

+ harbour/config/linux/clang.mk
    + added support for CLANG in LINUX builds

  * harbour/include/hbatomic.h
    + added assembler code for SPINLOCKs in WATCOM x86 builds

  * harbour/src/vm/fm.c
    * enabled HB_FM_DLMT_ALLOC by default in MT HVM if HB_FM_DL_ALLOC is
      also enabled

  * harbour/src/vm/dlmalloc.c
    * modifications for non MS-Windows WATCOM builds
      TOFIX: now it compiles in Linux and OS2 builds but it still does not
             work
This commit is contained in:
Przemyslaw Czerpak
2009-11-22 11:38:17 +00:00
parent 46703d3307
commit dc9128c46b
5 changed files with 145 additions and 4 deletions

View File

@@ -17,6 +17,22 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-22 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
+ harbour/config/linux/clang.mk
+ added support for CLANG in LINUX builds
* harbour/include/hbatomic.h
+ added assembler code for SPINLOCKs in WATCOM x86 builds
* harbour/src/vm/fm.c
* enabled HB_FM_DLMT_ALLOC by default in MT HVM if HB_FM_DL_ALLOC is
also enabled
* harbour/src/vm/dlmalloc.c
* modifications for non MS-Windows WATCOM builds
TOFIX: now it compiles in Linux and OS2 builds but it still does not
work
2009-11-22 12:29 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_prn2.c

View File

@@ -0,0 +1,69 @@
#
# $Id: clang.mk 12957 2009-11-21 10:11:32Z vszakats $
#
ifeq ($(HB_BUILD_MODE),cpp)
# -ccc-clang-cxx
HB_CMP := clang
else
HB_CMP := clang
endif
OBJ_EXT := .o
LIB_PREF := lib
LIB_EXT := .a
HB_DYN_COPT := -DHB_DYNLIB -fpic
CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
ifneq ($(filter --analyze, $(HB_USER_CFLAGS)),)
CC_IN :=
else
CC_IN := -c
endif
CC_OUT := -o
CPPFLAGS := -I. -I$(HB_INC_COMPILE)
CFLAGS :=
LDFLAGS :=
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -Wall -W
endif
ifneq ($(HB_BUILD_OPTIM),no)
CFLAGS += -O3
endif
ifeq ($(HB_BUILD_DEBUG),yes)
CFLAGS += -g
endif
ifneq ($(filter $(HB_BUILD_STRIP),all lib),)
ARSTRIP = && strip -S $(LIB_DIR)/$@
endif
ifneq ($(filter $(HB_BUILD_STRIP),all bin),)
LDSTRIP := -s
DYSTRIP := -s
endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
LD_OUT := -o
LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir))
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib))
LDFLAGS += $(LIBPATHS)
AR := $(HB_CCPREFIX)ar
ARFLAGS :=
AR_RULE = ( $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && false )
DY := $(CC)
DFLAGS := -shared $(LIBPATHS)
DY_OUT := -o$(subst x,x, )
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))
DY_RULE = $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE2)
include $(TOP)$(ROOT)config/rules.mk

View File

@@ -337,6 +337,55 @@ HB_EXTERN_BEGIN
# endif
static inline int hb_spinlock_trylock( volatile int * p )
{
int i = 1;
_asm {
mov eax, i
mov edx, p
xchg eax, dword ptr [edx]
mov i, eax
}
return i;
}
static inline void hb_spinlock_acquire( volatile int * l )
{
for( ;; )
{
if( !hb_spinlock_trylock( l ) )
return;
#ifdef HB_SPINLOCK_SLEEP
if( !hb_spinlock_trylock( l ) )
return;
#if defined( HB_TASK_THREAD )
hb_taskYield();
#elif defined( HB_OS_WIN )
Sleep( 0 );
#elif defined( HB_OS_OS2 )
DosSleep( 0 );
#elif defined( __SVR4 )
thr_yield();
#elif defined( HB_OS_UNIX )
sched_yield();
#else
sleep( 0 );
#endif
#endif
}
}
static inline void hb_spinlock_release( volatile int * l )
{
*l = 0;
}
# define HB_SPINLOCK_T volatile int
# define HB_SPINLOCK_INIT 0
# define HB_SPINLOCK_ACQUIRE(l) hb_spinlock_acquire(l)
# define HB_SPINLOCK_RELEASE(l) hb_spinlock_release(l)
# endif /* x86 */
#endif /* ??? C compiler ??? */

View File

@@ -467,11 +467,13 @@ DEFAULT_MMAP_THRESHOLD default: 256K
#endif /* HAVE_MORECORE */
#endif /* DARWIN */
#if defined(HB_OS_OS2) && defined(__WATCOMC__)
#ifndef HAVE_MMAP
#if defined(__WATCOMC__) && !defined(WIN32)
#define HAVE_MMAP 0
#endif
#define HAVE_MORECORE 0
#if !defined(HB_OS_OS2)
#define LACKS_SYS_PARAM_H
#endif /* OS2 */
#endif /* __WATCOMC__ */
#ifndef LACKS_SYS_TYPES_H
#include <sys/types.h> /* For size_t */
@@ -1395,7 +1397,7 @@ static int win32munmap(void* ptr, size_t size) {
unique mparams values are initialized only once.
*/
#if defined( HB_OS_OS2 ) || defined( HB_OS_WIN )
#if defined( HB_OS_OS2 ) || defined( HB_OS_WIN ) || defined( __WATCOMC__ )
# ifndef HB_SPINLOCK_USE
# define HB_SPINLOCK_USE
# endif

View File

@@ -114,6 +114,7 @@
#if defined( HB_FM_STD_ALLOC )
# undef HB_FM_DL_ALLOC
# undef HB_FM_DLMT_ALLOC
# undef HB_FM_WIN_ALLOC
#elif !defined( HB_FM_DL_ALLOC ) && !defined( HB_FM_WIN_ALLOC )
# if defined( _MSC_VER ) || defined( __BORLANDC__ ) || defined( __MINGW32__ ) || \
@@ -135,6 +136,10 @@
/* #define HB_PARANOID_MEM_CHECK */
#if defined( HB_FM_DL_ALLOC )
# if !defined( HB_FM_DLMT_ALLOC ) && !defined( HB_FM_DLMT_ALLOC_OFF ) && \
defined( HB_MT_VM )
# define HB_FM_DLMT_ALLOC
# endif
/* # define NO_MALLINFO 1 */
/* # define INSECURE */
/* # define USE_DL_PREFIX */