Aaron Hill
9e6320f101
Move convert_path_separator
to trait and use it in readlink
2020-10-04 12:34:13 -04:00
Aaron Hill
462f58298a
Make helper functions freestanding
2020-10-04 12:06:51 -04:00
Aaron Hill
8b89c7e1da
Use panicking coversions instead of as
2020-10-04 12:06:51 -04:00
Aaron Hill
186d59a3ec
Move some helper functions around
2020-10-04 12:06:51 -04:00
Aaron Hill
78bc89b4fc
Implement readlink
...
Due to the truncating behavior of `readlink`, I was not able to
directly use any of the existing C-cstring helper functions.
2020-10-04 12:06:51 -04:00
Ralf Jung
2b2a3a0cc1
check that all syscall arguments are scalars
2020-10-03 16:01:53 +02:00
Ralf Jung
b350c80a31
add backtics back in isolation error message
2020-10-03 15:25:30 +02:00
Mara Bos
68776d2921
Add FIXME about type of addr
in futex implementation.
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-10-03 14:32:30 +02:00
Mara Bos
c268ee2bcb
Add note about use of force_ptr in futex implementation.
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-10-03 14:21:37 +02:00
Mara Bos
dfcb46a4e0
Update syscall FIXME to include note about 'wrong' types.
2020-10-03 13:39:16 +02:00
Mara Bos
9d764c5750
Add FIXME note about variadic syscall().
2020-10-03 12:18:38 +02:00
Mara Bos
6df54c47a7
Use read_scalar_at_offset in futex_wait instead of memory.get_raw.
2020-10-03 12:11:24 +02:00
Mara Bos
924fd56944
Only allow FUTEX_WAIT with timeout when isoloation is disabled.
2020-10-03 11:35:13 +02:00
Mara Bos
c9627b25fb
Use correct return type for syscall(SYS_futex).
2020-10-03 00:40:53 +02:00
Mara Bos
e64ead2f46
Implement timeouts for FUTEX_WAIT.
2020-10-02 23:34:14 +02:00
Mara Bos
d5b3f54b46
Use force_ptr in futex implementation.
2020-10-02 21:59:11 +02:00
Mara Bos
422b5053a9
Add note about arguments in futex implementation.
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-10-02 20:56:01 +02:00
Mara Bos
dabd980567
Update note about number of arguments to SYS_futex.
2020-10-02 20:53:31 +02:00
Mara Bos
ee3eb4b223
Add comments that document SYS_futex better.
2020-10-02 10:47:53 +02:00
Mara Bos
712e8006b3
Improve handling of the addr
argument in SYS_futex.
2020-10-02 10:47:36 +02:00
Mara Bos
c2fa27c3b8
Check maximum amount of arguments to SYS_futex.
2020-10-02 10:46:57 +02:00
Mara Bos
1c582e7c96
Return correct value from futex_wait.
2020-10-02 01:49:20 +02:00
Mara Bos
69cea1dc92
Only check futex pointer in futex_wait and not in futex_wake.
...
futex_wake doesn't access the futex itself, so should accept pointers to
memory that's no longer there.
2020-10-01 22:57:27 +02:00
Mara Bos
6c2f36eb6b
Erase tag from futex pointers.
2020-10-01 21:06:16 +02:00
Mara Bos
281a538226
Move futex syscall to its own file.
2020-10-01 21:03:36 +02:00
Mara Bos
1ffc5bb563
Implement futex_wait and futex_wake.
...
This does not support futex_wait with a timeout yet.
2020-10-01 20:55:54 +02:00
Aaron Hill
5571bcfc4f
Require #[repr(C)] on MiriFrame
2020-09-28 13:44:46 -04:00
Aaron Hill
e1bce19ca9
Make some error messages lowercase
2020-09-28 13:44:45 -04:00
Aaron Hill
f756e3a93f
Explain encoding scheme
2020-09-28 13:44:45 -04:00
Aaron Hill
b89f6561e5
Move things around
2020-09-28 13:44:45 -04:00
Aaron Hill
ef43c5a614
Use a 'flags' parameter instead of 'version'
2020-09-28 13:44:45 -04:00
Aaron Hill
22f1eb01ee
Add API for capturing backtrace
...
This PR adds two new Miri-defined extern functions:
`miri_get_backtrace` and `miri_resolve_frame`, which are documented in
the README. Together, they allow obtaining a backtrace for the currently
executing program.
I've added a test showing how these APIs are used. I've also prepared a
companion PR `backtrace-rs`, which will allow
`backtrace::Backtrace::new()` to work automatically under Miri.
Once these two PRs are merged, we will be able to print backtraces from
the normal Rust panic hook (since libstd is now using backtrace-rs).
A few notes:
* Resolving the backtrace frames is *very* slow - you can actually see
each line being printed out one at a time. Some local testing showed
that this is not (primrary) caused by resolving a `Span` - it seems
to be just Miri being slow.
* For the first time, we now interact directly with a user-defined
struct (instead of just executing the user-provided MIR that
manipulates the struct). To allow for future changes, I've added
a 'version' parameter (currently required to be 0). This should allow
us to change the `MiriFrame` struct should the need ever arise.
* I used the approach suggested by @oli-obk - a returned backtrace
pointer consists of a base function allocation, with the 'offset'
used to encode the `Span.lo`. This allows losslessly reconstructing
the location information in `miri_resolve_frame`.
* There are a few quirks on the `backtrace-rs` side:
* `backtrace-rs` calls `getcwd()` by default to try to simplify
the filename. This results in an isolation error by default,
which could be annoying when printing a backtrace from libstd.
* `backtrace-rs` tries to remove 'internal' frames (everything between
the call to `Backtrace::new()` and the internal API call made by
backtrace-rs) by comparing the returned frame pointer value to
a Rust function pointer. This doesn't work due to the way we
construct the frame pointers passed to the caller. We could
attempt to support this kind of comparison, or just add a
`#[cfg(miri)]` and ignore the frames ourselves.
2020-09-28 13:44:45 -04:00
Lzu Tao
56ea94dfa3
Remove assume intrinsic from EvalContextExt
...
It has been moved to rustc_mir.
2020-09-27 10:00:06 +07:00
Ralf Jung
97a71c0c77
fmt
...
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2020-09-18 13:34:25 +02:00
Ralf Jung
32cdb7131b
support panic=abort
2020-09-18 13:10:18 +02:00
Ralf Jung
3163242ff1
rustup; no need to special-case the guaranteed_eq/ne intrinsics any more
2020-09-17 17:42:52 +02:00
Samrat Man Singh
563fb8e43d
Implement dup and close for stdin/stdout/stderr
...
Support F_DUPFD on stdin/stdout/stderr
Enable `close`-ing stdin/stdout/stderr
For `dup`, check if FD is `File` first
If not, clone the appropriate standard IO stream
Merge POSIX `close` and `dup` tests into same module
Also, add assertion that `write` on a closed FD returns an error.
Add `dup` as FileDescriptor trait fn
Also:
- Fix `close` so it drops `self` instead of reference to it
- Remove FD clamping in insert_fd_with_min_fd, since FDs 0-2 can be
closed
Fix fs_libc tests
Make error message when closing stdin/out/err more specific
Return io::Result from `FileDescriptor::dup`
Change error message when closing stdin/out/err
Refactor `FileDescriptor::dup` impl for `FileHandle`
Remove empty line
2020-09-09 23:26:33 +05:30
David Cook
33e928c9ca
Review comments
2020-09-07 10:54:39 -05:00
David Cook
417ac2939a
Implement libc::nanosleep shim
2020-09-06 18:07:17 -05:00
David Cook
6d323e1032
Refactor timespec parsing, improve error handling
2020-09-06 18:07:14 -05:00
LeSeulArtichaut
4f2f87b2df
Change ty.kind
-> ty.kind()
2020-09-04 22:03:45 +02:00
David Cook
7a2c6812b9
Per-thread errno storage
2020-09-02 20:57:20 -05:00
David Cook
da2f268443
Review comments
2020-08-31 19:32:14 -05:00
David Cook
3ba7f46058
Move panic payload state from Machine to Thread
2020-08-29 21:38:37 -05:00
Ralf Jung
d4e5943259
use real align_offset unless we symbolic alignment check is enabled
2020-08-16 18:26:04 +02:00
Ralf Jung
df311293e2
fix Stderr::as_file_handle error message
2020-08-13 14:27:03 +02:00
Samrat Man Singh
0c25064117
Remove unnecessary whitespace
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-08-13 16:18:08 +05:30
Samrat Man Singh
46852d736e
Remove lifetime from FileDescriptor trait
...
Also:
- Remove type annotate `handles` declaration instead of every insert.
- Add note about flush being unnecessary when writing to stderr
2020-08-13 15:01:52 +05:30
Ralf Jung
5657f08bea
fs: move isolation handling to inside trait
2020-08-08 15:24:30 +02:00
bors
eaf5d32ac7
Auto merge of #1501 - samrat:fix-fs-error-handling, r=RalfJung
...
Bubble up errors from FileDescriptor::as_file_handle
Instead of indicating incorrectly that a handle was not found, return the error from `as_file_handle` indicating the operation is not supported on the FD.
Addresses some comments in #1495
2020-08-08 12:28:08 +00:00
Ralf Jung
07a4383ac8
rustup
2020-08-08 14:05:11 +02:00
Samrat Man Singh
1069f6b174
Fix handling of as_file_handle error for fullfsync
2020-08-08 17:28:41 +05:30
Samrat Man Singh
045bcab1eb
Add FIXME's for dup
and other syscalls to support stdin/out/err
2020-08-08 15:08:29 +05:30
Samrat Man Singh
773dfb31f0
Bubble up error from FileDescriptor::as_file_handle
...
...instead of handle_not_found
2020-08-08 14:42:50 +05:30
Samrat Man Singh
bdef57ea45
Flush to stdout from FileDescriptor::write for Stdout
...
Also, remove unnecessary `-Zmiri-disable-isolation` in test
2020-08-04 20:40:48 +05:30
Samrat Man Singh
bea7113eb8
Add impl FileDescriptor
for stdin, stdout, stderr
...
- Use `FileDescriptor::read` for stdin reads
- Use `FileDescriptor::write` for stdout/err writes
- Handle stdout/err reads in `FileDescriptor::read`
2020-08-04 01:14:52 +05:30
bors
69d050fb6b
Auto merge of #1495 - samrat:fd-trait, r=oli-obk
...
Add FileDescriptor trait to abstract fn's on File's and Stdin,Stdout,Stderr
Related issue: #1486
Instead of mapping FDs to `FileHandle`, map them to a `FileDescriptor` trait object. The goal is to eventually have both `FileHandle` as well as `Stdin`, `Stdout` and `Stderr` implement this trait so that syscalls involving FDs can handle both `File`s as well as the standard IO streams.
This PR adds the `FileDescriptor` trait and an `impl` for `FileHandle`. I'll open a separate PR for implementing the trait for the standard IO streams.
2020-08-03 15:50:30 +00:00
Samrat Man Singh
79e066fc95
Remove unnecessary clone()
on writable
2020-08-03 20:39:09 +05:30
Samrat Man Singh
3386f12eca
Wrap io::Result from FileDescriptor::{read,write,seek}
in InterpResult
...
The outer InterpResult will be used to indicate that a fn is not
implemented for a struct(eg. `write` for Stdin).
The inner io::Result is just the result from the read/write/seek.
2020-08-03 11:01:42 +05:30
Samrat Man Singh
e3956f4200
Add FileDescriptor trait to abstract fn's on File's and Std{in,out,err}
2020-08-01 20:53:50 +05:30
Ralf Jung
2dfde5b696
remove upstreamed intrinsic impls
2020-07-30 18:31:40 +02:00
Ralf Jung
d340933112
rustup
2020-07-30 18:31:19 +02:00
Ralf Jung
6fbaa72642
fix diagnostics printing when triggered during TLS dtor scheduling
2020-07-27 23:32:15 +02:00
Ralf Jung
c77540ce13
deallocate thread-local statics when the thread dies
2020-07-27 23:32:15 +02:00
Ralf Jung
2a42f8e93c
fix and test order of TLS dtors and thread joining
2020-07-27 23:32:15 +02:00
Philippe Nadon
6dd700fd17
Changed not_undef to check_init in foreign_items.rs
...
Due to changes from upstream, a commit using not_undef was inserted, which had to be updated to use check_init.
related issue #71193
2020-07-27 13:07:25 -06:00
Philippe Nadon
21268157ff
renamed Immediate::to_scalar_or_undef
...
to Immediate::to_scalar_or_uninit
in src/shims/intrinsics.rs
related issue #71193
2020-07-26 16:05:20 -06:00
Philippe Nadon
5161ba346c
renamed ScalarMaybeUninit::not_undef to check_init
...
Related to PR https://github.com/rust-lang/rust/pull/74664
2020-07-26 16:05:20 -06:00
Ralf Jung
bc0569253f
enable leak check tests on Windows
2020-07-23 15:56:38 +02:00
Ralf Jung
fef5fa2ae1
add a Miri extern fn to mark an allocation as being a static root for leak checking
2020-07-23 15:47:33 +02:00
Ralf Jung
4033358956
make miri_start_panic intrinsic an FFI function
2020-07-23 15:20:36 +02:00
bors
592b140880
Auto merge of #1482 - canova:remote-unreachable, r=RalfJung
...
Remove unreachable intrinsic
This is now supported by the interpreter with https://github.com/rust-lang/rust/pull/74459 . We can remove this intrinsic implementation here.
This is covered by this test: https://github.com/rust-lang/miri/blob/master/tests/compile-fail/unreachable.rs
I guess we need to wait until the rust-lang/rust PR merges into nightly, and then we can update `rust-version` hash in the PR, right?
r? @oli-obk
2020-07-23 09:14:08 +00:00
Ralf Jung
7d6aec6887
rustup
2020-07-23 10:40:13 +02:00
Ralf Jung
cded9b7142
set errno on stdout write failure
2020-07-18 17:58:21 +02:00
bors
b021209b0e
Auto merge of #1436 - samrat:support-stdin-read, r=RalfJung
...
Handle `read`s on STDIN
Closes #1434
2020-07-18 14:56:38 +00:00
Nazım Can Altınova
d1aee6965b
Remove unreachable intrinsic
2020-07-18 12:48:26 +02:00
Samrat Man Singh
f4d1841811
Remove unnecessary cast
2020-07-18 10:45:06 +05:30
Samrat Man Singh
4c1beb2e45
Ensure buffer for reading from Stdin is smaller than machine usize
...
Also, set appropriate error code on failure
2020-07-17 20:18:07 +05:30
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
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
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
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
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
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
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
fdfd56b75b
Small changes.
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
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
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
4a2e08f9b8
fix warnings for non-Unix builds
2020-05-11 10:58:27 +02:00
Ralf Jung
379ac82a1c
bump Rust, fix for renames
2020-05-09 10:15:09 +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
994b13eaee
yield on x86 'pause' hint
2020-05-03 12:43:38 +02:00
Ralf Jung
ba670d6970
make sure macos function has 'macos' in its name
2020-04-30 19:38:17 +02:00
Vytautas Astrauskas
48da0cf489
Fix prctl SET_NAME and GET_NAME behaviour.
2020-04-30 08:35:59 -07: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
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
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
8a7dbde372
Check prctl argument types and fix the test.
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
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
1d0eb93ebd
Fix typo in a comment.
2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
552080a5b7
Fix imports.
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
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
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
Vytautas Astrauskas
f21197f081
Store the thread name.
2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
52184193c3
Fix comments in TLS.
2020-04-27 14:23:32 -07:00
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