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

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Dec 9 23:16:08 PST 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.174 -> 1.175
---
Log message:

Allow Numbers test case to pass.


---
Diffs of the changes:  (+12 -18)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.174 llvm-java/lib/Compiler/Compiler.cpp:1.175
--- llvm-java/lib/Compiler/Compiler.cpp:1.174	Fri Dec 10 00:01:54 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Fri Dec 10 01:15:57 2004
@@ -1250,18 +1250,14 @@
 
       assert (!method->isAbstract() && "Trying to compile an abstract method!");
 
-      // HACK: skip compiling java/lang/Class*, java/lang/reflect/*,
-      // java/lang/io/*, java/nio/*, java/security/*, java/text/* methods
-      if (classMethodDesc.find("java/lang/Object") != 0 &&
-          classMethodDesc.find("java/lang/StringBuffer") != 0 &&
-          (classMethodDesc.find("java/lang/Class") == 0 ||
-           classMethodDesc.find("java/lang/") == 0 ||
-           classMethodDesc.find("java/util/") == 0 ||
-           classMethodDesc.find("java/net/") == 0 ||
-           classMethodDesc.find("java/io/") == 0 ||
-           classMethodDesc.find("java/nio/") == 0 ||
-           classMethodDesc.find("java/text/") == 0 ||
-           classMethodDesc.find("java/security/") == 0)) {
+      // HACK: skip most of the class libraries.
+      if (classMethodDesc.find("java/") == 0 &&
+          classMethodDesc.find("java/lang/Object") != 0 &&
+          classMethodDesc.find("java/lang/Number") != 0 &&
+          classMethodDesc.find("java/lang/Byte") != 0 &&
+          classMethodDesc.find("java/lang/Integer") != 0 &&
+          classMethodDesc.find("java/lang/Long") != 0 &&
+          classMethodDesc.find("java/lang/Short") != 0) {
         DEBUG(std::cerr << "Skipping compilation of method: "
               << classMethodDesc << '\n');
         return function;
@@ -2436,10 +2432,11 @@
                bb);
   new ReturnInst(NULL, bb);
 
-  // HACK: for all <clinit> functions that are not compiled, add a
-  // dummy return.
+  // HACK: add dummy returns to functions so that the jit can run the
+  // generated bytecode
   for (Module::iterator F = m->begin(), E = m->end(); F != E; ++F)
-    if (F->getName().find("<clinit>") != std::string::npos) {
+    if (F->getName().find("<clinit>") != std::string::npos ||
+        F->getName().find("java/lang/VMClassLoader") != std::string::npos) {
       BasicBlock* entry = new BasicBlock("entry", F);
       if (F->getReturnType() == Type::VoidTy)
         new ReturnInst(NULL, entry);
@@ -2447,8 +2444,5 @@
         new ReturnInst(UndefValue::get(F->getReturnType()), entry);
     }
 
-//   for (Module::giterator G = m->gbegin(), E = m->gend(); G != E; ++G)
-//     std::cerr << *G << "\n\n";
-
   return m;
 }






More information about the llvm-commits mailing list