No longer run atExit functions from run()
[oota-llvm.git] / lib / ExecutionEngine / JIT / Intercept.cpp
index 191b57d22a052909bf093aeac6f9f3b489294a72..0b1b976836b5a2b43c17b567e048ea2cfda1c59e 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "VM.h"
+#include "JIT.h"
 #include "Support/DynamicLinker.h"
 #include <iostream>
-
-namespace llvm {
+using namespace llvm;
 
 // AtExitHandlers - List of functions to call when the program exits,
 // registered with the atexit() library function.
@@ -29,7 +28,7 @@ static std::vector<void (*)()> AtExitHandlers;
 /// calls to atexit(3), which we intercept and store in
 /// AtExitHandlers.
 ///
-void VM::runAtExitHandlers() {
+static void runAtExitHandlers() {
   while (!AtExitHandlers.empty()) {
     void (*Fn)() = AtExitHandlers.back();
     AtExitHandlers.pop_back();
@@ -46,7 +45,7 @@ static void NoopFn() {}
 
 // jit_exit - Used to intercept the "exit" library call.
 static void jit_exit(int Status) {
-  VM::runAtExitHandlers();   // Run atexit handlers...
+  runAtExitHandlers();   // Run atexit handlers...
   exit(Status);
 }
 
@@ -62,7 +61,7 @@ static int jit_atexit(void (*Fn)(void)) {
 /// function by using the dynamic loader interface.  As such it is only useful 
 /// for resolving library symbols, not code generated symbols.
 ///
-void *VM::getPointerToNamedFunction(const std::string &Name) {
+void *JIT::getPointerToNamedFunction(const std::string &Name) {
   // Check to see if this is one of the functions we want to intercept...
   if (Name == "exit") return (void*)&jit_exit;
   if (Name == "atexit") return (void*)&jit_atexit;
@@ -77,5 +76,3 @@ void *VM::getPointerToNamedFunction(const std::string &Name) {
   
   return Ptr;
 }
-
-} // End llvm namespace