summaryrefslogtreecommitdiff
path: root/include/llvm/ExecutionEngine
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-10-27 20:30:28 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-10-27 20:30:28 +0000
commitdc85724f703bddf6988b6b3f20203beab775f32b (patch)
treea936eb2947dd33c21f495fd517444bb74ab89493 /include/llvm/ExecutionEngine
parent5f75cf511bca0598d4db3b19d0f154ce5657f058 (diff)
downloadllvm-dc85724f703bddf6988b6b3f20203beab775f32b.tar.gz
llvm-dc85724f703bddf6988b6b3f20203beab775f32b.tar.bz2
llvm-dc85724f703bddf6988b6b3f20203beab775f32b.tar.xz
Change the JIT to compile eagerly by default as agreed in
http://llvm.org/PR5184, and beef up the comments to describe what both options do and the risks of lazy compilation in the presence of threads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85295 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index b5b664d5eb..04718249e8 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -88,7 +88,7 @@ public:
class ExecutionEngine {
const TargetData *TD;
ExecutionEngineState EEState;
- bool LazyCompilationDisabled;
+ bool CompilingLazily;
bool GVCompilationDisabled;
bool SymbolSearchingDisabled;
bool DlsymStubsEnabled;
@@ -319,13 +319,24 @@ public:
virtual void RegisterJITEventListener(JITEventListener *) {}
virtual void UnregisterJITEventListener(JITEventListener *) {}
- /// DisableLazyCompilation - If called, the JIT will abort if lazy compilation
- /// is ever attempted.
- void DisableLazyCompilation(bool Disabled = true) {
- LazyCompilationDisabled = Disabled;
+ /// EnableLazyCompilation - When lazy compilation is off (the default), the
+ /// JIT will eagerly compile every function reachable from the argument to
+ /// getPointerToFunction. If lazy compilation is turned on, the JIT will only
+ /// compile the one function and emit stubs to compile the rest when they're
+ /// first called. If lazy compilation is turned off again while some lazy
+ /// stubs are still around, and one of those stubs is called, the program will
+ /// abort.
+ ///
+ /// In order to safely compile lazily in a threaded program, the user must
+ /// ensure that 1) only one thread at a time can call any particular lazy
+ /// stub, and 2) any thread modifying LLVM IR must hold the JIT's lock
+ /// (ExecutionEngine::lock) or otherwise ensure that no other thread calls a
+ /// lazy stub. See http://llvm.org/PR5184 for details.
+ void EnableLazyCompilation(bool Enabled = true) {
+ CompilingLazily = Enabled;
}
- bool isLazyCompilationDisabled() const {
- return LazyCompilationDisabled;
+ bool isCompilingLazily() const {
+ return CompilingLazily;
}
/// DisableGVCompilation - If called, the JIT will abort if it's asked to