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

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue Feb 15 17:27:36 PST 2005



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.220 -> 1.221
---
Log message:

Do not add private methods to emitted vtables as these are statically
bound.


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

 Compiler.cpp |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)


Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.220 llvm-java/lib/Compiler/Compiler.cpp:1.221
--- llvm-java/lib/Compiler/Compiler.cpp:1.220	Sat Feb 12 14:17:48 2005
+++ llvm-java/lib/Compiler/Compiler.cpp	Tue Feb 15 19:27:25 2005
@@ -411,9 +411,11 @@
       // Add member functions to the vtable.
       for (unsigned i = 0, e = methods.size(); i != e; ++i) {
         Method* method = methods[i];
-        // The contructor is the only non-static method that is not
-        // dynamically dispatched so we skip it.
-        if (!method->isStatic() && method->getName()->str()[0] != '<') {
+        // Static methods, private instance methods and the contructor
+        // are statically bound so we don't add them to the vtable.
+        if (!method->isStatic() &&
+            !method->isPrivate() &&
+            method->getName()->str()[0] != '<') {
           std::string methodDescr =
             method->getName()->str() +
             method->getDescriptor()->str();
@@ -838,9 +840,11 @@
 
       for (unsigned i = 0, e = methods.size(); i != e; ++i) {
         Method* method = methods[i];
-        // The contructor is the only non-static method that is not
-        // dynamically dispatched so we skip it.
-        if (!method->isStatic() && method->getName()->str()[0] != '<') {
+        // Static methods, private instance methods and the contructor
+        // are statically bound so we don't add them to the vtable.
+        if (!method->isStatic() &&
+            !method->isPrivate() &&
+            method->getName()->str()[0] != '<') {
           const std::string& methodDescr =
             method->getName()->str() + method->getDescriptor()->str();
 






More information about the llvm-commits mailing list