From 32479d59c42938e2eb8d313fec55b736d650e793 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 13 Apr 2018 17:40:35 +0300 Subject: [PATCH] Allow gc_debug, redirect_malloc, large_config options in CMake script * CMakeLists.txt (enable_gc_debug, enable_redirect_malloc, enable_large_config): New OPTION (off by default). * CMakeLists.txt [enable_gc_debug] (DBG_HDRS_ALL, KEEP_BACK_PTRS): Define macro. * CMakeLists.txt [enable_redirect_malloc] (REDIRECT_MALLOC, REDIRECT_REALLOC, REDIRECT_FREE, GC_USE_DLOPEN_WRAP): Likewise. * CMakeLists.txt [enable_large_config] (LARGE_CONFIG): Likewise. * CMakeLists.txt [enable_gc_debug] (MAKE_BACK_GRAPH): Define macro if host is Linux or DG/UX. * CMakeLists.txt [enable_gc_debug] (SAVE_CALL_COUNT): Define macro to 8 if host is Linux. * CMakeLists.txt [enable_gc_debug] (SRC): Add backgraph.c if host is Linux or DG/UX. --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 214fa3b7..874b51e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,37 @@ IF(enable_gcj_support) SET(SRC ${SRC} gcj_mlc.c) ENDIF(enable_gcj_support) +OPTION(enable_gc_debug "Support for pointer back-tracing" NO) +IF(enable_gc_debug) + ADD_DEFINITIONS("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") + IF (HOST MATCHES ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) + ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") + ADD_DEFINITIONS("-DSAVE_CALL_COUNT=8") + SET(SRC ${SRC} backgraph.c) + ENDIF() + IF (HOST MATCHES i.86-.*-dgux.*) + ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") + SET(SRC ${SRC} backgraph.c) + ENDIF() +ENDIF(enable_gc_debug) + +OPTION(enable_redirect_malloc "Redirect malloc and friends to GC routines" NO) +IF(enable_redirect_malloc) + IF(enable_gc_debug) + ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") + ADD_DEFINITIONS("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") + ADD_DEFINITIONS("-DREDIRECT_FREE=GC_debug_free") + ELSE + ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_malloc") + ENDIF(enable_gc_debug) + ADD_DEFINITIONS("-DGC_USE_DLOPEN_WRAP") +ENDIF(enable_redirect_malloc) + +OPTION(enable_large_config "Optimize for large heap or root set" NO) +IF(enable_large_config) + ADD_DEFINITIONS("-DLARGE_CONFIG") +ENDIF(enable_large_config) + OPTION(enable_checksums "Report erroneously cleared dirty bits" NO) IF(enable_checksums) IF(enable_threads) -- 2.40.0