harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r587851 - in /harmony/enhanced/drlvm/trunk/vm: jitrino/config/em64t/ jitrino/src/codegenerator/ia32/ jitrino/src/optimizer/ port/src/encoder/ia32_em64t/
Date Wed, 24 Oct 2007 10:13:06 GMT
Author: mfursov
Date: Wed Oct 24 03:13:03 2007
New Revision: 587851

URL: http://svn.apache.org/viewvc?rev=587851&view=rev
Log:
 The second part for the fix from HARMONY-4553:[drlvm][jit][perf]String _compareTo and _regionMatches
calls replacement by REP CMPSW instructions

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_prvt.h
    harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf Wed Oct 24 03:13:03 2007
@@ -24,8 +24,8 @@
 
 -XX:jit.CS_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.CS_OPT.path.optimizer=ssa,devirt,inline,purge,simplify,dce,uce,escape,dce,uce,memopt,simplify,dce,uce,lower,dessa,statprof
--XX:jit.CS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.CS_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,simplify,dce,uce,escape,dce,uce,memopt,simplify,dce,uce,lower,dessa,statprof
+-XX:jit.CS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.CS_OPT.path.dce1=cg_dce
 -XX:jit.CS_OPT.path.dce2=cg_dce
 -XX:jit.CS_OPT.path.regalloc=bp_regalloc1,bp_regalloc2
@@ -34,7 +34,7 @@
 
 #inliner configuration
 -XX:jit.CS_OPT.CS_OPT_inliner_pipeline.filter=-
--XX:jit.CS_OPT.CS_OPT_inliner_pipeline.path=ssa,devirt
+-XX:jit.CS_OPT.CS_OPT_inliner_pipeline.path=ssa,devirt,hlo_api_magic
 -XX:jit.CS_OPT.arg.optimizer.inline.pipeline=CS_OPT_inliner_pipeline
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf Wed Oct 24 03:13:03
2007
@@ -69,8 +69,8 @@
 -XX:jit.SD1_OPT.arg.optimizer.vp_instrument.profile_abstract=true
 
 
--XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,inline,purge,simplify,dce,uce,so2-,simplify,dce,uce,escape,dce,uce,hvn,dce,uce,inline_helpers,purge,simplify,uce,dce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,classic_abcd,dce,uce,gcm,dessa,fastArrayFill,statprof
--XX:jit.SD2_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic,inline,purge,simplify,dce,uce,so2-,simplify,dce,uce,escape,dce,uce,hvn,dce,uce,inline_helpers,purge,simplify,uce,dce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,classic_abcd,dce,uce,gcm,dessa,fastArrayFill,statprof
+-XX:jit.SD2_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SD2_OPT.path.dce1=cg_dce
 -XX:jit.SD2_OPT.path.dce2=cg_dce
 
@@ -83,7 +83,7 @@
 
 #inliner configuration
 -XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.filter=-
--XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.path=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.path=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic
 -XX:jit.SD2_OPT.arg.optimizer.inline.pipeline=SD2_OPT_inliner_pipeline
 -XX:jit.SD2_OPT.arg.optimizer.inline.connect_early=false
 #devirt configuration for inliner pipeline

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf Wed Oct 24 03:13:03
2007
@@ -24,8 +24,8 @@
 
 -XX:jit.SS_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,statprof,devirt,inline,purge,simplify,dce,uce,hvn,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,classic_abcd,dce,uce,gcm,dessa,statprof
--XX:jit.SS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,statprof,devirt,hlo_api_magic,inline,purge,simplify,dce,uce,hvn,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,classic_abcd,dce,uce,gcm,dessa,statprof
+-XX:jit.SS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SS_OPT.path.dce1=cg_dce
 -XX:jit.SS_OPT.path.dce2=cg_dce
 -XX:jit.SS_OPT.path.regalloc=bp_regalloc1,bp_regalloc2
@@ -34,7 +34,7 @@
 
 #inliner configuration
 -XX:jit.SS_OPT.SS_OPT_inliner_pipeline.filter=-
--XX:jit.SS_OPT.SS_OPT_inliner_pipeline.path=ssa,simplify,dce,uce,statprof,devirt
+-XX:jit.SS_OPT.SS_OPT_inliner_pipeline.path=ssa,simplify,dce,uce,statprof,devirt,hlo_api_magic
 -XX:jit.SS_OPT.arg.optimizer.inline.pipeline=SS_OPT_inliner_pipeline
 
 -XX:jit.SS_OPT.arg.codegen.dce1.early=yes

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp Wed Oct
24 03:13:03 2007
@@ -60,7 +60,8 @@
     virtual void run()=0;
 protected:
 
