Skip to content

Commit

Permalink
Merge branch 'master' into ao-kvdb-sled
Browse files Browse the repository at this point in the history
* master:
  parity-util-mem: prepare release for 0.5.2 (#359)
  travis: test parity-util-mem on android (#358)
  parity-util-mem: update mimalloc feature (#352)
  kvdb: remove parity-bytes dependency (#351)
  parity-util-mem: use malloc for usable_size on android (#355)
  CI: troubleshoot macOS build (#356)
  • Loading branch information
ordian committed Mar 14, 2020
2 parents 61ffafc + bf58794 commit c02c091
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
20 changes: 11 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ matrix:
rust: stable
before_script:
- rustup component add rustfmt
- os: linux
rust: beta
- os: linux
rust: nightly
script:
- cargo check --all --benches
- cargo check --workspace --benches
- os: linux
rust: stable
install:
- cargo install cross
script:
- cross test --target=aarch64-linux-android -p parity-util-mem
- os: osx
osx_image: xcode11.2
osx_image: xcode11.3
addons:
chrome: stable
firefox: latest
install:
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | sh
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | sh
- source ~/.nvm/nvm.sh
- nvm install --lts
- npm install -g chromedriver
Expand All @@ -32,12 +36,10 @@ matrix:
install:
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
script:
- if [ "$TRAVIS_RUST_VERSION" == "stable" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
cargo fmt -- --check;
fi
- cargo check --all --tests
- cargo check --all --benches
- cargo build --all
- cargo check --workspace --tests --benches
- cargo test --all --exclude uint --exclude fixed-hash --exclude parity-crypto
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then
cd contract-address/ && cargo test --features=external_doc && cd ..;
Expand Down
1 change: 1 addition & 0 deletions kvdb/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog].

## [Unreleased]
- License changed from GPL3 to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)
- Remove dependency on parity-bytes. [#351](https://github.com/paritytech/parity-common/pull/351)

## [0.4.0] - 2019-01-06
- Bump parking_lot to 0.10. [#332](https://github.com/paritytech/parity-common/pull/332)
Expand Down
1 change: 0 additions & 1 deletion kvdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ edition = "2018"

[dependencies]
smallvec = "1.0.0"
bytes = { package = "parity-bytes", version = "0.1", path = "../parity-bytes" }
parity-util-mem = { path = "../parity-util-mem", version = "0.5", default-features = false }
3 changes: 1 addition & 2 deletions kvdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

//! Key-Value store abstraction.

use bytes::Bytes;
use smallvec::SmallVec;
use std::io;

Expand Down Expand Up @@ -73,7 +72,7 @@ impl DBTransaction {
}

/// Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
pub fn put_vec(&mut self, col: u32, key: &[u8], value: Bytes) {
pub fn put_vec(&mut self, col: u32, key: &[u8], value: Vec<u8>) {
self.ops.push(DBOp::Insert { col, key: DBKey::from_slice(key), value });
}

Expand Down
4 changes: 4 additions & 0 deletions parity-util-mem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]

## [0.5.2] - 2019-03-13
- License changed from GPL3 to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)
- Updated mimalloc dependency. [#352](https://github.com/paritytech/parity-common/pull/352)
- Use malloc for `usable_size` on Android. [#355](https://github.com/paritytech/parity-common/pull/355)

## [0.5.1] - 2019-02-05
- Add different mode for malloc_size_of_is_0 macro dealing with generics. [#334](https://github.com/paritytech/parity-common/pull/334)
Expand Down
13 changes: 4 additions & 9 deletions parity-util-mem/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "parity-util-mem"
version = "0.5.1"
version = "0.5.2"
authors = ["Parity Technologies <[email protected]>"]
repository = "https://github.com/paritytech/parity-common"
description = "Collection of memory related utilities"
Expand All @@ -13,13 +13,8 @@ dlmalloc = { version = "0.1.3", features = ["global"], optional = true }
wee_alloc = { version = "0.4.5", optional = true }
lru = { version = "0.4", optional = true }
hashbrown = { version = "0.6", optional = true }
# from https://github.com/microsoft/mimalloc:
# mimalloc can be built in secure mode,
# adding guard pages, randomized allocation, encrypted free lists, etc.
# to protect against various heap vulnerabilities.
# The performance penalty is only around 3% on average over our benchmarks.
mimallocator = { version = "0.1.3", features = ["secure"], optional = true }
mimalloc-sys = { version = "0.1.6", optional = true }
mimalloc = { version = "0.1.18", optional = true }
libmimalloc-sys = { version = "0.1.14", optional = true }
parity-util-mem-derive = { path = "derive", version = "0.1" }
impl-trait-for-tuples = "0.1.3"

Expand All @@ -45,7 +40,7 @@ weealloc-global = ["wee_alloc", "estimate-heapsize"]
# use jemalloc as global allocator
jemalloc-global = ["jemallocator"]
# use mimalloc as global allocator
mimalloc-global = ["mimallocator", "mimalloc-sys"]
mimalloc-global = ["mimalloc", "libmimalloc-sys"]
# implement additional types
ethereum-impls = ["ethereum-types", "primitive-types"]
# Full estimate: no call to allocator
Expand Down
4 changes: 2 additions & 2 deletions parity-util-mem/src/allocators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ mod usable_size {
pub unsafe extern "C" fn malloc_usable_size(ptr: *const c_void) -> usize {
// mimalloc doesn't actually mutate the value ptr points to,
// but requires a mut pointer in the API
mimalloc_sys::mi_usable_size(ptr as *mut _)
libmimalloc_sys::mi_usable_size(ptr as *mut _)
}

} else if #[cfg(target_os = "linux")] {
} else if #[cfg(any(target_os = "linux", target_os = "android"))] {

/// Linux call system allocator (currently malloc).
extern "C" {
Expand Down
10 changes: 5 additions & 5 deletions parity-util-mem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ cfg_if::cfg_if! {
not(target_os = "windows"),
not(target_arch = "wasm32")
))] {
#[global_allocator]
/// Global allocator
#[global_allocator]
pub static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
} else if #[cfg(feature = "dlmalloc-global")] {
#[global_allocator]
/// Global allocator
#[global_allocator]
pub static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
} else if #[cfg(feature = "weealloc-global")] {
#[global_allocator]
/// Global allocator
#[global_allocator]
pub static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
} else if #[cfg(all(
feature = "mimalloc-global",
not(target_arch = "wasm32")
))] {
#[global_allocator]
/// Global allocator
pub static ALLOC: mimallocator::Mimalloc = mimallocator::Mimalloc;
#[global_allocator]
pub static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
} else {
// default allocator used
}
Expand Down

0 comments on commit c02c091

Please sign in to comment.