Skip to content

Commit

Permalink
Make GC_VERIFY a make option and enable it for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed May 19, 2015
1 parent eb5da26 commit 364c123
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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=

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions contrib/windows/msys_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)); \
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 3 additions & 1 deletion src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 364c123

Please sign in to comment.