-    Opnd*  addElemIndexWithLEA(Opnd* array, Opnd* index, Node* node);
+    void    convertIntToInt(Opnd* dst, Opnd* src, Node* node);
+    Opnd*   addElemIndexWithLEA(Opnd* array, Opnd* index, Node* node);
 
     IRManager* irm;
     CallInst* callInst;
@@ -108,6 +109,7 @@
                         continue; 
                     };
                     if( ri->getKind() == Opnd::RuntimeInfo::Kind_MethodDirectAddr ){
+#ifndef _EM64T_
                         MethodDesc * md = (MethodDesc*)ri->getValue(0);
                         const char* className = md->getParentType()->getName();
                         const char* methodName = md->getName();
@@ -125,6 +127,7 @@
                                 handlers.push_back(new (tmpMM) Long_numberOfTrailingZeros_Handler_x_J_x_I(irm,
callInst, md));
                             }
                         }
+#endif
                     } else if( ri->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress
) {
                         if( strcmp((char*)ri->getValue(0),"String_compareTo")==0 ) {
                             if(getBoolArg("String_compareTo_as_magic", true))
@@ -363,7 +366,7 @@
 
     // prepare counter
     Opnd* counter = irm->newRegOpnd(counterType,counterRegName);
-    node->appendInst(irm->newCopyPseudoInst(Mnemonic_MOV, counter, valForCounter));
+    convertIntToInt(counter, valForCounter, node);
 
     // prepare this position
     Opnd* thisAddr = addElemIndexWithLEA(thisArr,thisIdx,node);
@@ -451,7 +454,7 @@
 
     // prepare counter
     Opnd* counter = irm->newRegOpnd(counterType,counterRegName);
-    node->appendInst(irm->newCopyPseudoInst(Mnemonic_MOV, counter, valForCounter));
+    convertIntToInt(counter, valForCounter, node);
 
     // prepare this position
     Opnd* thisAddr = addElemIndexWithLEA(thisArr,thisIdx,node);
@@ -491,6 +494,25 @@
     callInst->unlink();
 }
 
+// this intends for indexes and counters conversion
+// ATTENTION !!! Zero Extention is used for this
+void  APIMagicHandler::convertIntToInt(Opnd* dst, Opnd* src, Node* node) 
+{
+    Type* dstType = dst->getType();
+    Type* srcType = src->getType();
+
+    // this works only for equal types 
+    // or Int32 into Int64 conversion
+    assert(srcType == dstType || (srcType == irm->getTypeManager().getInt32Type() &&
+                                  dstType == irm->getTypeManager().getInt64Type()));
+
+    if(srcType != dstType) {
+        node->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, dst, src));
+    } else {
+        node->appendInst(irm->newCopyPseudoInst(Mnemonic_MOV, dst, src));
+    }
+}
+
 //  Compute address of the array element given 
 //  address of the first element and index
 //  using 'LEA' instruction
@@ -520,22 +542,14 @@
     }
     Opnd * elemSizeOpnd  = irm->newImmOpnd(indexType, elemSize);
     
