Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jun 2017 07:15:06 +0000 (UTC)
From:      Jason Evans <jasone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc
Message-ID:  <201706150715.v5F7F6aT031218@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jasone
Date: Thu Jun 15 07:15:05 2017
New Revision: 319971
URL: https://svnweb.freebsd.org/changeset/base/319971

Log:
  Update jemalloc to 5.0.0.

Added:
  head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_a.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/arena_structs_a.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/arena_structs_b.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/arena_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/atomic_c11.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_sync.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_structs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/base_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/base_inlines.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/base_structs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/base_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/bit_util.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_dss.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_inlines.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_mmap.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_structs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/extent_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/hooks.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_b.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_preamble.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/large_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/malloc_io.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/mutex_pool.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/mutex_prof.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/prof_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_a.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_b.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/prof_structs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/prof_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/rtree_tsd.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/stats_tsd.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/sz.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tcache_externs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tcache_inlines.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tcache_structs.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tcache_types.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tsd_generic.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tsd_tls.h   (contents, props changed)
  head/contrib/jemalloc/include/jemalloc/internal/tsd_types.h   (contents, props changed)
  head/contrib/jemalloc/src/background_thread.c   (contents, props changed)
  head/contrib/jemalloc/src/extent_dss.c   (contents, props changed)
  head/contrib/jemalloc/src/extent_mmap.c   (contents, props changed)
  head/contrib/jemalloc/src/hooks.c   (contents, props changed)
  head/contrib/jemalloc/src/large.c   (contents, props changed)
  head/contrib/jemalloc/src/malloc_io.c   (contents, props changed)
  head/contrib/jemalloc/src/mutex_pool.c   (contents, props changed)
  head/contrib/jemalloc/src/sz.c   (contents, props changed)
Deleted:
  head/contrib/jemalloc/include/jemalloc/internal/arena.h
  head/contrib/jemalloc/include/jemalloc/internal/base.h
  head/contrib/jemalloc/include/jemalloc/internal/chunk.h
  head/contrib/jemalloc/include/jemalloc/internal/chunk_dss.h
  head/contrib/jemalloc/include/jemalloc/internal/chunk_mmap.h
  head/contrib/jemalloc/include/jemalloc/internal/extent.h
  head/contrib/jemalloc/include/jemalloc/internal/huge.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
  head/contrib/jemalloc/include/jemalloc/internal/mb.h
  head/contrib/jemalloc/include/jemalloc/internal/prof.h
  head/contrib/jemalloc/include/jemalloc/internal/quarantine.h
  head/contrib/jemalloc/include/jemalloc/internal/tcache.h
  head/contrib/jemalloc/include/jemalloc/internal/valgrind.h
  head/contrib/jemalloc/src/atomic.c
  head/contrib/jemalloc/src/chunk.c
  head/contrib/jemalloc/src/chunk_dss.c
  head/contrib/jemalloc/src/chunk_mmap.c
  head/contrib/jemalloc/src/huge.c
  head/contrib/jemalloc/src/mb.c
  head/contrib/jemalloc/src/quarantine.c
  head/contrib/jemalloc/src/util.c
Modified:
  head/contrib/jemalloc/COPYING
  head/contrib/jemalloc/ChangeLog
  head/contrib/jemalloc/FREEBSD-Xlist
  head/contrib/jemalloc/FREEBSD-diffs
  head/contrib/jemalloc/FREEBSD-upgrade
  head/contrib/jemalloc/VERSION
  head/contrib/jemalloc/doc/jemalloc.3
  head/contrib/jemalloc/include/jemalloc/internal/assert.h
  head/contrib/jemalloc/include/jemalloc/internal/atomic.h
  head/contrib/jemalloc/include/jemalloc/internal/bitmap.h
  head/contrib/jemalloc/include/jemalloc/internal/ckh.h
  head/contrib/jemalloc/include/jemalloc/internal/ctl.h
  head/contrib/jemalloc/include/jemalloc/internal/hash.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_macros.h
  head/contrib/jemalloc/include/jemalloc/internal/mutex.h
  head/contrib/jemalloc/include/jemalloc/internal/nstime.h
  head/contrib/jemalloc/include/jemalloc/internal/pages.h
  head/contrib/jemalloc/include/jemalloc/internal/ph.h
  head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h
  head/contrib/jemalloc/include/jemalloc/internal/prng.h
  head/contrib/jemalloc/include/jemalloc/internal/public_namespace.h
  head/contrib/jemalloc/include/jemalloc/internal/ql.h
  head/contrib/jemalloc/include/jemalloc/internal/qr.h
  head/contrib/jemalloc/include/jemalloc/internal/rb.h
  head/contrib/jemalloc/include/jemalloc/internal/rtree.h
  head/contrib/jemalloc/include/jemalloc/internal/size_classes.h
  head/contrib/jemalloc/include/jemalloc/internal/smoothstep.h
  head/contrib/jemalloc/include/jemalloc/internal/spin.h
  head/contrib/jemalloc/include/jemalloc/internal/stats.h
  head/contrib/jemalloc/include/jemalloc/internal/ticker.h
  head/contrib/jemalloc/include/jemalloc/internal/tsd.h
  head/contrib/jemalloc/include/jemalloc/internal/util.h
  head/contrib/jemalloc/include/jemalloc/internal/witness.h
  head/contrib/jemalloc/include/jemalloc/jemalloc.h
  head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
  head/contrib/jemalloc/include/jemalloc/jemalloc_typedefs.h
  head/contrib/jemalloc/src/arena.c
  head/contrib/jemalloc/src/base.c
  head/contrib/jemalloc/src/bitmap.c
  head/contrib/jemalloc/src/ckh.c
  head/contrib/jemalloc/src/ctl.c
  head/contrib/jemalloc/src/extent.c
  head/contrib/jemalloc/src/hash.c
  head/contrib/jemalloc/src/jemalloc.c
  head/contrib/jemalloc/src/mutex.c
  head/contrib/jemalloc/src/nstime.c
  head/contrib/jemalloc/src/pages.c
  head/contrib/jemalloc/src/prng.c
  head/contrib/jemalloc/src/prof.c
  head/contrib/jemalloc/src/rtree.c
  head/contrib/jemalloc/src/spin.c
  head/contrib/jemalloc/src/stats.c
  head/contrib/jemalloc/src/tcache.c
  head/contrib/jemalloc/src/ticker.c
  head/contrib/jemalloc/src/tsd.c
  head/contrib/jemalloc/src/witness.c
  head/include/malloc_np.h
  head/lib/libc/stdlib/jemalloc/Makefile.inc

