Commit 1b34b164 authored by Drew's avatar Drew

swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a

parent 8db52b67
......@@ -34,11 +34,6 @@ RUN bash /swift-dev/update-tags.sh
# or for AM
# RUN git config --global user.email "drew@sealedabstract.com" && git config --global user.name "Drew Crawford"
# RUN git am -3 < ../SAMPLE.patch
ADD foundation-fix.patch /swift-dev/
ADD sr-761-b.patch /swift-dev/
RUN git config --global user.email "drew@sealedabstract.com" && git config --global user.name "Drew Crawford"
RUN cd ../swift-corelibs-foundation && git am ../foundation-fix.patch
RUN cd ../swift-corelibs-libdispatch && git am ../sr-761-b.patch && git submodule update
# And now we build, like a good little linuxen.
# I believe this is what the linux build script does. In practice, this builds a system into /tmp/install and then tars it up.
......
From 088be54e73a90539fc525ca96a3929b332561a90 Mon Sep 17 00:00:00 2001
From: Drew Crawford <drew@sealedabstract.com>
Date: Sat, 27 Feb 2016 03:10:18 -0600
Subject: [PATCH] Fix foundation build when libdispatch is enabled
David Grove writes:
> If both --foundation and --libdispatch are given to the invocation of
> build-script (or are in the same preset), then the build attempts to
> build CoreFoundation with libdispatch dependent functionality
> enabled. Right now, this doesn't compile, so the build fails.
Disable this behavior.
---
build.py | 7 -------
1 file changed, 7 deletions(-)
diff --git a/build.py b/build.py
index d713b08..40753bf 100644
--- a/build.py
+++ b/build.py
@@ -61,13 +61,6 @@ if "XCTEST_BUILD_DIR" in Configuration.current.variables:
'-I/usr/include/libxml2'
]
-if "LIBDISPATCH_SOURCE_DIR" in Configuration.current.variables:
- foundation.CFLAGS += " "+" ".join([
- '-DDEPLOYMENT_ENABLE_LIBDISPATCH',
- '-I'+Configuration.current.variables["LIBDISPATCH_SOURCE_DIR"],
- '-I'+Configuration.current.variables["LIBDISPATCH_BUILD_DIR"]+'/tests' # for include of dispatch/private.h in CF
- ])
-
foundation.SWIFTCFLAGS = " ".join(swift_cflags)
foundation.LDFLAGS += '-lpthread -ldl -lm -lswiftCore -lxml2 '
--
2.5.4 (Apple Git-61)
From 5e1aad762cb93a54609de5fe49661e77323b3fa3 Mon Sep 17 00:00:00 2001
From: Hubertus Franke <frankeh@us.ibm.com>
Date: Wed, 24 Feb 2016 17:58:40 -0500
Subject: [PATCH] Enable notification to libpwq before semaphore waiting
Drew's reroll with:
* libpwq update to origin/master (e16bcd6c4b4df3fd85939a981baf94b30968a1ba)
* futex support per https://bugs.swift.org/browse/SR-761?focusedCommentId=12435&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12435
* More futex support per https://bugs.swift.org/browse/SR-761?focusedCommentId=12442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12442
Signed-off-by: Drew Crawford <drew@sealedabstract.com>
---
libpwq | 2 +-
src/semaphore.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libpwq b/libpwq
index 4312f99..e16bcd6 160000
--- a/libpwq
+++ b/libpwq
@@ -1 +1 @@
-Subproject commit 4312f994da24d35fb355ad6701418752ab8fdf3a
+Subproject commit e16bcd6c4b4df3fd85939a981baf94b30968a1ba
diff --git a/src/semaphore.c b/src/semaphore.c
index db40161..9f6055d 100644
--- a/src/semaphore.c
+++ b/src/semaphore.c
@@ -301,6 +301,13 @@ dispatch_semaphore_signal(dispatch_semaphore_t dsema)
return _dispatch_semaphore_signal_slow(dsema);
}
+#if (USE_POSIX_SEM || USE_FUTEX_SEM) && HAVE_PTHREAD_WORKQUEUES
+extern void pthread_workqueue_signal_np(void);
+#define _dispatch_threadmgr_inform_wait() pthread_workqueue_signal_np()
+#else
+#define _dispatch_threadmgr_inform_wait() do { } while (0)
+#endif
+
DISPATCH_NOINLINE
static long
_dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
@@ -371,6 +378,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -383,6 +391,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -425,11 +434,13 @@ again:
DISPATCH_SEMAPHORE_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret != 0);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
@@ -636,6 +647,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -649,6 +661,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = nsec / NSEC_PER_SEC;
_timeout.tv_nsec = nsec % NSEC_PER_SEC;
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -691,11 +704,13 @@ again:
DISPATCH_GROUP_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret == -1 && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
--
2.5.4 (Apple Git-61)
From 9523f10395e54ee354e4c577b2657bd1df4f305a Mon Sep 17 00:00:00 2001
From: Hubertus Franke <frankeh@us.ibm.com>
Date: Wed, 24 Feb 2016 17:58:40 -0500
Subject: [PATCH] Enable notification to libpwq before semaphore waiting
Drew's reroll with:
* libpwq update to origin/master (e16bcd6c4b4df3fd85939a981baf94b30968a1ba)
* futex support (although it doesn't fix deadlock) per https://bugs.swift.org/browse/SR-761?focusedCommentId=12435&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12435
* More futex support (although it doesn't fix deadlock) per https://bugs.swift.org/browse/SR-761?focusedCommentId=12442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12442
* Disabling futex to fix deadlock per https://bugs.swift.org/browse/SR-761?focusedCommentId=12440&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12440
Signed-off-by: Drew Crawford <drew@sealedabstract.com>
---
configure.ac | 3 ---
libpwq | 2 +-
src/semaphore.c | 15 +++++++++++++++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 73dd498..2696bed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,9 +301,6 @@ AC_MSG_CHECKING([what semaphore type to use]);
AS_IF([test "x$have_mach" = "xtrue"],
[AC_DEFINE(USE_MACH_SEM, 1, [Define to use Mach semaphores])
AC_MSG_RESULT([Mach semaphores])],
- [test "x$have_futex" = "xtrue"],
- [AC_DEFINE(USE_FUTEX_SEM, 1, [Define to use Futex semaphores])
- AC_MSG_RESULT([Futex semaphores])],
[test "x$have_sem_init" = "xtrue"],
[AC_DEFINE(USE_POSIX_SEM, 1, [Define to use POSIX semaphores])
AC_MSG_RESULT([POSIX semaphores])],
diff --git a/libpwq b/libpwq
index 4312f99..e16bcd6 160000
--- a/libpwq
+++ b/libpwq
@@ -1 +1 @@
-Subproject commit 4312f994da24d35fb355ad6701418752ab8fdf3a
+Subproject commit e16bcd6c4b4df3fd85939a981baf94b30968a1ba
diff --git a/src/semaphore.c b/src/semaphore.c
index db40161..9f6055d 100644
--- a/src/semaphore.c
+++ b/src/semaphore.c
@@ -301,6 +301,13 @@ dispatch_semaphore_signal(dispatch_semaphore_t dsema)
return _dispatch_semaphore_signal_slow(dsema);
}
+#if (USE_POSIX_SEM || USE_FUTEX_SEM) && HAVE_PTHREAD_WORKQUEUES
+extern void pthread_workqueue_signal_np(void);
+#define _dispatch_threadmgr_inform_wait() pthread_workqueue_signal_np()
+#else
+#define _dispatch_threadmgr_inform_wait() do { } while (0)
+#endif
+
DISPATCH_NOINLINE
static long
_dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
@@ -371,6 +378,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -383,6 +391,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -425,11 +434,13 @@ again:
DISPATCH_SEMAPHORE_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret != 0);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
@@ -636,6 +647,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -649,6 +661,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = nsec / NSEC_PER_SEC;
_timeout.tv_nsec = nsec % NSEC_PER_SEC;
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -691,11 +704,13 @@ again:
DISPATCH_GROUP_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret == -1 && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
--
2.5.4 (Apple Git-61)
From 4797488a72649ed0ea1ad65e9cc920cfb4c4b15d Mon Sep 17 00:00:00 2001
From: Hubertus Franke <frankeh@us.ibm.com>
Date: Mon, 29 Feb 2016 18:05:57 -0500
Subject: [PATCH 1/2] inform libpwq thread manager before semaphore wait
---
src/semaphore.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/semaphore.c b/src/semaphore.c
index 5c1a0ff..cc6c6c1 100644
--- a/src/semaphore.c
+++ b/src/semaphore.c
@@ -301,6 +301,13 @@ dispatch_semaphore_signal(dispatch_semaphore_t dsema)
return _dispatch_semaphore_signal_slow(dsema);
}
+#if (USE_POSIX_SEM || USE_FUTEX_SEM) && HAVE_PTHREAD_WORKQUEUES
+extern void pthread_workqueue_signal_np(void);
+#define _dispatch_threadmgr_inform_wait() pthread_workqueue_signal_np()
+#else
+#define _dispatch_threadmgr_inform_wait() do { } while (0)
+#endif
+
DISPATCH_NOINLINE
static long
_dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
@@ -371,6 +378,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -383,6 +391,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -425,11 +434,13 @@ again:
DISPATCH_SEMAPHORE_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret != 0);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
@@ -636,6 +647,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -648,6 +660,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -690,11 +703,13 @@ again:
DISPATCH_GROUP_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret == -1 && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
--
2.6.4 (Apple Git-63)
From fec9fce023f96a05b0998dbe410a8227e670b7d2 Mon Sep 17 00:00:00 2001
From: Drew Crawford <drew@sealedabstract.com>
Date: Tue, 1 Mar 2016 05:22:01 -0600
Subject: [PATCH 2/2] Update libpwq to upstream master
---
libpwq | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libpwq b/libpwq
index 4312f99..e16bcd6 160000
--- a/libpwq
+++ b/libpwq
@@ -1 +1 @@
-Subproject commit 4312f994da24d35fb355ad6701418752ab8fdf3a
+Subproject commit e16bcd6c4b4df3fd85939a981baf94b30968a1ba
--
2.6.4 (Apple Git-63)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment