diff --git a/.travis.yml b/.travis.yml index 48a3d0d35fc08..fa7b50bccd01d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ notifications: - http://julia.mit.edu:8000/travis-hook before_install: - if [ `uname` = "Linux" ]; then - BUILDOPTS="USEGCC=1 LLVM_CONFIG=llvm-config-3.3 LLVM_LLC=llc-3.3 VERBOSE=1 USE_BLAS64=0"; + BUILDOPTS="USEGCC=1 LLVM_CONFIG=llvm-config-3.3 LLVM_LLC=llc-3.3 VERBOSE=1 USE_BLAS64=0 WITH_GC_VERIFY=1"; for lib in LLVM ZLIB SUITESPARSE ARPACK BLAS FFTW LAPACK GMP MPFR PCRE LIBUNWIND OPENLIBM RMATH; do export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1"; done; diff --git a/Make.inc b/Make.inc index 7b6725e5fd6b1..b068f465f34da 100644 --- a/Make.inc +++ b/Make.inc @@ -65,6 +65,9 @@ USE_LIBCPP = 0 # assume we don't have LIBSSP support in our compiler, will enable later if likely true HAVE_SSP = 0 +# GC debugging options +WITH_GC_VERIFY = 0 + # Prevent picking up $ARCH from the environment variables ARCH= @@ -426,6 +429,11 @@ $(error "please install either GNU tar or bsdtar") endif endif +ifeq ($(WITH_GC_VERIFY), 1) +JCXXFLAGS += -DGC_VERIFY +JCFLAGS += -DGC_VERIFY +endif + # =========================================================================== # Select the cpu architecture to target, or automatically detects the user's compiler diff --git a/contrib/windows/msys_build.sh b/contrib/windows/msys_build.sh index 16f6528f8b828..0a2174e326258 100755 --- a/contrib/windows/msys_build.sh +++ b/contrib/windows/msys_build.sh @@ -146,6 +146,7 @@ $SEVENZIP x -y $f >> get-deps.log echo 'override LLVM_CONFIG = $(JULIAHOME)/usr/bin/llvm-config' >> Make.user if [ -n "$APPVEYOR" ]; then + echo "override WITH_GC_VERIFY = 1" >> Make.user for i in make.exe touch.exe msys-intl-8.dll msys-iconv-2.dll; do f="/c/MinGW/msys/1.0/bin/$i" if [ -e $f ]; then diff --git a/src/gc.c b/src/gc.c index ca18e6f25ebc1..d01d8e10542c8 100644 --- a/src/gc.c +++ b/src/gc.c @@ -503,7 +503,8 @@ static void add_lostval_parent(jl_value_t* parent) #define verify_parent(ty, obj, slot, args...) do { \ - if (*(jl_value_t**)(slot) == lostval && (obj) != lostval) { \ + if (*(jl_value_t**)(slot) == lostval && \ + (jl_value_t*)(obj) != lostval) { \ jl_printf(JL_STDOUT, "Found parent %s 0x%lx at %s:%d\n", \ ty, (uintptr_t)(obj), __FILE__, __LINE__); \ jl_printf(JL_STDOUT, "\tloc 0x%lx : ", (uintptr_t)(slot)); \ @@ -1944,12 +1945,11 @@ static arraylist_t bits_save[4]; // freelist in pools static void clear_mark(int bits) { - size_t i; - pool_t* pool; - gcval_t* pv; + gcval_t *pv; if (!verifying) { - for(int i = 0; i < 4; i++) - bits_save[i].len = 0; + for (int i = 0;i < 4;i++) { + bits_save[i].len = 0; + } } void *current_heap = NULL; bigval_t *bigs[2]; diff --git a/src/options.h b/src/options.h index 91015f0860192..44b333e251eed 100644 --- a/src/options.h +++ b/src/options.h @@ -47,7 +47,9 @@ // GC_VERIFY force a full verification gc along with every quick gc to ensure no // reachable memory is freed -//#define GC_VERIFY +#ifndef GC_VERIFY +// #define GC_VERIFY +#endif // profiling options