Commit Graph

570 Commits

Author SHA1 Message Date
Dan Gohman
7b3544ba97 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 20:16:55 +00:00
Dan Gohman
88abb89183 Update a comment to reflect the current code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 17:32:39 +00:00
Dan Gohman
2cd498be60 Remove needless uses of std::flush in the parent process after a
fork call. This eliminates a need for <iostream>. Also remove
needless fsync calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 00:17:00 +00:00
Dan Gohman
339685269f Use _exit rather than exit in the child process after a failed exec.
Add a comment explaining why.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 00:09:12 +00:00
Dan Gohman
f363bc8326 Follow Unix behavior and return 127 if the command is not found,
and 126 if it is not executable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 23:15:49 +00:00
Daniel Dunbar
6db0a8b4fd When exec() fails, return 127 instead of errno; the parent process has no way to
distinguish that the result is errno, so it can't use it to provide more
information about the error (it also exposes the numeric value of errno).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 20:32:25 +00:00
Daniel Dunbar
defc85327a Fix a race condition in getting the process exit code on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 05:02:46 +00:00
Daniel Dunbar
9a0b574ba4 Empty arguments need to be quoted on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 20:41:09 +00:00
Chris Lattner
afebf3548b eXtensible Systems doesn't exist any more and Reid donated this to the
project under the normal license, yay. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 22:54:17 +00:00
Dan Gohman
28daa10246 Remove another F_OK.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 00:02:58 +00:00
Dan Gohman
a87861e4f8 On "Unix", if Program::FindProgramByName is given a name containing
slashes, just go with it, regardless of whether it looks like it will
be executable. This follows the behavior of sh(1) more closely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 23:25:18 +00:00
Dan Gohman
73c74ead21 It isn't necessary to use F_OK when using R_OK or similar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77392 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 23:22:01 +00:00
Benjamin Kramer
b0facb18df Fix a fixme; don't take binaries from the working directory.
This fixes clang on non-darwin platforms if a file called 'ld' or 'as'
is in the working directory. Based on patch by Pawel Worach!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 22:08:15 +00:00
Douglas Gregor
e34887d5d0 CMake: make sure that the *.inc files for libSystem show up in the resulting
project.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 17:55:55 +00:00
Daniel Dunbar
2749b3e745 Don't use llvm_report_error in libSystem, this is a layering violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 21:16:42 +00:00
Reid Kleckner
10b4fc552f Re-committing r76828 with the JIT memory manager changes now that the build
bots like the BumpPtrAllocator changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 21:46:56 +00:00
Reid Kleckner
4bf370698a Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:40:54 +00:00
Reid Kleckner
81ce3ed08c Make the JIT code emitter properly retry and ask for more memory when it runs
out of memory, and also make the default memory manager allocate more memory
when it runs out.

Also, switch function stubs and global data over to using the BumpPtrAllocator.

This makes it so the JIT no longer mmaps (or the equivalent on Windows) 16 MB
of memory, and instead allocates in 512K slabs.  I suspect this size could go
lower, especially on embedded platforms, now that more slabs can be allocated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 00:49:59 +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
Ted Kremenek
1935629829 Lexically order files in CMakeLists.txt files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 21:08:16 +00:00
Daniel Dunbar
cae9a3f51d Use llvm_report_error, not llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 21:01:49 +00:00
Daniel Dunbar
a00e85c9b1 Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!

 - Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75424 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 20:23:56 +00:00
Chris Lattner
0f55014430 "UNIX paths can contain non-ASCII characters, so Path::isValid() should not reject paths with such characters in them. The attached patch removes the check from Path::isValid()."
patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 19:01:16 +00:00
Chris Lattner
ac356602f2 eraseFromDisk no longer throws.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 16:17:28 +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
Chris Lattner
8b8d31e3ec remove two methods that no longer exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:07:39 +00:00
Chris Lattner
01d9a1b78d more getting windows to build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 00:52:12 +00:00
Chris Lattner
8e5a084d47 hopefully fix the build on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 00:29:32 +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
Chris Lattner
0875c7ccf5 we don't use libtool anymore, update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:50:11 +00:00
Owen Anderson
643dda1d62 No need to double-include config.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:24:37 +00:00
Owen Anderson
3d7622d0f5 We need to include config.h to get the proper setting to LLVM_MULTITHREADED.
Patch by Xerxes Ranby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 18:50:47 +00:00
Chris Lattner
c880815c40 improve portability to windows, patch by Xerces Ranby!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 17:24:48 +00:00
Jeffrey Yasskin
4733e747d1 Oops, I #included errno.h from inside the llvm::sys namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 16:50:27 +00:00
Duncan Sands
9170d592ee Fix windows build, patch by Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 12:09:50 +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
4127ccdb8d Try again at making this work on OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:19:23 +00:00
Owen Anderson
91aef8ba97 Fix the build on OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:53:29 +00:00
Oscar Fuentes
2b1a6e7581 Fixed assert that checks return value of TlsSetValue.
See http://msdn.microsoft.com/en-us/library/ms686818(VS.85).aspx

Patch by Olaf Krzikalla!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 14:12:28 +00:00
Owen Anderson
02b97355aa Fix compilation without pthreads.
Patch by Xerxes Ranby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 08:48:03 +00:00
Daniel Dunbar
6f8f6066fd Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:34:35 +00:00
Owen Anderson
1c7a848e54 Fix error in the Win32 implementation pointed out by Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:51: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
7e026b74dd Fix typo in assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:28:28 +00:00
Owen Anderson
27fcfe1364 Add a configure test for pthread_getspecific, and use it when building ThreadLocal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:10:26 +00:00
Owen Anderson
3c99d29b60 Update cmake build files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:58:34 +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
f37feb954f Guard dynamic library loading.
I did my best at implementing this for Win32, but I don't have a way to test it.
Can someone with access to a Win32 machine test/fix this?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:12:44 +00:00