Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dlang-community/containers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.8.0-alpha.7
Choose a base ref
...
head repository: dlang-community/containers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 30, 2018

  1. Upgrade stdx.allocator to 2.77.2

    This is to ensure Circle CI passes at dlang/phobos#6515
    JinShil authored May 30, 2018
    Copy the full SHA
    ee4d14c View commit details
  2. Merge pull request #112 from JinShil/patch-1

    Upgrade stdx.allocator to 2.77.2
    wilzbach authored May 30, 2018
    Copy the full SHA
    5d85484 View commit details
  3. Copy the full SHA
    9016b3b View commit details
  4. Merge pull request #113 from wilzbach/bump-stdx

    Update stdx-allocator git submodule
    merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
    dlang-bot authored May 30, 2018
    Copy the full SHA
    c0c4ce6 View commit details

Commits on Jun 18, 2018

  1. Support structs for key types in the hashmap/treemap. #71

    Hackerpilot committed Jun 18, 2018
    Copy the full SHA
    64ef163 View commit details

Commits on Jun 22, 2018

  1. Copy the full SHA
    f07d5cc View commit details
  2. Remove unused imports

    Hackerpilot committed Jun 22, 2018
    Copy the full SHA
    e620c39 View commit details
  3. Merge pull request #114 from dlang-community/derp

    Correctly reset t-tree length field to zero when clearing
    merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
    dlang-bot authored Jun 22, 2018
    Copy the full SHA
    931aad7 View commit details

Commits on Aug 6, 2018

  1. fix #116 - unittest build type is always set

    Basile Burg committed Aug 6, 2018
    Copy the full SHA
    65c02c1 View commit details
  2. Merge pull request #117 from dlang-community/issue-116

    fix #116 - unittest build type is always set
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Aug 6, 2018
    Copy the full SHA
    43ecf2c View commit details

Commits on Sep 26, 2018

  1. Stick to Meson 0.47.2 due to a regression in latest release

    The same as mesonbuild/meson#4248 appeared in #119.
    bbasile authored and Basile Burg committed Sep 26, 2018
    Copy the full SHA
    dfa5098 View commit details
  2. Merge pull request #120 from dlang-community/messon-reg

    Stick to Meson 0.47.2 due to a regression in latest release
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Sep 26, 2018
    Copy the full SHA
    fe6837d View commit details
  3. hash without using explicitly typeid

    Inspired by https://issues.dlang.org/show_bug.cgi?id=19197.
    Add to this the fact that typeid added an indirection.
    Basile Burg committed Sep 26, 2018
    Copy the full SHA
    09292dc View commit details

Commits on Sep 27, 2018

  1. Merge pull request #119 from dlang-community/hashof

    hash without using explicitly typeid
    Hackerpilot authored Sep 27, 2018
    Copy the full SHA
    9d25849 View commit details

Commits on Oct 9, 2018

  1. Copy the full SHA
    930df66 View commit details
  2. Merge pull request #118 from eclipseo/link_with_shared_runtime

    Link test_dcontainers with shared runtime via LDC switch '-link-defau…
    Hackerpilot authored Oct 9, 2018
    Copy the full SHA
    37f7c16 View commit details

Commits on Oct 16, 2018

  1. containers.hashmap: Re-add the storeHash parameter

    In some cases, the hash can be extremely cheap to calculate (e.g. the
    first few bytes of the key, when the key itself is a longer hash). In
    these cases, storing the hash is an unnecessary overhead. As such, the
    user should be able to specify when to store the hash within HashMap
    nodes.
    
    The storeHash parameter was initially introduced in
    fb998f0, and was later
    removed (presumably accidentally) in
    15eea7f. As it was part of the API,
    this was a breaking regression. This commit Fixes the regression and
    adds the parameter again.
    CyberShadow committed Oct 16, 2018
    Copy the full SHA
    c070981 View commit details
  2. containers.hashmap: Fix redundant hashFunction call in getOrAdd

    The result was being thrown away by being overwritten inside
    find(). Additionally, when a hash function was specified with a return
    value other than size_t, this resulted in a compilation error.
    
    The bug is a regression (introduced in commit
    15eea7f).
    
    Fix by letting find compute the hash as in other invocations.
    CyberShadow committed Oct 16, 2018
    Copy the full SHA
    4d332a4 View commit details
  3. Merge pull request #122 from CyberShadow/revive-storehash

    containers.hashmap: Re-add the storeHash parameter
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Oct 16, 2018
    Copy the full SHA
    fd5f7e3 View commit details
  4. Merge pull request #123 from CyberShadow/pull-20181016-103046

    containers.hashmap: Fix redundant hashFunction call in getOrAdd
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Oct 16, 2018
    Copy the full SHA
    02b2a82 View commit details
  5. containers.hashmap: Re-add opApply iteration

    Commit 15eea7f intentionally removed
    opApply iteration to make room for range-based iteration via
    opSlice. The change caused code breakage (foreach (k, v; aa) was
    broken as ranges, in lieu of language tuples, can only iterate as a
    KeyValue struct at best). That wouldn't be so bad by itself assuming
    the iterator range was implemented by keeping a pointer to the HashMap
    node and allowing writing back to it / accessing the value by
    reference... but, no, the KeyValue object used here actually created
    wasteful copies of iterated keys/values.
    
    Furthermore, the new implementation of iteration accepted the
    following code:
    
    	foreach (ref v; map) v++;
    
    ... which compiled, but did not actually mutate the iterated hashmap.
    
    Improve the situation by adding opApply iteration back, thus
    unbreaking:
    
    - iterating by key/value as distinct foreach parameters
    - avoiding copying the key/value by providing it by ref
    - writing values back to the HashMap.
    CyberShadow committed Oct 16, 2018
    Copy the full SHA
    4a04cb3 View commit details
  6. Copy the full SHA
    937eb34 View commit details
  7. Merge pull request #125 from CyberShadow/pull-20181016-123552

    containers.hashmap: Fix HashMap.remove for storeHash==false
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Oct 16, 2018
    Copy the full SHA
    03a5345 View commit details
  8. Merge pull request #124 from CyberShadow/revive-opapply

    containers.hashmap: Re-add opApply iteration
    Hackerpilot authored Oct 16, 2018
    Copy the full SHA
    9de0e4f View commit details

