Commit Graph

6967 Commits

Author SHA1 Message Date
Andy Wang
a2467c9b2a
Add C++20 SC access test 2022-08-27 15:24:25 +01:00
Andy Wang
01dffe0575
Remove useless store buffer search logging 2022-08-27 15:24:25 +01:00
Andy Wang
f4ba8b1160
Improve SC comments 2022-08-27 15:24:24 +01:00
bors
bb8212484f Auto merge of #2455 - RalfJung:scalar-always-init, r=RalfJung
adjust for earlier init checking in the core engine

Miri side of https://github.com/rust-lang/rust/pull/100043
2022-08-27 13:17:31 +00:00
Ralf Jung
df19b856ce rustup 2022-08-27 08:57:06 -04:00
Ralf Jung
3a2252b7b3 adjust for earlier init checking in the core engine 2022-08-27 08:51:28 -04:00
bors
101c4f2e38 Auto merge of #2511 - RalfJung:extern-so, r=RalfJung
some extern-so cleanup and fixes
2022-08-26 21:44:32 +00:00
Ralf Jung
235036fcb3 nicer errors 2022-08-26 17:43:04 -04:00
Ralf Jung
82802337a8 rename test to match usual naming conventions
what's a "fcts"?
2022-08-26 17:40:26 -04:00
Ralf Jung
4e017b54ad fix host/target check for extern-so 2022-08-26 17:38:59 -04:00
bors
4ae68749f7 Auto merge of #2510 - oli-obk:merge_conflict, r=oli-obk
Fix merge conflict

found in https://github.com/rust-lang/miri/pull/2363#discussion_r956100939
2022-08-26 14:38:14 +00:00
Oli Scherer
fa1e51ae7d Fix merge conflict 2022-08-26 14:35:40 +00:00
bors
515038ed7d Auto merge of #2509 - RalfJung:env-data-race, r=RalfJung
fix data race error during env var cleanup

Fixes https://github.com/rust-lang/miri/issues/2508
2022-08-26 13:33:40 +00:00
Ralf Jung
10a1a59c4b fix data race error during env var cleanup 2022-08-26 09:32:30 -04:00
bors
64185014af Auto merge of #2363 - emarteca:int-function-args-returns, r=oli-obk
Adding support for external C functions that have integer (or empty) args and/or returns

Starts addressing `@https://github.com/rust-lang/miri/issues/11`

