637 Commits

Author SHA1 Message Date
Hiroki Tokunaga
9c0c565178
feat: implement Debug for Deque 2021-09-05 15:44:30 +09:00
Emil Fresk
59bc89f297
Merge pull request #236 from japaric/lazy-init-anchor
CAS Pool x86_64: lazily initialized ANCHOR
2021-08-26 15:43:12 +02:00
Emil Fresk
d5e092575b
Merge pull request #235 from japaric/well-aligned-dangling-pointer
CAS Pool: make dangling Ptr well aligned
2021-08-26 15:42:49 +02:00
Jorge Aparicio
25b9b06d1c CAS Pool x86_64: lazily initialized ANCHOR
this reduces the chances of hitting the 32-bit address space issue on x86_64

instead of (always) using a static ANCHOR variable located in .bss we lazily initialize the ANCHOR
variable using the value passed to the first `Ptr::new` invocation. In practice, this means the very
first `Pool::grow` (on x86_64) call is guaranteed to work (use the given memory). Follow up `grow`
invocations are *more likely* to work (but not guaranteed) *if* all given memory comes from the
heap.

We still need an ANCHOR in .bss as a fallback because it's possible to allocate ZST on a pool
without calling `Pool::grow` (= the lazily init ANCHOR is never initialized *but* it can be read)
2021-08-26 14:17:43 +02:00
Jorge Aparicio
46d1361f72 offset can be zero 2021-08-26 13:57:01 +02:00
Jorge Aparicio
cfbc9a9ef7 also test larger alignment 2021-08-26 13:53:52 +02:00
Jorge Aparicio
959fc9b683 CAS Pool: make dangling Ptr well aligned
the old logic didn't consider the pointee's alignment when creating a dangling pointer

dangling pointers are used in pools of ZST (Zero Sized Types). the old logic resulted in these Boxed
ZST not being well aligned. the test added in this PR was failing
2021-08-26 13:14:34 +02:00
Emil Fresk
9563b3546c
Merge pull request #234 from japaric/pool-nonzero-tag
CAS (x86*) Pool: make the tag NonZeroU32
2021-08-26 13:01:55 +02:00
Jorge Aparicio
9de605524e x86* Pool: make the tag NonZeroU32
in the CAS version of the Treiber stack, the 64-bit "pointers" (Ptr) are NonZero values because a
Node is an Option<Ptr> and that needs to be a 64-bit value.

after adding x86 support it became (theoretically) possible to break the non-zero invariant: Ptr is
a 32-bit tag plus a 32-bit pointer (or offset on x86_64). The tag can be zero. The 32-bit offset on
x86_64 can _not_ be zero (+) because the ANCHOR is one byte in memory and memory cannot overlap.
However, on x86 the pointer can(?) be zero (I mean on Cortex-M, address zero is a valid memory
location) so that's a problem.

This fixes the issue be turning the tag into a NonZeroU32 value. This way even if the offset/pointer
is 0 the NonZero invariant of Ptr is maintained. So care in needed when incrementing the tag to not
turn it into a zero value on wraparound

(+) spoilers: I have a follow up PR where the 32-bit offset on x86_64 can become zero so this PR is
prerequisite for that follow up PR
2021-08-26 11:23:33 +02:00
Emil Fresk
f76a8bdb97
Merge pull request #233 from japaric/x86-pool
Sync Pool support for (32-bit) x86
2021-08-25 18:30:11 +02:00
Jorge Aparicio
dffc1251a4 CI: remove i686 MUSL from TSAN test
no TSAN support for that target
2021-08-25 16:05:08 +02:00
Jorge Aparicio
63c7636990 actually make Pool Sync on x86
the `#[cfg(any(.., test)]` was misleading
2021-08-25 16:05:08 +02:00
Emil Fresk
1a7c8e8b25
Merge pull request #232 from japaric/fix-pool-capacity-report
fix return value of `Pool::grow` on x86_64
2021-08-25 15:53:16 +02:00
Jorge Aparicio
6f9c883726 Sync Pool support for (32-bit) x86
the implementation uses a 64-bit atomic on `x86` to avoid the `ANCHOR` variable and the address
space limitation seen with the x86_64 compilation target

this PR also adds the i686-linux-musl target to the test matrix to exercise the new implementation

