harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r509440 [1/3] - in /harmony/enhanced/drlvm/trunk/vm: jitrino/src/codegenerator/ipf/ jitrino/src/codegenerator/ipf/include/ jitrino/src/main/ jitrino/src/optimizer/ vmcore/src/util/linux/
Date Tue, 20 Feb 2007 07:04:14 GMT
Author: varlax
Date: Mon Feb 19 23:04:13 2007
New Revision: 509440

URL: http://svn.apache.org/viewvc?view=rev&rev=509440
Log:
Applied HARMONY-3131 [drlvm][ipf] jitrino ipf enabling: specjvm98 passes

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp?view=diff&rev=509440&r1=509439&r2=509440
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp Mon
Feb 19 23:04:13 2007
@@ -33,31 +33,47 @@
 #include "IpfPrologEpilogGenerator.h"
 #include "IpfRuntimeSupport.h"
 #include "IpfCfgVerifier.h"
+#include "CodeGenerator.h"
 //#include "IpfInstrumentator.h"
 
 namespace Jitrino {
 namespace IPF {
 
+static const char* help = "  Ipf CodeGen\n";
+static ActionFactory<CodeGenerator> _ipf_codegen("ipf_codegen", help);
+
 //========================================================================================//
 // IpfCodeGenerator
 //========================================================================================//
 
-CodeGenerator::CodeGenerator(MemoryManager        &memoryManager_, 
-                             CompilationInterface &compilationInterface_) 
-    : memoryManager(memoryManager_), compilationInterface(compilationInterface_) {
+CodeGenerator::CodeGenerator() {
 
-    cfg        = NULL;
-    methodDesc = NULL;
+    compilationInterface = NULL;
+    cfg                  = NULL;
+    methodDesc           = NULL;
 }
 
 //----------------------------------------------------------------------------------------//
 
-void CodeGenerator::genCode(SessionAction *sa, MethodCodeSelector &methodCodeSelector)
{
+void CodeGenerator::run() {
+    
+    MemoryManager mm(0x1000, "IpfCodeGenerator");
+
+    CompilationContext   *cc          = CompilationContext::getCurrentContext();
+    IRManager            &irManager   = *cc->getHIRManager();
+    CompilationInterface *ci          = cc->getVMCompilationInterface();
+    MethodDesc           *methodDesc  = ci->getMethodToCompile();
+    ::Jitrino::OpndManager &opndManager = irManager.getOpndManager();
+    const OptimizerFlags &optFlags    = irManager.getOptimizerFlags();
+    VarOpnd              *varOpnds    = opndManager.getVarOpnds();
 
-    MemoryManager  mm(0x1000, "IpfCodeGenerator");
-    cfg = new(mm) Cfg(mm, compilationInterface);
-    IrPrinter irPrinter(*cfg, "LOG"); //(char *)Log::getLogDirName());
-    methodDesc = compilationInterface.getMethodToCompile();
+    MethodCodeSelector *methodCodeSelector = new(mm) _MethodCodeSelector(irManager, methodDesc,
+        varOpnds, &irManager.getFlowGraph(), opndManager, optFlags.sink_constants, optFlags.sink_constants1);
+    
+    compilationInterface = CompilationContext::getCurrentContext()->getVMCompilationInterface();
+    cfg                  = new(mm) Cfg(mm, *compilationInterface);
+    methodDesc           = compilationInterface->getMethodToCompile();
+    IrPrinter irPrinter(*cfg);
 
     if(LOG_ON) {
         const char *methodName     = methodDesc->getName();
@@ -69,9 +85,11 @@
         IPF_LOG << endl << methodTypeName << "." << methodName <<
methodSignature << endl;
     }
 
+    //compilationInterface->lockMethodData();
+
     IPF_LOG << endl << "=========== Stage: Code Selector ============================="
<< endl;
-    IpfMethodCodeSelector ipfMethodCodeSelector(*cfg, compilationInterface);
-    methodCodeSelector.selectCode(ipfMethodCodeSelector);
+    IpfMethodCodeSelector ipfMethodCodeSelector(*cfg, *compilationInterface);
+    methodCodeSelector->selectCode(ipfMethodCodeSelector);
 
     methodDesc = ipfMethodCodeSelector.getMethodDesc();
     cfg->getOpndManager()->initCompBases((BbNode *)cfg->getEnterNode());
@@ -98,7 +116,7 @@
     liveAnalyzer.makeLiveSets(false);
 
     IPF_LOG << endl << "=========== Stage: Build GC Root Set ========================="
<< endl;
-    RuntimeSupport runtimeSupport(*cfg, compilationInterface);
+    RuntimeSupport runtimeSupport(*cfg, *compilationInterface);
     runtimeSupport.buildRootSet();
 
     IPF_LOG << endl << "=========== Stage: Register Allocator ========================"
<< endl;
@@ -116,11 +134,13 @@
     if(LOG_ON) irPrinter.printAsm(LOG_OUT);
 
     IPF_LOG << endl << "=========== Stage: Code Emitter =============================="
<< endl;
-    Emitter emitter(*cfg, compilationInterface, false);
+    Emitter emitter(*cfg, *compilationInterface, false);
     bool ret = emitter.emit();
 
     IPF_LOG << endl << "=========== Stage: Make Runtime Info ========================="
<< endl;
     runtimeSupport.makeRuntimeInfo();
+
+    //compilationInterface->unlockMethodData();
     
     if(ret) IPF_LOG << endl << "=========== Compilation Successful ==========================="
<< endl;
     else    IPF_LOG << endl << "=========== Compilation Failed ==============================="
<< endl;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp?view=diff&rev=509440&r1=509439&r2=509440
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp Mon Feb
19 23:04:13 2007
@@ -35,20 +35,17 @@
 // IrPrinter
 //========================================================================================//
 
-IrPrinter::IrPrinter(Cfg &cfg_, char *logDirName_) :
+IrPrinter::IrPrinter(Cfg &cfg_) :
     mm(cfg_.getMM()),
     cfg(cfg_),
-    logDirName(logDirName_),
     ofs(NULL) {
 }
 
 //----------------------------------------------------------------------------------------//
 
-void IrPrinter::printLayoutDot(char *logFileName) {
+void IrPrinter::printLayoutDot(char *logName) {
 
-    string logName(logDirName);
-    logName.append(logFileName);
-    ofs = new(mm) ofstream(logName.c_str());
+    ofs = new(mm) ofstream(logName);
     
     BbNode *node = (BbNode *)cfg.getEnterNode();
     BbNode *succ = node->getLayoutSucc();
@@ -69,11 +66,9 @@
 
 //----------------------------------------------------------------------------------------//
 
-void IrPrinter::printCfgDot(char *logFileName) {
+void IrPrinter::printCfgDot(char *logName) {
 
-    string logName(logDirName);
-    logName.append(logFileName);
-    ofs = new(mm) ofstream(logName.c_str());
+    ofs = new(mm) ofstream(logName);
     
     NodeVector &nodes = cfg.search(SEARCH_POST_ORDER);
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h?view=diff&rev=509440&r1=509439&r2=509440
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
Mon Feb 19 23:04:13 2007
@@ -34,17 +34,15 @@
 // CodeGenerator
 //========================================================================================//
 
-class CodeGenerator : public ::Jitrino::CodeGenerator {
+class CodeGenerator : public SessionAction {
 public:
-                         CodeGenerator(MemoryManager&, CompilationInterface&);
-    void                 genCode(SessionAction*, MethodCodeSelector&);
+                         CodeGenerator();
+    void                 run();
     virtual              ~CodeGenerator() {}
 
 protected:
-    MemoryManager        &memoryManager;
-    CompilationInterface &compilationInterface;
+    CompilationInterface *compilationInterface;
     MethodDesc           *methodDesc;
-
     Cfg                  *cfg;
 };
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h?view=diff&rev=509440&r1=509439&r2=509440
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h Mon
Feb 19 23:04:13 2007
@@ -37,7 +37,7 @@
 
 class IrPrinter {
 public:
-                   IrPrinter(Cfg&, char*);
+                   IrPrinter(Cfg&);
     void           printCfgDot(char*);
     void           printLayoutDot(char*);
     void           printAsm(ostream&);
@@ -65,7 +65,6 @@
     
     MemoryManager  &mm;
     Cfg            &cfg;
-    char           *logDirName;   // name of log dir
     ostream        *os;           // output stream
     ofstream       *ofs;          // file output stream
 };

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp?view=diff&rev=509440&r1=509439&r2=509440
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp Mon Feb 19 23:04:13 2007
@@ -272,9 +272,9 @@
 
 bool Jitrino::CompileMethod(CompilationContext* cc) {
     CompilationInterface* compilationInterface = cc->getVMCompilationInterface();
-#ifdef _IPF_ //IPF CG params are not safe -> add them to CompilationContext and remove
this lock
-    compilationInterface->lockMethodData();
-#endif
+//#ifdef _IPF_ //IPF CG params are not safe -> add them to CompilationContext and remove
this lock
+//    compilationInterface->lockMethodData();
+//#endif
     bool success = false;
     MethodDesc& methodDesc = *compilationInterface->getMethodToCompile();
     initialize_parameters(cc, methodDesc);
@@ -285,9 +285,9 @@
     } else {
         success = compileMethod(cc);
     }
-#ifdef _IPF_
-    compilationInterface->unlockMethodData();
-#endif
+//#ifdef _IPF_
+//    compilationInterface->unlockMethodData();
+//#endif
     return success;
 }
 



Mime
View raw message