Skip to content

closure: make it build on Windows x86_64 #1440

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 1 commit into from
Feb 23, 2018
Merged

Conversation

compnerd
Copy link
Member

Windows x86_64 is a LLP64 environment. unsigned long is not size_t.
Adjust the parameter to be the correct size for the allocator. This is
compatible with the previous implementation on LP64 environments.

Prefer to use the __sync_bool_compare_and_swap over the MSVC
intrinsic which is overly strong. While in the area, remove an unused
compare and swap method.

@compnerd
Copy link
Member Author

CC: @parkera

@compnerd
Copy link
Member Author

@swift-ci please test

1 similar comment
@compnerd
Copy link
Member Author

@swift-ci please test

@parkera
Copy link
Contributor

parkera commented Feb 19, 2018

Seems reasonable. I thought we were actually depending on the swift-corelibs-libdispatch version of this file now, though.

@@ -142,7 +139,7 @@ GC support stub routines



static void *_Block_alloc_default(const unsigned long size, const bool initialCountIsOne, const bool isObject) {
static void *_Block_alloc_default(uintptr_t size, const bool initialCountIsOne, const bool isObject) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this still be size_t though? I can see using the ptr types for the CAS.

@compnerd
Copy link
Member Author

Hmm, actually, yeah, the size_t probably is better. Hmm, using the version that is in libdispatch is fine, but, we should then have a single copy of the sources. Would it be okay to remove these then?

Windows x86_64 is a LLP64 environment.  `unsigned long` is not `size_t`.
Adjust the parameter to be the correct size for the allocator.  This is
compatible with the previous implementation on LP64 environments.

Prefer to use the `__sync_bool_compare_and_swap` over the MSVC
intrinsic which is overly strong.  While in the area, remove an unused
compare and swap method.
@compnerd
Copy link
Member Author

Switched to size_t. I took a look at the build.py. Seems that if LIBDISPATCH_SOURCE_DIR is not specified, then it will fall back to this source. Is it really possible to build CoreFoundation/Foundation without libdispatch at this point (i.e. is that just dead code)?

@parkera
Copy link
Contributor

parkera commented Feb 20, 2018

@compnerd I have been wondering that myself recently as well. We did need this during bringup (dispatch was not yet ready), and I wonder if it is still useful and still working for other platforms that are in that stage.

@parkera
Copy link
Contributor

parkera commented Feb 20, 2018

Like Windows 64 bit, apparently. :)

@compnerd
Copy link
Member Author

@swift-ci please test

1 similar comment
@alblue
Copy link
Contributor

alblue commented Feb 21, 2018

@swift-ci please test

@compnerd
Copy link
Member Author

That failure is really weird, its not at all related to this change, and the crasher there doesn't even reference Foundation.

@shahmishal
Copy link
Member

@swift-ci please test

1 similar comment
@spevans
Copy link
Contributor

spevans commented Feb 21, 2018

@swift-ci please test

@compnerd
Copy link
Member Author

@spevans guess it likes you better than the rest of us :-p. @parkera good to merge? I have the mirror'ed commit in libdispatch up as well so that we don't drift apart until we can unify the codebase.

@parkera
Copy link
Contributor

parkera commented Feb 22, 2018

Yup, ok.

@compnerd compnerd merged commit f33db01 into swiftlang:master Feb 23, 2018
@compnerd compnerd deleted the closure branch February 23, 2018 01:34
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.

5 participants