aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-10-16 21:18:05 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-10-16 21:18:05 +0000
commit19684164a7b695b9dc22d879675e8d2b286ef7e5 (patch)
tree08fa79d4ba0ea5a15e27c33d6a2ff2baced49dd4 /lib/ExecutionEngine
parent7034adbce2fc7e761d745dbf586167380a69ee1a (diff)
downloadexternal_llvm-19684164a7b695b9dc22d879675e8d2b286ef7e5.zip
external_llvm-19684164a7b695b9dc22d879675e8d2b286ef7e5.tar.gz
external_llvm-19684164a7b695b9dc22d879675e8d2b286ef7e5.tar.bz2
* Reorder includes as per the style guide
* Move the constructors from .h file here * Document ExecutionEngine::create() * Catch exception possibly thrown by ModuleProvider::releaseModule() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 35a735d..ceeb857 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -6,12 +6,13 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "jit"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "JIT/VM.h"
#include "Interpreter/Interpreter.h"
-#include "llvm/DerivedTypes.h"
+#include "JIT/VM.h"
#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
+#include "llvm/ModuleProvider.h"
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Target/TargetData.h"
#include "Support/Debug.h"
@@ -21,11 +22,22 @@
Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized");
+ExecutionEngine::ExecutionEngine(ModuleProvider *P) :
+ CurMod(*P->getModule()), MP(P) {
+ assert(P && "ModuleProvider is null?");
+}
+
+ExecutionEngine::ExecutionEngine(Module *M) : CurMod(*M), MP(0) {
+ assert(M && "Module is null?");
+}
+
ExecutionEngine::~ExecutionEngine() {
delete MP;
}
-/// FIXME: document
+/// If possible, create a JIT, unless the caller specifically requests an
+/// Interpreter or there's an error. If even an Interpreter cannot be created,
+/// NULL is returned.
///
ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
bool ForceInterpreter,
@@ -37,8 +49,12 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
EE = VM::create(MP);
// If we can't make a JIT, make an interpreter instead.
- if (EE == 0)
- EE = Interpreter::create(MP->releaseModule(), TraceMode);
+ try {
+ if (EE == 0)
+ EE = Interpreter::create(MP->releaseModule(), TraceMode);
+ } catch (...) {
+ EE = 0;
+ }
return EE;
}