Skip to content

Use an extra shims header to remove _silgen_name from Dispatch. #5854

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

Conversation

jrose-apple
Copy link
Contributor

Follow-up to #5309 for Dispatch.

We still have a bunch of redeclarations of Dispatch functions to avoid the automatic bridging of dispatch_data_t and dispatch_block_t, but mostly this is a vast reduction in complexity (and increase in safety).

I think there are still bugs, so I'm not going to call any of the Dispatch folks to review just yet.

After this gets merged, we'll only be using _silgen_name outside the core stdlib in Foundation and "Platform" (Darwin or Glibc), plus a number of things that don't actually get shipped (benchmarks and StdlibUnittest).

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - e79cafe02d14cc4ed80a3726ed625839e3e5004e
Test requested by - @jrose-apple

@jrose-apple jrose-apple force-pushed the excise-silgen_name-from-Dispatch branch from e79cafe to df4fbef Compare November 18, 2016 23:38
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test macOS

@jrose-apple
Copy link
Contributor Author

@swift-ci Please ASan test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - e79cafe02d14cc4ed80a3726ed625839e3e5004e
Test requested by - @jrose-apple

@jrose-apple
Copy link
Contributor Author

Filed rdar://problem/29340689 for the odd compiler-rt failure.

@swift-ci Please test macOS

@jrose-apple
Copy link
Contributor Author

ASan test happening here.

@jrose-apple jrose-apple force-pushed the excise-silgen_name-from-Dispatch branch from df4fbef to 0d11c1e Compare December 1, 2016 01:33
@jrose-apple jrose-apple changed the title [WIP] Use an extra shims header to remove _silgen_name from Dispatch. Use an extra shims header to remove _silgen_name from Dispatch. Dec 1, 2016
@jrose-apple
Copy link
Contributor Author

Ready for review! @mwwa, @das?

@swift-ci Please test macOS
@swift-ci Please smoke test Linux

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test macOS

@das
Copy link

das commented Dec 1, 2016

do we need an equivalent change to swift-corelibs-libdispatch for the Linux overlay ? I see _silgen_name in src/swift/ files

return _dispatch_data_destructor_munmap;
}

#define SWIFT_DISPATCH_SOURCE(t) \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SWIFT_DISPATCH_SOURCE_TYPE ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good call, will change.

__swift_shims_dispatch_block_t block) {
dispatch_barrier_async(queue, block);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more a question for @mwwa : why don't we have _swift_dispatch_barrier_sync here (i.e. why can _syncBarrier use __dispatch_barrier_sync ) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a sync<T> call that takes a DispatchWorkItem. The reason we have to have these shims is to preserve the identity of DispatchWorkItem/dispatch_block_t such that the runtime doesn't wrap them in thunk closures. The barrier case in sync<T> is only ever fed closures anyway, so we don't need a shim here.

@das
Copy link

das commented Dec 1, 2016

lgtm but @mwwa should have a look too since he is the one that originally wrote this code

@jrose-apple
Copy link
Contributor Author

I forgot that the Linux overlay would have _silgen_name in it too. I don't think anything there will break, but if they depend on DispatchShims.mm they might. Let's find out.

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 1, 2016

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - e79cafe02d14cc4ed80a3726ed625839e3e5004e
Test requested by - @jrose-apple

@mwwa
Copy link
Contributor

mwwa commented Dec 1, 2016

Same, LGTM.

@jrose-apple
Copy link
Contributor Author

All tests passed, so I'll update the name for SWIFT_DISPATCH_SOURCE_TYPE, commit, and then do swift-corelibs-dispatch separately.

We still have a bunch of redeclarations of Dispatch functions to avoid
the automatic bridging of dispatch_data_t and dispatch_block_t, but
mostly this is a vast reduction in complexity (and increase in safety).
...so we can see it in failure logs.
@jrose-apple jrose-apple force-pushed the excise-silgen_name-from-Dispatch branch from 0d11c1e to 1c68744 Compare December 2, 2016 00:06
@jrose-apple
Copy link
Contributor Author

Full tests passed already, so just running smoke tests this time.

@swift-ci Please smoke test

@jrose-apple jrose-apple merged commit e54ec3d into swiftlang:master Dec 2, 2016
@jrose-apple jrose-apple deleted the excise-silgen_name-from-Dispatch branch December 2, 2016 17:20
@jrose-apple jrose-apple requested review from ktopley-apple and removed request for ktopley-apple February 8, 2018 16:43
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.

4 participants