Commit Graph

4422 Commits

Author SHA1 Message Date
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
bors
4155fb610f Auto merge of #1351 - RalfJung:float-test-source, r=RalfJung
note source of float cast test values, and some more UB tests
2020-04-19 07:37:25 +00:00
Ralf Jung
70c828b761 test some more extreme cast cases 2020-04-19 09:34:54 +02:00
Ralf Jung
fbf47d1784 note source of test values 2020-04-19 09:21:00 +02: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
bors
fac9d22375 Auto merge of #1349 - RalfJung:machine-layouts, r=RalfJung
use pre-computed layouts some more
2020-04-18 15:55:41 +00:00
Ralf Jung
14f50b34a3 use pre-computed layouts some more 2020-04-18 17:54:26 +02:00
bors
d1ae77f967 Auto merge of #1347 - RalfJung:float-cast-test, r=RalfJung
rename test_cast -> test_both_cast to make purpose clearer
2020-04-18 11:08:24 +00:00
Ralf Jung
699685c07c rename test_cast -> test_both_cast to make purpose clearer 2020-04-18 13:07:50 +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
Ralf Jung
bb38ab4340 use u128::MAX symbolic name 2020-04-18 10:11:45 +02:00
bors
72667b58b8 Auto merge of #1346 - RalfJung:dyn-layout-test, r=RalfJung
Test that we enforce dynamic layout properties (not just static ones of sized prefix)
2020-04-18 07:16:35 +00:00
Ralf Jung
0345ee42da some UB gets masked by optimizations 2020-04-18 09:15:59 +02:00
Ralf Jung
c6ab27577b test that we check dynamic actual size of object 2020-04-18 02:06:36 +02:00
Ralf Jung
521e77d712 test that we properly check dynamic alignment 2020-04-17 20:43:54 +02:00
bors
216e686cc6 Auto merge of #1344 - RalfJung:rustup, r=RalfJung
rustup for FieldsShape::Primitive
2020-04-17 12:20:03 +00:00
Ralf Jung
6ad0187265 rustup for FieldsShape::Primitive 2020-04-17 14:19:26 +02:00
bors
562d602422 Auto merge of #1343 - RalfJung:derive-packed, r=RalfJung
test #[derive] on packed struct
2020-04-17 09:05:56 +00:00
Ralf Jung
6a81014ae9 test #[derive] on packed struct 2020-04-17 11:04:48 +02:00
David Cook
57c7119315 Handle std::sync::atomic::spin_loop_hint() 2020-04-16 23:24:57 -05:00
bors
9b4af73eb0 Auto merge of #1341 - RalfJung:force-ptr-everywhere, r=oli-obk
ReadBytesAsPointer is always supported

Cc @oli-obk
2020-04-16 19:07:08 +00:00
Ralf Jung
ff3b382b14 ReadBytesAsPointer is always supported 2020-04-16 18:36:03 +02:00
bors
d481e0818c Auto merge of #1338 - RalfJung:test-cleanup, r=RalfJung
Cleanup some run-pass tests
2020-04-16 07:46:57 +00:00
Ralf Jung
3e3613f2e2 merge packed_static and packed_struct 2020-04-16 09:33:22 +02:00
Ralf Jung
974f9c3023 avoid test-wide allowance of unused/dead code 2020-04-16 09:25:12 +02:00
Ralf Jung
b0fe99e81d consolidate ptr tests in fewer files 2020-04-16 09:06:21 +02:00
bors
5c823a1ec1 Auto merge of #1337 - RalfJung:intrinsic-tests, r=RalfJung
test some so-far untested intrinsics
2020-04-15 16:09:40 +00:00
Ralf Jung
07c696e27e test some so-far untested intrinsics 2020-04-15 18:00:16 +02:00
bors
b6fca87d66 Auto merge of #1334 - KrishnaSannasi:track-dealloc, r=RalfJung
add deallocation tracking

fixes #1314
2020-04-15 15:48:07 +00:00
Ozaren
b77968e8bd
added deallocation tracking 2020-04-15 11:29:35 -04:00
bors
e4eceba7d3 Auto merge of #1336 - RalfJung:instance-sanity, r=RalfJung
tighten Instance sanity check

Let's see if we can get away with this...
2020-04-15 11:34:34 +00:00
Ralf Jung
a85dab42ea tighten Instance sanity check 2020-04-15 13:13:17 +02:00
bors
fbea3e57f3 Auto merge of #1330 - RalfJung:retag-return-place, r=RalfJung
retag return place

@eddyb suggested that return places should be treated like unique references for Stacked Borrows. That is implemented by this patch, but it is unfortunately quite the hack because otherwise we are retagging *references*, not places.

@eddyb does this roughly correspond to what you had in mind? (Except for whatever it is you think should happen with argument passing, which is a much bigger issue.) Also, do you think there is any way we can *test* this?

Needs https://github.com/rust-lang/rust/pull/71100 to land.
2020-04-15 10:41:13 +00:00
Ralf Jung
3548dcf8cc rustup 2020-04-15 12:39:28 +02:00
Ralf Jung
0805b4bf2e retag return places 2020-04-15 12:39:19 +02:00
Ralf Jung
90d71cd13f adjust for frame hook changes 2020-04-15 12:33:52 +02:00
bors
669191bca9 Auto merge of #1331 - samrat:macos-mach-timebase-info, r=RalfJung
Implement `mach_timebase_info` for macOS

Since we return nanoseceonds instead of ticks from `mach_absolute_time`, we don't need to scale the absolute time

Fixes #1288
2020-04-14 09:30:22 +00: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
bors
4ed3d487a6 Auto merge of #1333 - RalfJung:flag-test, r=RalfJung
Make sure we find many failures even with other checks disabled
2020-04-14 08:25:34 +00:00
Ralf Jung
e6822d60b3 make sure we find some things without validation or stacked borrows, respectively 2020-04-14 10:23:47 +02:00
Ralf Jung
179e78d0ad make sure our disable flags do not miss all bugs; move type-assert intrinsic tests to their folder 2020-04-14 10:23:47 +02:00
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
bors
03715907f4 Auto merge of #1332 - RalfJung:disable-alignment-check, r=RalfJung
Add option to disable alignment check

Requires https://github.com/rust-lang/rust/pull/71101
Fixes https://github.com/rust-lang/miri/issues/1326
2020-04-14 07:50:41 +00:00
Ralf Jung
f4a15444cf fix comment in alignment test 2020-04-14 09:50:20 +02:00
Ralf Jung
8e73db6510 rustup 2020-04-14 09:40:00 +02:00
Ralf Jung
48aaf674f7 tweak flag section in README 2020-04-14 09:39:57 +02:00
Samrat Man Singh
f6bb8111f2 Use pre-defined u32 layout
Also fix typo and remove newline
2020-04-14 09:40:40 +05:30