Unverified Commit 1fa3f7f6 authored by Sergey Pepyakin's avatar Sergey Pepyakin Committed by GitHub
Browse files

Refactor and document allocator (#4855)



* Clarify code a bit.

* Move code around.

* Introduce `Order`.

* Introduce `Link` structure.

* Get rid of ptr_offset

This is beneficial since ptr_offset is essentially makes us handle two different address spaces, global (i.e. `mem`) and heap local and without it things are becoming simpler.

* Rename PREFIX_SIZE to HEADER_SIZE.

This will come in the next commits.

* Introduce a separate `Memory` trait.

This is not necessary, but will come in handy for the upcoming changes.

* Rename `ptr` to `header_ptr` where makes sense.

* Introduce a `Header` type.

* Make `bump` dumber.

This allows us to pull `HEADER_SIZE` to see that we actually allocate `order.size() + HEADER_SIZE`.

* Clean up.

* Introduce a freelists struct.

* Update documentation.

* Make Sized requirement optional to make the PR truly back-compatible.

* Apply suggestions from code review

Co-Authored-By: default avatarGavin Wood <[email protected]>

* Apply suggestions from code review

Co-Authored-By: default avatarBastian Köcher <[email protected]>

Co-authored-by: default avatarGavin Wood <[email protected]>
Co-authored-by: default avatarBastian Köcher <[email protected]>
parent 571e3c4d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment