Skip to content

Merge tag darwin/darwin-008 on darwin/trunk. #252

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

Merged
merged 50 commits into from
May 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d051a8b
missing hunk from 95875d7
das May 19, 2017
ae657d7
missing hunk from 5464492
das May 19, 2017
d0e53b5
missing hunk from 24f49a2
das May 19, 2017
6b3862b
missing hunk from b5e37c8
das May 19, 2017
4ac2139
missing hunk from 709964f
das May 19, 2017
919c0f8
fix libdispatch.a
weissi Feb 6, 2017
84b4018
Merge pull request #209 from weissi/jw-fix-libdispatch.a
MadCoder Feb 20, 2017
9242229
Linux fixes for dispatch-806 merge
dgrove-oss Feb 22, 2017
155406d
Merge pull request #216 from dgrove-oss/das-darwin-libdispatch-806-me…
das Feb 22, 2017
1263468
provide fallback definitions for all API_* macros
das Feb 22, 2017
27c57a9
Merge pull request #218 from apple/das-api-availability-build-fix
das Feb 22, 2017
430623f
remove unused dependency on linux/membarrier.h for intel to fix CI build
das Feb 22, 2017
6584090
Merge pull request #221 from apple/das-disable-linux-membarrier-include
das Feb 22, 2017
1b5bc31
queue_specific_queue is missing its do_push vtable entry
MadCoder Feb 23, 2017
ab9652e
Merge pull request #223 from apple/eng/PR-SR-4039
das Feb 24, 2017
afa3ac5
fixes for compiler warnings
dgrove-oss Feb 24, 2017
69118be
Merge pull request #226 from dgrove-oss/fix-compiler-warnings
MadCoder Feb 26, 2017
2590ec7
Adding DISPATCH_SOURCE_TYPE_DATA_REPLACE to the Swift overlay
ktopley-apple Feb 28, 2017
426c007
Add support for UnsafeRawBufferPointer to DispatchData
ktopley-apple Mar 9, 2017
3b5ffaf
Review comments.
ktopley-apple Mar 10, 2017
b281c51
Makes the DispatchIO initializer that accepts a path failable, reflec…
ktopley-apple Mar 17, 2017
3fd71eb
Fix compile error on s390x in shims/lock.h. s390x has a strong memory…
vivkong Apr 3, 2017
0c49ad7
Merge pull request #234 from linux-on-ibm-z/fix_compile_error
MadCoder Apr 5, 2017
34203e3
libdispatch: Avoid submodules for headers that should not be included
bcardosolopes Apr 8, 2017
446f7b8
Merge pull request #236 from bcardosolopes/master
das Apr 11, 2017
bacc2aa
Port changes from swift repository.
ktopley-apple Apr 12, 2017
f6cb594
build: add a cmake based build system
compnerd Dec 28, 2016
00e7e55
Merge pull request #196 from compnerd/cmake
das Apr 19, 2017
7b0a448
lock: Avoid use of undefined DISPATCH_INTERNAL_CRASH
amboar Apr 4, 2017
b2789e6
Merge pull request #233 from amboar/master
das Apr 21, 2017
64da2b1
build: attempt to add swift support to cmake
compnerd Apr 30, 2017
4479254
Merge pull request #243 from compnerd/swiftDispatch
MadCoder May 7, 2017
1d4da8a
SR-4201: DispatchSourceSignal not working on Linux
dgrove-oss Mar 10, 2017
ec53c56
Merge pull request #231 from dgrove-oss/SR-4201-signalsource
MadCoder May 7, 2017
eee9a8d
fix build failures due to missing return value
das May 19, 2017
f1ad3ff
Create a DISPATCH_PTR_SIZE macro and use it
compnerd May 3, 2017
26d2dce
Merge pull request #244 from compnerd/ptrsize
MadCoder May 7, 2017
3d5b6ce
guard includes with checks
compnerd May 7, 2017
9c8afda
invert Linux handling
compnerd May 7, 2017
2ab4696
build: improve support for cl-like compilers
compnerd May 7, 2017
3b42f6b
Merge pull request #245 from compnerd/windows-cleanups
MadCoder May 7, 2017
8af68ef
fix invalid use of config defines in API/SPI headers
das May 19, 2017
a15c12c
build: fix typo in build system
compnerd May 12, 2017
2735e22
Merge pull request #246 from compnerd/build-dependencies
das May 12, 2017
6dcf9a3
implement pthread_workqueue within libdispatch
dgrove-oss Jan 25, 2017
624ae1d
Merge pull request #206 from dgrove-oss/internal-pwq-impl
MadCoder May 18, 2017
2e6188e
fix #include of project header
das May 19, 2017
5e87d7c
fix build failures due to signed vs unsigned warnings
das May 19, 2017
905bfe2
merge darwin/darwin-008
das May 25, 2017
81a67c9
Merge branch 'master' into das-darwin-008-merge-master
das May 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions PATCHES
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,23 @@ github commits starting with 29bdc2f from
[787dd92] APPLIED rdar://30568673
[ba4cac5] APPLIED rdar://30568673
[7974138] APPLIED rdar://30568673
[cd12dcb] APPLIED rdar://32283666
[ff05109] APPLIED rdar://32283666
[73315ee] APPLIED rdar://32283666
[fcc1924] APPLIED rdar://32283666
[272e818] APPLIED rdar://32283666
[b6f8908] APPLIED rdar://32283666
[a6c16d0] APPLIED rdar://32283666
[1cc64e1] APPLIED rdar://32283666
[d137aa4] APPLIED rdar://32283666
[a69853f] APPLIED rdar://32283666
[eea0667] APPLIED rdar://32283666
[f84d21d] APPLIED rdar://32283666
[3da8398] APPLIED rdar://32283666
[2df80a3] APPLIED rdar://32283666
[97a2f06] APPLIED rdar://32283666
[f76b8f5] APPLIED rdar://32283666
[3828fbb] APPLIED rdar://32283666
[5e8789e] APPLIED rdar://32283666
[3fba60a] APPLIED rdar://32283666
[d6eb245] APPLIED rdar://32283666
21 changes: 4 additions & 17 deletions dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,17 @@
#ifdef __APPLE__
#include <Availability.h>
#include <TargetConditionals.h>
#else
#ifndef API_AVAILABLE
#define API_AVAILABLE(...)
#include <os/base.h>
#elif defined(__linux__)
#include <os/linux_base.h>
#endif
#ifndef API_DEPRECATED
#define API_DEPRECATED(...)
#endif
#ifndef API_UNAVAILABLE
#define API_UNAVAILABLE(...)
#endif
#ifndef API_DEPRECATED_WITH_REPLACEMENT
#define API_DEPRECATED_WITH_REPLACEMENT(...)
#endif
#endif // __APPLE__

#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#if HAVE_UNISTD_H
#if !defined(HAVE_UNISTD_H) || HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
Expand Down
17 changes: 17 additions & 0 deletions os/linux_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@

#include <sys/param.h>

#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif

#ifndef API_AVAILABLE
#define API_AVAILABLE(...)
#endif
#ifndef API_DEPRECATED
#define API_DEPRECATED(...)
#endif
#ifndef API_UNAVAILABLE
#define API_UNAVAILABLE(...)
#endif
#ifndef API_DEPRECATED_WITH_REPLACEMENT
#define API_DEPRECATED_WITH_REPLACEMENT(...)
#endif

#if __GNUC__
#define OS_EXPECT(x, v) __builtin_expect((x), (v))
#define OS_UNUSED __attribute__((__unused__))
Expand Down
8 changes: 3 additions & 5 deletions os/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@

#ifdef __APPLE__
#include <Availability.h>
#include <TargetConditionals.h>
#include <os/availability.h>
#endif
#ifdef __linux__
#include <os/linux_base.h>
#else
#include <TargetConditionals.h>
#include <os/base.h>
#elif defined(__linux__)
#include <os/linux_base.h>
#endif

/*!
Expand Down
10 changes: 2 additions & 8 deletions os/object_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
#ifndef __OS_OBJECT_PRIVATE__
#define __OS_OBJECT_PRIVATE__

#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#include <stddef.h>
#include <os/object.h>

#ifndef API_AVAILABLE
#define API_AVAILABLE(...)
#endif
#include <stddef.h>
#include <stdint.h>

#if __GNUC__
#define OS_OBJECT_NOTHROW __attribute__((__nothrow__))
Expand Down
11 changes: 6 additions & 5 deletions src/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,21 @@ dispatch_apply_f(size_t iterations, dispatch_queue_t dq, void *ctxt,
if (slowpath(iterations == 0)) {
return;
}
int32_t thr_cnt = dispatch_hw_config(active_cpus);
dispatch_thread_context_t dtctxt = _dispatch_thread_context_find(_dispatch_apply_key);
int32_t thr_cnt = (int32_t)dispatch_hw_config(active_cpus);
dispatch_thread_context_t dtctxt =
_dispatch_thread_context_find(_dispatch_apply_key);
size_t nested = dtctxt ? dtctxt->dtc_apply_nesting : 0;
dispatch_queue_t old_dq = _dispatch_queue_get_current();

if (!slowpath(nested)) {
nested = iterations;
} else {
thr_cnt = nested < thr_cnt ? thr_cnt / nested : 1;
thr_cnt = nested < (size_t)thr_cnt ? thr_cnt / (int32_t)nested : 1;
nested = nested < DISPATCH_APPLY_MAX && iterations < DISPATCH_APPLY_MAX
? nested * iterations : DISPATCH_APPLY_MAX;
}
if (iterations < thr_cnt) {
thr_cnt = iterations;
if (iterations < (size_t)thr_cnt) {
thr_cnt = (int32_t)iterations;
}
if (slowpath(dq == DISPATCH_APPLY_CURRENT_ROOT_QUEUE)) {
dq = old_dq ? old_dq : _dispatch_get_root_queue(
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ _dispatch_sigmask(void)
r |= sigdelset(&mask, SIGPIPE);
r |= sigdelset(&mask, SIGPROF);
r |= pthread_sigmask(SIG_BLOCK, &mask, NULL);
(void)dispatch_assume_zero(r);
return dispatch_assume_zero(r);
}

#pragma mark -
Expand Down
30 changes: 15 additions & 15 deletions src/inline_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,30 +592,30 @@ _dq_state_has_side_suspend_cnt(uint64_t dq_state)
}

DISPATCH_ALWAYS_INLINE
static inline uint32_t
static inline int32_t
_dq_state_extract_width_bits(uint64_t dq_state)
{
dq_state &= DISPATCH_QUEUE_WIDTH_MASK;
return (uint32_t)(dq_state >> DISPATCH_QUEUE_WIDTH_SHIFT);
return (int32_t)(dq_state >> DISPATCH_QUEUE_WIDTH_SHIFT);
}

DISPATCH_ALWAYS_INLINE
static inline uint32_t
static inline int32_t
_dq_state_available_width(uint64_t dq_state)
{
uint32_t full = DISPATCH_QUEUE_WIDTH_FULL;
int32_t full = DISPATCH_QUEUE_WIDTH_FULL;
if (likely(!(dq_state & DISPATCH_QUEUE_WIDTH_FULL_BIT))) {
return full - _dq_state_extract_width_bits(dq_state);
}
return 0;
}

DISPATCH_ALWAYS_INLINE
static inline uint32_t
static inline int32_t
_dq_state_used_width(uint64_t dq_state, uint16_t dq_width)
{
uint32_t full = DISPATCH_QUEUE_WIDTH_FULL;
uint32_t width = _dq_state_extract_width_bits(dq_state);
int32_t full = DISPATCH_QUEUE_WIDTH_FULL;
int32_t width = _dq_state_extract_width_bits(dq_state);

if (dq_state & DISPATCH_QUEUE_PENDING_BARRIER) {
// DISPATCH_QUEUE_PENDING_BARRIER means (dq_width - 1) of the used width
Expand Down Expand Up @@ -1030,21 +1030,21 @@ _dispatch_queue_try_reserve_sync_width(dispatch_queue_t dq)
* possibly 0
*/
DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT
static inline uint32_t
_dispatch_queue_try_reserve_apply_width(dispatch_queue_t dq, uint32_t da_width)
static inline int32_t
_dispatch_queue_try_reserve_apply_width(dispatch_queue_t dq, int32_t da_width)
{
uint64_t old_state, new_state;
uint32_t width;
int32_t width;

(void)os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, relaxed, {
width = _dq_state_available_width(old_state);
width = (int32_t)_dq_state_available_width(old_state);
if (unlikely(!width)) {
os_atomic_rmw_loop_give_up(return 0);
}
if (width > da_width) {
width = da_width;
}
new_state = old_state + width * DISPATCH_QUEUE_WIDTH_INTERVAL;
new_state = old_state + (uint64_t)width * DISPATCH_QUEUE_WIDTH_INTERVAL;
});
return width;
}
Expand All @@ -1055,10 +1055,10 @@ _dispatch_queue_try_reserve_apply_width(dispatch_queue_t dq, uint32_t da_width)
*/
DISPATCH_ALWAYS_INLINE
static inline void
_dispatch_queue_relinquish_width(dispatch_queue_t dq, uint32_t da_width)
_dispatch_queue_relinquish_width(dispatch_queue_t dq, int32_t da_width)
{
(void)os_atomic_sub2o(dq, dq_state,
da_width * DISPATCH_QUEUE_WIDTH_INTERVAL, relaxed);
(uint64_t)da_width * DISPATCH_QUEUE_WIDTH_INTERVAL, relaxed);
}