### Implementation
Adding support for calling external C functions that have any number of integer arguments (types of integers: `i8`, `i16`, `i32`, `i64`, `u8`, `u16`, `u32`, `u64`) and an integer return type (or `void`).
As suggested in `@https://github.com/rust-lang/miri/issues/11,` the [`libffi` crate](https://docs.rs/libffi/latest/libffi/index.html) is used to dispatch the calls to external C functions.

#### Modifications
Main modifications are to:
* [helper.rs](https://github.com/emarteca/miri/blob/int-function-args-returns/src/helpers.rs) : adding a function `call_and_add_external_c_fct_to_context` to read the code pointer to the external C function, dispatch the call, and save the return in MIRI internal memory. Handles all conversions between MIRI and C values (using some macros, also defined in this file).
* [foreign_items.rs](https://github.com/emarteca/miri/blob/int-function-args-returns/src/shims/foreign_items.rs) : handles the calling of `call_and_add_external_c_fct_to_context` in [helper.rs](https://github.com/emarteca/miri/blob/int-function-args-returns/src/helpers.rs) when a foreign item is encountered. Also adds some structs to model C representations of arguments, and the signature of the external C call.

### Testing
Adds tests for the following external functions which are now supported:
* [int tests](https://github.com/emarteca/miri/blob/int-function-args-returns/tests/pass/external_C/int_c_tests.rs):
     - adds 2 to a provided int (no type of int specified, so autocasts)
     - takes the sum of its 12 arguments (tests stack spill)
     - adds 3 to a 16 bit int
     - adds an `i16` to an `i64`
     - returns -10 as an unsigned int
* [void tests](https://github.com/emarteca/miri/blob/int-function-args-returns/tests/pass/external_C/print_from_c.rs)
     - void function that prints from C

### Code review
The code in this PR was reviewed by `@maurer` on [another fork](https://github.com/maurer/miri/pull/1) -- thanks!
2022-08-26 08:51:11 +00:00
Ellen Arteca
88a7882615 C FFI support for functions with int args and returns 2022-08-26 00:53:23 +00:00
bors
d5853bc724 Auto merge of #2449 - oli-obk:ui_test_subtree_sync, r=RalfJung
Use ui_test from crates.io instead of having it in-tree

I have moved a copy of the `ui_test` crate into [a separate repo](https://github.com/oli-obk/ui_test) to facilitate the further non-miri development of it. I will keep syncing until we have reached a point where we don't touch it anymore for miri. At that point we can remove the in-tree version and do further development out of tree.
2022-08-25 15:35:16 +00:00
Oli Scherer
fb071a14bd Use ui_test from crates.io instead of having it in-tree 2022-08-25 15:34:57 +00:00
bors
d09542977c Auto merge of #2448 - oli-obk:test_crates_on_their_own, r=RalfJung
Run `pass` tests without building dependencies first

fixes https://github.com/rust-lang/miri/issues/2442

One thing that I'm wondering is if we should do away with running each folder individually and make `ui_test` support running all tests in parallel (so building deps becomes a thread, and all tests needing deps are blocked on it)
2022-08-25 12:21:07 +00:00
Oli Scherer
6f8885e60f Run pass tests without building dependencies first 2022-08-25 08:03:50 +00:00
bors
9f99aa9d0d Auto merge of #2505 - RalfJung:ui-test, r=oli-obk
cope with rustc aborting due to a signal

`status.code().unwrap()` will panic when the process is aborted due to a signal.  Let's not do that.
2022-08-23 09:43:52 +00:00
Ralf Jung
1914b615ff cope with rustc aborting due to a signal 2022-08-22 21:23:02 -04:00
bors
53138c6fb7 Auto merge of #2504 - Hiroki6:move-thread-to-concurrency-module, r=RalfJung
move thread.rs into concurrency

Follow-up of https://github.com/rust-lang/miri/pull/2500 and closes https://github.com/rust-lang/miri/issues/2199

I moved the `thread.rs` into the `concurrency` module.
2022-08-22 18:49:07 +00:00
Ralf Jung
2107cbbe2f reorganize imports a bit 2022-08-22 14:48:47 -04:00
Hiroki6
5259fb9bb0 move thread.rs into concurrency 2022-08-22 19:13:39 +02:00
bors
e0f0e1fce7 Auto merge of #2503 - RalfJung:tls-dtor-order, r=RalfJung
notes on TLS dtor order

Fixes https://github.com/rust-lang/miri/issues/2486
2022-08-22 16:21:11 +00:00
Ralf Jung
afacf62cf0 notes on TLS dtor order 2022-08-22 12:20:53 -04:00
bors
a109994f22 Auto merge of #2481 - RalfJung:shim-pattern, r=oli-obk
document general shim pattern

r? `@oli-obk`
2022-08-22 14:44:53 +00:00
Ralf Jung
daaa81fc5e document general shim pattern 2022-08-22 10:16:49 -04:00
bors
6e306f9483 Auto merge of #2441 - RalfJung:arithmetic, r=oli-obk
pass clippy::integer_arithmetic in our shims

`@oli-obk` [raised some concerns](https://github.com/rust-lang/miri/pull/2422#discussion_r928220546) about this one. I still think it is the right call, since I don't see a good way to enable overflow checks for our official release builds. I'm open to suggestions though!

Fixes https://github.com/rust-lang/miri/issues/1236
2022-08-22 14:11:46 +00:00
Ralf Jung
8497fd4906 pass clippy::integer_arithmetic in our shims 2022-08-22 10:11:16 -04:00
bors
7b071620cb Auto merge of #2500 - Hiroki6:make-vector-clock-private, r=RalfJung
move vector_clock and sync into concurrency & make vector_clock private

Closes https://github.com/rust-lang/miri/issues/2199

The thread.rs didn't have to be moved to build.
If it makes more sense to move the thread.rs as well, please let me know. I can move it as well.
2022-08-21 23:12:41 +00:00
Hiroki6
8ee6849012 rustfmt 2022-08-21 23:44:43 +02:00
Hiroki6
b073fe2537 move vector_clock and sync into concurrency & make vector_clock private
move thread it back
2022-08-21 23:35:29 +02:00
bors
ab88e64b15 Auto merge of #2495 - RalfJung:ra, r=RalfJung
add ./miri cargo for RA to invoke

RA expects a check command to check *individual workspaces*, whereas `./miri` is designed to check/build/test all parts of Miri. So add a new `./miri cargo` that performs just a single cargo invocation, but with the right env vars so that the build cache can be shared with `./miri check`.
2022-08-20 13:30:34 +00:00
Ralf Jung
0c3ad68a5a add ./miri cargo for RA to invoke 2022-08-19 23:46:17 -04:00
bors
1a03e30b79 Auto merge of #2473 - RalfJung:dyn-upcast-nop, r=RalfJung
allow NOP-casts with mismatching vtables

The Miri side of https://github.com/rust-lang/rust/pull/100208.
2022-08-20 03:33:42 +00:00
Ralf Jung
cf04c1f1ce rustup 2022-08-19 23:33:15 -04:00
Ralf Jung
53037a7c09 allow NOP-casts with mismatching vtables 2022-08-19 23:33:15 -04:00
bors
09118da54f Auto merge of #2454 - saethlin:diagnostics-cleanup, r=RalfJung
Improve information sharing across SB diagnostics

Previous Stacked Borrows diagnostics were missing a lot of information about the state of the interpreter, and it was difficult to add additional state because it was threaded through all the intervening function signatures.

This change factors a lot of the arguments which used to be passed individually to many stacked borrows functions into a single `DiagnosticCx`, which is built in `Stacks::for_each`, and since it wraps a handle to `AllocHistory`, we can now handle more nuanced things like heterogeneous borrow of `!Freeze` types.
2022-08-18 20:37:50 +00:00
Ralf Jung
7397c8e9cf re-bless after rebase 2022-08-18 16:36:53 -04:00
Ben Kimock
15a4f0a9e0 some CurrentSpan cleanup 2022-08-18 16:36:53 -04:00
Ben Kimock
17fc52a06d Clean up diff churn a bit, adjust comments 2022-08-18 15:01:05 -04:00
Ben Kimock
14e72e7ffa Improve information sharing across SB diagnostics
Previous Stacked Borrows diagnostics were missing a lot of information
about the state of the interpreter, and it was difficult to add
additional state because it was threaded through all the intervening
function signatures.

This change factors a lot of the arguments which used to be passed
individually to many stacked borrows functions into a single
`DiagnosticCx`, which is built in `Stacks::for_each`, and since it
wraps a handle to `AllocHistory`, we can now handle more nuanced
things like heterogeneous borrow of `!Freeze` types.
2022-08-18 15:01:03 -04:00
bors
46da748502 Auto merge of #2231 - DrMeepster:winfred, r=RalfJung
Windows thread support: Part 1

This PR adds support for threads on Windows.
2022-08-18 15:26:07 +00:00
Ralf Jung
c466ac0b3e add some missing assert_target_os 2022-08-18 11:25:20 -04:00
bors
339500f060 Auto merge of #2493 - RalfJung:android, r=RalfJung
add very basic Android support

This is just enough to print to stdout. I won't push this any further, but having these basics should hopefully make it easier for others to do so.

Also slightly improve threading support on FreeBSD while we are at it.

Partially based on https://github.com/rust-lang/miri/pull/2011.
Fixes https://github.com/rust-lang/miri/issues/2010.
2022-08-18 13:13:21 +00:00
Ralf Jung
5e10f14584 clippy... 2022-08-18 09:13:07 -04:00
Ralf Jung
4359f43e92 make abort-on-panic work on Android 2022-08-18 08:39:53 -04:00
Ralf Jung
3ec8dd8760 implement setting the thread name on freebsd 2022-08-18 08:34:16 -04:00