Ralf Jung
d617d615e4
fix non-fatal diagnostics stacktraces
2020-07-17 12:55:45 +02:00
Ralf Jung
c28786d320
remove an unnecessary intermediate cast
2020-07-16 12:16:43 +02:00
Ralf Jung
ce5ed69eac
rustup; fix Windows TLS
2020-07-15 08:42:15 +02:00
Samrat Man Singh
74ff4f805a
Read into buffer of fixed size for read
s to STDIN
...
Also:
- Check isolation is disabled.
- Add FIXMEs to set error numbers in `read` and `write`.
2020-07-12 20:27:19 +05:30
Samrat Man Singh
2602e951c0
Handle read
s on STDIN
2020-07-11 14:06:49 +05:30
Justus K
22e7a6263b
Early exit if program doesn't contain a main fn
2020-07-09 13:16:38 +02:00
Ralf Jung
dcb0f6309e
we cannot track all machine memory any more due to int-ptr-casts
2020-07-08 12:01:49 +02:00
Gary Guo
c5b324b031
Remove likely and unlikely from intrinsics shim
...
They are now implemented in MIR interpreter by rust-lang/rust#73778
2020-07-02 20:00:27 +01:00
Ralf Jung
c379793cde
add option to track call IDs
2020-07-02 10:33:54 +02:00
Ralf Jung
3a5bcb97ed
move rwlock dequeuing to shared code, and use that code for Windows rwlocks
2020-06-28 11:28:46 +02:00
Ralf Jung
a9dc2796ca
Move get/set_at_offset helpers to global helpers file
2020-06-28 09:23:01 +02:00
Ralf Jung
e54619b5e1
with this, we support panics on Windows
2020-06-27 14:43:37 +02:00
Ralf Jung
8e92969948
implement Windows SRWLock shims
2020-06-27 14:36:05 +02:00
Ralf Jung
dca00ab85e
introduce platform-specific module hierarchy for dlsym (similar to foreign_items)
2020-06-27 14:36:05 +02:00
bors
bde2eb4a44
Auto merge of #1460 - RalfJung:modules, r=RalfJung
...
Re-organize platform-specific shims
Move platform-specific code to `shims::{posix::{linux, macos}, windows}`. Also make it private in these modules to ensure we are reasonably structured.
2020-06-27 11:27:36 +00:00
Ralf Jung
af5887e869
module organization: move platform-specific code to shims::{posix::{linux, macos}, windows}
2020-06-27 13:22:49 +02:00
Ralf Jung
395f5d40dc
Rename shims::{sync -> posic_sync} and move sync_singlethread test to other sync test
2020-06-27 12:37:12 +02:00
Ralf Jung
b46f946c81
supply our own implementation of the CTFE pointer comparison intrinsics
2020-06-27 11:57:43 +02:00
Ralf Jung
5c5b61ffb0
rustup
2020-06-15 17:38:27 +02:00
Ralf Jung
e063ce2737
rustup; and a bit of UnsafeCell detection refactoring
2020-06-13 11:30:31 +02:00
bors
ffd03b3caa
Auto merge of #1418 - divergentdave:file-sync, r=RalfJung
...
Add file sync shims
This PR adds shim implementations for these related file syncing functions.
* `fsync`, for POSIX targets, backed by `File::sync_all()`
* `fdatasync`, for POSIX targets, backed by `File::sync_data()`
* `fcntl` with command `F_FULLFSYNC`, for macOS targets, backed by `File::sync_all()`
* `sync_file_range`, for Linux targets, backed by `File::sync_data()`
2020-06-09 08:48:40 +00:00
David Cook
a60c130b0d
Extract common logic for Windows host workaround
2020-06-08 23:34:02 +00:00
David Cook
e352d4fbb7
Finish fixing Windows host support
2020-06-06 16:54:13 +00:00
Ralf Jung
17dd44ee92
rustup
2020-06-01 19:23:54 +02:00
Ralf Jung
0b6ec575b9
make mutex_unlock infallible
2020-05-30 22:54:37 +02:00
Ralf Jung
acb3ec0866
test and fix for rwlock unlock bug
2020-05-30 22:48:43 +02:00
Ralf Jung
a80821e046
also combine re-locking into the dequeue-and-unblock operation
2020-05-30 22:35:58 +02:00
Ralf Jung
7589bc7ba9
sync cleanup: mark infallible ops as such; consistent combine en/dequeue with (un)block; comments
2020-05-30 22:29:27 +02:00
Ralf Jung
c77e9022d5
rustup (and account for stabilization)
2020-05-30 09:23:25 +02:00
Joe Richey
394a57fc22
Remove pointer arithmetic intrinsics
...
These are now implemented in rustc's mir interpreter
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-30 09:06:37 +02:00
Ralf Jung
f55c0153f1
str_strip is stable
2020-05-29 10:01:07 +02:00
bors
83b4222d9a
Auto merge of #1422 - RalfJung:cargo-miri-workspace, r=oli-obk
...
Move cargo-miri into separate package
So far, `cargo-miri` depended on the Miri library crate. That was mostly for convenience (to avoid having to deal with workspaces), but also because until recently `cargo-miri` needed access to the ["Miri default flags"](af044209b0/src/lib.rs (L75)
). But with `MIRI_BE_RUSTC` that is no longer the case, so we can remove this fake dependency. :)
@oli-obk what do you think? Also I expect the rustc bootstrap integration will need updates, hints would be appreciated. :D
2020-05-28 13:02:41 +00:00
Ralf Jung
0790f75ae4
make cargo-miri a separate crate in a workspace
2020-05-28 08:53:44 +02:00
Ralf Jung
60f466d6ad
use strip_prefix where it makes sense
2020-05-28 08:51:38 +02:00
David Cook
c01bc14219
Fix fsync shim for Windows hosts with RO files
2020-05-25 21:45:29 -05:00
David Cook
7ba8bbc49f
Update comments
2020-05-25 07:32:56 -05:00
Ralf Jung
a95f754a9c
better error when reading from stdin
2020-05-25 10:39:43 +02:00
Ralf Jung
9ff77f6cb3
add an assertion
2020-05-25 09:59:01 +02:00
Ralf Jung
1fecbd8a87
macos does not have pthread_condattr_setclock/getclock
2020-05-25 09:42:08 +02:00
Vytautas Astrauskas
dec205757a
Fix compilation errors after rebase.
2020-05-25 00:28:01 +02:00
Vytautas Astrauskas
90590a399d
Small fixes.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
6ff0af3adf
Fix #1419 .
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
bd97074517
Small changes.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
8b5a9836be
Small changes.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
0838347d8f
Change the scheduling to execute timeout callbacks first.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
fdfd56b75b
Small changes.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
3da61fa427
Add comments explaining the declare_id macro.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
0bbac12751
Change how the time is handled.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
86eb262e8a
Cleanup Condvar tests.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
044a068c67
Improve code readability and comments.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
d0de439ac8
Cleanup.
2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
679245769b
Implement support for synchronization primitives.
2020-05-25 00:02:54 +02:00
Ralf Jung
2c94ad08d8
use helper method to compute size of int type
2020-05-24 19:20:44 +02:00
Ralf Jung
cf7d88fd91
unset RUSTC_WRAPPER for xargo invocation
2020-05-24 14:46:38 +02:00
David Cook
87a846f2d6
Update to match rustc changes
2020-05-22 17:03:25 +02:00
Ralf Jung
fbb8c1526a
verify the size of all shim arguments
2020-05-22 11:56:18 +02:00
Ralf Jung
402535ef86
also pretend GetSystemTimePreciseAsFileTime does not exist
2020-05-21 23:24:37 +02:00
Ralf Jung
526fae7541
GetProcAddress: basic validation for hModule argument
2020-05-21 23:06:31 +02:00
Ralf Jung
f09decb398
disentangle macos and linux dlsyms
2020-05-21 23:01:27 +02:00
Ralf Jung
08ddbd6ce0
prepare Dlsym system for dynamic symbols on Windows
2020-05-21 22:38:06 +02:00
David Cook
0b060c7364
Review comments
2020-05-19 08:57:31 -05:00
David Cook
87c4694448
Add file sync shims
...
Adds implementations for fsync, fdatasync, and sync_file_range
2020-05-17 22:10:40 -05:00
Ralf Jung
d90a087df9
fix libstd rebuilds due to RUSTFLAGS changes
2020-05-17 11:20:05 +02:00
Ralf Jung
e22baedb1f
add test suite filter example to README and 'cargo miri --help'
2020-05-17 10:12:17 +02:00
Ralf Jung
e0f9081c5c
use new rustc_driver::catch_with_exit_code
2020-05-16 11:30:11 +02:00
Ralf Jung
4a2e08f9b8
fix warnings for non-Unix builds
2020-05-11 10:58:27 +02:00
Ralf Jung
938fe00f02
fix some comments, and run_compiler return type
2020-05-11 00:09:46 +02:00
Ralf Jung
845b89c236
we do not need to set RUSTFLAGS for xargo any more as miri-as-rustc already uses these flags
2020-05-10 18:56:38 +02:00
Ralf Jung
81046fa5e5
cargo-miri: never invoke rustc, always go through 'MIRI_BE_RUSTC=1 miri' instead
2020-05-10 18:41:03 +02:00
Oliver Scherer
3fdab9c446
Update to rustc changes
2020-05-10 10:14:03 +02:00
Ralf Jung
ac65350789
adjust default sysroot when being rustc
...
Also while at it, refactor how we pass the default Miri flags
2020-05-09 13:42:07 +02:00
Ralf Jung
ba801a45db
make Miri work in rustc bootstrap stage 0
2020-05-09 13:19:23 +02:00
Ralf Jung
024cc435f4
avoid env::var which requires valid UTF-8
2020-05-09 12:04:21 +02:00
Ralf Jung
20097be2fe
more comment
2020-05-09 11:54:45 +02:00
Ralf Jung
1ba42b9f55
Wording
...
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-05-09 11:53:24 +02:00
Ralf Jung
e73fc97f0b
cargo-miri: honor RUSTC env var
2020-05-09 11:52:26 +02:00
Ralf Jung
70f83a342c
re-do cargo-miri host/target detection logic to match rustbuild
2020-05-09 11:45:43 +02:00
Ralf Jung
379ac82a1c
bump Rust, fix for renames
2020-05-09 10:15:09 +02:00
Ralf Jung
914e483c89
fix cargo-miri intercepting --help/--version arguments
2020-05-08 09:55:28 +02:00
Ralf Jung
45ef97535f
fs shim: check that mode is default
2020-05-05 16:49:01 +02:00
Ralf Jung
40800cfa19
make sure we check the size of all arguments
2020-05-05 12:19:54 +02:00
Ralf Jung
5656cb73d4
fix a comment now that we have concurrency
2020-05-05 11:59:22 +02:00
Ralf Jung
cd6be98852
make sure we check argument count everywhere
2020-05-05 11:59:22 +02:00
Ralf Jung
5566e3901c
deduplicate FD extraction
2020-05-05 11:44:33 +02:00
Chase Albert
4e3d1fee51
Address comments.
2020-05-04 14:24:22 -04:00
Chase Albert
4d3dff2add
Address consistency of naming for unused/merely validated arguments.
2020-05-04 13:51:23 -04:00
Chase Albert
78f329513a
Check that shims are called with the correct number of arguments
2020-05-04 13:51:21 -04:00
Ralf Jung
61a86e1ffe
Windows lock primitives: check that we are truly sinle-threaded
2020-05-04 09:37:40 +02:00
Ralf Jung
6b18f6e106
fix setting thread name on macOS
2020-05-03 13:22:56 +02:00
Ralf Jung
6680118588
de-duplicate <unnamed> default thread name
2020-05-03 12:56:38 +02:00
Ralf Jung
994b13eaee
yield on x86 'pause' hint
2020-05-03 12:43:38 +02:00
Ralf Jung
1578540959
bump Rust, fix warnings
2020-05-03 12:10:24 +02:00
Ralf Jung
393165f859
rustup; fix for changed error messages
2020-05-01 14:43:59 +02:00
Ralf Jung
ba670d6970
make sure macos function has 'macos' in its name
2020-04-30 19:38:17 +02:00
bors
351d46d3fb
Auto merge of #1284 - vakaras:add-threads-cr2, r=RalfJung
...
Implement basic support for concurrency (Linux/macos only)
Changes (most new code is in `src/threads.rs` and `src/shims/foreign_items/posix.rs`):
1. Move the stack from `Machine` to a newly created `Thread` struct.
2. Add a `ThreadSet` struct that manages the threads.
3. Change `canonical_alloc_id` to create a unique allocation id for each thread local and thread (the responsible struct is `ThreadLocalStorage`)
4. Change the code to execute the thread local destructors immediately when a thread terminates.
5. Add the most basic round-robin scheduler.
This pull request depends on [these changes to the compiler](https://github.com/rust-lang/rust/pull/70598 ).
2020-04-30 16:21:43 +00:00
Vytautas Astrauskas
48da0cf489
Fix prctl SET_NAME and GET_NAME behaviour.
2020-04-30 08:35:59 -07:00
Ralf Jung
e9212d14ac
more helpful error on workspaces
2020-04-30 10:19:34 +02:00
Vytautas Astrauskas
603ec0b3d8
Fix a regression in Windows dtors.
2020-04-29 15:20:26 -07:00
Vytautas Astrauskas
0e052ab897
Use Entry API in set_dtors_running.
2020-04-29 15:12:09 -07:00
Vytautas Astrauskas
46b03174d0
Improve code readability and comments.
2020-04-29 13:16:22 -07:00
Ralf Jung
a5445e0230
rustup for more LocalDefId changes
2020-04-28 10:30:21 +02:00
Vytautas Astrauskas
3b5854191c
Fix MacOS and Windows builds.
2020-04-27 15:21:01 -07:00
Vytautas Astrauskas
1355574beb
Delete remaining tls entries after all destructors completed.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
df2ca53b69
Make From implementations non-failing.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
c56ef31780
Improve comments.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
f204b67b0f
Merge dtors_running and last_dtor_key fields.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
356aecce7f
Add a FIXME.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
207c6e7fa7
Improve comments and code clarity.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
9ba3ef2a44
Change representation and conversion of ThreadId and BlockSetId.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
174adad2b3
Use DLL_THREAD_DETACH when calling windows TLS destructor.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d9e18ada39
Make sure to remove thread local data only if we have destructor.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
911ff7eade
Improve style and comments.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
c4574dde8d
Many small changes to clean up code.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
6842eb2b84
Rename global tls dtor to thread dtor.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
64164b10e8
Improve comments.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
bc9d007e3e
Improve Debug formatting of the thread name.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
04abf066f1
Move copying of the thread name to the client side.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
feb188360e
Unify TLS dtors; move stepping outside.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d45e985669
Clarify FIXME.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
8a7dbde372
Check prctl argument types and fix the test.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
e7c2694b8b
Make the main thread detached.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
69eaaadc28
Fix merge error.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
452e36efb3
Print the thread name in Debug.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
3bb1657448
Small style fix.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
9a01c3fa3e
Clarify comments about TLS destructor handling in Windows, add a test for TLS destructors.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
e4dc3567f8
Track if a thread was already joined.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
17f7bc86ae
Fix how a pthread_create function argument is constructed.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
94cbe88e80
Many small changes to thread management.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
75e6549c11
Improve prctl, add a test.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
eab38dfe00
Change the warning message.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
69df2e19de
Move prctl to Linux specific shims.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d6c03926ab
Rename MacOS set global dtor function.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
421be273cc
Add concurrency tests.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
46fd333daa
Implement thread::yield_now.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
134533d066
Add a comment explaining global destructors on MacOS.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d062f63519
Fix support for MacOS.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
44e9305599
Rename threads to thread to match the Rust standard library.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
a585dc8289
Add a missing newline.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
688cacbdd7
Cleanup the implementation of adjust_global_const.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
1d0eb93ebd
Fix typo in a comment.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
94118d4d9a
Make an assert message consistent with other asserts.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
552080a5b7
Fix imports.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
4609c3c520
Rename eval_maybe_thread_local_static_const to adjust_global_const.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
325c31e578
Address some of the reviewers comments.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
51b16e56cd
Generate thread local allocations in eval_maybe_thread_local_static_const.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
963e9698f9
Generate fresh allocation ids for thread locals in eval_maybe_thread_local_static_const.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
0c4303cd7f
Small refactoring in pthread sync: extract common functionallity to separate functions.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
d907fb5021
Rename ThreadSet to ThreadManager.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
1c8a59c691
Rebase on PR 1157.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
2202278f6a
Fix pthread_self.
2020-04-27 14:23:32 -07:00