-    Opnd * indexOpnd = index;
-    assert(index->getType() == indexType); //when this assertion fails 'convert' should
be implemented
-//    indexOpnd = convert(indexOpnd, indexType);
-
-    if ( indexOpnd->isPlacedIn(OpndKind_Imm) ) {
-        // we need to put index operand on a register to satisfy LEA constraint
-        int64 immValue = indexOpnd->getImmValue();
-        if (immValue == 0) {
+    Opnd * indexOpnd = NULL;
+    if ( index->isPlacedIn(OpndKind_Imm) && index->getImmValue() == 0 ) {
             indexOpnd = NULL;
             elemSizeOpnd = NULL;
-        } else {
-            Opnd * indexReg = irm->newOpnd(indexType);
-            node->appendInst(irm->newCopyPseudoInst(Mnemonic_MOV, indexReg, indexOpnd));
-            indexOpnd = indexReg;
-        }
-    }    
+    } else {
+        indexOpnd = irm->newOpnd(indexType);
+        convertIntToInt(indexOpnd,index,node);
+    } 
     Opnd * arrOffset = irm->newImmOpnd(offType, arrayType->getArrayElemOffset());
     Opnd * addr = irm->newMemOpnd(dstType,(Opnd*)array, indexOpnd, elemSizeOpnd, arrOffset);
     Opnd * dst = irm->newOpnd(dstType);

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?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Wed Oct 24 03:13:03
2007
@@ -125,15 +125,17 @@
     if(skipMethods != NULL || _inlineSkipApiMagicMethods) {
         _inlineSkipMethodTable = new (_tmpMM) Method_Table(_tmpMM, skipMethods, "SKIP_METHODS",
false);
         if (_inlineSkipApiMagicMethods) {
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined (_IPF_)
 //TODO: IA32 helpers should work on EM64T too -> TODO test
 #else
             //is_accepted will return 'true' for these methods by skip table-> no inlining
will be done
             Method_Table::Decision des = Method_Table::mt_accepted; 
+#ifndef  _EM64T_ // not tested
             _inlineSkipMethodTable->add_method_record("java/lang/Integer", "numberOfLeadingZeros",
"(I)I", des, false);
             _inlineSkipMethodTable->add_method_record("java/lang/Integer", "numberOfTrailingZeros",
"(I)I", des, false);
             _inlineSkipMethodTable->add_method_record("java/lang/Long", "numberOfLeadingZeros",
"(J)I", des, false);
             _inlineSkipMethodTable->add_method_record("java/lang/Long", "numberOfTrailingZeros",
"(J)I", des, false);
+#endif
             if(argSource->getBoolArg("String_compareTo_as_magic",true)) {
                 _inlineSkipMethodTable->add_method_record("java/lang/String", "compareTo",
"(Ljava/lang/String;)I", des, false);
             }

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_prvt.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_prvt.h?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_prvt.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_prvt.h Wed Oct 24 03:13:03
2007
@@ -156,6 +156,11 @@
     #define RDX     { OpndKind_GPReg, OpndSize_64, RegName_RDX }
 #endif
 
+#define ESI         {OpndKind_GPReg, OpndSize_32, RegName_ESI}
+#ifdef _EM64T_
+    #define RSI     { OpndKind_GPReg, OpndSize_64, RegName_RSI }
+#endif
+
 #define EDI         {OpndKind_GPReg, OpndSize_32, RegName_EDI}
 #ifdef _EM64T_
     #define RDI     { OpndKind_GPReg, OpndSize_64, RegName_RDI }

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp?rev=587851&r1=587850&r2=587851&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp Wed Oct 24 03:13:03
2007
@@ -1439,22 +1439,22 @@
 
 BEGIN_MNEMONIC(CMPSB, MF_AFFECTS_FLAGS, DU_DU_DU)
 BEGIN_OPCODES()
-    {OpcodeInfo::ia32,  {0xA6},         {r32,r32,ECX},    DU_DU_DU },
-    {OpcodeInfo::em64t, {0xA6},         {r64,r64,RCX},    DU_DU_DU },
+    {OpcodeInfo::ia32,  {0xA6},         {ESI,EDI,ECX},    DU_DU_DU },
+    {OpcodeInfo::em64t, {0xA6},         {RSI,RDI,RCX},    DU_DU_DU },
 END_OPCODES()
 END_MNEMONIC()
 
 BEGIN_MNEMONIC(CMPSW, MF_AFFECTS_FLAGS, DU_DU_DU)
 BEGIN_OPCODES()
-    {OpcodeInfo::ia32,  {Size16, 0xA7}, {r32,r32,ECX},  DU_DU_DU },
-    {OpcodeInfo::em64t, {Size16, 0xA7}, {r64,r64,RCX},  DU_DU_DU },
+    {OpcodeInfo::ia32,  {Size16, 0xA7}, {ESI,EDI,ECX},  DU_DU_DU },
+    {OpcodeInfo::em64t, {Size16, 0xA7}, {RSI,RDI,RCX},  DU_DU_DU },
 END_OPCODES()
 END_MNEMONIC()
 
 BEGIN_MNEMONIC(CMPSD, MF_AFFECTS_FLAGS, DU_DU_DU)
 BEGIN_OPCODES()
-    {OpcodeInfo::ia32,  {0xA7},         {r32,r32,ECX},  DU_DU_DU },
-    {OpcodeInfo::em64t, {0xA7},         {r64,r64,RCX},  DU_DU_DU },
+    {OpcodeInfo::ia32,  {0xA7},         {ESI,EDI,ECX},  DU_DU_DU },
+    {OpcodeInfo::em64t, {0xA7},         {RSI,RDI,RCX},  DU_DU_DU },
 END_OPCODES()
 END_MNEMONIC()
 



Mime
View raw message