Modified: head/contrib/jemalloc/COPYING
==============================================================================
--- head/contrib/jemalloc/COPYING	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/COPYING	Thu Jun 15 07:15:05 2017	(r319971)
@@ -1,10 +1,10 @@
 Unless otherwise specified, files in the jemalloc source distribution are
 subject to the following license:
 --------------------------------------------------------------------------------
-Copyright (C) 2002-2016 Jason Evans <jasone@canonware.com>.
+Copyright (C) 2002-2017 Jason Evans <jasone@canonware.com>.
 All rights reserved.
 Copyright (C) 2007-2012 Mozilla Foundation.  All rights reserved.
-Copyright (C) 2009-2016 Facebook, Inc.  All rights reserved.
+Copyright (C) 2009-2017 Facebook, Inc.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

Modified: head/contrib/jemalloc/ChangeLog
==============================================================================
--- head/contrib/jemalloc/ChangeLog	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/ChangeLog	Thu Jun 15 07:15:05 2017	(r319971)
@@ -4,6 +4,193 @@ brevity.  Much more detail can be found in the git rev
 
     https://github.com/jemalloc/jemalloc
 
+* 5.0.0 (June 13, 2017)
+
+  Unlike all previous jemalloc releases, this release does not use naturally
+  aligned "chunks" for virtual memory management, and instead uses page-aligned
+  "extents".  This change has few externally visible effects, but the internal
+  impacts are... extensive.  Many other internal changes combine to make this
+  the most cohesively designed version of jemalloc so far, with ample
+  opportunity for further enhancements.
+
+  Continuous integration is now an integral aspect of development thanks to the
+  efforts of @davidtgoldblatt, and the dev branch tends to remain reasonably
+  stable on the tested platforms (Linux, FreeBSD, macOS, and Windows).  As a
+  side effect the official release frequency may decrease over time.
+
+  New features:
+  - Implement optional per-CPU arena support; threads choose which arena to use
+    based on current CPU rather than on fixed thread-->arena associations.
+    (@interwq)
+  - Implement two-phase decay of unused dirty pages.  Pages transition from
+    dirty-->muzzy-->clean, where the first phase transition relies on
+    madvise(... MADV_FREE) semantics, and the second phase transition discards
+    pages such that they are replaced with demand-zeroed pages on next access.
+    (@jasone)
+  - Increase decay time resolution from seconds to milliseconds.  (@jasone)
+  - Implement opt-in per CPU background threads, and use them for asynchronous
+    decay-driven unused dirty page purging.  (@interwq)
+  - Add mutex profiling, which collects a variety of statistics useful for
+    diagnosing overhead/contention issues.  (@interwq)
+  - Add C++ new/delete operator bindings.  (@djwatson)
+  - Support manually created arena destruction, such that all data and metadata
+    are discarded.  Add MALLCTL_ARENAS_DESTROYED for accessing merged stats
+    associated with destroyed arenas.  (@jasone)
+  - Add MALLCTL_ARENAS_ALL as a fixed index for use in accessing
+    merged/destroyed arena statistics via mallctl.  (@jasone)
+  - Add opt.abort_conf to optionally abort if invalid configuration options are
+    detected during initialization.  (@interwq)
+  - Add opt.stats_print_opts, so that e.g. JSON output can be selected for the
+    stats dumped during exit if opt.stats_print is true.  (@jasone)
+  - Add --with-version=VERSION for use when embedding jemalloc into another
+    project's git repository.  (@jasone)
+  - Add --disable-thp to support cross compiling.  (@jasone)
+  - Add --with-lg-hugepage to support cross compiling.  (@jasone)
+  - Add mallctl interfaces (various authors):
+    + background_thread
+    + opt.abort_conf
+    + opt.retain
+    + opt.percpu_arena
+    + opt.background_thread
+    + opt.{dirty,muzzy}_decay_ms
+    + opt.stats_print_opts
+    + arena.<i>.initialized
+    + arena.<i>.destroy
+    + arena.<i>.{dirty,muzzy}_decay_ms
+    + arena.<i>.extent_hooks
+    + arenas.{dirty,muzzy}_decay_ms
+    + arenas.bin.<i>.slab_size
+    + arenas.nlextents
+    + arenas.lextent.<i>.size
+    + arenas.create
+    + stats.background_thread.{num_threads,num_runs,run_interval}
+    + stats.mutexes.{ctl,background_thread,prof,reset}.
+      {num_ops,num_spin_acq,num_wait,max_wait_time,total_wait_time,max_num_thds,
+      num_owner_switch}
+    + stats.arenas.<i>.{dirty,muzzy}_decay_ms
+    + stats.arenas.<i>.uptime
+    + stats.arenas.<i>.{pmuzzy,base,internal,resident}
+    + stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged}
+    + stats.arenas.<i>.bins.<j>.{nslabs,reslabs,curslabs}
+    + stats.arenas.<i>.bins.<j>.mutex.
+      {num_ops,num_spin_acq,num_wait,max_wait_time,total_wait_time,max_num_thds,
+      num_owner_switch}
+    + stats.arenas.<i>.lextents.<j>.{nmalloc,ndalloc,nrequests,curlextents}
+    + stats.arenas.i.mutexes.{large,extent_avail,extents_dirty,extents_muzzy,
+      extents_retained,decay_dirty,decay_muzzy,base,tcache_list}.
+      {num_ops,num_spin_acq,num_wait,max_wait_time,total_wait_time,max_num_thds,
+      num_owner_switch}
+
+  Portability improvements:
+  - Improve reentrant allocation support, such that deadlock is less likely if
+    e.g. a system library call in turn allocates memory.  (@davidtgoldblatt,
+    @interwq)
+  - Support static linking of jemalloc with glibc.  (@djwatson)
+
+  Optimizations and refactors:
+  - Organize virtual memory as "extents" of virtual memory pages, rather than as
+    naturally aligned "chunks", and store all metadata in arbitrarily distant
+    locations.  This reduces virtual memory external fragmentation, and will
+    interact better with huge pages (not yet explicitly supported).  (@jasone)
+  - Fold large and huge size classes together; only small and large size classes
+    remain.  (@jasone)
+  - Unify the allocation paths, and merge most fast-path branching decisions.
+    (@davidtgoldblatt, @interwq)
+  - Embed per thread automatic tcache into thread-specific data, which reduces
+    conditional branches and dereferences.  Also reorganize tcache to increase
+    fast-path data locality.  (@interwq)
+  - Rewrite atomics to closely model the C11 API, convert various
+    synchronization from mutex-based to atomic, and use the explicit memory
+    ordering control to resolve various hypothetical races without increasing
+    synchronization overhead.  (@davidtgoldblatt)
+  - Extensively optimize rtree via various methods:
+    + Add multiple layers of rtree lookup caching, since rtree lookups are now
+      part of fast-path deallocation.  (@interwq)
+    + Determine rtree layout at compile time.  (@jasone)
+    + Make the tree shallower for common configurations.  (@jasone)
+    + Embed the root node in the top-level rtree data structure, thus avoiding
+      one level of indirection.  (@jasone)
+    + Further specialize leaf elements as compared to internal node elements,
+      and directly embed extent metadata needed for fast-path deallocation.
+      (@jasone)
+    + Ignore leading always-zero address bits (architecture-specific).
+      (@jasone)
+  - Reorganize headers (ongoing work) to make them hermetic, and disentangle
+    various module dependencies.  (@davidtgoldblatt)
+  - Convert various internal data structures such as size class metadata from
+    boot-time-initialized to compile-time-initialized.  Propagate resulting data
+    structure simplifications, such as making arena metadata fixed-size.
+    (@jasone)
+  - Simplify size class lookups when constrained to size classes that are
+    multiples of the page size.  This speeds lookups, but the primary benefit is
+    complexity reduction in code that was the source of numerous regressions.
+    (@jasone)
+  - Lock individual extents when possible for localized extent operations,
+    rather than relying on a top-level arena lock.  (@davidtgoldblatt, @jasone)
+  - Use first fit layout policy instead of best fit, in order to improve
+    packing.  (@jasone)
+  - If munmap(2) is not in use, use an exponential series to grow each arena's
+    virtual memory, so that the number of disjoint virtual memory mappings
+    remains low.  (@jasone)
+  - Implement per arena base allocators, so that arenas never share any virtual
+    memory pages.  (@jasone)
+  - Automatically generate private symbol name mangling macros.  (@jasone)
+
+  Incompatible changes:
+  - Replace chunk hooks with an expanded/normalized set of extent hooks.
+    (@jasone)
+  - Remove ratio-based purging.  (@jasone)
+  - Remove --disable-tcache.  (@jasone)
+  - Remove --disable-tls.  (@jasone)
+  - Remove --enable-ivsalloc.  (@jasone)
+  - Remove --with-lg-size-class-group.  (@jasone)
+  - Remove --with-lg-tiny-min.  (@jasone)
+  - Remove --disable-cc-silence.  (@jasone)
+  - Remove --enable-code-coverage.  (@jasone)
+  - Remove --disable-munmap (replaced by opt.retain).  (@jasone)
+  - Remove Valgrind support.  (@jasone)
+  - Remove quarantine support.  (@jasone)
+  - Remove redzone support.  (@jasone)
+  - Remove mallctl interfaces (various authors):
+    + config.munmap
+    + config.tcache
+    + config.tls
+    + config.valgrind
+    + opt.lg_chunk
+    + opt.purge
+    + opt.lg_dirty_mult
+    + opt.decay_time
+    + opt.quarantine
+    + opt.redzone
+    + opt.thp
+    + arena.<i>.lg_dirty_mult
+    + arena.<i>.decay_time
+    + arena.<i>.chunk_hooks
+    + arenas.initialized
+    + arenas.lg_dirty_mult
+    + arenas.decay_time
+    + arenas.bin.<i>.run_size
+    + arenas.nlruns
+    + arenas.lrun.<i>.size
+    + arenas.nhchunks
+    + arenas.hchunk.<i>.size
+    + arenas.extend
+    + stats.cactive
+    + stats.arenas.<i>.lg_dirty_mult
+    + stats.arenas.<i>.decay_time
+    + stats.arenas.<i>.metadata.{mapped,allocated}
+    + stats.arenas.<i>.{npurge,nmadvise,purged}
+    + stats.arenas.<i>.huge.{allocated,nmalloc,ndalloc,nrequests}
+    + stats.arenas.<i>.bins.<j>.{nruns,reruns,curruns}
+    + stats.arenas.<i>.lruns.<j>.{nmalloc,ndalloc,nrequests,curruns}
+    + stats.arenas.<i>.hchunks.<j>.{nmalloc,ndalloc,nrequests,curhchunks}
+
+  Bug fixes:
+  - Improve interval-based profile dump triggering to dump only one profile when
+    a single allocation's size exceeds the interval.  (@jasone)
+  - Use prefixed function names (as controlled by --with-jemalloc-prefix) when
+    pruning backtrace frames in jeprof.  (@jasone)
+
 * 4.5.0 (February 28, 2017)
 
   This is the first release to benefit from much broader continuous integration
