[vmkit-commits] [vmkit] r84999 - /vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat Oct 24 04:42:09 PDT 2009


Author: geoffray
Date: Sat Oct 24 06:42:08 2009
New Revision: 84999

URL: http://llvm.org/viewvc/llvm-project?rev=84999&view=rev
Log:
If a declaration of a function already exists, use it.


Modified:
    vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp

Modified: vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp?rev=84999&r1=84998&r2=84999&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp Sat Oct 24 06:42:08 2009
@@ -159,9 +159,16 @@
         memcpy(buf, "JnJVM", 5);
       }
 
-      methodFunction = Function::Create(getFunctionType(), 
-                                        GlobalValue::GhostLinkage, buf,
-                                        Mod->getLLVMModule());
+      methodFunction = Mod->getLLVMModule()->getFunction(buf);
+      if (!methodFunction) {
+        methodFunction = Function::Create(getFunctionType(), 
+                                          GlobalValue::GhostLinkage, buf,
+                                          Mod->getLLVMModule());
+      } else {
+        if (methodFunction->isDeclaration()) {
+          methodFunction->setLinkage(GlobalValue::GhostLinkage);
+        }
+      }
 
     } else {
 





More information about the vmkit-commits mailing list