Vytautas Astrauskas
1f33f04fd4
Move pthread_create and related shims to a separate file.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
58a6a2729a
Add a warning that Miri does not check for data-races.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
82f17ab917
Implement basic support for concurrency (Linux only).
2020-04-27 14:23:32 -07:00
David Cook
f49839ac30
Add comment
2020-04-22 07:09:20 -05:00
David Cook
54897f66f8
Implement ftruncate64/ftruncate for File::set_len
2020-04-21 21:17:54 -05:00
bors
8d9db57a0d
Auto merge of #1335 - vakaras:add-threads-noop, r=RalfJung
...
Move the stack to the evaluator. (no-op PR for 70598)
The changes to Miri to make it to compile with Rustc PR https://github.com/rust-lang/rust/pull/70598 .
2020-04-20 08:39:29 +00:00
Vytautas Astrauskas
5224c72403
Move the stack to the evaluator to make Miri compile with the newest Rustc.
2020-04-20 09:19:37 +02:00
bors
763782aa08
Auto merge of #1342 - divergentdave:pause-instruction, r=RalfJung
...
Handle std::sync::atomic::spin_loop_hint()
This PR adds support for `std::sync::atomic::spin_loop_hint()` by implementing the `llvm.x86.sse2.pause` intrinsic when the target is x86-based. It appears this is the first LLVM intrinsic in foreign_items, so I added a couple match blocks to handle it or fall through to the different OS-specific methods. I added a basic smoke test to `tests/run-pass/sync.rs`. I came across this by way of `crossbeam::utils::Backoff::spin()`, FWIW.
2020-04-19 14:53:02 +00:00
David Cook
547a4cc920
Review comments
2020-04-19 09:22:40 -05:00
David Cook
7b69a6271e
Add support for std: 🧵 :yield_now
2020-04-18 19:31:02 -05:00
David Cook
11cd87e457
Flip matching
2020-04-18 19:16:52 -05:00
Ralf Jung
14f50b34a3
use pre-computed layouts some more
2020-04-18 17:54:26 +02:00
bors
45113eb6a4
Auto merge of #1325 - RalfJung:float_to_int_unchecked, r=RalfJung
...
implement float_to_int_unchecked
@hanna-kruppe would be great if you could have a look at this.
`float.rs` tests legal casts. `test_cast` checks that both `as` casts and unchecked casts work (i.e., these are not saturating). The `compile-fail` tests should ensure that illegal casts via the intrinsic are detected as such.
Fixes https://github.com/rust-lang/miri/issues/1264
2020-04-18 08:13:24 +00:00
David Cook
57c7119315
Handle std::sync::atomic::spin_loop_hint()
2020-04-16 23:24:57 -05:00
Ralf Jung
07c696e27e
test some so-far untested intrinsics
2020-04-15 18:00:16 +02:00
Samrat Man Singh
fff45b77ad
Reword comment in mach_timebase_info
...
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-14 13:59:43 +05:30
Samrat Man Singh
90729bb039
Use precomputed TyLayout from machine.layouts
...
And add comment documenting successful return value from
`mach_timebase_info`.
2020-04-14 13:31:24 +05:30
Samrat Man Singh
f6bb8111f2
Use pre-defined u32 layout
...
Also fix typo and remove newline
2020-04-14 09:40:40 +05:30
Samrat Man Singh
5f6d250b30
[macOS] Implement mach_timebase_info
...
Since we return nanoseceonds instead of ticks from
`mach_absolute_time`, we don't need to scale the absolute time
2020-04-13 21:18:34 +05:30
Ralf Jung
a82efce590
remove some unnecessary trait bounds
2020-04-12 22:01:46 +02:00
Ralf Jung
78ce616490
implement float_to_int_unchecked
2020-04-12 12:01:20 +02:00
Ralf Jung
2a3ce5d618
there is no 'align_of_val' intrinsic
2020-04-12 11:04:18 +02:00
Ralf Jung
fd0957f5cd
remove an intrinsic that was moved to rustc
2020-04-12 11:02:56 +02:00
Ralf Jung
6414003ab9
organize intrinsics into groups
2020-04-12 11:01:59 +02:00
Ralf Jung
314e7238cf
avoid a bunch of as_ref/as_mut
2020-04-12 10:32:36 +02:00
Ralf Jung
97791a56da
avoid ref in matches
2020-04-12 10:08:12 +02:00
bors
d935f62172
Auto merge of #1157 - divergentdave:shim-pthread-try-lock, r=RalfJung
...
Add shims for RwLock::try_read/RwLock::try_write
This implements proper locking so that we can check for reentrancy and implement the `try_*` methods.
Fixes https://github.com/rust-lang/miri/issues/781
2020-04-06 13:55:53 +00:00
David Cook
0f5f0e1520
Fix spelling typo
2020-04-05 20:55:39 -05:00
David Cook
bc54c7628d
Eagerly compute i32 and u32 layouts
2020-04-05 16:03:44 -05:00
David Cook
f9dc942cfd
Changes to error handling
2020-04-05 13:53:03 -05:00
David Cook
e7944419d4
Use Deadlock machine stop uniformly
2020-04-05 12:44:23 -05:00
David Cook
100141f57c
Remove null checks, fall through to UB upon deref
2020-04-05 12:32:09 -05:00
David Cook
79f3307f30
Update comments, rearrange code
2020-04-05 12:09:31 -05:00
David Cook
ac8c98da8e
Store layouts of i32 and u32 inside Evaluator
2020-04-05 10:37:57 -05:00
David Cook
8293d80b53
Set explicit return value size for windows shim
2020-04-05 10:36:14 -05:00
David Cook
e1a1592991
Set some explicit return value sizes
2020-04-05 10:35:08 -05:00
David Cook
37ddde9f70
Implement TryEnterCriticalSection
2020-04-05 10:33:32 -05:00
David Cook
7f6df15aa2
Rearrange functions
2020-04-05 10:32:06 -05:00
David Cook
c7466c9531
Add TerminationInfo::Deadlock, use in mutex shim
2020-04-05 10:32:01 -05:00
David Cook
735fc12e1a
Handle variation in layout of pthread_mutex_t
2020-04-05 10:27:31 -05:00
David Cook
e5e3256b59
Address review comments
2020-04-05 10:10:35 -05:00
David Cook
ba3884dae6
Use checked addition/subtraction on lock counts
2020-04-05 10:08:39 -05:00
David Cook
141319a412
Refactor sync shims with setters and getters
2020-04-05 10:07:39 -05:00
David Cook
fd94255b9d
Add comments explaining asserts
2020-04-05 10:06:37 -05:00
David Cook
d11315ebfb
Fix misleading function names
2020-04-05 10:05:34 -05:00
David Cook
765050f302
Revise mutex/rwlock memory layout for macOS compat
2020-04-05 10:03:29 -05:00
David Cook
dd9896b0f8
Implement mutex and rwlock functions
2020-04-05 10:03:22 -05:00
David Cook
88f319fb4c
Add failing tests for mutex and rwlock
2020-04-05 09:25:21 -05:00
David Cook
46679bc9ef
Add shims for RwLock::try_read/RwLock::try_write
2020-04-05 09:25:21 -05:00
Stein Somers
e7fafa1904
Replace last_entry with last_key_value
2020-04-05 15:21:15 +02:00