@@ -12,7 +199,7 @@ brevity.  Much more detail can be found in the git rev
   regressions fixed by this release.
 
   New features:
-  - Add --disable-thp and the opt.thp to provide opt-out mechanisms for
+  - Add --disable-thp and the opt.thp mallctl to provide opt-out mechanisms for
     transparent huge page integration.  (@jasone)
   - Update zone allocator integration to work with macOS 10.12.  (@glandium)
   - Restructure *CFLAGS configuration, so that CFLAGS behaves typically, and
@@ -25,7 +212,7 @@ brevity.  Much more detail can be found in the git rev
   - Handle race in per size class utilization computation.  This functionality
     was first released in 4.0.0.  (@interwq)
   - Fix lock order reversal during gdump.  (@jasone)
-  - Fix-refactor tcache synchronization.  This regression was first released in
+  - Fix/refactor tcache synchronization.  This regression was first released in
     4.0.0.  (@jasone)
   - Fix various JSON-formatted malloc_stats_print() bugs.  This functionality
     was first released in 4.3.0.  (@jasone)

Modified: head/contrib/jemalloc/FREEBSD-Xlist
==============================================================================
--- head/contrib/jemalloc/FREEBSD-Xlist	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/FREEBSD-Xlist	Thu Jun 15 07:15:05 2017	(r319971)
@@ -4,7 +4,7 @@ $FreeBSD$
 .git*
 .travis.yml
 FREEBSD-*
