Merge branch 'main'

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
This commit is contained in:
Jay Lee 2023-07-28 00:09:36 +08:00
commit 66797a54ea
No known key found for this signature in database
GPG key ID: CF3437B6A06C22F9
10 changed files with 38 additions and 8 deletions

View file

@ -1,3 +1,10 @@
# 0.5.4 - 2023-07-22
- Add disable_initial_exec_tls feature for jemalloc-ctl (#59)
- Fix definition of `c_bool` for non-MSVC targets (#54)
- Add `disable_cache_oblivious` feature (#51)
- Add loongarch64 support (#42)
# jemalloc-sys 0.5.3 - 2023-02-03
- Remove fs-extra dependency (#47)

View file

@ -1,6 +1,6 @@
[package]
name = "jemalloc-ctl"
version = "0.5.0"
version = "0.5.4"
authors = [
"Steven Fackler <sfackler@gmail.com>",
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>",
@ -36,6 +36,7 @@ jemallocator = { path = "../jemallocator", version = "0.5.0" }
[features]
default = []
use_std = [ "libc/use_std" ]
disable_initial_exec_tls = ["tikv-jemalloc-sys/disable_initial_exec_tls"]
[package.metadata.docs.rs]
rustdoc-args = [ "--cfg", "jemallocator_docs" ]

View file

@ -1,6 +1,6 @@
[package]
name = "jemalloc-sys"
version = "0.5.3+5.3.0-patched"
version = "0.5.4+5.3.0-patched"
authors = [
"Alex Crichton <alex@alexcrichton.com>",
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>",
@ -40,6 +40,7 @@ background_threads = [ "background_threads_runtime_support" ]
stats = []
unprefixed_malloc_on_supported_platforms = []
disable_initial_exec_tls = []
disable_cache_oblivious = []
[package.metadata.docs.rs]
rustdoc-args = [ "--cfg", "jemallocator_docs" ]

View file

@ -84,6 +84,13 @@ This crate provides following cargo feature flags:
the error `yourlib.so: cannot allocate memory in static TLS block`, you'll
likely want to enable this.
* `disable_cache_oblivious` (disabled by default): when enabled, jemalloc is
built with the `--disable-cache-oblivious` option. In that case, all large
allocations are page-aligned as an implementation artifact. It may severely
harm CPU cache utilization. However, the cache-oblivious layout has a cost of
one extra page per large allocation which can be unfeasible for certain
applications.
### Environment variables
`jemalloc` options taking values are passed via environment variables using the

View file

@ -262,6 +262,11 @@ fn main() {
cmd.arg("--disable-initial-exec-tls");
}
if env::var("CARGO_FEATURE_DISABLE_CACHE_OBLIVIOUS").is_ok() {
info!("CARGO_FEATURE_DISABLE_CACHE_OBLIVIOUS set");
cmd.arg("--disable-cache-oblivious");
}
cmd.arg(format!("--host={}", gnu_target(&target)));
cmd.arg(format!("--build={}", gnu_target(&host)));
cmd.arg(format!("--prefix={}", out_dir.display()));

View file

@ -50,7 +50,14 @@
#![deny(missing_docs, broken_intra_doc_links)]
use libc::{c_char, c_int, c_uint, c_void, size_t};
// jemalloc uses `stdbool.h` to define `bool` for which the Rust equivalent is `bool`.
// However jemalloc also has its own `stdbool.h` that it uses when compiling with MSVC,
// and this header defines `bool` as `BOOL` which in turn is `int`.
#[cfg(target_env = "msvc")]
type c_bool = c_int;
#[cfg(not(target_env = "msvc"))]
type c_bool = bool;
/// Align the memory allocation to start at an address that is a
/// multiple of `1 << la`.

View file

@ -1,7 +1,7 @@
[package]
name = "jemallocator"
# Make sure to update the version in the README as well:
version = "0.5.0"
version = "0.5.4"
authors = [
"Alex Crichton <alex@alexcrichton.com>",
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>",

View file

@ -4,7 +4,7 @@
This project is the successor of [jemallocator](https://github.com/gnzlbg/jemallocator).
The project is published as `tikv-jemallocator` and `jemallocator` for historical reasons. The two crates are the same except names. It's OK to use either crate. But due to lack of permissions, only `jemallocator` and `jemalloc-sys` are updated. If you want to use other crates, `tikv-xxx` versions are still required.
The project is also published as `jemallocator` for historical reasons. The two crates are the same except names. For new projects, it's recommended to use `tikv-xxx` versions instead.
> Links against `jemalloc` and provides a `Jemalloc` unit type that implements
> the allocator APIs and can be set as the `#[global_allocator]`

View file

@ -31,6 +31,7 @@ const MIN_ALIGN: usize = 8;
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "riscv64",
target_arch = "s390x",

View file

@ -42,24 +42,25 @@ use libc::{c_int, c_void};
// _Alignof(max_align_t), the malloc-APIs return memory whose alignment is
// either the requested size if its a power-of-two, or the next smaller
// power-of-two.
#[cfg(all(any(
#[cfg(any(
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc"
)))]
))]
const ALIGNOF_MAX_ALIGN_T: usize = 8;
#[cfg(all(any(
#[cfg(any(
target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "riscv64",
target_arch = "s390x",
target_arch = "sparc64"
)))]
))]
const ALIGNOF_MAX_ALIGN_T: usize = 16;
/// If `align` is less than `_Alignof(max_align_t)`, and if the requested