server-skynet-source-3rd-je.../include/jemalloc/internal
Elliot Ronaghan 8a1a794b0c Don't use compact red-black trees with the pgi compiler
Some bug (either in the red-black tree code, or in the pgi compiler) seems to
cause red-black trees to become unbalanced. This issue seems to go away if we
don't use compact red-black trees. Since red-black trees don't seem to be used
much anymore, I opted for what seems to be an easy fix here instead of digging
in and trying to find the root cause of the bug.

Some context in case it's helpful:

I experienced a ton of segfaults while using pgi as Chapel's target compiler
with jemalloc 4.0.4. The little bit of debugging I did pointed me somewhere
deep in red-black tree manipulation, but I didn't get a chance to investigate
further. It looks like 4.2.0 replaced most uses of red-black trees with
pairing-heaps, which seems to avoid whatever bug I was hitting.

However, `make check_unit` was still failing on the rb test, so I figured the
core issue was just being masked. Here's the `make check_unit` failure:

```sh
=== test/unit/rb ===
test_rb_empty: pass
tree_recurse:test/unit/rb.c:90: Failed assertion: (((_Bool) (((uintptr_t) (left_node)->link.rbn_right_red) & ((size_t)1)))) == (false) --> true != false: Node should be black
test_rb_random:test/unit/rb.c:274: Failed assertion: (imbalances) == (0) --> 1 != 0: Tree is unbalanced
tree_recurse:test/unit/rb.c:90: Failed assertion: (((_Bool) (((uintptr_t) (left_node)->link.rbn_right_red) & ((size_t)1)))) == (false) --> true != false: Node should be black
test_rb_random:test/unit/rb.c:274: Failed assertion: (imbalances) == (0) --> 1 != 0: Tree is unbalanced
node_remove:test/unit/rb.c:190: Failed assertion: (imbalances) == (0) --> 2 != 0: Tree is unbalanced
<jemalloc>: test/unit/rb.c:43: Failed assertion: "pathp[-1].cmp < 0"
test/test.sh: line 22: 12926 Aborted
Test harness error
```

While starting to debug I saw the RB_COMPACT option and decided to check if
turning that off resolved the bug. It seems to have fixed it (`make check_unit`
passes and the segfaults under Chapel are gone) so it seems like on okay
work-around. I'd imagine this has performance implications for red-black trees
under pgi, but if they're not going to be used much anymore it's probably not a
big deal.
2016-06-08 14:48:55 -07:00
..
arena.h Modify extent hook functions to take an (extent_t *) argument. 2016-06-05 21:00:02 -07:00
assert.h Tweak code to allow compilation of concatenated src/*.c sources. 2015-11-12 11:06:41 -08:00
atomic.h Refactor arenas array (fixes deadlock). 2016-02-24 23:58:10 -08:00
base.h Resolve bootstrapping issues when embedded in FreeBSD libc. 2016-05-10 22:51:33 -07:00
bitmap.h Move slabs out of chunks. 2016-06-05 20:42:23 -07:00
chunk.h Rename most remaining *chunk* APIs to *extent*. 2016-06-05 20:42:23 -07:00
ckh.h Resolve bootstrapping issues when embedded in FreeBSD libc. 2016-05-10 22:51:33 -07:00
ctl.h Rename huge to large. 2016-06-05 20:42:23 -07:00
extent_dss.h Rename most remaining *chunk* APIs to *extent*. 2016-06-05 20:42:23 -07:00
extent_mmap.h Rename most remaining *chunk* APIs to *extent*. 2016-06-05 20:42:23 -07:00
extent.h Fix extent_alloc_dss() regressions. 2016-06-05 21:00:02 -07:00
hash.h typecast address to pointer to byte to avoid unaligned memory access error 2016-05-03 10:02:26 -07:00
jemalloc_internal_decls.h Fix Windows build issues 2016-02-23 18:55:45 -08:00
jemalloc_internal_defs.h.in Miscellaneous s/chunk/extent/ updates. 2016-06-05 20:42:24 -07:00
jemalloc_internal_macros.h Use KQU() rather than QU() where applicable. 2014-05-28 21:17:42 -07:00
jemalloc_internal.h.in Don't use compact red-black trees with the pgi compiler 2016-06-08 14:48:55 -07:00
large.h Remove a stray memset(), and fix a junk filling test regression. 2016-06-05 21:00:02 -07:00
mb.h Use TSDN_NULL rather than NULL as appropriate. 2016-05-12 21:07:08 -07:00
mutex.h Add rtree element witnesses. 2016-06-03 12:27:41 -07:00
nstime.h Fix style nits. 2016-04-17 13:44:59 -07:00
pages.h Move *PAGE* definitions to pages.h. 2016-06-03 12:27:41 -07:00
ph.h Fix a style nit. 2016-04-12 23:18:25 -07:00
private_namespace.sh Refactor to support more varied testing. 2013-12-03 22:06:59 -08:00
private_symbols.txt Fix extent_alloc_dss() regressions. 2016-06-05 21:00:02 -07:00
private_unnamespace.sh Refactor to support more varied testing. 2013-12-03 22:06:59 -08:00
prng.h Implement cache-oblivious support for huge size classes. 2016-06-03 12:27:41 -07:00
prof.h Add a missing prof_alloc_rollback() call. 2016-06-05 20:42:24 -07:00
public_namespace.sh Fix name mangling for stress tests. 2014-01-16 17:38:01 -08:00
public_unnamespace.sh Fix name mangling for stress tests. 2014-01-16 17:38:01 -08:00
ql.h Style and spelling fixes. 2014-12-08 16:34:04 -08:00
qr.h Style and spelling fixes. 2014-12-08 16:34:04 -08:00
rb.h Remove rbt_nil 2016-02-23 18:09:25 -08:00
rtree.h Add rtree lookup path caching. 2016-06-05 20:59:57 -07:00
size_classes.sh Relax NBINS constraint (max 255 --> max 256). 2016-06-05 20:42:24 -07:00
smoothstep.h Implement smoothstep table generation. 2016-02-19 20:56:15 -08:00
smoothstep.sh Implement smoothstep table generation. 2016-02-19 20:56:15 -08:00
stats.h Miscellaneous s/chunk/extent/ updates. 2016-06-05 20:42:24 -07:00
tcache.h Make tsd cleanup functions optional, remove noop cleanup functions. 2016-06-05 20:42:24 -07:00
ticker.h Implement ticker. 2016-02-19 20:29:06 -08:00
tsd.h Add rtree lookup path caching. 2016-06-05 20:59:57 -07:00
util.h Clean up char vs. uint8_t in junk filling code. 2016-04-11 02:26:35 -07:00
witness.h Make tsd cleanup functions optional, remove noop cleanup functions. 2016-06-05 20:42:24 -07:00