-INSTALL
+INSTALL.md
 Makefile*
 README
 autogen.sh
@@ -13,23 +13,24 @@ bin/
 build-aux/
 config.*
 configure*
-coverage.sh
 doc/*.in
 doc/*.xml
 doc/*.xsl
 doc/*.html
-include/jemalloc/internal/jemalloc_internal.h.in
+include/jemalloc/internal/atomic_msvc.h
 include/jemalloc/internal/jemalloc_internal_defs.h.in
+include/jemalloc/internal/jemalloc_preamble.h.in
 include/jemalloc/internal/private_namespace.sh
-include/jemalloc/internal/private_symbols.txt
-include/jemalloc/internal/private_unnamespace.h
-include/jemalloc/internal/private_unnamespace.sh
+include/jemalloc/internal/private_symbols_jet.awk
+include/jemalloc/internal/private_symbols.awk
+include/jemalloc/internal/private_symbols.sh
 include/jemalloc/internal/public_namespace.sh
 include/jemalloc/internal/public_symbols.txt
 include/jemalloc/internal/public_unnamespace.h
 include/jemalloc/internal/public_unnamespace.sh
 include/jemalloc/internal/size_classes.sh
 include/jemalloc/internal/smoothstep.sh
+include/jemalloc/internal/tsd_win.h
 include/jemalloc/jemalloc.h.in
 include/jemalloc/jemalloc.sh
 include/jemalloc/jemalloc_defs.h
@@ -48,8 +49,10 @@ include/jemalloc/jemalloc_typedefs.h.in
 include/msvc_compat/
 install-sh
 jemalloc.pc*
+m4/
 msvc/
+run_tests.sh
 scripts/
-src/valgrind.c
+src/jemalloc_cpp.cpp
 src/zone.c
 test/

Modified: head/contrib/jemalloc/FREEBSD-diffs
==============================================================================
--- head/contrib/jemalloc/FREEBSD-diffs	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/FREEBSD-diffs	Thu Jun 15 07:15:05 2017	(r319971)
@@ -1,21 +1,19 @@
 diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
-index c97ab0f..be8dda5 100644
+index 21e401ac..f977c5f5 100644
 --- a/doc/jemalloc.xml.in
 +++ b/doc/jemalloc.xml.in
-@@ -53,11 +53,23 @@
+@@ -53,11 +53,21 @@
      <para>This manual describes jemalloc @jemalloc_version@.  More information
      can be found at the <ulink
      url="http://jemalloc.net/">jemalloc website</ulink>.</para>
 +
 +    <para>The following configuration options are enabled in libc's built-in
 +    jemalloc: <option>--enable-fill</option>,
-+    <option>--enable-lazy-lock</option>, <option>--enable-munmap</option>,
-+    <option>--enable-stats</option>, <option>--enable-tcache</option>,
-+    <option>--enable-tls</option>, <option>--enable-utrace</option>, and
-+    <option>--enable-xmalloc</option>.  Additionally,
-+    <option>--enable-debug</option> is enabled in development versions of
-+    FreeBSD (controlled by the <constant>MALLOC_PRODUCTION</constant> make
-+    variable).</para>
++    <option>--enable-lazy-lock</option>, <option>--enable-stats</option>,
++    <option>--enable-utrace</option>, and <option>--enable-xmalloc</option>.
++    Additionally, <option>--enable-debug</option> is enabled in development
++    versions of FreeBSD (controlled by the
++    <constant>MALLOC_PRODUCTION</constant> make variable).</para>
 +
    </refsect1>
    <refsynopsisdiv>
@@ -27,7 +25,7 @@ index c97ab0f..be8dda5 100644
        <refsect2>
          <title>Standard API</title>
          <funcprototype>
-@@ -2989,4 +3001,18 @@ malloc_conf = "lg_chunk:24";]]></programlisting></para>
+@@ -3252,4 +3262,18 @@ malloc_conf = "narenas:1";]]></programlisting></para>
      <para>The <function>posix_memalign()</function> function conforms
      to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para>
    </refsect1>
@@ -46,42 +44,42 @@ index c97ab0f..be8dda5 100644
 +    11.0.</para>
 +  </refsect1>
  </refentry>
-diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h
-index 119e3a5..277989f 100644
---- a/include/jemalloc/internal/arena.h
-+++ b/include/jemalloc/internal/arena.h
-@@ -731,8 +731,13 @@ arena_miscelm_get_mutable(arena_chunk_t *chunk, size_t pageind)
- JEMALLOC_ALWAYS_INLINE const arena_chunk_map_misc_t *
- arena_miscelm_get_const(const arena_chunk_t *chunk, size_t pageind)
- {
-+#if 1 /* Work around gcc bug. */
-+	arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
+diff --git a/include/jemalloc/internal/hooks.h b/include/jemalloc/internal/hooks.h
+index cd49afcb..85e2a991 100644
+--- a/include/jemalloc/internal/hooks.h
++++ b/include/jemalloc/internal/hooks.h
+@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*hooks_libc_hook)();
  
-+	return (arena_miscelm_get_mutable(mchunk, pageind));
-+#else
- 	return (arena_miscelm_get_mutable((arena_chunk_t *)chunk, pageind));
-+#endif
- }
+ #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn)
  
