phobos icon indicating copy to clipboard operation
phobos copied to clipboard

Add SharedAllocatorList

Open jercaianu opened this issue 6 years ago • 4 comments

Added the shared version of AllocatorList. This will be very useful together with SharedAscendingPageAllocator. Instead of mapping a huge chunk of virtual memory when constructing the allocator, we can now use it together with SharedAllocatorList and gradually map smaller chunks of memory on demand.

jercaianu avatar Apr 19 '18 19:04 jercaianu

Thanks for your pull request and interest in making D better, @jercaianu! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#6465"

dlang-bot avatar Apr 19 '18 19:04 dlang-bot

@jercaianu try sth. like this:

static foreach (T; __traits(allMembers, typeof(impl)))
{
    static if (mixin("isCallable!(impl." ~ T ~ ")") && !T.startsWith("__"))
    static if (mixin("__traits(getProtection, impl." ~ T ~ ") == `public`"))
    {
        mixin(`auto ` ~ T ~ `(Parameters!(impl.`~T~`) params)
        {
            lock.lock();
            scope(exit) lock.unlock();
            return assumeUnshared(impl).`~T~`(params);
        }
        `);
    }
}

wilzbach avatar May 02 '18 14:05 wilzbach

Oh and if you use synchronized you don't need assumeUnshared because the compiler is then smart enough:

synchronized(mutex) {
  return impl.foo();
}

(though it needs to be a mutex, e.g. new Mutex)

wilzbach avatar May 02 '18 14:05 wilzbach

Removing auto merge, this is stalled.

thewilsonator avatar Jan 14 '22 11:01 thewilsonator