Commit Graph

251 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Dan Gohman
070c42f311 glibc has two versions of strerror_r, a standards compliant one and a GNU
specific one. The GNU one is chosen when _GNU_SOURCE is defined. g++ always
defines _GNU_SOURCE on linux platforms because glibc's headers won't compile
in C++ mode without it. The GNU strerror_r doesn't always modify the buffer
which causes empty error messages on linux.

This patch changes MakeErrMsg to use the return value of strerror_r to get
the string instead of assuming the buffer will be modified, on GLIBC.

Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 18:05:46 +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
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
51b16f4737 Untabification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72604 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 01:09:53 +00:00
Jay Foad
a14be3b264 Work around a page size issue on Cygwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 17:57:59 +00:00
Douglas Gregor
071d73d67e termios.h contains the winsize structure we need to determine the
width of a terminal. Don't try to get the width of a terminal if we
don't have this header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 17:21:34 +00:00
Douglas Gregor
01746745f1 Add terminal width detection to llvm::sys::Process. This is needed to
fix Clang PRs 4148 and 4183.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:05:52 +00:00
Daniel Dunbar
a7f2a9e69f Make Unix.h:MakeErrMsg separate the prefix and errno string, so we get:
clang: error: unable to make temporary file: /etc/cc: can't make
  unique filename: Permission denied

instead of 

  clang: error: unable to make temporary file: /etc/cc: can't make
  unique filenamePermission denied

for example.

Also, audited the uses of MakeErrMsg to make the prefix strings
consistent (not end with newline/punctuation/space/": ").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69626 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 20:50:13 +00:00
Chris Lattner
b7253150ab fix PR3965:SIGINT handler not restored after calling ParseAST(),
patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:33:13 +00:00
Daniel Dunbar
be46c79501 Add llvm::sys::getHostTriple and remove
llvm::sys::getOS{Name,Version}.

Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 17:30:15 +00:00
Chris Lattner
a8bd27ff66 fix a bug Alexei Svitkine pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 06:46:20 +00:00
Chris Lattner
eab5cb3b55 When we restore signal handlers, restore them back to what they
were when we came around, not to their default handler.  This 
should fix PR3848


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:55:36 +00:00
Chris Lattner
1c4d8a00ab factorize signal registration, part of PR3848.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:42:29 +00:00
Chris Lattner
f48ba7b74c add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 19:13:45 +00:00
Chris Lattner
922a881f32 When a crash signal is delivered do two things: remove all of our
signal handlers to prevent reentrance on unrelated things (a sigabort
where the handle bus errors) also, clear the signal mask so that the
signal doesn't infinitely reissue.  This fixes rdar://6654827 -
Crash causes clang to loop



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 08:15:47 +00:00
Chris Lattner
0f6290d698 move some code to gracefully handle the case when a handler crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:22:14 +00:00
Chris Lattner
35033a5876 Add a new 'AddSignalHandler' function to Signals.h that allows
arbitrary functions to be run when a crash happens.  Delete 
RemoveDirectoryOnSignal as it is dead and has never had clients.

Change PrintStackTraceOnErrorSignal to be implemented in terms of
AddSignalHandler.

I updated the Win32 versions of these APIs, but can't test them.
If there are any problems, I'd be happy to fix them as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:21:36 +00:00
Chris Lattner
893a0f9f0e Fix main executable path name resolution on FreeBSD, patch by
Ed Schouten!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 22:17:15 +00:00
Chris Lattner
d18a2c1eae If an executable is run through a symlink, dladdr will return the
symlink.  We really want the ultimate executable being run, not
the symlink.  This lets clang find its headers when invoked through
a symlink. rdar://6602012


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 05:34:35 +00:00
Mikhail Glushenkov
8eada627d5 Fix warning on gcc 4.3.
"system() declared with attribute warn_unused_result."

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 03:20:32 +00:00
Mikhail Glushenkov
b8863a16ad Whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64573 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 03:20:03 +00:00
Dan Gohman
d4e1845849 Use const, to support platforms where strrchr returns a const char *.
This fixes PR3535.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 17:56:28 +00:00
Mikhail Glushenkov
ba041f45fe Add a Sleep() function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 22:47:39 +00:00
Mikhail Glushenkov
0cdadd8b9d Add Emacs hints to Alarm.inc.
Also removes some trailing whitespace and fixes one 80-column violation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 21:10:57 +00:00
Chris Lattner
b67c958342 rename methods in System/Host to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 19:53:00 +00:00
Dan Gohman
dd17b25611 Don't use plain %x to print pointer values. I had changed it from %p
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 23:39:24 +00:00
Dan Gohman
56d9b6dff3 Demangle and pretty-print symbols in internal backtraces. Patch by
Wesley Peck, with a few fixes by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 20:12:48 +00:00
Jim Grosbach
932a32d251 Update the stub and callback code to handle lazy compilation. The stub
is re-written by the callback to branch directly to the compiled code
in future invocations.

Added back in range-based memory permission functions for the updating of
the stub on Darwin.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 21:39:23 +00:00
Jim Grosbach
cce6c297c5 On Darwin ARM, memory needs special handling to do JIT. This patch expands
this handling to work properly for modifying stub functions, relocations
back to entry points after JIT compilation, etc..


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 16:17:20 +00:00
Daniel Dunbar
bb14672097 Add llvm::sys::{osName,osVersion} for retrieving operating system name
& version as strings.
 - Win32 code is untested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 01:17:28 +00:00
Evan Cheng
bc4707a255 Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 07:54:21 +00:00
Evan Cheng
19a341acb8 AllocateRWXMemory -> AllocateRWX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 17:28:18 +00:00
Chris Lattner
0eab5e2efa add a helper method to sys::Path for clang, patch by
Kovarththanan Rajaratnam!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 23:39:47 +00:00
Devang Patel
bdfa9ac445 Create temp. file in current path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 00:35:38 +00:00
Devang Patel
ce8fdf105c While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:02:39 +00:00
Seo Sanghyeon
fd6437f4f9 Fix GetMainExecutable. Patch by Sam Bishop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52847 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 22:55:30 +00:00