Commit Graph

246 Commits

Author SHA1 Message Date
Mikhail Glushenkov
9dc87305db Add a Program::GetPid() method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 21:43:40 +00:00
Mikhail Glushenkov
3140619c63 Remove duplication in Program::Execute{And,No}Wait.
Implemented by moving the code out of static functions into methods of Program
class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 21:43:12 +00:00
Mikhail Glushenkov
234f6893a2 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 20:38:17 +00:00
Dan Gohman
6ca5f9360c Add a raw_ostream operator<< to sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 16:33:33 +00:00
David Greene
59629c1d8b Add an ExecuteNoWait interface to support asynchronous process spawning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 21:46:40 +00:00
Owen Anderson
a9d1f2c559 Have scoped mutexes take referenes instead of pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:33:04 +00:00
Chris Lattner
a9b7d60d67 Eliminate the static constructors and locks from DynamicLibrary.cpp.
This fixes PR4512 and eliminating static ctors is always good.  Losing
thread safety is unfortunate, but the code is just incredibly poorly
designed.

If someone is interested, the "right" solution is to split
DynamicLibrary.cpp into two separate pieces: a stateless piece in
libsystem, and a simple support file in libsupport that has the
"state" (e.g.  AddSymbol) in managed static objects.

Doing this would both fix memory leaks we already have, as well as make
the code thread safe again.  it would also make sense to move all the
unix specific code in System/DynamicLibrary.cpp into 
System/Unix/DynamicLibrary.inc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:17:07 +00:00
Chris Lattner
72501b4a21 remove dead code, noone creates instances of "DynamicLibrary", so the ctor and dtor are dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:01:58 +00:00
Jeffrey Yasskin
ed1c0ffe0b Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes the
Windows variant, strerror_s, but I couldn't test that.

I'll update configure and config.h.in in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 18:11:20 +00:00
Owen Anderson
438d3946af Add support for const thread locals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:31:18 +00:00
Owen Anderson
4a28522c1a Add a class for supporting platform independent thread-local storage.
Windows people, please double-check/patch this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:58:01 +00:00
Owen Anderson
e0fa0b42b2 Add atomic multiply and divide operations, built on top of CompareAndSwap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 21:19:04 +00:00
Owen Anderson
6f2c64d70a Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:17:22 +00:00
Owen Anderson
f43f9d0ef8 Atomic ops that do arithmetic use signed arithmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:30:27 +00:00
Owen Anderson
0de9953e88 Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:01:04 +00:00
Owen Anderson
5a9c0eeaf2 Add an atomic add operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 17:39:31 +00:00
Owen Anderson
cc40f077b0 Add debugging code to test for various locking faux-pas's, when running in single threaded mode. This should help improve testing coverage for
threading support, without having extensive actually concurrent clients yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:27:21 +00:00
Owen Anderson
1b19a50cdb Fix a major typo.
Nicolas, this is probably the cause of the failures you were seeing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 17:08:20 +00:00
Owen Anderson
4f10c3b4dc Fix weird class-size-being-different problems. At some level this is being caused by config.h not being
included everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 00:48:22 +00:00
Owen Anderson
3c8031df6d Add a SmartScopedLock, and use it to simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:51:00 +00:00
Owen Anderson
f0eeb9b7f5 Simplify the SmartMutex implementation a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:29:03 +00:00
Owen Anderson
b65e9ed106 Give RWMutex the SmartRWMutex treatment too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:26:15 +00:00
Owen Anderson
b849a4dd4b Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
should become a no-op when not running in multithreaded mode.  Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 17:53:17 +00:00
Owen Anderson
e3cd5ca7e7 Move Threading.[h|cpp] from Support to System.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:54:52 +00:00
Owen Anderson
bf5ec1b9db Reapply r73647 in a non-broken form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:49:06 +00:00
Owen Anderson
b983d67465 Protect the GC table in Function.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:23:31 +00:00
Owen Anderson
dd561e1539 Add an RAII ScopedWriter, which allows one to acquire a writer lock for the duration of a scope. Simplify a lot of uses of
writer locks in Constants.cpp by using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:34:43 +00:00
Owen Anderson
efdbfc4cef Use atomic increment/decrement for reference counting of Type's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:28:49 +00:00
Owen Anderson
9a3df671ab Add an atomic increment and decrement implementation, which will be used for
thread-safe reference counting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:13:00 +00:00
Owen Anderson
82995a83e1 Fix #include guards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:26:04 +00:00
Owen Anderson
2a8cf9aadd Add a portable wrapper for reader-writer locks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:19:28 +00:00
Chris Lattner
88d7e403d0 add a new static method to portably determine whether a patch is
absolute or not, based on a patch by Gregory Curfman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:17:07 +00:00
Torok Edwin
6c8db34165 Fix comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 08:18:25 +00:00
Torok Edwin
e8ebb0fe1b Add support for outputting ANSI colors to raw_fd_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 07:09:50 +00:00
Bill Wendling
4d4eab219a Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 00:58:37 +00:00
Owen Anderson
c4551d3d21 Use DataTypes.h instead of stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 00:48:13 +00:00
Owen Anderson
3c1eaa0dc2 Move atomic operations' definitions out of line. While this seems kind of silly,
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 18:26:15 +00:00
Owen Anderson
9b2818d207 Compile fix for MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 09:34:13 +00:00
Owen Anderson
81e4e9f7cb We need to include config.h here so that the #defines are set properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 00:31:29 +00:00
Owen Anderson
a86037084d Split the ENABLE_THREADS #define in two. Now ENABLE_THREADS indicates the ability to run multiple threads at once in the JIT, and requires only
mutex support.  LLVM_MULTITHREADED indicates (or will indicate) the ability to run LLVM itself across multiple threads, and requires atomics support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 22:18:56 +00:00
Owen Anderson
84e5cac70a Make using an unsupported CAS size a hard error on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:08:36 +00:00
Owen Anderson
ecb1684d51 Fix up the Windows portion of Atomic.h. This is untested, but it is my best understanding of what should work.
I'd be much obliged if someone on MSVC++ could try this out and let me know if it works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:07:40 +00:00
Owen Anderson
03462230c7 Template CompareAndSwap function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:02:27 +00:00
Owen Anderson
71417827e8 Now that we have atomics support properly detected by configure,
use it to implement Atomic.h.

This expunges the code previously imported from libatomic_ops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 00:08:29 +00:00
Owen Anderson
6962815683 Significantly improve Atomic.h by pulling in code from libatomic_ops by HP. This is a little outdated, but reasonably complete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 04:57:54 +00:00
Owen Anderson
de52f865b6 Remove the volatile marker from the cas_flag typedef, fixing some warnings.
It's now the client's resposibility to add it in when needed


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 21:08:25 +00:00
Anton Korobeynikov
b2e82d07a7 Unbreak mingw build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 11:04:52 +00:00
Owen Anderson
2c34f320ea Improve compatibility with older versions of Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 10:40:23 +00:00
Owen Anderson
8064c8b86d (Hopefully) unbreak Apple-style builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 06:49:31 +00:00
Owen Anderson
8060424c40 Don't #include OSAtomic.h unless we really need it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 05:13:57 +00:00