Skip to content

Merge darwin/trunk, including libdispatch-703.1.4 Apple source drop, to swift-3.0-branch #143

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 81 commits into from
Aug 15, 2016

Conversation

das
Copy link
Contributor

@das das commented Aug 11, 2016

Merge tag darwin/darwin-006 on darwin/trunk, which includes the latest Apple source drop libdispatch-703.1.4 as well as with all the github PR’s that we’ve pulled back into our internal repository since the last darwin/trunk merge, along with any changes made to these during internal review and testing on Darwin.

dgrove-oss and others added 30 commits July 28, 2016 20:39
Minimal set of changes to get sources merged
from libdispatch-685 to compile and run on Linux.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Linux port of libdispatch-685 merge

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
validated by building on Darwin with -DHAVE_PTHREAD_WORKQUEUE_QOS=0
-DDISPATCH_USE_KEVENT_QOS=0 -DVOUCHER_USE_MACH_VOUCHER=0
-DOS_FIREHOSE_SPI=0

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Change name of generated header file to config_ac.h
and use __has_include to prefer the generated file if
it is present.  Avoids stomping on the config.h used by
XCode when building using autotools.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Avoid overwriting config.h with generated header

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Get rid of mach_error_string, mach_vm_deallocate, and mach_test_self
by adding missing #if HAVE_MACH in the last couple places it was missing.

Avoid needing pthread_mach_thread_np by replacing uses of the
_dispatch_thread_port() macro with _dispatch_tid_self()

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
eliminate mach_task_self from linux_stubs

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
TLS: Thread Local Storage

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
whitespace

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
…of github swift repo

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Import Swift 3 overlay from swift repo

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Define DISPATCH_UNAVAILABLE and DISPATCH_LINUX_UNAVAILABLE macros
and use them to mark dispatch_source API functions that are
not available on Linux.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Mark dispatch_source APIs that are not available on Linux as unavailable

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
…header annotation macros

switch guard for vm_deallocate to HAVE_MACH

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
A useful checkpoint along the way to a complete implementation of
the Swift3 overlay for libdispatch on non-Objective C platforms.
The overlay code builds successfully and simple example programs
using queues and timers work as expected.

The basic approach is to wrap the C libdispatch objects in Swift
objects and make the C dispatch APIs available internally via the
CDispatch module.

A few pieces (marked with FIXME) are ifdefed out to avoid compilation
problems (will get back to them in later commits) or still need to
be implemented (release on deinit).

Although the installed libdispatch can be used in Swift programs via
'import Dispatch', the swiftc command for the client program currently
needs to pass additional command line flags (to be fixed later). For example:
  swiftc -Xcc -fblocks -Xcc -D__DISPATCH_BUILDING_SWIFT_MODULE__=1 Forever.swift

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Initial Swift3 wrapping overlay for libdispatch

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Instead of using a special macro, check for __has_feature(modules) to
activate including stdio.h in dispatch.h on Linux.

Also, fix one place where OS_OBJECT_SWIFT_3 was used outside of an
OS_OBJECT_USE_OBJC block (to prepare for SWIFT_SDK_OVERLAY_DISPATCH_EPOCH
being defined by the clang importer on non-Darwin platforms).

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
…-on-linux

Use SWIFT_SDK_OVERLAY_DISPATCH_EPOCH to detect that an overlay is bei…

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
ARC support in wrapping overlay. Add deinit methods to wrapping
Swift classes that call dispatch_release on the wrapped C objects.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
release wrapped C objects when Swift object deinitialized

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
If the main thread calls pthread_exit on Linux, the process
becomes a zombie. Modify dispatch_main to avoid this by adding
a pthread_key destructor that calls dispatch_sig_thread
(effectively stalling pthread exit until the program really exits).

This patch relies on the TSD destructors being called in order of
creation, which is currently the case in glibc.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Linux: avoid zombie process when dispatch_main is called

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Update for SE-0112: ErrorProtocol has been renamed to Error

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
mwwa and others added 17 commits July 28, 2016 20:42
Sync up recent Swift overlay changes into swift-corelibs-dispatch and
get them building for Linux.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
[overlay-syncup] sync overlay changes to Linux

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Add description for building libdispatch with Swift API
either as part of building a Swift toolchain from source
using utils/build-script or using a pre-built Swift toolchain.

Update Linux-specific instructions to try to avoid some
common problems people have been reporting.

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Update INSTALL instructions

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Update libpwq for fix to race condition in libpwq's test_api
Disable dispatch_read2 due to intermittent failure
…endency

Eliminate the external dependency on libBlocksRuntime.so by
copying the blocks runtime code from swift-corelibs-foundation/closure
and building it into libdispatch.  Added a configure option to control
whether or not the blocks runtime is embedded; defaults to embedded on
Linux and not embedded on other platforms.  Since the blocks runtime is
embedded; we can take the link directive out of the module.modulemap file.

This change enables dispatch to be built and run on a system without
the libblocksruntime-dev package installed.
SR-2309: embed BlocksRuntime in libdispatch to eliminate external dep…
Added Toolchain section in INSTALL.md
@das
Copy link
Contributor Author

das commented Aug 11, 2016

@swift-ci Please test

@das
Copy link
Contributor Author

das commented Aug 15, 2016

@swift-ci Please test

@das
Copy link
Contributor Author

das commented Aug 15, 2016

@RLovelett that seems like a complaint about #139 and not this PR ? that flag was introduced there

@RLovelett
Copy link

tl;dr I did not intend to bring the nitpick up in this PR. In fact, I didn't know it even existed when I wrote my comment. 😄

@das you are right. I wrote the comment on the line of code in the change for #139 (specifically b65aa22).

GitHub pulls comments on lines of code in the comments section for a PR. Because you are pulling to a new branch that contains a commit (b65aa22) that I commented on GitHub brought the comment into this PR thread.

I certainly do not intend to have my nitpick slow-down the swift-3.0-branch.

Sorry for the trouble. 🖖

@das
Copy link
Contributor Author

das commented Aug 15, 2016

@RLovelett: no problem, thanks

@das das force-pushed the das-darwin-006-merge-swift-3.0-branch branch from 0f9bf59 to 12e8a1b Compare August 15, 2016 14:36
@das
Copy link
Contributor Author

das commented Aug 15, 2016

@swift-ci Please test

@das das merged commit 7563bdf into swift-3.0-branch Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.