Commit Graph

18 Commits

Author SHA1 Message Date
Saleem Abdulrasool
59e465d337 Threading: add a linker directive for Windows autolinking
This library is pulled into the standard library. Add autolinking
directives to enable the use of the library with static linking without
specifying the system dependencies. This is required to enable the user
to use `-static-stdlib` without having to specify all dependencies.
2025-01-17 09:25:11 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Saleem Abdulrasool
1db88858b2 Threading: repair the 32-bit Windows builds
This repairs the Windows x86 SDK build after #59287.  Use `intptr_t`
rather than the explicitly sized integer as this is always guaranteed to
be the size of the pointer width (irrespective of LP64/LP32 or
LLP64/LLP32).  Since this impacts only the once predicate, this
shouldn't impact any assumptions around structure sizes.
2022-06-18 09:36:27 -07:00
Alastair Houghton
c401cc34fd [Threading] Use llvm::Optional<> rather than making a zero lower bound special.
While most systems aren't going to have their stack bottom at zero,
using llvm::Optional<> here is cleaner.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
dc809f8723 [Threading] A few include tweaks.
The threading implementations need to include Impl.h, not just their
specific variant, to pick up the `stack_bounds` type.

Also fix a newly exposed problem with Atomic.h.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
b5c8b79556 [Threading] Move stack bounds fetching into the threading library.
Fetching the current stack bounds is done using threading functions, so
should be in the threading library.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
0e9318cec5 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
f3a412dd53 [Threading] Remove thread_get_main().
Removing thread_get_main() means we don't need a static initializer on
Darwin, which means we can delete Darwin.cpp as well.  We can also delete
Nothreads.cpp while we're about it, because there's nothing in that file.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
66f6eb6bc6 [Runtime][Windows] A couple of files need to include <windows.h>
We shouldn't include <windows.h> implicitly from .cpp files, but should
do it directly so that we know it's there.

Also, if we're including <windows.h>, do it at the top of the file.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alastair Houghton
f5bdb858e0 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
43cc1f97ba [Threading] Use llvm::Optional<> rather than making a zero lower bound special.
While most systems aren't going to have their stack bottom at zero,
using llvm::Optional<> here is cleaner.

rdar://90776105
2022-05-24 17:46:33 +01:00
Alastair Houghton
1c6618eca7 [Threading] A few include tweaks.
The threading implementations need to include Impl.h, not just their
specific variant, to pick up the `stack_bounds` type.

Also fix a newly exposed problem with Atomic.h.

rdar://90776105
2022-05-24 14:57:42 +01:00
Alastair Houghton
fc4f941185 [Threading] Move stack bounds fetching into the threading library.
Fetching the current stack bounds is done using threading functions, so
should be in the threading library.

rdar://90776105
2022-05-24 14:57:42 +01:00
Alastair Houghton
b5bd267ff1 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-05-24 14:57:41 +01:00
Alastair Houghton
6e875dacc9 [Threading] Remove thread_get_main().
Removing thread_get_main() means we don't need a static initializer on
Darwin, which means we can delete Darwin.cpp as well.  We can also delete
Nothreads.cpp while we're about it, because there's nothing in that file.

rdar://90776105
2022-05-24 14:57:41 +01:00
Alastair Houghton
79e2d0d37d [Runtime][Windows] A couple of files need to include <windows.h>
We shouldn't include <windows.h> implicitly from .cpp files, but should
do it directly so that we know it's there.

Also, if we're including <windows.h>, do it at the top of the file.

rdar://90776105
2022-05-24 14:57:40 +01:00
Alastair Houghton
63a09007a1 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-05-24 14:57:39 +01:00