- JEMALLOC_ALWAYS_INLINE size_t
-@@ -791,8 +796,13 @@ arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t pageind)
- JEMALLOC_ALWAYS_INLINE const size_t *
- arena_mapbitsp_get_const(const arena_chunk_t *chunk, size_t pageind)
- {
-+#if 1 /* Work around gcc bug. */
-+	arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
+-#define open JEMALLOC_HOOK(open, hooks_libc_hook)
+-#define read JEMALLOC_HOOK(read, hooks_libc_hook)
+-#define write JEMALLOC_HOOK(write, hooks_libc_hook)
+-#define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook)
+-#define close JEMALLOC_HOOK(close, hooks_libc_hook)
+-#define creat JEMALLOC_HOOK(creat, hooks_libc_hook)
+-#define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook)
+ /* Note that this is undef'd and re-define'd in src/prof.c. */
+ #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook)
  
-+	return (arena_mapbitsp_get_mutable(mchunk, pageind));
-+#else
- 	return (arena_mapbitsp_get_mutable((arena_chunk_t *)chunk, pageind));
-+#endif
- }
+diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h
+index 1efdb56b..12a7e5a8 100644
+--- a/include/jemalloc/internal/jemalloc_internal_decls.h
++++ b/include/jemalloc/internal/jemalloc_internal_decls.h
+@@ -1,6 +1,9 @@
+ #ifndef JEMALLOC_INTERNAL_DECLS_H
+ #define JEMALLOC_INTERNAL_DECLS_H
  
- JEMALLOC_ALWAYS_INLINE size_t
-diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
-index e3b499a..827fdbf 100644
---- a/include/jemalloc/internal/jemalloc_internal.h.in
-+++ b/include/jemalloc/internal/jemalloc_internal.h.in
++#include "libc_private.h"
++#include "namespace.h"
++
+ #include <math.h>
+ #ifdef _WIN32
+ #  include <windows.h>
+diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in
+index 18539a09..c8af8683 100644
+--- a/include/jemalloc/internal/jemalloc_preamble.h.in
++++ b/include/jemalloc/internal/jemalloc_preamble.h.in
 @@ -8,6 +8,9 @@
  #include <sys/ktrace.h>
  #endif
@@ -89,10 +87,10 @@ index e3b499a..827fdbf 100644
 +#include "un-namespace.h"
 +#include "libc_private.h"
 +
- #define	JEMALLOC_NO_DEMANGLE
+ #define JEMALLOC_NO_DEMANGLE
  #ifdef JEMALLOC_JET
- #  define JEMALLOC_N(n) jet_##n
-@@ -42,13 +45,7 @@ static const bool config_fill =
+ #  undef JEMALLOC_IS_MALLOC
+@@ -68,13 +71,7 @@ static const bool config_fill =
      false
  #endif
      ;
@@ -107,25 +105,11 @@ index e3b499a..827fdbf 100644
  static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
  static const bool config_prof =
  #ifdef JEMALLOC_PROF
-diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h
-index c907d91..4626632 100644
---- a/include/jemalloc/internal/jemalloc_internal_decls.h
-+++ b/include/jemalloc/internal/jemalloc_internal_decls.h
-@@ -1,6 +1,9 @@
- #ifndef JEMALLOC_INTERNAL_DECLS_H
- #define	JEMALLOC_INTERNAL_DECLS_H
- 
-+#include "libc_private.h"
-+#include "namespace.h"
-+
- #include <math.h>
- #ifdef _WIN32
- #  include <windows.h>
 diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h
-index 2b4b1c3..e03a6d0 100644
+index 6520c251..0013cbe9 100644
 --- a/include/jemalloc/internal/mutex.h
 +++ b/include/jemalloc/internal/mutex.h
-@@ -57,9 +57,6 @@ struct malloc_mutex_s {
+@@ -121,9 +121,6 @@ struct malloc_mutex_s {
  
  #ifdef JEMALLOC_LAZY_LOCK
  extern bool isthreaded;
@@ -134,33 +118,21 @@ index 2b4b1c3..e03a6d0 100644
 -#  define isthreaded true
  #endif
  
- bool	malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
-@@ -67,6 +64,7 @@ bool	malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
- void	malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex);
- void	malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex);
- void	malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex);
-+bool	malloc_mutex_first_thread(void);
- bool	malloc_mutex_boot(void);
+ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
+@@ -131,6 +128,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
+ void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex);
+ void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex);
+ void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex);
++bool malloc_mutex_first_thread(void);
+ bool malloc_mutex_boot(void);
+ void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex);
  
- #endif /* JEMALLOC_H_EXTERNS */
-diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt
-index 60b57e5..056a8fe 100644
---- a/include/jemalloc/internal/private_symbols.txt
-+++ b/include/jemalloc/internal/private_symbols.txt
-@@ -312,7 +312,6 @@ iralloct_realign
- isalloc
- isdalloct
- isqalloc
--isthreaded
- ivsalloc
- ixalloc
- jemalloc_postfork_child
 diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h
 new file mode 100644
-index 0000000..c58a8f3
+index 00000000..355b565c
 --- /dev/null
 +++ b/include/jemalloc/jemalloc_FreeBSD.h
-@@ -0,0 +1,162 @@
+@@ -0,0 +1,185 @@
 +/*
 + * Override settings that were generated in jemalloc_defs.h as necessary.
 + */
@@ -173,51 +145,65 @@ index 0000000..c58a8f3
 +
 +#undef JEMALLOC_DSS
 +
++#undef JEMALLOC_BACKGROUND_THREAD
++
 +/*
 + * The following are architecture-dependent, so conditionally define them for
 + * each supported architecture.
 + */
 +#undef JEMALLOC_TLS_MODEL
 +#undef STATIC_PAGE_SHIFT
++#undef LG_VADDR
 +#undef LG_SIZEOF_PTR
 +#undef LG_SIZEOF_INT
 +#undef LG_SIZEOF_LONG
 +#undef LG_SIZEOF_INTMAX_T
 +
 +#ifdef __i386__
