515 Commits

Author SHA1 Message Date
Jorge Aparicio
c0a5495463 [do not merge] run CI 2022-04-29 11:27:51 +02:00
Emil Fresk
f3af76d607
Merge pull request #260 from japaric/fix-index-structs
Fix bounds in IndexMap and IndexSet, IndexSet::new() is now const
v0.7.9
2021-12-16 10:57:58 +01:00
Emil Fresk
318da23c43 Fix bounds in IndexMap and IndexSet, IndexSet::new() is now const 2021-12-16 10:37:23 +01:00
Emil Fresk
e3c536b3c2
Merge pull request #255 from robinkrahl/vec-try-from
Implement TryFrom<&[T]> for Vec<T, N>
2021-11-24 16:11:29 +01:00
Robin Krahl
a9756bd652
Implement TryFrom<&[T]> for Vec<T, N>
There already is the Vec::from_slice method that does the same, but
implementing the TryFrom trait makes it easier to write code that works
both with heapless::Vec and std::vec::Vec.
2021-11-23 12:54:55 +01:00
Emil Fresk
f3175ee2f6
Merge pull request #251 from japaric/defmt-version-span
defmt version range
v0.7.8
2021-11-11 10:40:13 +01:00
Emil Fresk
cd754b7936 Support defmt version range (0.2 and 0.3) 2021-11-11 10:25:10 +01:00
Emil Fresk
8a77f3237f
Merge pull request #246 from Dirbaio/ci-miri
Run tests with MIRI in CI
2021-09-29 09:03:38 +02:00
Dario Nieuwenhuis
932760f3b7 Run tests with MIRI in CI 2021-09-24 23:48:36 +02:00
Emil Fresk
80cbe663f5
Merge pull request #244 from chemicstry/master
Fix MPMC size asserts
2021-09-22 21:14:31 +02:00
chemicstry
bd3cbaba61 Fix MPMC size asserts 2021-09-22 17:48:53 +03:00
Emil Fresk
1c1dd43e08 Preparing 0.7.7 release v0.7.7 2021-09-22 07:12:04 +02:00
Emil Fresk
23627b9dd0 Prepare v0.7.6 release v0.7.6 2021-09-21 17:43:21 +02:00
Emil Fresk
95f122a0d9
Merge pull request #241 from japaric/arc-thumbv6
Allow arc pool on thumbv6
2021-09-21 17:39:21 +02:00
Emil Fresk
751f24e928 Allow arc pool on thumbv6 2021-09-21 17:32:45 +02:00
Emil Fresk
3adc93a605
Merge pull request #242 from japaric/fix-miri
fix miri errors
2021-09-20 09:10:42 +02:00
Jorge Aparicio
8cf5a26347 use plain arithmetic instead of ptr::offset API
the offset from the anchor was computed used plain arithmetic
so to do the reverse (go from offset to a pointer) also use plain arithmetic

we were using the offset API for the reverse operation but miri doesn't like that: it consider the
pointer to be out of bounds wrt to the ANCHOR static variable
2021-09-15 11:08:39 +02:00
Jorge Aparicio
aa017a5606 fix ZST check in Pool::grow
Node<T> always has non-zero size; we want to check the size of the data T
2021-09-15 11:06:36 +02:00
Jorge Aparicio
0717a8c1ce avoid pointer arithmetic on pool::Box node when handling ZST 2021-09-15 11:05:28 +02:00
Emil Fresk
d3be154506
Merge pull request #240 from Dirbaio/miri-fixes
Miri fixes
2021-09-13 08:39:35 +02:00
Dario Nieuwenhuis
4c203532ba Ignore slow tests when running in miri.
There's a few tests that do millions of iterations. Miri is incredibly
slow and takes too long to run these (I gave up waiting after 5+ minutes),
so we ignore them when testing with miri.
2021-09-13 01:22:38 +02:00
Dario Nieuwenhuis
c98804daec deque: Fix miri error due to too small raw pointer borrow.
`&mut buffer[0]` only grants access to the first item, we need access
to the entire buffer.
2021-09-13 01:22:38 +02:00
Dario Nieuwenhuis
350e112db0 deque: fix miri error with raw-borrowing twice.
When you take a raw pointer, previous raw pointers are invalidated.
We get the pointer just once and use it twice.
2021-09-13 00:41:26 +02:00
Emil Fresk
0738b3cefc
Merge pull request #238 from japaric/arc-pool
add Arc pointer backed by a memory pool
2021-09-10 16:27:40 +02:00
Jorge Aparicio
6e8e26cc40 add grow_exact + docs 2021-09-10 16:16:58 +02:00
Jorge Aparicio
adee3a067d fix build for ARMv6-M 2021-09-10 13:16:43 +02:00
Jorge Aparicio
a4f33b4768 add Arc pointer backed by a memory pool 2021-09-10 12:56:16 +02:00
Emil Fresk
05c21c4b49
Merge pull request #237 from toku-sa-n/impl_debug_for_deque
feat: implement `Debug` for `Deque`
2021-09-05 08:55:02 +02:00
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