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

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu May 27 15:42:13 PDT 2004


Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.36 -> 1.37

---
Log message:

Inline compileMethodInit and add a ClassFile* member to CompilerImpl.


---
Diffs of the changes:  (+14 -17)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.36 llvm-java/lib/Compiler/Compiler.cpp:1.37
--- llvm-java/lib/Compiler/Compiler.cpp:1.36	Thu May 27 10:02:44 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Thu May 27 15:38:21 2004
@@ -115,6 +115,7 @@
     struct CompilerImpl :
         public BytecodeParser<CompilerImpl> {
     private:
+        const ClassFile* cf_;
         OperandStack opStack_;
         Locals locals_;
         BC2BBMap bc2bbMap_;
@@ -156,21 +157,6 @@
             return static_cast<Instruction::BinaryOps>(-1);
         }
 
-        void compileMethodInit(Function& function,
-                               const ClassFile& cf,
-                               const CodeAttribute& codeAttr) {
-            while (!opStack_.empty())
-                opStack_.pop();
-
-            locals_.clear();
-            locals_.assign(codeAttr.getMaxLocals(), NULL);
-
-            Bytecode2BasicBlockMapper mapper(function, bc2bbMap_, codeAttr);
-            mapper.compute();
-
-            prologue_ = new BasicBlock("prologue");
-        }
-
         Value* getOrCreateLocal(unsigned index, const Type* type) {
             if (!locals_[index]) {
                 locals_[index] = new AllocaInst(type, NULL,
@@ -190,7 +176,9 @@
             DEBUG(std::cerr << "compiling method: "
                   << method.getName()->str() << '\n');
 
-            std::string name = cf.getThisClass()->getName()->str();
+            cf_ = &cf;
+
+            std::string name = cf_->getThisClass()->getName()->str();
             name += '/';
             name += method.getName()->str();
             name += method.getDescriptor()->str();
@@ -203,7 +191,16 @@
             const Java::CodeAttribute* codeAttr =
                 Java::getCodeAttribute(method.getAttributes());
 
-            compileMethodInit(*function, cf, *codeAttr);
+            while (!opStack_.empty())
+                opStack_.pop();
+
+            locals_.clear();
+            locals_.assign(codeAttr->getMaxLocals(), NULL);
+
+            Bytecode2BasicBlockMapper mapper(*function, bc2bbMap_, *codeAttr);
+            mapper.compute();
+
+            prologue_ = new BasicBlock("prologue");
 
             parse(codeAttr->getCode(), codeAttr->getCodeSize());
 





More information about the llvm-commits mailing list