harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r496669 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: codegenerator/ia32/Ia32CodeLayout.cpp main/CompilationContext.cpp main/CompilationContext.h optimizer/inliner.cpp optimizer/inliner.h translator/java/JavaByteCodeTranslator.cpp
Date Tue, 16 Jan 2007 12:30:29 GMT
Author: varlax
Date: Tue Jan 16 04:30:28 2007
New Revision: 496669

URL: http://svn.apache.org/viewvc?view=rev&rev=496669
Log:
Applied HARMONY-2983 [drlvm][jit] Type propagation for args of inlined methods
Tested on SUSE9@ia32, SuSE9@x64

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp Tue
Jan 16 04:30:28 2007
@@ -131,11 +131,13 @@
 // Returns true if edge can be converted to a fall-through edge (i.e. an edge
 // not requiring a branch) assuming the edge's head block is laid out after the tail block.

 bool Linearizer::canEdgeBeMadeToFallThrough(Edge *edge) {
+    Inst *inst = (Inst*)edge->getSourceNode()->getLastInst();
+    if (edge->isUnconditionalEdge()) {
+        return inst == NULL || !inst->hasKind(Inst::Kind_SwitchInst);
+    }
     assert(edge->isTrueEdge());
-    Inst *br = (Inst*)edge->getSourceNode()->getLastInst();
-    assert(br!=NULL);
-    assert(br->hasKind(Inst::Kind_BranchInst));
-    return ((BranchInst*)br)->canReverse();
+    assert(inst->hasKind(Inst::Kind_BranchInst));
+    return ((BranchInst*)inst)->canReverse();
 }
 
 bool Linearizer::isBlockLayoutDone() {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp Tue Jan 16 04:30:28
2007
@@ -59,7 +59,7 @@
 #endif
     currentSessionAction = NULL;
     currentSessionNum = 0;
-
+    inliningContext = NULL;
     ccTls.push((CompilationContext*)this);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h Tue Jan 16 04:30:28
2007
@@ -32,6 +32,7 @@
 class SessionAction;
 class LogStreams;
 class HPipeline;
+class InliningContext;
 
 #ifdef _IPF_
 #else 
@@ -78,6 +79,9 @@
     void setPipeline(HPipeline* pipe) {pipeline = pipe;}
     HPipeline* getPipeline () const {return pipeline;}
 
+    void setInliningContext(InliningContext* c) {inliningContext = c;}
+    InliningContext* getInliningContext() const {return inliningContext;}
+
     static CompilationContext* getCurrentContext();
 
 #ifdef _IPF_
@@ -102,6 +106,7 @@
     int                     currentSessionNum;
     LogStreams*             currentLogStreams;
     HPipeline*              pipeline;
+    InliningContext*        inliningContext;
 
     void init();
     void initCompilationMode();

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Tue Jan 16 04:30:28
2007
@@ -969,6 +969,16 @@
     }
 
     inlineCC.setHIRManager(inlinedIRM);
+    
+    //prepare type info
+    uint32 nArgs = call->getNumSrcOperands() - 2;
+    Type** types = new (_tmpMM)Type*[nArgs];
+    for (uint32 i = 0; i < nArgs; i++) {
+        types[i] = call->getSrc(i + 2)->getType();
+    }
+
+    InliningContext* ic = new (_tmpMM) InliningContext(nArgs, types);
+    inlineCC.setInliningContext(ic);
     runTranslatorSession(inlineCC);
 
     return inlineNode;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h Tue Jan 16 04:30:28 2007
@@ -47,6 +47,16 @@
 class LoopTree;
 class Method_Table;
 
+class InliningContext {
+public:
+    InliningContext(uint32 _nArgs, Type** _argTypes) : nArgs(_nArgs), argTypes(_argTypes)
{}
+    uint32 getNumArgs() const {return nArgs;}
+    Type** getArgTypes() const {return argTypes;}
+private:
+    uint32 nArgs;
+    Type** argTypes;
+};
+
 class InlineNode : public TreeNode {
 public:
     InlineNode(IRManager& irm, Inst *callInst, Node *callNode) : _irm(irm), _callInst(callInst),
_callNode(callNode) {}

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp?view=diff&rev=496669&r1=496668&r2=496669
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
Tue Jan 16 04:30:28 2007
@@ -32,6 +32,7 @@
 #include "irmanager.h"
 #include "Jitrino.h"
 #include "EMInterface.h"
+#include "inliner.h"
 
 #include <assert.h>
 #include <stdio.h>
@@ -236,6 +237,8 @@
     cfgBuilder.genBlock(irBuilder.genMethodEntryLabel(&methodDesc));
     initLocalVars();
     initArgs();
+    CompilationContext* cc = CompilationContext::getCurrentContext();
+    InliningContext* ic  = cc->getInliningContext();
     //
     // load actual parameters into formal parameters
     //
@@ -251,6 +254,16 @@
             arg = irBuilder.genArgDef(NonNullThisArg,argTypes[i]);
         } else {
             Type* type = argTypes[i];
+            if (ic!=NULL) {
+                assert(ic->getNumArgs() == numArgs);
+                Type* newType = ic->getArgTypes()[i];
+                if (newType->isObject()) {
+                    assert(newType->isNullObject() || newType->asObjectType()->isSubClassOf(type->asObjectType()));
+                    type = newType;
+                } else {
+                    //do nothing, numX->numY auto convertion not tested
+                }
+            } 
             if (isMagicClass(type)) {
                 type = convertMagicType2HIR(typeManager, type);
             }



Mime
View raw message