closes #231
2021-08-25 15:37:27 +02:00
Jorge Aparicio
0d721bf0e6 fix return value of Pool::grow on x86_64
the logic was increasing the "capacity" counter even in the case the given memory address was out of
range (ANCHOR +- 2GB) -- `None` branch in code -- resulting in a wrong / misleading value being
reported
2021-08-25 15:13:07 +02:00
Emil Fresk
f49f967148 v0.7.5 release v0.7.5 2021-08-16 14:16:52 +02:00
Emil Fresk
c82478f78b
Merge pull request #229 from japaric/symmetric_vec_interface
Made pop_unchecked public, added is_empty
2021-08-16 14:14:32 +02:00
Emil Fresk
e0323e7157
Merge pull request #227 from japaric/linked_list_impl
Added sorted linked list implementation
2021-08-16 14:12:05 +02:00
Emil Fresk
0bac6ca2d6 Added sorted linked list implementation 2021-08-16 13:59:18 +02:00
Emil Fresk
dadf5bf76f Made pop_unchecked public, added is_empty 2021-08-16 12:23:38 +02:00
Emil Fresk
8d76c2d755
Merge pull request #219 from Dirbaio/deque
Add Deque.
2021-08-09 10:24:41 +02:00
Dario Nieuwenhuis
e292ca4486 deque: Add front, front_mut, back, back_mut. 2021-08-08 21:24:41 +02:00
Emil Fresk
3777e96673 v0.7.4 release v0.7.4 2021-08-06 18:44:16 +02:00
Emil Fresk
d1b53baaba
Merge pull request #226 from bbqsrc/master
Add PartialOrd and Ord to Vec and String
2021-08-05 09:20:14 +02:00
Brendan Molloy
345cafbdef Add tests 2021-08-04 20:40:38 +02:00
Brendan Molloy
e3cfa98b2f Handle heterogenous vector sizes 2021-08-04 20:40:38 +02:00
Brendan Molloy
f1f48b3c85 Add Ord and PartialOrd to String 2021-08-04 18:03:58 +02:00
Brendan Molloy
0d57dd28c9 Add PartialOrd and Ord to Vec 2021-08-04 17:40:10 +02:00
Dario Nieuwenhuis
a11ed8c33e Tests to create something on stack should create it on stack. 2021-07-30 17:43:25 +02:00
Dario Nieuwenhuis
dbeef92226 Remove outdated comment 2021-07-30 17:43:25 +02:00
Dario Nieuwenhuis
40808ec22f Add Deque. 2021-07-30 17:43:25 +02:00
Emil Fresk
186b2b55e7
Merge pull request #220 from therealprof/atomic-polyfill-optional
Make "atomic-polyfill" an optional dep for thumbv6m-none-eabi only
2021-07-30 15:07:52 +02:00
Emil Fresk
7f2a01f16b
Merge pull request #224 from rise0chen/master
impl Default
2021-07-30 14:38:52 +02:00
Emil Fresk
312e903e39
Merge pull request #225 from abhikjain360/master
fix safety comment in spsc
2021-07-30 12:47:29 +02:00
Abhik Jain
09192874ab
fix safety comment in spsc
Signed-off-by: Abhik Jain <abhikjain360@gmail.com>
2021-07-29 20:15:50 +05:30
rise0chen
3264c92292 impl Default 2021-07-28 15:23:21 +08:00
Emil Fresk
e7c4c7b1f2
Merge pull request #221 from jordens/patch-1
spsc: fix optimal queue size docstring
2021-07-25 11:32:21 +02:00
Robert Jördens
46d6f1d4b2
spsc: clarify optimal queue size doc
`capacity` is defined as `N - 1`. But best performance (cheap modulo) is achieved if `N` is a power of two, not `capacity`.
This clarifies the docstring.
2021-07-20 15:04:58 +02:00
Daniel Egger
0f899d9696 Make "atomic-polyfill" an optional dep for thumbv6m-none-eabi only
... otherwise any crate using heapless will automatically add all the
funny ARMv6-M only dependencies regardless.

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2021-07-14 14:30:10 +02:00
Emil Fresk
2390ab798c
Merge pull request #217 from japaric/deprecate-freeze-v0.7.3
Deprecate `Box::freeze`, prepare v0.7.3
v0.7.3
2021-07-01 10:20:35 +02:00
Emil Fresk
01f16f1716 Deprecate Box::freeze, prepare v0.7.3 2021-07-01 10:04:03 +02:00
Emil Fresk
1d502c09a8
Merge pull request #215 from japaric/v0.7.2-release
Preparing v0.7.2
v0.7.2
2021-06-30 17:24:39 +02:00
Emil Fresk
295e115542 Preparing v0.7.2 2021-06-30 17:12:36 +02:00
Emil Fresk
22e4c73383
Merge pull request #211 from GrantM11235/vec_into_array
Add new `Vec::into_array` method
2021-06-25 11:09:10 +02:00
Grant Miller
90daba17b8 Add new Vec::into_array method 2021-06-24 19:44:53 -05:00
Emil Fresk
3b4983683d Preparing for v0.7.1 v0.7.1 2021-05-23 14:25:23 +02:00
Emil Fresk
6d1a2ed3d7
Merge pull request #172 from theunkn0wn1/feature/defmt
defmt impl for Vec
2021-05-23 14:22:42 +02:00
Joshua Salzedo
63d0ed8395
cargo fmt 2021-05-18 11:11:30 -07:00
Joshua Salzedo
f4617ea76c
attempt at reimplementing on a clean history 2021-05-17 12:51:03 -07:00
Emil Fresk
afd7eb9255
Merge pull request #209 from vinaychandra/generic_mpmc
Generic MPMC
2021-05-09 17:51:09 +02:00