Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing `_zeroed` varants to `AllocRef` #69027

Merged
merged 1 commit into from Feb 12, 2020
Merged

Conversation

@TimDiekmann
Copy link
Contributor

TimDiekmann commented Feb 10, 2020

The majority of the allocator wg has decided to add the missing _zeroed variants to AllocRef:

these should be added since they can be efficiently implemented with the mremap system call on Linux. mremap allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.

If AllocRef does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for realloc_zeroed, alloc_excess_zeroed, realloc_excess_zeroed, and grow_in_place_zeroed.

r? @Amanieu

@TimDiekmann TimDiekmann force-pushed the TimDiekmann:zeroed-alloc branch from 08edded to 97d1f8d Feb 10, 2020
@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Feb 11, 2020

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 11, 2020

📌 Commit 97d1f8d has been approved by Amanieu

jonas-schievink added a commit to jonas-schievink/rust that referenced this pull request Feb 11, 2020
Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu
bors added a commit that referenced this pull request Feb 11, 2020
Rollup of 11 pull requests

Successful merges:

 - #68679 (Improve `ty.needs_drop`)
 - #68848 (Hasten macro parsing)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #69002 (miri: improve and simplify overflow detection)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69031 (Use `dyn Trait` more in tests)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69034 (parser: Remove `Parser::prev_token_kind`)
 - #69047 (Don't rustfmt check the vendor directory.)

Failed merges:

r? @ghost
jonas-schievink added a commit to jonas-schievink/rust that referenced this pull request Feb 11, 2020
Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu
bors added a commit that referenced this pull request Feb 11, 2020
Rollup of 11 pull requests

Successful merges:

 - #68848 (Hasten macro parsing)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #69002 (miri: improve and simplify overflow detection)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69034 (parser: Remove `Parser::prev_token_kind`)
 - #69038 (Add initial debug fmt for Backtrace)
 - #69040 (Cleanup SGX entry code)
 - #69058 (Preparation for allocator aware `Box`)
 - #69070 (Add self to .mailmap)

Failed merges:

r? @ghost
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 12, 2020
Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu
bors added a commit that referenced this pull request Feb 12, 2020
Rollup of 10 pull requests

Successful merges:

 - #67695 (Added dyn and true keyword docs)
 - #68241 (Migrate borrowck dataflow impls to new framework)
 - #68679 (Improve `ty.needs_drop`)
 - #68848 (Hasten macro parsing)
 - #68877 (On mismatched argument count point at arguments)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69058 (Preparation for allocator aware `Box`)
 - #69070 (Add self to .mailmap)
 - #69077 (Fix outdated doc comment.)

Failed merges:

r? @ghost
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 12, 2020
Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu
bors added a commit that referenced this pull request Feb 12, 2020
Rollup of 11 pull requests

Successful merges:

 - #67695 (Added dyn and true keyword docs)
 - #68487 ([experiment] Support linking from a .rlink file)
 - #68554 (Split lang_items to crates `rustc_hir` and `rustc_passes`.)
 - #68937 (Test failure of unchecked arithmetic intrinsics in const eval)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #68999 (remove dependency on itertools)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69058 (Preparation for allocator aware `Box`)
 - #69070 (Add self to .mailmap)
 - #69077 (Fix outdated doc comment.)

Failed merges:

r? @ghost
@bors bors merged commit 97d1f8d into rust-lang:master Feb 12, 2020
4 checks passed
4 checks passed
pr Build #20200210.49 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.