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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Sep 18 23:05:58 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.103 -> 1.104
---
Log message:

Fix type for member functions.


---
Diffs of the changes:  (+8 -3)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.103 llvm-java/lib/Compiler/Compiler.cpp:1.104
--- llvm-java/lib/Compiler/Compiler.cpp:1.103	Wed Sep 15 19:09:36 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Sun Sep 19 01:05:48 2004
@@ -343,6 +343,8 @@
 
       const Methods& methods = cf->getMethods();
 
+      const ClassInfo& ci = getClassInfo(cf);
+
       // add member functions to the vtable
       for (unsigned i = 0, e = methods.size(); i != e; ++i) {
         Method* method = methods[i];
@@ -355,7 +357,7 @@
 
           std::string funcName = "java/lang/Object/" + methodDescr;
           const FunctionType* funcTy = cast<FunctionType>(
-            getType(method->getDescriptor(), getClassInfo(cf).type));
+            getType(method->getDescriptor(), ci.type));
 
           Function* vfun = module_->getOrInsertFunction(funcName, funcTy);
           toCompileFunctions_.insert(vfun);
@@ -723,14 +725,17 @@
     Function* compileMethodOnly(const std::string& classMethodDesc) {
       Method* method;
       tie(cf_, method) = findClassAndMethod(classMethodDesc);
+      const ClassInfo& ci = getClassInfo(cf_);
 
       std::string name = cf_->getThisClass()->getName()->str();
       name += '/';
       name += method->getName()->str();
       name += method->getDescriptor()->str();
 
-      Function* function = module_->getOrInsertFunction
-        (name, cast<FunctionType>(getType(method->getDescriptor())));
+      FunctionType* funcTy = cast<FunctionType>(
+        getType(method->getDescriptor(), method->isStatic() ? NULL : ci.type));
+
+      Function* function = module_->getOrInsertFunction(name, funcTy);
       function->setLinkage(method->isPrivate() ?
                            Function::InternalLinkage :
                            Function::ExternalLinkage);






More information about the llvm-commits mailing list