[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Jul 24 14:05:09 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.64 -> 1.65

---
Log message:

Initialize the module_ in the compileMethod() function which is the
only entry point to the compiler.


---
Diffs of the changes:  (+5 -6)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.64 llvm-java/lib/Compiler/Compiler.cpp:1.65
--- llvm-java/lib/Compiler/Compiler.cpp:1.64	Sat Jul 24 15:48:54 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Sat Jul 24 16:04:59 2004
@@ -271,11 +271,9 @@
             return locals_[index];
         }
 
-        Function* compileMethodOnly(Module& module,
-                               const std::string& classMethodDesc) {
+        Function* compileMethodOnly(const std::string& classMethodDesc) {
             DEBUG(std::cerr << "Compiling method: " << classMethodDesc << '\n');
 
-            module_ = &module;
             Method* method;
             tie(cf_, method) = findClassAndMethod(classMethodDesc);
 
@@ -284,7 +282,7 @@
             name += method->getName()->str();
             name += method->getDescriptor()->str();
 
-            Function* function = module.getOrInsertFunction
+            Function* function = module_->getOrInsertFunction
                 (name, cast<FunctionType>(getType(method->getDescriptor())));
             function->setLinkage(method->isPrivate() ?
                                  Function::InternalLinkage :
@@ -337,13 +335,14 @@
     public:
         Function* compileMethod(Module& module,
                                 const std::string& classMethodDesc) {
+            module_ = &module;
             c2tMap_.insert(std::make_pair("java/lang/Object",
                                           OpaqueType::get()));
             module.addTypeName("java/lang/Object", c2tMap_["java/lang/Object"]);
-            Function* function = compileMethodOnly(module, classMethodDesc);
+            Function* function = compileMethodOnly(classMethodDesc);
             for (unsigned i = 0; i != toCompileFunctions_.size(); ++i) {
                 Function* f = toCompileFunctions_[i];
-                compileMethodOnly(module, f->getName());
+                compileMethodOnly(f->getName());
             }
 
             return function;





More information about the llvm-commits mailing list