Fix riscv32 atomics and fix tests on 32-bit platforms#533
Fix riscv32 atomics and fix tests on 32-bit platforms#533VictorKoenders merged 6 commits intobincode-org:trunkfrom
Conversation
This test checks the range, which is necessarily different when running on another platform. Signed-off-by: Sean Cross <sean@xobs.io>
The deserialization process assumes that usize/isize are 64-bits, as does the spec at https://github.com/bincode-org/bincode/blob/trunk/docs/spec.md#varintencoding Force `usize` and `isize` to be encoded as `u64` and `i64` to force 32-bit platforms to conform to this spec. This fixes running tests under `cargo test --target i686-pc-windows-msvc` Signed-off-by: Sean Cross <sean@xobs.io>
Not all platforms support AtomicI64 or AtomicU64. Use the `target_has_atomic` config flag to determine whether to include these. This fixes bincode-org#532. Signed-off-by: Sean Cross <sean@xobs.io>
VictorKoenders
left a comment
There was a problem hiding this comment.
I wonder if we could make this bigger and add target_has_atomic to all atomic impls, and deprecate the atomic feature
Now that there is an attribute to indicate which atomic features are supported on this platform, remove the `atomic` Feature and use these new attributes. Signed-off-by: Sean Cross <sean@xobs.io>
|
Thanks for the suggestions. I've annotated all Atomic implementations. I assume that I'm not sure what the best way is to deprecate the feature, so I removed it wholesale. |
Codecov Report
@@ Coverage Diff @@
## trunk #533 +/- ##
==========================================
- Coverage 70.82% 69.45% -1.37%
==========================================
Files 47 46 -1
Lines 3215 3179 -36
==========================================
- Hits 2277 2208 -69
- Misses 938 971 +33
Continue to review full report at Codecov.
|
|
Can you pull in the new cross-platform build pipeline, and see if bincode now compiles for your target arch? |
|
It does build for my platform still, so it looks good to me! [10:10:39 am] E:/Code/bincode> cargo build --lib --target riscv32imac-unknown-xous-elf
Compiling virtue v0.0.7
Compiling bincode_derive v2.0.0-rc.1 (E:\Code\bincode\derive)
Compiling bincode v2.0.0-rc.1 (E:\Code\bincode)
Finished dev [unoptimized + debuginfo] target(s) in 2.39s
[10:10:43 am] E:/Code/bincode> |
Signed-off-by: Sean Cross <sean@xobs.io>
|
If you run |
|
Alright, I just ran |
|
Thanks! |
This fixes tests on 32-bit platforms. Previously, the
Encodewould encode ausizeand decode au64. This works fine on 64-bit platforms, but on 32-bit platforms this results in a mismatch.Force
usizeto be encoded as au64even on 32-bit platforms.Additionally, the 32-bit riscv target does not implement
AtomicU64orAtomicI64, so remove those impelementations on that platform.