-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows improvements #453
Windows improvements #453
Commits on Mar 18, 2019
-
shims: correct indirection on Windows
The `_dispatch_sema4_t` type is a pointer to the handle of the semaphore, so we need to indirect through the pointer before using it. This site was incorrectly using it directly.
Configuration menu - View commit details
-
Copy full SHA for dd6d93a - Browse repository at this point
Copy the full SHA dd6d93aView commit details
Commits on Mar 19, 2019
-
event: plumb partial timer support for Windows
This sets up the event loop for Windows to run and schedule timers. This allows us to start running some of the timer sources.
Configuration menu - View commit details
-
Copy full SHA for b6ff007 - Browse repository at this point
Copy the full SHA b6ff007View commit details -
remove last few __LP64__ usage
This cleans up the __LP64__ usage to allow libdispatch to work correctly on LLP64 targets (like Windows x64).
Configuration menu - View commit details
-
Copy full SHA for f7a0cbb - Browse repository at this point
Copy the full SHA f7a0cbbView commit details -
Linux, FreeBSD already define DISPATCH_COCOA_COMPAT, and Windows was defining that in a couple of places in an unstructured haphazard manner. Define it similarly and clean up the other sites.
Configuration menu - View commit details
-
Copy full SHA for 6481203 - Browse repository at this point
Copy the full SHA 6481203View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41678df - Browse repository at this point
Copy the full SHA 41678dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 00c62df - Browse repository at this point
Copy the full SHA 00c62dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for c0a2e84 - Browse repository at this point
Copy the full SHA c0a2e84View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c912a4 - Browse repository at this point
Copy the full SHA 3c912a4View commit details -
FlsAlloc returns FLS_OUT_OF_INDEXES in an error scenario, everything else is a valid result. Correct the assertion.
Configuration menu - View commit details
-
Copy full SHA for 84e7a03 - Browse repository at this point
Copy the full SHA 84e7a03View commit details -
shims: correct _dispatch_get_nanoseconds on Windows
The NT time representation uses 1/1/1601 as epoch as opposed to Unix which uses 1/1/1970. Account for the offset in the calculation. This corrects the calculation of now.
Configuration menu - View commit details
-
Copy full SHA for e92ca67 - Browse repository at this point
Copy the full SHA e92ca67View commit details -
event: support CLOCK_WALL on Windows
This is needed for XCTest to run its test suite.
Configuration menu - View commit details
-
Copy full SHA for c82c26b - Browse repository at this point
Copy the full SHA c82c26bView commit details -
time: use GetSystemTimePreceiseAsFileTime on Windows
Use the `GetSystemTimePreciseAsFileTime` rather than `GetSystemTimeAsFileTime` as we may otherwise get a cached value from the last context switch.
Configuration menu - View commit details
-
Copy full SHA for 37ac7c6 - Browse repository at this point
Copy the full SHA 37ac7c6View commit details -
lock: adopt the POSIX behaviour on Windows
Ideally we would do the lazy semaphore approach that Mach does. Unfortunately, the queue wasn't getting drained as in that case. A follow up should investigate and fix the lazy allocation.
Configuration menu - View commit details
-
Copy full SHA for bbde530 - Browse repository at this point
Copy the full SHA bbde530View commit details -
queue: expose
_dispatch_get_main_queue_port_4CF
This was being re-implemented in CF by means of a macro. Just expose the function instead.
Configuration menu - View commit details
-
Copy full SHA for c3b9b8e - Browse repository at this point
Copy the full SHA c3b9b8eView commit details -
Optimize Windows contention performance
The dispatch_cascade test is very slow on Windows right now (often taking 4-5 minutes to execute on my machine and sometimes locking it up entirely) because contention is not being handled correctly. `_dispatch_contention_usleep()` is expected to put the thread to sleep, but on Windows it spins on `QueryPerformanceCounter()`. This is causing a huge amount of starvation in the dispatch_cascade test. Implement it using `Sleep()`, and accordingly adjust `DISPATCH_CONTENTION_USLEEP_START` to be 1ms on Windows. Additionally, `_dispatch_contention_spins()` is currently implemented using the `rand_s()` function. This is slow (and experimentally seems to be slower than not randomizing the spin count at all!) because `rand_s()` guarantees cryptographic security, which is unnecessary for dispatch's use case. Replace it with a basic linear congruential generator (from K&R) since there isn't any other `rand_r()` equivalent. Based on the average wall clock times reported by bsdtestharness, this is around 35% faster on my PC (i7-8700K). These changes bring the runtime of the dispatch_cascade test down to around 1-2s at most for me. (It's even faster than this if stdout isn't a console window because that slows down the histogram display.)
Configuration menu - View commit details
-
Copy full SHA for fdc684b - Browse repository at this point
Copy the full SHA fdc684bView commit details -
shims: flesh out generic_sys_queue.h further
The 1121 merge introduced additional usage of sys/queue.h. Flesh out the shims header further to repair the build on Windows.
Configuration menu - View commit details
-
Copy full SHA for 1428c6d - Browse repository at this point
Copy the full SHA 1428c6dView commit details -
semaphore: correct the size of semaphore for LLP64
The `dsema_value` field was marked as long which is incorrect for LLP64 environments. Update the type to `intptr_t` which is the portable type for this value.
Configuration menu - View commit details
-
Copy full SHA for 55195b7 - Browse repository at this point
Copy the full SHA 55195b7View commit details -
shims: correct
_dispatch_uptime
for WindowsThis should use `QueryUnbiasedInterruptTime` `QueryPerformanceCounter` is roughly in units of of TSC frequency. We would need to use `QueryPerformanceFrequency` to convert that into nanoseconds. Additionally, `QueryPerformanceCounter` includes time spent during suspend, which is not what is desired. Switch to `QueryUnbiasedInterruptTime` to get something close to `CLOCK_MONOTONIC` on Linux.
Configuration menu - View commit details
-
Copy full SHA for 766d647 - Browse repository at this point
Copy the full SHA 766d647View commit details -
benchmark: disable 128-bit math on Windows
Windows does not support 128-bit division, disable the support for now. One option is to statically link compiler-rt to provide `__udivti3`.
Configuration menu - View commit details
-
Copy full SHA for 346785c - Browse repository at this point
Copy the full SHA 346785cView commit details -
This addresses the updates that were not applied to the Windows port but were applied to the Linux port and the macOS port.
Configuration menu - View commit details
-
Copy full SHA for b6b1975 - Browse repository at this point
Copy the full SHA b6b1975View commit details -
tests: support the timer source tests on Windows
PR apple#453 provides an initial implementation for timer support on Windows. Support building and running the `DISPATCH_SOURCE_TYPE_TIMER` tests so we can easily verify that timers work correctly. These tests should pass on Windows with this and apple#453 applied: - dispatch_drift - dispatch_suspend_timer - dispatch_timer - dispatch_timer_bit31 - dispatch_timer_bit63 - dispatch_timer_set_time - dispatch_timer_short - dispatch_timer_timeout
Configuration menu - View commit details
-
Copy full SHA for 3085ae0 - Browse repository at this point
Copy the full SHA 3085ae0View commit details