++#  define LG_VADDR		32
 +#  define LG_SIZEOF_PTR		2
 +#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
 +#endif
 +#ifdef __ia64__
++#  define LG_VADDR		64
 +#  define LG_SIZEOF_PTR		3
 +#endif
 +#ifdef __sparc64__
++#  define LG_VADDR		64
 +#  define LG_SIZEOF_PTR		3
 +#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
 +#endif
 +#ifdef __amd64__
++#  define LG_VADDR		48
 +#  define LG_SIZEOF_PTR		3
 +#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
 +#endif
 +#ifdef __arm__
++#  define LG_VADDR		32
 +#  define LG_SIZEOF_PTR		2
 +#endif
 +#ifdef __aarch64__
++#  define LG_VADDR		48
 +#  define LG_SIZEOF_PTR		3
 +#endif
 +#ifdef __mips__
 +#ifdef __mips_n64
++#  define LG_VADDR		64
 +#  define LG_SIZEOF_PTR		3
 +#else
++#  define LG_VADDR		32
 +#  define LG_SIZEOF_PTR		2
 +#endif
 +#endif
 +#ifdef __powerpc64__
++#  define LG_VADDR		64
 +#  define LG_SIZEOF_PTR		3
 +#elif defined(__powerpc__)
++#  define LG_VADDR		32
 +#  define LG_SIZEOF_PTR		2
 +#endif
 +#ifdef __riscv__
++#  define LG_VADDR		64
 +#  define LG_SIZEOF_PTR		3
 +#endif
 +
@@ -291,8 +277,17 @@ index 0000000..c58a8f3
 +#define	read			_read
 +#define	write			_write
 +#define	close			_close
++#define	pthread_join		_pthread_join
++#define	pthread_once		_pthread_once
++#define	pthread_self		_pthread_self
++#define	pthread_equal		_pthread_equal
 +#define	pthread_mutex_lock	_pthread_mutex_lock
++#define	pthread_mutex_trylock	_pthread_mutex_trylock
 +#define	pthread_mutex_unlock	_pthread_mutex_unlock
++#define	pthread_cond_init	_pthread_cond_init
++#define	pthread_cond_wait	_pthread_cond_wait
++#define	pthread_cond_timedwait	_pthread_cond_timedwait
++#define	pthread_cond_signal	_pthread_cond_signal
 +
 +#ifdef JEMALLOC_C_
 +/*
@@ -324,7 +319,7 @@ index 0000000..c58a8f3
 +__weak_reference(__nallocm, nallocm);
 +#endif
 diff --git a/include/jemalloc/jemalloc_rename.sh b/include/jemalloc/jemalloc_rename.sh
-index f943891..47d032c 100755
+index f9438912..47d032c1 100755
 --- a/include/jemalloc/jemalloc_rename.sh
 +++ b/include/jemalloc/jemalloc_rename.sh
 @@ -19,4 +19,6 @@ done
@@ -335,10 +330,10 @@ index f943891..47d032c 100755
 +#include "jemalloc_FreeBSD.h"
  EOF
 diff --git a/src/jemalloc.c b/src/jemalloc.c
-index f73a26c..fcfe204 100644
+index 52c86aa6..868c9e86 100644
 --- a/src/jemalloc.c
 +++ b/src/jemalloc.c
-@@ -4,6 +4,10 @@
+@@ -20,6 +20,10 @@
  /******************************************************************************/
  /* Data. */
  
@@ -349,7 +344,7 @@ index f73a26c..fcfe204 100644
  /* Runtime configuration options. */
  const char	*je_malloc_conf
  #ifndef _WIN32
-@@ -2781,6 +2785,107 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr)
+@@ -2981,6 +2985,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) {
   */
  /******************************************************************************/
  /*
@@ -366,78 +361,74 @@ index f73a26c..fcfe204 100644
 +#define	ALLOCM_ERR_NOT_MOVED	2
 +
 +int
-+je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
-+{
-+	void *p;
-+
++je_allocm(void **ptr, size_t *rsize, size_t size, int flags) {
 +	assert(ptr != NULL);
 +
-+	p = je_mallocx(size, flags);
-+	if (p == NULL)
++	void *p = je_mallocx(size, flags);
++	if (p == NULL) {
 +		return (ALLOCM_ERR_OOM);
-+	if (rsize != NULL)
-+		*rsize = isalloc(tsdn_fetch(), p, config_prof);
++	}
++	if (rsize != NULL) {
++		*rsize = isalloc(tsdn_fetch(), p);
++	}
 +	*ptr = p;
-+	return (ALLOCM_SUCCESS);
++	return ALLOCM_SUCCESS;
 +}
 +
 +int
-+je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
-+{
-+	int ret;
-+	bool no_move = flags & ALLOCM_NO_MOVE;
-+
++je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags) {
 +	assert(ptr != NULL);
 +	assert(*ptr != NULL);
 +	assert(size != 0);
 +	assert(SIZE_T_MAX - size >= extra);
 +
++	int ret;
++	bool no_move = flags & ALLOCM_NO_MOVE;
++
 +	if (no_move) {
 +		size_t usize = je_xallocx(*ptr, size, extra, flags);
 +		ret = (usize >= size) ? ALLOCM_SUCCESS : ALLOCM_ERR_NOT_MOVED;
-+		if (rsize != NULL)
++		if (rsize != NULL) {
 +			*rsize = usize;
++		}
 +	} else {
 +		void *p = je_rallocx(*ptr, size+extra, flags);
 +		if (p != NULL) {
 +			*ptr = p;
 +			ret = ALLOCM_SUCCESS;
-+		} else
++		} else {
 +			ret = ALLOCM_ERR_OOM;
-+		if (rsize != NULL)
-+			*rsize = isalloc(tsdn_fetch(), *ptr, config_prof);
++		}
++		if (rsize != NULL) {
++			*rsize = isalloc(tsdn_fetch(), *ptr);
++		}
 +	}
-+	return (ret);
++	return ret;
 +}
 +
 +int
-+je_sallocm(const void *ptr, size_t *rsize, int flags)
-+{
-+
++je_sallocm(const void *ptr, size_t *rsize, int flags) {
 +	assert(rsize != NULL);
 +	*rsize = je_sallocx(ptr, flags);
-+	return (ALLOCM_SUCCESS);
++	return ALLOCM_SUCCESS;
 +}
 +
 +int
-+je_dallocm(void *ptr, int flags)
-+{
-+
++je_dallocm(void *ptr, int flags) {
 +	je_dallocx(ptr, flags);
-+	return (ALLOCM_SUCCESS);
++	return ALLOCM_SUCCESS;
 +}
 +
 +int
-+je_nallocm(size_t *rsize, size_t size, int flags)
-+{
-+	size_t usize;
-+
-+	usize = je_nallocx(size, flags);
-+	if (usize == 0)
-+		return (ALLOCM_ERR_OOM);
-+	if (rsize != NULL)
++je_nallocm(size_t *rsize, size_t size, int flags) {
++	size_t usize = je_nallocx(size, flags);
++	if (usize == 0) {
++		return ALLOCM_ERR_OOM;
++	}
++	if (rsize != NULL) {
 +		*rsize = usize;
-+	return (ALLOCM_SUCCESS);
++	}
++	return ALLOCM_SUCCESS;
 +}
 +
 +#undef ALLOCM_LG_ALIGN
@@ -457,7 +448,7 @@ index f73a26c..fcfe204 100644
   * The following functions are used by threading libraries for protection of
   * malloc during fork().
   */
-@@ -2922,4 +3027,11 @@ jemalloc_postfork_child(void)
+@@ -3141,4 +3242,11 @@ jemalloc_postfork_child(void) {
  	ctl_postfork_child(tsd_tsdn(tsd));
  }
  
@@ -469,11 +460,36 @@ index f73a26c..fcfe204 100644
 +}
 +
  /******************************************************************************/