/* Used by target-queue recursing code
Expand Down Expand Up @@ -1474,7 +1474,7 @@ _dispatch_queue_push_update_head(dispatch_queue_t dq,
DISPATCH_ALWAYS_INLINE
static inline void
_dispatch_root_queue_push_inline(dispatch_queue_t dq, dispatch_object_t _head,
dispatch_object_t _tail, unsigned int n)
dispatch_object_t _tail, int n)
{
struct dispatch_object_s *head = _head._do, *tail = _tail._do;
if (unlikely(_dispatch_queue_push_update_tail_list(dq, head, tail))) {
Expand Down
2 changes: 1 addition & 1 deletion src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ _dispatch_root_queue_init_pthread_pool(dispatch_root_queue_context_t qc,
{
dispatch_pthread_root_queue_context_t pqc = qc->dgq_ctxt;
int32_t thread_pool_size = overcommit ? DISPATCH_WORKQ_MAX_PTHREAD_COUNT :
dispatch_hw_config(active_cpus);
(int32_t)dispatch_hw_config(active_cpus);
if (slowpath(pool_size) && pool_size < thread_pool_size) {
thread_pool_size = pool_size;
}
Expand Down
2 changes: 1 addition & 1 deletion src/shims.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#endif // HAVE_PTHREAD_WORKQUEUES

#if DISPATCH_USE_INTERNAL_WORKQUEUE
#include <event/workqueue_internal.h>
#include "event/workqueue_internal.h"
#endif

#if HAVE_PTHREAD_NP_H
Expand Down
2 changes: 1 addition & 1 deletion src/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ _dispatch_trace_client_callout2(void *ctxt, size_t i, void (*f)(void *, size_t))
DISPATCH_ALWAYS_INLINE
static inline void
_dispatch_trace_root_queue_push_list(dispatch_queue_t dq,
dispatch_object_t _head, dispatch_object_t _tail, unsigned int n)
dispatch_object_t _head, dispatch_object_t _tail, int n)
{
if (slowpath(DISPATCH_QUEUE_PUSH_ENABLED())) {
struct dispatch_object_s *dou = _head._do;
Expand Down