about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-09-07 14:05:32 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-09-07 14:23:48 -0400
commit1ee099da36f6ac647747806558e555c5fe8dcd12 (patch)
treef0d7c4aafb7be82a78573f73539e44ab2c155f95
parent4067252def4251d7c2f4afc79ae1716093fe27ac (diff)
downloadrust-1ee099da36f6ac647747806558e555c5fe8dcd12.tar.gz
rust-1ee099da36f6ac647747806558e555c5fe8dcd12.zip
enable jemalloc debugging in unoptimized builds
The performance hit from these checks is significant, but unoptimized
builds are already incredibly slow. Enabling these checks results in
better test coverage since there are bots doing unoptimized builds, and
the cost is relatively small in the context of an unoptimized build.
This also allows using `JEMALLOC_FLAGS` to override the default
configure flags.
-rw-r--r--Makefile.in1
-rw-r--r--mk/main.mk4
-rw-r--r--mk/rt.mk2
3 files changed, 6 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 5683eb7ba06..48b211167cf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -65,6 +65,7 @@
 #
 #   * `VERBOSE=1` - Print all commands. Use this to see what's going on.
 #   * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
+#   * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
 #
 #   * `TESTNAME=...` - Specify the name of tests to run
 #   * `CHECK_IGNORED=1` - Run normally-ignored tests
diff --git a/mk/main.mk b/mk/main.mk
index 2bdfc1bafd7..3d5d0b441f1 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -90,15 +90,19 @@ endif
 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
 CFG_GCCISH_CFLAGS :=
 CFG_GCCISH_LINK_FLAGS :=
+CFG_JEMALLOC_FLAGS :=
 
 ifdef CFG_DISABLE_OPTIMIZE
   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
   CFG_RUSTC_FLAGS +=
+  CFG_JEMALLOC_FLAGS += --enable-debug
 else
   # The rtopt cfg turns off runtime sanity checks
   CFG_RUSTC_FLAGS += -O --cfg rtopt
 endif
 
+CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
+
 ifdef CFG_DISABLE_DEBUG
   CFG_RUSTC_FLAGS += --cfg ndebug
   CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
diff --git a/mk/rt.mk b/mk/rt.mk
index 13ed4abb438..216abcf5f3e 100644
--- a/mk/rt.mk
+++ b/mk/rt.mk
@@ -301,7 +301,7 @@ JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1
 $$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
 	@$$(call E, make: jemalloc)
 	cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
-		$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ \
+		$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ $(CFG_JEMALLOC_FLAGS) \
 		--build=$(CFG_BUILD) --host=$(1) \
 		CC="$$(CC_$(1))" \
 		AR="$$(AR_$(1))" \