Commits on Oct 26, 2018

  1. update wrap file for stdx allocator

    head requires to add mir-core as submodule
    bbasile authored Oct 26, 2018
    Copy the full SHA
    71adb34 View commit details
  2. Merge pull request #127 from dlang-community/stdxalloc-version

    update wrap file for stdx allocator
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Oct 26, 2018
    Copy the full SHA
    458387d View commit details

Commits on Nov 2, 2018

  1. Prevent running CI twice when PR branch is in origin (#128)

    Prevent running CI twice when PR branch is in origin
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    bbasile authored and dlang-bot committed Nov 2, 2018
    Copy the full SHA
    c692722 View commit details

Commits on Nov 8, 2018

  1. Copy the full SHA
    7432553 View commit details
  2. Code cleanup

    Hackerpilot committed Nov 8, 2018
    Copy the full SHA
    f105d54 View commit details

Commits on Nov 9, 2018

  1. Merge pull request #129 from Hackerpilot/hash-nonsense

    Improve hash code to array index translation
    jcrapuchettes authored Nov 9, 2018
    Copy the full SHA
    760a040 View commit details

Commits on Dec 14, 2018

  1. Copy the full SHA
    1b05641 View commit details
  2. Merge pull request #132 from dlang-community/BBasile-patch-1

    fix CI failure due to Python environment and Meson
    merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
    dlang-bot authored Dec 14, 2018
    Copy the full SHA
    836a0cc View commit details

Commits on Jan 25, 2019

  1. Copy the full SHA
    57abb5a View commit details
  2. Merge pull request #133 from dlang-community/fix_hashset_remove

    Fix crash when attempting to remove en element from an empty set
    merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
    dlang-bot authored Jan 25, 2019
    Copy the full SHA
    22fe1e5 View commit details

Commits on Jan 26, 2019

  1. Speed up hash-> index conversion

    Brian Schott committed Jan 26, 2019
    Copy the full SHA
    117c1d9 View commit details

Commits on Jan 28, 2019

  1. Copy the full SHA
    96be8bc View commit details
  2. Use bsf for consistency

    Hackerpilot committed Jan 28, 2019
    Copy the full SHA
    c2d7a6d View commit details
  3. Merge pull request #135 from dlang-community/optimize_hashToIndex

    Optimize hash to index using LDC intrinsics
    jcrapuchettes authored Jan 28, 2019
    Copy the full SHA
    d2ae062 View commit details

Commits on Feb 13, 2019

  1. Copy the full SHA
    83eb2b8 View commit details
  2. Add test for containsKey

    Hackerpilot committed Feb 13, 2019
    Copy the full SHA
    d6e2257 View commit details
  3. Merge pull request #138 from dlang-community/fix_containsKey

    Fix a bug where containsKey just didn't even compile
    jcrapuchettes authored Feb 13, 2019
    Copy the full SHA
    86e29cb View commit details

Commits on Feb 19, 2019

  1. Copy the full SHA
    2acd71f View commit details
  2. Merge pull request #140 from dlang-community/fix_139

    Fix incorrect import of walkLength
    merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
    dlang-bot authored Feb 19, 2019
    Copy the full SHA
    18a0224 View commit details

Commits on Mar 12, 2019

  1. Fix CI failure caused by wrong stdx allocs version

    Basile-z authored and Basile Burg committed Mar 12, 2019
    Copy the full SHA
    87a48d7 View commit details
  2. Copy the full SHA
    a954f70 View commit details

Commits on Mar 16, 2019

  1. Merge pull request #141 from dlang-community/stdx-allocs+Meson

    Fix CI failure starting from DMD 2.085
    wilzbach authored Mar 16, 2019
    Copy the full SHA
    257c041 View commit details

Commits on Apr 18, 2019

  1. fix #143 - Still issues in unrolled list

    Basile Burg committed Apr 18, 2019
    Copy the full SHA
    aa08d97 View commit details

Commits on Apr 29, 2019

  1. Copy the full SHA
    bdaf3b9 View commit details
  2. oops

    Hackerpilot committed Apr 29, 2019
    Copy the full SHA
    29149d2 View commit details
  3. Merge pull request #145 from dlang-community/fix_insert

    Fix use-after-free when an insert causes a rehash
    jcrapuchettes authored Apr 29, 2019
    Copy the full SHA
    f718ec1 View commit details
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -8,5 +8,8 @@ trim_trailing_whitespace = true
[*.d]
indent_style = tab

[*.json]
[*.{json,sdl}]

[*.yml]
indent_style = space
indent_size = 2
85 changes: 85 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI
on:
pull_request:
push:
branches:
- master

jobs:
Test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- windows-2019
- macos-10.15
d:
- "ldc-1.27.1"
- "dmd-2.097.2"
meson:
- 0.59.1
ninja:
- 1.10.2
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

# Cache
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.dub
~/AppData/Local/dub
~/.cache/pip
~/AppData/Local/pip/cache
key: "containers-cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-${{ matrix.meson }}-${{ matrix.ninja }}-deps:${{ hashFiles('./meson.build') }}-${{ hashFiles('./dub.sdl') }}"

# Setup compilers and tools

- name: Setup D
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.d }}

- uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Setup Meson
run: pip install meson==${{ matrix.meson }}

- name: Setup Ninja
uses: aminya/install-cmake@new-versions-and-arch
with:
cmake: false
ninja: ${{ matrix.ninja }}

# Build and Test

- name: Build documentation
run: |
dub build --build=ddox
dub build --build=docs
- name: Build
run: |
meson setup ./build
meson compile -C ./build
- name: Install gcc-multilib
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get install -y gcc-multilib

- name: Make Test
run: |
make -B -C test/
# TODO it fails to run the UnrolledList test on ldc
- name: Dub Test
run: |
dub test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -21,4 +21,4 @@ __test__*__
.directory
*.userprefs
.vscode
emsi_containers-test-unittest
build/
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,9 +3,6 @@ Containers [![CI status](https://travis-ci.org/dlang-community/containers.svg?br

Containers backed by std.experimental.allocator

# Dependencies
Run `git submodule update --init --recursive` after cloning this repository.

# Documentation
Documentation is available at http://dlang-community.github.io/containers/index.html

19 changes: 0 additions & 19 deletions dub.json

This file was deleted.

10 changes: 10 additions & 0 deletions dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name "emsi_containers"
description "Containers that use Phobos' experimental allocators"
homepage "https://github.com/dlang-community/containers"
authors "EMSI" "DLang Community"
license "BSL-1.0"
targetPath "build"
buildType "unittest" {
versions "emsi_containers_unittest"
buildOptions "debugMode" "debugInfo" "unittests"
}
31 changes: 18 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
project('dcontainers', 'd',
meson_version: '>=0.44',
meson_version: '>=0.52',
license: 'BSL-1.0',
version: '0.8.0'
)

project_soversion = '0'

pkgc = import('pkgconfig')
allocator_dep = dependency('stdx-allocator', version: '>= 2.77', fallback: ['stdx-allocator', 'allocator_dep'])

#
# Sources
#
@@ -33,24 +30,22 @@ dcontainers_src = [
'src/containers/unrolledlist.d'
]

dc = meson.get_compiler('d')
src_dir = include_directories('src/')

#
# Targets
#
dcontainers_lib = library('dcontainers',
dcontainers_lib = static_library('dcontainers',
[dcontainers_src],
include_directories: [src_dir],
install: true,
version: meson.project_version(),
soversion: project_soversion,
dependencies: [allocator_dep]
)

pkgc = import('pkgconfig')
pkgc.generate(name: 'dcontainers',
libraries: [dcontainers_lib],
subdirs: 'd/containers',
requires: ['stdx-allocator'],
version: meson.project_version(),
description: 'Containers backed by std.experimental.allocator.'
)
@@ -59,20 +54,30 @@ pkgc.generate(name: 'dcontainers',
dcontainers_dep = declare_dependency(
link_with: [dcontainers_lib],
include_directories: [src_dir],
dependencies: [allocator_dep]
)

#
# Tests
#
if dc.get_id() == 'gcc'
test_link_args = []
test_main_file = configure_file(capture: true,
command: ['echo', 'int main(string[] args) { return 0; }'],
output: 'unittest_main.d'
)
else
test_link_args = ['-main']
test_main_file = []
endif

dcontainers_test_exe = executable('test_dcontainers',
[dcontainers_src,
'test/compile_test.d',
'test/external_allocator_test.d'],
'test/external_allocator_test.d',
test_main_file],
include_directories: [src_dir],
dependencies: [allocator_dep],
d_unittest: true,
link_args: '-main'
link_args: test_link_args
)
test('test_dcontainers', dcontainers_test_exe)

57 changes: 29 additions & 28 deletions src/containers/cyclicbuffer.d
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
module containers.cyclicbuffer;

private import core.exception : onRangeError;
private import stdx.allocator.mallocator : Mallocator;
private import std.experimental.allocator.mallocator : Mallocator;
private import std.range.primitives : empty, front, back, popFront, popBack;
private import containers.internal.node : shouldAddGCRange;

@@ -26,7 +26,7 @@ struct CyclicBuffer(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange
@disable this(this);

private import std.conv : emplace;
private import stdx.allocator.common : stateSize;
private import std.experimental.allocator.common : stateSize;
private import std.traits : isImplicitlyConvertible, hasElaborateDestructor;

static if (stateSize!Allocator != 0)
@@ -40,9 +40,10 @@ struct CyclicBuffer(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange
this(Allocator allocator) nothrow pure @safe @nogc
in
{
assert(allocator !is null, "Allocator must not be null");
static if (is(typeof(allocator is null)))
assert(allocator !is null, "Allocator must not be null");
}
body
do
{
this.allocator = allocator;
}
@@ -226,23 +227,23 @@ struct CyclicBuffer(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange
auto ref front(this This)() nothrow pure @property @safe
{
version (assert) if (empty) onRangeError();
alias ET = ContainerElementType!(This, T);
alias ET = ContainerElementType!(This, T, true);
return cast(ET) storage[start];
}

/// Accesses to the item at the end of the buffer.
auto ref back(this This)() nothrow pure @property @safe
{
version (assert) if (empty) onRangeError();
alias ET = ContainerElementType!(This, T);
alias ET = ContainerElementType!(This, T, true);
return cast(ET) storage[end];
}

/// buffer[i]
auto ref opIndex(this This)(size_t i) nothrow pure @safe
{
version (assert) if (i >= length) onRangeError();
alias ET = ContainerElementType!(This, T);
alias ET = ContainerElementType!(This, T, true);
return cast(ET) storage[(start + i) % $];
}

@@ -449,8 +450,8 @@ private:
version(emsi_containers_unittest) private
{
import std.algorithm.comparison : equal;
import stdx.allocator.gc_allocator : GCAllocator;
import stdx.allocator.building_blocks.free_list : FreeList;
import std.experimental.allocator.gc_allocator : GCAllocator;
import std.experimental.allocator.building_blocks.free_list : FreeList;
import std.range : iota, lockstep, StoppingPolicy;

struct S
@@ -549,27 +550,27 @@ version(emsi_containers_unittest) unittest

version(emsi_containers_unittest) unittest
{
int a = 0;
int* a = new int;
{
CyclicBuffer!S b;
{
S s = { &a };
S s = { a };
foreach (i; 0 .. 5)
b.insertBack(s);
assert(a == 5);
assert(*a == 5);
foreach (i; 0 .. 5)
b.insertBack(S(&a));
assert(a == 10);
b.insertBack(S(a));
assert(*a == 10);
foreach (i; 0 .. 5)
{
b.removeBack();
b.removeFront();
}
assert(a == 20);
assert(*a == 20);
}
assert(a == 21);
assert(*a == 21);
}
assert(a == 21);
assert(*a == 21);
}

version(emsi_containers_unittest) unittest
@@ -678,26 +679,26 @@ version(emsi_containers_unittest) unittest

version(emsi_containers_unittest) unittest
{
int a = 0;
int* a = new int;
{
CyclicBuffer!S b;
foreach (i; 0 .. 5)
b.insertBack(S(&a));
assert(a == 5);
b.insertBack(S(a));
assert(*a == 5);
}
assert(a == 10);
a = 0;
assert(*a == 10);
*a = 0;
{
CyclicBuffer!S b;
foreach (i; 0 .. 4)
b.insertBack(S(&a));
assert(a == 4);
b.insertBack(S(a));
assert(*a == 4);
b.removeFront();
assert(a == 5);
b.insertBack(S(&a));
assert(a == 6);
assert(*a == 5);
b.insertBack(S(a));
assert(*a == 6);
}
assert(a == 10);
assert(*a == 10);
}

version(emsi_containers_unittest) unittest
Loading