Skip to content

Commit 1ee099d

Browse files
committed
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.
1 parent 4067252 commit 1ee099d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#
6666
# * `VERBOSE=1` - Print all commands. Use this to see what's going on.
6767
# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
68+
# * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
6869
#
6970
# * `TESTNAME=...` - Specify the name of tests to run
7071
# * `CHECK_IGNORED=1` - Run normally-ignored tests

mk/main.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,19 @@ endif
9090
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
9191
CFG_GCCISH_CFLAGS :=
9292
CFG_GCCISH_LINK_FLAGS :=
93+
CFG_JEMALLOC_FLAGS :=
9394

9495
ifdef CFG_DISABLE_OPTIMIZE
9596
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
9697
CFG_RUSTC_FLAGS +=
98+
CFG_JEMALLOC_FLAGS += --enable-debug
9799
else
98100
# The rtopt cfg turns off runtime sanity checks
99101
CFG_RUSTC_FLAGS += -O --cfg rtopt
100102
endif
101103

104+
CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
105+
102106
ifdef CFG_DISABLE_DEBUG
103107
CFG_RUSTC_FLAGS += --cfg ndebug
104108
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG

mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1
301301
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
302302
@$$(call E, make: jemalloc)
303303
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
304-
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ \
304+
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ $(CFG_JEMALLOC_FLAGS) \
305305
--build=$(CFG_BUILD) --host=$(1) \
306306
CC="$$(CC_$(1))" \
307307
AR="$$(AR_$(1))" \

0 commit comments

Comments
 (0)