Skip to content

Commit ceb075f

Browse files
authored
Merge pull request #16 from TroyNeubauer/fix_ci
Allow miri to access time
2 parents 005add2 + b7cda32 commit ceb075f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- script: cargo miri test
5050
displayName: cargo miri test
5151
env:
52-
MIRIFLAGS: -Zmiri-ignore-leaks
52+
MIRIFLAGS: "-Zmiri-ignore-leaks -Zmiri-disable-isolation"
5353
- job: loom
5454
displayName: "Run loom on test suite"
5555
pool:

src/domain.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use core::sync::atomic::Ordering;
99
// `SYNC_TIME_PERIOD` nanoseconds. The next time we should run reclamation is stored in
1010
// `due_time` inside `Domain`. On `no_std` we don't (yet) have access to time so this feature is
1111
// disabled. Also on platforms with < 64 bits, we can only store 2^32 nanoseconds -> ~4 seconds or
12-
// less, so this feature is also disabled. Additionally, miri can't support time because of
13-
// system calls (perhaps this can be mocked), and loom can't support time for reasons of determinism.
12+
// less, so this feature is also disabled. Additionally, loom can't support time for reasons of
13+
// determinism.
1414

15-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
15+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
1616
const SYNC_TIME_PERIOD: u64 = std::time::Duration::from_nanos(2000000000).as_nanos() as u64;
17-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
17+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
1818
use crate::sync::atomic::AtomicU64;
1919

2020
#[cfg(loom)]
@@ -62,7 +62,7 @@ pub struct Domain<F> {
6262
hazptrs: HazPtrRecords,
6363
untagged: [RetiredList; NUM_SHARDS],
6464
family: PhantomData<F>,
65-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
65+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
6666
due_time: AtomicU64,
6767
nbulk_reclaims: AtomicUsize,
6868
count: AtomicIsize,
@@ -113,7 +113,7 @@ macro_rules! new {
113113
},
114114
untagged,
115115
count: AtomicIsize::new(0),
116-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
116+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
117117
due_time: AtomicU64::new(0),
118118
nbulk_reclaims: AtomicUsize::new(0),
119119
family: PhantomData,
@@ -370,7 +370,7 @@ impl<F> Domain<F> {
370370
.compare_exchange_weak(rcount, 0, Ordering::AcqRel, Ordering::Relaxed)
371371
{
372372
Ok(_) => {
373-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
373+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
374374
{
375375
self.due_time
376376
.store(Self::now() + SYNC_TIME_PERIOD, Ordering::Release);
@@ -383,7 +383,7 @@ impl<F> Domain<F> {
383383
0
384384
}
385385

386-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
386+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
387387
fn check_due_time(&self) -> isize {
388388
let time = Self::now();
389389
let due = self.due_time.load(Ordering::Acquire);
@@ -411,7 +411,7 @@ impl<F> Domain<F> {
411411
// TODO: Implement some kind of mock time for no_std.
412412
// Currently we reclaim only based on rcount on no_std
413413
// (also the reason for allow unused_mut)
414-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
414+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
415415
{
416416
rcount = self.check_due_time();
417417
}
@@ -554,7 +554,7 @@ impl<F> Domain<F> {
554554
0
555555
}
556556

557-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
557+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
558558
fn now() -> u64 {
559559
use std::convert::TryFrom;
560560
u64::try_from(

src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pub(crate) use loom::thread::yield_now;
1010

1111
#[cfg(not(loom))]
1212
pub(crate) mod atomic {
13-
pub(crate) use core::sync::atomic::{fence, AtomicIsize, AtomicPtr, AtomicUsize};
1413
#[cfg(target_pointer_width = "64")]
1514
pub use core::sync::atomic::AtomicU64;
15+
pub(crate) use core::sync::atomic::{fence, AtomicIsize, AtomicPtr, AtomicUsize};
1616
}
1717
#[cfg(all(not(loom), feature = "std"))]
1818
pub(crate) use std::thread::yield_now;

0 commit comments

Comments
 (0)