+diff --git a/src/malloc_io.c b/src/malloc_io.c
+index 6b99afcd..4363cb83 100644
+--- a/src/malloc_io.c
++++ b/src/malloc_io.c
+@@ -88,6 +88,20 @@ wrtmessage(void *cbopaque, const char *s) {
+ 
+ JEMALLOC_EXPORT void	(*je_malloc_message)(void *, const char *s);
+ 
++JEMALLOC_ATTR(visibility("hidden"))
++void
++wrtmessage_1_0(const char *s1, const char *s2, const char *s3, const char *s4) {
++
++	wrtmessage(NULL, s1);
++	wrtmessage(NULL, s2);
++	wrtmessage(NULL, s3);
++	wrtmessage(NULL, s4);
++}
++
++void	(*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3,
++    const char *s4) = wrtmessage_1_0;
++__sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0);
++
+ /*
+  * Wrapper around malloc_message() that avoids the need for
+  * je_malloc_message(...) throughout the code.
 diff --git a/src/mutex.c b/src/mutex.c
-index 6333e73..13f8d79 100644
+index a528ef0c..820af613 100644
 --- a/src/mutex.c
 +++ b/src/mutex.c
-@@ -66,6 +66,17 @@ pthread_create(pthread_t *__restrict thread,
+@@ -40,6 +40,17 @@ pthread_create(pthread_t *__restrict thread,
  #ifdef JEMALLOC_MUTEX_INIT_CB
  JEMALLOC_EXPORT int	_pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
      void *(calloc_cb)(size_t, size_t));
@@ -490,55 +506,21 @@ index 6333e73..13f8d79 100644
 +}
  #endif
  
- bool
-@@ -142,7 +153,7 @@ malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex)
+ void
+@@ -130,6 +141,16 @@ mutex_addr_comp(const witness_t *witness1, void *mutex1,
  }
  
  bool
--malloc_mutex_boot(void)
-+malloc_mutex_first_thread(void)
- {
- 
- #ifdef JEMALLOC_MUTEX_INIT_CB
-@@ -156,3 +167,14 @@ malloc_mutex_boot(void)
- #endif
- 	return (false);
- }
++malloc_mutex_first_thread(void) {
 +
-+bool
-+malloc_mutex_boot(void)
-+{
-+
 +#ifndef JEMALLOC_MUTEX_INIT_CB
 +	return (malloc_mutex_first_thread());
 +#else
 +	return (false);
 +#endif
 +}
-diff --git a/src/util.c b/src/util.c
-index dd8c236..a4ff287 100644
---- a/src/util.c
-+++ b/src/util.c
-@@ -67,6 +67,22 @@ wrtmessage(void *cbopaque, const char *s)
- 
- JEMALLOC_EXPORT void	(*je_malloc_message)(void *, const char *s);
- 
-+JEMALLOC_ATTR(visibility("hidden"))
-+void
-+wrtmessage_1_0(const char *s1, const char *s2, const char *s3,
-+    const char *s4)
-+{
 +
-+	wrtmessage(NULL, s1);
-+	wrtmessage(NULL, s2);
-+	wrtmessage(NULL, s3);
-+	wrtmessage(NULL, s4);
-+}
-+
-+void	(*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3,
-+    const char *s4) = wrtmessage_1_0;
-+__sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0);
-+
- /*
-  * Wrapper around malloc_message() that avoids the need for
-  * je_malloc_message(...) throughout the code.
++bool
+ malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
+     witness_rank_t rank, malloc_mutex_lock_order_t lock_order) {
+ 	mutex_prof_data_init(&mutex->prof_data);

Modified: head/contrib/jemalloc/FREEBSD-upgrade
==============================================================================
--- head/contrib/jemalloc/FREEBSD-upgrade	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/FREEBSD-upgrade	Thu Jun 15 07:15:05 2017	(r319971)
@@ -22,19 +22,19 @@
 #
 # Extract latest jemalloc release.
 #
-#   ./FREEBSD-upgrade extract
+#   ./FREEBSD-upgrade extract <rev>
 #
 # Fix patch conflicts as necessary, then regenerate diffs to update line
 # offsets:
 #
 #   ./FREEBSD-upgrade rediff
-#   ./FREEBSD-upgrade extract
+#   ./FREEBSD-upgrade extract <rev>
 #
 # Do multiple buildworld/installworld rounds.  If problems arise and patches
 # are needed, edit the code in ${work} as necessary, then:
 #
 #   ./FREEBSD-upgrade rediff
-#   ./FREEBSD-upgrade extract
+#   ./FREEBSD-upgrade extract <rev>
 #
 # The rediff/extract order is important because rediff saves the local
 # changes, then extract blows away the work tree and re-creates it with the
@@ -45,43 +45,98 @@
 #  ./FREEBSD-upgrade clean
 
 set -e
+set -x
 
 if [ ! -x "FREEBSD-upgrade" ] ; then
   echo "Run from within src/contrib/jemalloc/" >&2
   exit 1
 fi
 
+if [ "x${JEMALLOC_REPO}" = "x" ] ; then
+  JEMALLOC_REPO=https://github.com/jemalloc/jemalloc.git
+fi
+
 src=`pwd`
-workname="jemalloc.git"
-work="${src}/../${workname}" # merge-changes expects ${workname} in "..".
+
+jemalloc_tmp="jemalloc.tmp"
+tmpdir="${src}/../${jemalloc_tmp}"
+bare_repo="${tmpdir}/jemalloc_bare.git"
+work="jemalloc_work.git"
+work_repo="${tmpdir}/${work}"
+namespace_repo="${tmpdir}/jemalloc_namespace.git"
 changes="${src}/FREEBSD-changes"
 
-do_extract() {
+do_fetch() {
   local rev=$1
-  # Clone.
-  rm -rf ${work}
-  git clone https://github.com/jemalloc/jemalloc.git ${work}
+  if [ ! -d "${bare_repo}" ] ; then
+    mkdir -p "${bare_repo}"
+    git clone --bare ${JEMALLOC_REPO} ${bare_repo}
+  fi
   (
-    cd ${work}
+    cd ${bare_repo}
+    git fetch origin ${rev}
+  )
+}
+
+do_extract_helper() {
+  local rev=$1
+  local repo=$2
+  do_fetch ${rev}
+  rm -rf ${repo}
+  git clone ${bare_repo} ${repo}
+  (
+    cd ${repo}
     if [ "x${rev}" != "x" ] ; then
       # Use optional rev argument to check out a revision other than HEAD on
       # master.
       git checkout ${rev}
     fi
+  )
+}
+
+do_autogen() {
+  ./autogen.sh --enable-xmalloc --enable-utrace \
+    --with-xslroot=/usr/local/share/xsl/docbook --with-private-namespace=__ \
+    --with-lg-page-sizes=12,13,14,16
+}
+
+do_extract_diff() {
+  local rev=$1
+  local repo=$2
+  do_extract_helper ${rev} ${repo}
+  (
+    cd ${repo}
     # Apply diffs before generating files.
     patch -p1 < "${src}/FREEBSD-diffs"
     find . -name '*.orig' -delete
-    # Generate various files.
-    ./autogen.sh --enable-cc-silence --enable-xmalloc --enable-utrace \
-      --with-xslroot=/usr/local/share/xsl/docbook --with-private-namespace=__ \
-      --with-lg-page-sizes=12,13,14,16
+    # Generate files.
+    do_autogen
     gmake dist
   )
 }
 
+do_extract_namespace() {
+  local rev=$1
+  local repo=$2
+  do_extract_helper ${rev} ${repo}
+  (
+    cd ${repo}
+    # Generate files.
+    do_autogen
+    gmake include/jemalloc/internal/private_namespace.h
+  )
+}
+
+do_extract() {
+  local rev=$1
+  do_fetch ${rev}
+  do_extract_diff ${rev} ${work_repo}
+  do_extract_namespace ${rev} ${namespace_repo}
+}
+
 do_diff() {
   (
-    cd ${work}
+    cd ${work_repo}
     find . -name '*.orig' -delete
     find . -name '*.rej' -delete
     git add -A
@@ -98,12 +153,12 @@ case "${command}" in
     do_extract ${rev}
     # Compute local differences to the upstream+patches and apply them.
     (
-      cd ..
-      diff -ru -X ${src}/FREEBSD-Xlist ${workname} jemalloc > ${changes} || true
+      cd ${tmpdir}
+      diff -ru -X ${src}/FREEBSD-Xlist ${work} ../jemalloc > ${changes} || true
     )
     (
-      cd ${work}
-      patch -p1 < ${changes}
+      cd ${work_repo}
+      patch -p1 < ${changes} || true
       find . -name '*.orig' -delete
     )
     # Update diff.
@@ -115,13 +170,17 @@ case "${command}" in
     # Delete existing files so that cruft doesn't silently remain.
     rm -rf ChangeLog COPYING VERSION doc include src
     # Copy files over.
-    tar cf - -C ${work} -X FREEBSD-Xlist . |tar xvf -
+    tar cf - -C ${work_repo} -X FREEBSD-Xlist . |tar xvf -
+    internal_dir="include/jemalloc/internal"
+    grep -v ' isthreaded ' \
+      "${namespace_repo}/${internal_dir}/private_namespace.h" \
+      > "${internal_dir}/private_namespace.h"
     ;;
   rediff) # Regenerate diffs based on working tree.
     do_diff
     ;;
   clean) # Remove working tree and temporary files.
-    rm -rf ${work} ${changes}
+    rm -rf ${tmpdir} ${changes}
     ;;
   *)
     echo "Unsupported command: \"${command}\"" >&2

Modified: head/contrib/jemalloc/VERSION
==============================================================================
--- head/contrib/jemalloc/VERSION	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/VERSION	Thu Jun 15 07:15:05 2017	(r319971)
@@ -1 +1 @@
-4.5.0-0-g04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5
+5.0.0-4-g84f6c2cae0fb1399377ef6aea9368444c4987cc6

Modified: head/contrib/jemalloc/doc/jemalloc.3
==============================================================================
--- head/contrib/jemalloc/doc/jemalloc.3	Thu Jun 15 06:48:36 2017	(r319970)
+++ head/contrib/jemalloc/doc/jemalloc.3	Thu Jun 15 07:15:05 2017	(r319971)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706150715.v5F7F6aT031218>