Reid Kleckner
b500f07edf
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.
llvm-svn: 76828
2009-07-23 00:49:59 +00:00
Mikhail Glushenkov
1c0854b913
Add a Program::GetPid() method.
...
llvm-svn: 76341
2009-07-18 21:43:40 +00:00
Mikhail Glushenkov
583e23d726
Remove duplication in Program::Execute{And,No}Wait.
...
Implemented by moving the code out of static functions into methods of Program
class.
llvm-svn: 76340
2009-07-18 21:43:12 +00:00
Mikhail Glushenkov
d44eba5166
Trailing whitespace.
...
llvm-svn: 76229
2009-07-17 20:38:17 +00:00
Dan Gohman
69766f9ade
Add a raw_ostream operator<< to sys::Path.
...
llvm-svn: 75790
2009-07-15 16:33:33 +00:00
David Greene
87dbe0a3b5
Add an ExecuteNoWait interface to support asynchronous process spawning.
...
llvm-svn: 75055
2009-07-08 21:46:40 +00:00
Owen Anderson
75f0f1cc6c
Have scoped mutexes take referenes instead of pointers.
...
llvm-svn: 74931
2009-07-07 18:33:04 +00:00
Chris Lattner
ccaba64332
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.
llvm-svn: 74927
2009-07-07 18:17:07 +00:00
Chris Lattner
b11fca33f8
remove dead code, noone creates instances of "DynamicLibrary", so the ctor and dtor are dead.
...
llvm-svn: 74926
2009-07-07 18:01:58 +00:00
Jeffrey Yasskin
29ea777c1e
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.
llvm-svn: 74621
2009-07-01 18:11:20 +00:00
Owen Anderson
3a892a63b7
Add support for const thread locals.
...
llvm-svn: 74226
2009-06-25 23:31:18 +00:00
Owen Anderson
e716e57779
Add a class for supporting platform independent thread-local storage.
...
Windows people, please double-check/patch this.
llvm-svn: 74209
2009-06-25 21:58:01 +00:00
Owen Anderson
5bda03a404
Add atomic multiply and divide operations, built on top of CompareAndSwap.
...
llvm-svn: 74004
2009-06-23 21:19:04 +00:00
Owen Anderson
c11dfb46c1
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.
llvm-svn: 73993
2009-06-23 20:17:22 +00:00
Owen Anderson
c2d02066d0
Atomic ops that do arithmetic use signed arithmetic.
...
llvm-svn: 73980
2009-06-23 18:30:27 +00:00
Owen Anderson
1bea9b9158
Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
...
the near future.
llvm-svn: 73971
2009-06-23 18:01:04 +00:00
Owen Anderson
e0ff9fb130
Add an atomic add operation.
...
llvm-svn: 73964
2009-06-23 17:39:31 +00:00
Owen Anderson
b66d0add26
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.
llvm-svn: 73803
2009-06-20 00:27:21 +00:00
Owen Anderson
c0ba371831
Fix a major typo.
...
Nicolas, this is probably the cause of the failures you were seeing.
llvm-svn: 73770
2009-06-19 17:08:20 +00:00
Owen Anderson
5fa89d2f8d
Fix weird class-size-being-different problems. At some level this is being caused by config.h not being
...
included everywhere.
llvm-svn: 73745
2009-06-19 00:48:22 +00:00
Owen Anderson
b7742c5035
Add a SmartScopedLock, and use it to simplify code.
...
llvm-svn: 73722
2009-06-18 20:51:00 +00:00
Owen Anderson
a1d2310ac7
Simplify the SmartMutex implementation a bit.
...
llvm-svn: 73711
2009-06-18 18:29:03 +00:00
Owen Anderson
4760da0a7a
Give RWMutex the SmartRWMutex treatment too.
...
llvm-svn: 73710
2009-06-18 18:26:15 +00:00
Owen Anderson
9aaa6b8958
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.
llvm-svn: 73709
2009-06-18 17:53:17 +00:00
Owen Anderson
a59f91c08d
Move Threading.[h|cpp] from Support to System.
...
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
00e7ebbc38
Reapply r73647 in a non-broken form.
...
llvm-svn: 73662
2009-06-17 23:49:06 +00:00
Owen Anderson
0e2a78e820
Protect the GC table in Function.cpp
...
llvm-svn: 73647
2009-06-17 22:23:31 +00:00
Owen Anderson
f8776799ec
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.
llvm-svn: 73630
2009-06-17 20:34:43 +00:00
Owen Anderson
3637fc65bd
Use atomic increment/decrement for reference counting of Type's.
...
llvm-svn: 73588
2009-06-17 00:28:49 +00:00
Owen Anderson
430f18d2db
Add an atomic increment and decrement implementation, which will be used for
...
thread-safe reference counting.
llvm-svn: 73587
2009-06-17 00:13:00 +00:00
Owen Anderson
c52c99f111
Fix #include guards.
...
llvm-svn: 73548
2009-06-16 20:26:04 +00:00
Owen Anderson
48d53f2c53
Add a portable wrapper for reader-writer locks.
...
llvm-svn: 73545
2009-06-16 20:19:28 +00:00
Chris Lattner
dfaaf63aff
add a new static method to portably determine whether a patch is
...
absolute or not, based on a patch by Gregory Curfman!
llvm-svn: 73368
2009-06-15 04:17:07 +00:00
Torok Edwin
a10c3b9bc6
Fix comments.
...
llvm-svn: 72858
2009-06-04 08:18:25 +00:00
Torok Edwin
5da9f51d1e
Add support for outputting ANSI colors to raw_fd_ostream.
...
llvm-svn: 72854
2009-06-04 07:09:50 +00:00
Bill Wendling
d50f27458f
Untabify.
...
llvm-svn: 72603
2009-05-30 00:58:37 +00:00
Owen Anderson
81e8ddcfda
Use DataTypes.h instead of stdint.h.
...
llvm-svn: 72201
2009-05-21 00:48:13 +00:00
Owen Anderson
2753821fab
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.
llvm-svn: 72174
2009-05-20 18:26:15 +00:00
Owen Anderson
438c3c3660
Compile fix for MSVC.
...
llvm-svn: 72167
2009-05-20 09:34:13 +00:00
Owen Anderson
d64df37f4c
We need to include config.h here so that the #defines are set properly.
...
llvm-svn: 72148
2009-05-20 00:31:29 +00:00
Owen Anderson
e1474eebee
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.
llvm-svn: 72140
2009-05-19 22:18:56 +00:00
Owen Anderson
de192dfaee
Make using an unsupported CAS size a hard error on Windows.
...
llvm-svn: 72088
2009-05-19 01:08:36 +00:00
Owen Anderson
421e290a35
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.
llvm-svn: 72087
2009-05-19 01:07:40 +00:00
Owen Anderson
e4233e3349
Template CompareAndSwap function.
...
llvm-svn: 72086
2009-05-19 01:02:27 +00:00
Owen Anderson
4d289e72a2
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.
llvm-svn: 72077
2009-05-19 00:08:29 +00:00
Owen Anderson
a15fc9a761
Significantly improve Atomic.h by pulling in code from libatomic_ops by HP. This is a little outdated, but reasonably complete.
...
llvm-svn: 71973
2009-05-17 04:57:54 +00:00
Owen Anderson
61d036c993
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
llvm-svn: 71959
2009-05-16 21:08:25 +00:00
Anton Korobeynikov
0df5f515ff
Unbreak mingw build
...
llvm-svn: 71856
2009-05-15 11:04:52 +00:00
Owen Anderson
1f8d845588
Improve compatibility with older versions of Windows.
...
llvm-svn: 71855
2009-05-15 10:40:23 +00:00
Owen Anderson
86ba469f0a
(Hopefully) unbreak Apple-style builds.
...
llvm-svn: 71849
2009-05-15 06:49:31 +00:00
Owen Anderson
278050e948
Don't #include OSAtomic.h unless we really need it.
...
llvm-svn: 71837
2009-05-15 05:13:57 +00:00
Owen Anderson
7ded7b9a62
Now with working on Leopard!
...
llvm-svn: 71819
2009-05-15 00:01:40 +00:00
Owen Anderson
a9f74b107a
Dropped this #include by accident.
...
llvm-svn: 71798
2009-05-14 21:33:57 +00:00
Owen Anderson
88d12ab881
Add CompareAndSwap.
...
llvm-svn: 71795
2009-05-14 21:24:15 +00:00
Owen Anderson
c778e8bf21
Add an Atomic.h to the System library, for providing a platform independent API
...
to low-level sync operations.
The only one present at the moment is MemoryFence(), and only for the platforms
for which I could easily discern the proper way to do it. If your favorite platform
isn't represented, patches are welcome!
llvm-svn: 71770
2009-05-14 05:54:36 +00:00
Douglas Gregor
26745696ef
Add terminal width detection to llvm::sys::Process. This is needed to
...
fix Clang PRs 4148 and 4183.
llvm-svn: 71448
2009-05-11 18:05:52 +00:00
Daniel Dunbar
7682ffcabb
Add sys::Path::makeAbsolute().
...
llvm-svn: 68663
2009-04-09 00:33:08 +00:00
Daniel Dunbar
aec3d9857f
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.
llvm-svn: 68118
2009-03-31 17:30:15 +00:00
Chris Lattner
faf39c40d4
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.
llvm-svn: 66072
2009-03-04 21:21:36 +00:00
Dan Gohman
51d4e8db6a
Fix a bunch of Doxygen syntax issues. Escape special characters,
...
and put @file directives on their own comment line.
llvm-svn: 65920
2009-03-03 02:55:14 +00:00
Mikhail Glushenkov
ed5cc8a9cf
80-column violation.
...
llvm-svn: 64102
2009-02-08 22:48:07 +00:00
Mikhail Glushenkov
d9f64e601f
Add a Sleep() function.
...
llvm-svn: 64101
2009-02-08 22:47:39 +00:00
Dan Gohman
9296e654cf
Make Mutex's constructor explicit, and tidy up whitespace.
...
llvm-svn: 63963
2009-02-06 21:17:03 +00:00
Chris Lattner
da545d3918
rename methods in System/Host to be more consistent.
...
llvm-svn: 62776
2009-01-22 19:53:00 +00:00
Jim Grosbach
1de8b23129
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.
llvm-svn: 57846
2008-10-20 21:39:23 +00:00
Jim Grosbach
a49386d8e7
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..
llvm-svn: 57013
2008-10-03 16:17:20 +00:00
Daniel Dunbar
1fab10702e
Add llvm::sys::{osName,osVersion} for retrieving operating system name
...
& version as strings.
- Win32 code is untested.
llvm-svn: 56942
2008-10-02 01:17:28 +00:00
Evan Cheng
a0459a1c5a
Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
...
llvm-svn: 56303
2008-09-18 07:54:21 +00:00
Chris Lattner
0e03352a9f
add a helper method to sys::Path for clang, patch by
...
Kovarththanan Rajaratnam!
llvm-svn: 54655
2008-08-11 23:39:47 +00:00
Chris Lattner
24c59453f6
Add a new InvalidateInstructionCache method to sys::Memory.
...
llvm-svn: 52731
2008-06-25 17:14:10 +00:00
Chris Lattner
7fdc625548
Add support for building on solaris, working around namespace
...
polution problems from system headers. Patch by Nathan Keynes!
llvm-svn: 52682
2008-06-24 17:44:42 +00:00
Matthijs Kooijman
fedd2bd496
Add comment.
...
llvm-svn: 52313
2008-06-16 12:20:05 +00:00
Dan Gohman
3ea2dceca0
Prune and tidy #includes.
...
llvm-svn: 51697
2008-05-29 19:52:31 +00:00
Bill Wendling
7ec2aad450
Follow-up to the reverting of r51218. This puts the checks out-of-line. Because
...
they aren't in the header file, systems with a <string> header file that isn't
64-bit clean shouldn't warn if #including Path.h and specifying
-Wshorten-64-to-32.
llvm-svn: 51393
2008-05-21 21:20:07 +00:00
Bill Wendling
f4cc5ad69a
Reverting r51218 because of breakage on PPC32.
...
llvm-svn: 51358
2008-05-20 23:54:27 +00:00
Chris Lattner
0c5b5c08e1
add missing #include.
...
llvm-svn: 51227
2008-05-18 14:24:58 +00:00
Bill Wendling
568cd9c076
On Darwin, the string header file isn't 64-bit clean. The use of
...
"-Wshorten-64-to-32 -Werror" will cause a failure when compiling this complex
program:
#include <string>
class Path {
mutable std::string path;
public:
bool operator == (const Path &that) {
return path == that.path;
}
};
Using strcmp gets us past this annoying error.
llvm-svn: 51218
2008-05-17 09:10:40 +00:00
Nick Lewycky
6bc321fbdf
Make constructors target-specific. This fixes problems where the path would
...
include backslashes on Windows. This should fix llvm-ld problems on win32.
llvm-svn: 50960
2008-05-11 17:37:40 +00:00
Dan Gohman
a84b75df17
Remove uses of llvm/System/IncludeFile.h that are no longer needed.
...
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Evan Cheng
d9353009b7
Fix more -Wshorten-64-to-32 warnings.
...
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Bill Wendling
45432e8339
Add "empty()" method to sys::Path and remove unnecessary whitespace.
...
Patch by Mikhail Glushenkov!
llvm-svn: 49803
2008-04-16 18:27:02 +00:00
Ted Kremenek
be2279d470
Make getDirnameSep a static method (not part of Path's interface).
...
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek
82b7e8d306
Added method Path::getDirname().
...
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Chris Lattner
4614369b45
MappedFile is dead, remove it.
...
llvm-svn: 49035
2008-04-01 06:20:44 +00:00
Chris Lattner
2e3d2c6ec8
Stub out some sys::Path::MapInFilePages/UnMapFilePages methods.
...
llvm-svn: 49030
2008-04-01 06:00:12 +00:00
Chris Lattner
0ee9b20a1b
Make MappedFile::map return a const correct pointer, don't leak address space on Unix platforms.
...
llvm-svn: 49026
2008-04-01 03:49:38 +00:00
Chris Lattner
b29e4e90bc
Remove the MappedFile::charBase member, rename base -> getBase() and
...
make getBase() return a const-correct pointer.
llvm-svn: 49025
2008-04-01 03:40:53 +00:00
Chris Lattner
50d56e0f2b
add an accessor.
...
llvm-svn: 49023
2008-04-01 03:20:31 +00:00
Chris Lattner
f2309c208a
Remove MappedFile support for mapping files for write and exec
...
and shared. This complicates the design, is not used, and probably
doesn't even work.
llvm-svn: 49022
2008-04-01 03:10:22 +00:00
Chris Lattner
c3d03d3f10
cleanup the MappedFile API and comments. This removes and updates
...
tons of out of date comments (really nothing throws here!) and fixes
some other fairly glaring issues: "size" used to return the size of
the file *and* change it, depending on how you called it.
llvm-svn: 49009
2008-04-01 00:53:25 +00:00
Chris Lattner
a0b425c6bc
remove DEFINING_FILE_FOR for MappedFile.h
...
llvm-svn: 49008
2008-04-01 00:35:55 +00:00
Owen Anderson
e540be453a
Revert r48676. I had plans for using it, but now it's just dead code.
...
llvm-svn: 48743
2008-03-24 21:29:58 +00:00
Owen Anderson
de2d3aca1b
Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself.
...
llvm-svn: 48677
2008-03-22 02:59:54 +00:00
Owen Anderson
5654dda62c
Add an AllocateRW to match AllocateRWX.
...
llvm-svn: 48676
2008-03-22 02:33:53 +00:00
Dan Gohman
479c8ef76d
Specialize FORCE_DEFINING_FILE_TO_BE_LINKED using a GCC trick
...
to avoid using constructor calls for static objects. This reduces
the number of objects requiring static constructors in a typical
LLVM build by around 20%.
llvm-svn: 48665
2008-03-21 23:38:23 +00:00
Chris Lattner
b549d83ca6
Restore this member, which is used on win32.
...
llvm-svn: 48372
2008-03-14 21:17:54 +00:00
Devang Patel
2c38efe128
Remove unused GetAddressOfSymbol()
...
Thanks Daniel Dunbar!
llvm-svn: 48340
2008-03-13 16:55:34 +00:00
Chris Lattner
5b84600196
Stub out a Path::GetMainExecutable call to find the path to the
...
main executable of a program. This needs to be implemented on windows.
llvm-svn: 47835
2008-03-03 02:55:43 +00:00
Chris Lattner
d2a01e1994
Add path separator support, patch by Sam Bishop.
...
llvm-svn: 47662
2008-02-27 06:17:10 +00:00
Anton Korobeynikov
9f8c4b85cf
Add convenient helper to get suffix of the file
...
llvm-svn: 47397
2008-02-20 19:41:22 +00:00