You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mc...@apache.org on 2008/05/22 15:34:09 UTC
svn commit: r659108 [12/19] - in /harmony/enhanced/drlvm/trunk/vm: em/src/
gc_gen/src/common/ gc_gen/src/mark_compact/ gc_gen/src/mark_sweep/
gc_gen/src/semi_space/ gc_gen/src/trace_forward/ include/open/
interpreter/src/ jitrino/src/codegenerator/ jit...
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Thu May 22 06:33:38 2008
@@ -60,11 +60,11 @@
struct ComObjStat {
ComObjStat() :_n0(0), _n_ge(0), _n_ae(0), _n_ne(0), _n_lo(0) {};
- uint32 _n0;
- uint32 _n_ge;
- uint32 _n_ae;
- uint32 _n_ne;
- uint32 _n_lo;
+ U_32 _n0;
+ U_32 _n_ge;
+ U_32 _n_ae;
+ U_32 _n_ne;
+ U_32 _n_lo;
};
static ComObjStat comObjStat;
EscAnalyzer::CalleeMethodInfos* EscAnalyzer::calleeMethodInfos=NULL;
@@ -95,8 +95,8 @@
: eaMemManager(mm), irManager(irm), mh(irm.getMethodDesc()),
compInterface(irm.getCompilationInterface()),os_sc(Log::out())
{
- maxMethodExamLevel = (uint32)argSource->getIntArg("max_level",maxMethodExamLevel_default);
- allProps = (uint32)argSource->getIntArg("d_prop",0);
+ maxMethodExamLevel = (U_32)argSource->getIntArg("max_level",maxMethodExamLevel_default);
+ allProps = (U_32)argSource->getIntArg("d_prop",0);
debug_method = argSource->getStringArg("d_method", NULL);
method_ea_level = 0; // determines level of method scan
do_sync_removal = argSource->getBoolArg("do_sync_removal",true);
@@ -175,9 +175,9 @@
const char* mn = mh.getName();
const Nodes& nodes = irManager.getFlowGraph().getNodes();
ControlFlowGraph& fg = irManager.getFlowGraph();
- uint32 nodeNum = (uint32)nodes.size();
- uint32 num2 = fg.getNodeCount();
- uint32 num3 = fg.getMaxNodeId();
+ U_32 nodeNum = (U_32)nodes.size();
+ U_32 num2 = fg.getNodeCount();
+ U_32 num3 = fg.getMaxNodeId();
Nodes::const_iterator niter;
lastCnGNodeId = 0; // initialization of private field
@@ -310,9 +310,9 @@
Type* type = NULL;
CnGNode* cgnode = NULL;
- uint32 ntype=0;
+ U_32 ntype=0;
MethodPtrType* methType = NULL;
- uint32 n = 0;
+ U_32 n = 0;
bool addinst = false;
Inst* method_inst = NULL;
if (shortLog) {
@@ -461,7 +461,7 @@
assert(methType!=NULL);
n=methType->getNumParams();
addinst=false;
- for (uint32 i = 0; i < n; i++) {
+ for (U_32 i = 0; i < n; i++) {
Type* tt = methType->getParamType(i);
if (!tt->isReference()) {
continue;
@@ -502,7 +502,7 @@
n=methType->getNumParams();
addinst=false;
- for (uint32 i = 0; i < n; i++) {
+ for (U_32 i = 0; i < n; i++) {
Type* tt = methType->getParamType(i);
if (!tt->isReference()) {
continue;
@@ -623,7 +623,7 @@
} // instrExam(Node* node)
-void EscAnalyzer::getLdFieldAddrInfo(Inst* inst, Type*& type, uint32& nType) {
+void EscAnalyzer::getLdFieldAddrInfo(Inst* inst, Type*& type, U_32& nType) {
type = NULL;
nType = 0;
if (inst->getOpcode() == Op_LdFieldAddr || inst->getOpcode() == Op_LdStaticAddr) {
@@ -645,7 +645,7 @@
void EscAnalyzer::instrExam_processLdFieldAddr(Inst* inst) {
Type* type = NULL;
- uint32 nType = 0;
+ U_32 nType = 0;
getLdFieldAddrInfo(inst, type, nType);
if (type->isReference() || nType==NT_INSTFLD) {
assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -662,7 +662,7 @@
void
EscAnalyzer::instrExam2_processLdFieldAddr(Inst* inst) {
Type* type = NULL;
- uint32 nType = 0;
+ U_32 nType = 0;
getLdFieldAddrInfo(inst, type, nType);
bool isref = type->isReference();
@@ -722,9 +722,9 @@
Type* type = NULL;
CnGNode* cgnode = NULL;
CnGNode* cgn_src = NULL;
- uint32 ntype=0;
+ U_32 ntype=0;
MethodPtrType* methType = NULL;
- uint32 n = 0;
+ U_32 n = 0;
Inst* method_inst = NULL;
bool not_exam = false;
@@ -776,7 +776,7 @@
}
if (type->isValue()) {
Inst* srcInst = inst->getSrc(0)->getInst();
- uint32 src_opcode = srcInst->getOpcode();
+ U_32 src_opcode = srcInst->getOpcode();
if (src_opcode==Op_LdStaticAddr || isVMHelperCall(srcInst, VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE)) {
break;
}
@@ -827,7 +827,7 @@
}
if (type->isValue()) {
Inst* srcInst = inst->getSrc(1)->getInst();
- uint32 src_opcode = srcInst->getOpcode();
+ U_32 src_opcode = srcInst->getOpcode();
if (src_opcode==Op_LdStaticAddr || isVMHelperCall(srcInst, VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE)) {
break;
}
@@ -845,7 +845,7 @@
case Op_DirectCall: // call
methType = typeManager.getMethodPtrType(inst->asMethodInst()->getMethodDesc());
n = methType->getNumParams();
- for (uint32 i = 0; i < n; i++) {
+ for (U_32 i = 0; i < n; i++) {
Type* tt = methType->getParamType(i);
if (!tt->isReference()) {
continue;
@@ -871,7 +871,7 @@
}
assert(methType!=NULL);
n = methType->getNumParams();
- for (uint32 i = 0; i < n; i++) {
+ for (U_32 i = 0; i < n; i++) {
Type* tt = methType->getParamType(i);
if (!tt->isReference()) {
continue;
@@ -899,10 +899,10 @@
case Op_Phi: // phi
type = inst->getDst()->getType();
if (type->isObject()) {
- uint32 nsrc=inst->getNumSrcOperands();
+ U_32 nsrc=inst->getNumSrcOperands();
cgnode = findCnGNode_op(inst->getDst()->getId());
assert(cgnode!=NULL);
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
Opnd* srcOpnd = inst->getSrc(i);
cgn_src=findCnGNode_op(srcOpnd->getId());
assert(cgn_src!=NULL);
@@ -971,7 +971,7 @@
EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode(Inst* inst, Type* type, uint32 ntype) {
+EscAnalyzer::addCnGNode(Inst* inst, Type* type, U_32 ntype) {
CnGNode* cgnode = new (eaMemManager) CnGNode; // new CG node
cgnode->cngNodeId = ++lastCnGNodeId;
@@ -1021,11 +1021,11 @@
}
cngNodes->push_back(cgnode);
return cgnode;
-} // addCnGNode(Inst* inst, Type* type, uint32 ntype)
+} // addCnGNode(Inst* inst, Type* type, U_32 ntype)
EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode_op(Inst* inst, Type* type, uint32 ntype) {
+EscAnalyzer::addCnGNode_op(Inst* inst, Type* type, U_32 ntype) {
CnGNode* cgnode = addCnGNode(inst, type, ntype); // new CG node
Opnd* opnd = inst->getDst();
@@ -1036,11 +1036,11 @@
Log::out() << std::endl;
}
return cgnode;
-} // addCnGNode_op(Inst* inst, Type* type, uint32 ntype)
+} // addCnGNode_op(Inst* inst, Type* type, U_32 ntype)
EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode_mp(Inst* inst, MethodPtrType* mpt, uint32 ntype, uint32 narg) {
+EscAnalyzer::addCnGNode_mp(Inst* inst, MethodPtrType* mpt, U_32 ntype, U_32 narg) {
Type* type = mpt->getParamType(narg);
CnGNode* cgnode = addCnGNode(inst, type, ntype); // new CG node
@@ -1052,11 +1052,11 @@
Log::out() << std::endl;
}
return cgnode;
-} // addCnGNode_mp(Inst* inst, MethodDesc* md, uint32 ntype, uint32 narg)
+} // addCnGNode_mp(Inst* inst, MethodDesc* md, U_32 ntype, U_32 narg)
EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode_ex(Inst* inst, uint32 ntype) {
+EscAnalyzer::addCnGNode_ex(Inst* inst, U_32 ntype) {
Type* type = inst->getSrc(0)->getType();
CnGNode* cgnode = addCnGNode(inst, type, ntype); // new CG node
@@ -1067,11 +1067,11 @@
Log::out() << std::endl;
}
return cgnode;
-} // addCnGNode_ex(Inst* inst, uint32 ntype)
+} // addCnGNode_ex(Inst* inst, U_32 ntype)
EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode_fl(Inst* inst, uint32 ntype) {
+EscAnalyzer::addCnGNode_fl(Inst* inst, U_32 ntype) {
Type* type = inst->getDst()->getType();
CnGNode* cgnode = addCnGNode(inst, type, ntype); // new CG node
@@ -1082,44 +1082,44 @@
Log::out() << std::endl;
}
return cgnode;
-} // addCnGNode_fl(Inst* inst, uint32 ntype)
+} // addCnGNode_fl(Inst* inst, U_32 ntype)
EscAnalyzer::CnGNode*
-EscAnalyzer::findCnGNode_op(uint32 nId) {
+EscAnalyzer::findCnGNode_op(U_32 nId) {
CnGNodes::iterator it;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->opndId==nId && ((*it)->nodeType & (NT_OBJS|NT_LDVAL)))
return (*it);
}
return(NULL);
-} // findCnGNode_op(uint32 nId)
+} // findCnGNode_op(U_32 nId)
EscAnalyzer::CnGNode*
-EscAnalyzer::findCnGNode_id(uint32 nId) {
+EscAnalyzer::findCnGNode_id(U_32 nId) {
CnGNodes::iterator it;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->cngNodeId==nId)
return (*it);
}
return(NULL);
-} // findCnGNode_id(uint32 nId)
+} // findCnGNode_id(U_32 nId)
EscAnalyzer::CnGNode*
-EscAnalyzer::findCnGNode_in(uint32 nId) {
+EscAnalyzer::findCnGNode_in(U_32 nId) {
CnGNodes::iterator it;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->instrId==nId)
return (*it);
}
return(NULL);
-} // findCnGNode_in(uint32 nId)
+} // findCnGNode_in(U_32 nId)
EscAnalyzer::CnGNode*
-EscAnalyzer::findCnGNode_mp(uint32 iId, uint32 aId) {
+EscAnalyzer::findCnGNode_mp(U_32 iId, U_32 aId) {
CnGNodes::iterator it;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->instrId==iId && (*it)->argNumber==aId &&
@@ -1127,11 +1127,11 @@
return (*it);
}
return(NULL);
-} // findCnGNode_mp(uint32 iId, uint32 aId)
+} // findCnGNode_mp(U_32 iId, U_32 aId)
EscAnalyzer::CnGNode*
-EscAnalyzer::findCnGNode_fl(Inst* inst, uint32 ntype) {
+EscAnalyzer::findCnGNode_fl(Inst* inst, U_32 ntype) {
FieldDesc* fd1 = NULL;
if (inst->asFieldAccessInst()==NULL) {// unresolved field access
assert(inst->getOpcode() == Op_AddOffset || isVMHelperCall(inst, VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE));
@@ -1139,7 +1139,7 @@
fd1 = inst->asFieldAccessInst()->getFieldDesc();
}
- uint32 idr = 0; //object field used to reference this field
+ U_32 idr = 0; //object field used to reference this field
if (ntype==NT_INSTFLD) {
idr=inst->getSrc(0)->getId();
}
@@ -1158,7 +1158,7 @@
}
if ( (fd1!=NULL && fd1->getFieldHandle() == fd2->getFieldHandle()) || inst == inst2/*don't optimize*/ ) {
if (ntype==NT_INSTFLD) {
- uint32 idf = inst2->getSrc(0)->getId();
+ U_32 idf = inst2->getSrc(0)->getId();
if (idr!=idf) {
continue;
}
@@ -1168,12 +1168,12 @@
}
}
return(NULL);
-} // findCnGNode_fl(Opnd* opnd, uint32 ntype)
+} // findCnGNode_fl(Opnd* opnd, U_32 ntype)
void
EscAnalyzer::addEdge(CnGNode* cgnfrom, CnGNode* cgnto,
- uint32 etype, Inst* inst) {
+ U_32 etype, Inst* inst) {
CnGEdges::iterator it;
CnGRefs* el = NULL;
CnGRef* ref;
@@ -1260,7 +1260,7 @@
Log::out() << "++++ addEdge: added edge" << std::endl;
}
-} // addEdge(CnGNode* cgnfrom, CnGNode* cgnto, uint32 etype, Inst* inst)
+} // addEdge(CnGNode* cgnfrom, CnGNode* cgnto, U_32 etype, Inst* inst)
void
@@ -1269,7 +1269,7 @@
NodeMDs::iterator it1;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
- uint32 nt = (*it)->nodeType;
+ U_32 nt = (*it)->nodeType;
if (nt==NT_STFLD || nt==NT_CATCHVAL
|| (nt==NT_RETVAL && (*it)->nInst->getOpcode()==Op_IndirectMemoryCall)
|| (nt==NT_RETVAL && (*it)->nInst->asMethodInst()->getMethodDesc()->isNative())) {
@@ -1347,7 +1347,7 @@
}
}
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
- uint32 nt = (*it)->nodeType;
+ U_32 nt = (*it)->nodeType;
if ((nt&(NT_OBJECT|NT_RETVAL) || nt==NT_LDOBJ) && (getEscState(*it)==ARG_ESCAPE)) {
for (it1 = (*it)->nodeMDs->begin(); it1 != (*it)->nodeMDs->end(); it1++) {
CnGNode* n=findCnGNode_id(*it1); // method argument node
@@ -1423,9 +1423,9 @@
}
break;
} else { // to use info about scanned method
- uint32 narg = n->argNumber;
+ U_32 narg = n->argNumber;
ParamInfos::iterator it2;
- uint32 state = 0;
+ U_32 state = 0;
if (verboseLog) {
Log::out() << "--setSt cmi: method "
<< mtdInfo->methodIdent->parentName << "::"
@@ -1475,7 +1475,7 @@
}
}
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
- uint32 nt = (*it)->nodeType;
+ U_32 nt = (*it)->nodeType;
if ((nt==NT_RETVAL) && getEscState(*it)>GLOBAL_ESCAPE) {
MethodDesc* mdesc = (*it)->nInst->asMethodInst()->getMethodDesc();
if (((*it)->nInst->getOpcode())!=Op_DirectCall) { // only direct call may be here
@@ -1512,7 +1512,7 @@
scannedSucNodes->clear();
// check states of array elements' and fields' values
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
- uint32 nt = (*it)->nodeType;
+ U_32 nt = (*it)->nodeType;
if ((nt&(NT_OBJECT|NT_RETVAL) || nt==NT_LDOBJ) && (getEscState(*it)!=GLOBAL_ESCAPE)) {
if ((*it)->outEdges == NULL)
continue;
@@ -1536,7 +1536,7 @@
CnGRefs::iterator it1;
CnGNode* next_node;
ObjIds* scObjs = check_var_src ? scannedObjsRev : scannedObjs;
- uint32 ni_opcode = cgn->nInst->getOpcode();
+ U_32 ni_opcode = cgn->nInst->getOpcode();
bool needFix = isStateNeedGEFix(getFullState(cgn),cgn->nodeType);
if (cgn->nodeType != NT_STFLD && cgn->nodeType != NT_THRVAL && cgn->nodeType != NT_EXITVAL
@@ -1641,8 +1641,8 @@
}
if (check_var_src) {
if (ni_opcode == Op_LdVar || ni_opcode == Op_StVar || ni_opcode ==Op_Phi) {
- uint32 nsrc=cgn->nInst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc=cgn->nInst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
next_node = findCnGNode_op(cgn->nInst->getSrc(i)->getId());
needFix = isStateNeedGEFix(getFullState(next_node),next_node->nodeType);
if (!needFix) {
@@ -1675,8 +1675,8 @@
CnGRefs::iterator it1;
CnGNode* next_node;
ObjIds* scObjs = check_var_src ? scannedObjsRev : scannedObjs;
- uint32 ni_opcode = cgn->nInst->getOpcode();
- uint32 curMDNode_saved = 0;
+ U_32 ni_opcode = cgn->nInst->getOpcode();
+ U_32 curMDNode_saved = 0;
if (curMDNode == 0) {
assert(getEscState(cgn)!=ARG_ESCAPE);
@@ -1749,8 +1749,8 @@
}
if (check_var_src) {
if (ni_opcode == Op_LdVar || ni_opcode == Op_StVar || ni_opcode ==Op_Phi) {
- uint32 nsrc=cgn->nInst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc=cgn->nInst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
next_node = findCnGNode_op(cgn->nInst->getSrc(i)->getId());
if (getEscState(next_node) <= ARG_ESCAPE)
continue;
@@ -2050,13 +2050,13 @@
mident->name=mname;
mident->signature=msig;
minfo->methodIdent=mident;
- uint32 numpar = mdesc->getNumParams();
+ U_32 numpar = mdesc->getNumParams();
minfo->numberOfArgs=numpar;
ParamInfos* prminfos = new (globalMM) ParamInfos(globalMM);
minfo->paramInfos=prminfos;
minfo->retValueState=0;
if (mdesc->getReturnType()->isReference()) {
- uint32 escstate = 0;
+ U_32 escstate = 0;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++) {
if ((*it)->nodeType==NT_EXITVAL) {
if (isGlobalState(getFullState((*it)->outEdges->front()->cngNodeTo))) {
@@ -2099,10 +2099,10 @@
} // saveScannedMethodInfo(MemoryManager& mm)
-uint32
-EscAnalyzer::getMethodParamState(CalleeMethodInfo* mi, uint32 np) {
+U_32
+EscAnalyzer::getMethodParamState(CalleeMethodInfo* mi, U_32 np) {
ParamInfos::iterator it;
- uint32 st = 0;
+ U_32 st = 0;
if (mi==NULL)
return 0;
for (it = mi->paramInfos->begin( ); it != mi->paramInfos->end( ); it++) {
@@ -2112,15 +2112,15 @@
}
}
return st;
-} // getMethodParamState(CalleeMethodInfo* mi, uint32 np)
+} // getMethodParamState(CalleeMethodInfo* mi, U_32 np)
void
EscAnalyzer::markNotEscInsts() {
CnGNodes::iterator it;
bool p2 = false;
- StlMap<uint32, uint32> nonEscInsts(eaMemManager);
- typedef ::std::pair <uint32,uint32> intPair;
+ StlMap<U_32, U_32> nonEscInsts(eaMemManager);
+ typedef ::std::pair <U_32,U_32> intPair;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->nodeType == NT_OBJECT && getEscState(*it) > GLOBAL_ESCAPE && getVirtualCall(*it) == 0
@@ -2393,7 +2393,7 @@
void
EscAnalyzer::lObjectHistory(Inst* inst,std::string text,::std::ostream& os) {
Inst* inst1;
- uint32 nsrc=inst->getNumSrcOperands();
+ U_32 nsrc=inst->getNumSrcOperands();
if (scannedInsts->size()!=0) {
if (checkScannedInsts(inst->getId())) {
@@ -2418,7 +2418,7 @@
return;
}
scannedInsts->push_back(inst->getId());
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst1 = inst->getSrc(i)->getInst();
if (!(Type::isTau(inst->getSrc(i)->getType()->tag)))
lObjectHistory(inst1,text+" ",os);
@@ -2434,7 +2434,7 @@
irManager.getMethodDesc().printFullName(os);
os << std::endl;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
- uint32 nt = (*it)->nodeType;
+ U_32 nt = (*it)->nodeType;
if (nt&(NT_OBJECT|NT_RETVAL) || nt==NT_LDOBJ) {
printCnGNode(*it,os);
((Opnd*)(*it)->refObj)->printWithType(os);
@@ -2466,7 +2466,7 @@
int n_ge = 0;
int n_ae = 0;
int n_ne = 0;
- uint32 state = 0;
+ U_32 state = 0;
for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
if ((*it)->nodeType == NT_OBJECT) {
@@ -2513,7 +2513,7 @@
void
EscAnalyzer::printOriginObjects(Inst* inst, bool all, std::string text) {
Inst* inst1 = NULL;
- uint32 nsrc=inst->getNumSrcOperands();
+ U_32 nsrc=inst->getNumSrcOperands();
if (scannedObjs->size()!=0) {
if (checkScannedObjs(inst->getId())) {
@@ -2582,7 +2582,7 @@
}
scannedObjs->push_back(inst->getId());
if (all) {
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst1 = inst->getSrc(i)->getInst();
printOriginObjects(inst1,true,text+" ");
}
@@ -2594,13 +2594,13 @@
printOriginObjects(inst1,false,text+" ");
break;
case Op_TauStInd: // stind
- for (uint32 i=0; i<2; i++) {
+ for (U_32 i=0; i<2; i++) {
inst1 = inst->getSrc(i)->getInst();
printOriginObjects(inst1,false,text+" ");
}
break;
default:
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst1 = inst->getSrc(i)->getInst();
printOriginObjects(inst1,false,text+" ");
}
@@ -2696,9 +2696,9 @@
os << " MethodInst" << std::endl;
MethodDesc* md=inst->asMethodInst()->getMethodDesc();
logMethod(md);
- uint32 n=md->getNumParams();
+ U_32 n=md->getNumParams();
os << " Params " << n << std::endl;
- for (uint32 i = 0; i < n; i++) {
+ for (U_32 i = 0; i < n; i++) {
Type* tt = md->getParamType(i);
os << " << "<<i<<" >> " << tt->getName() <<" "<< tt->tag<< std::endl;
os << " isObject " << tt->isObject();
@@ -2747,7 +2747,7 @@
EscAnalyzer::debug_inst_info(Inst* inst,::std::ostream& os) {
Opnd* dst;
Opnd* src;
- uint32 nsrc;
+ U_32 nsrc;
os << " =="; inst->print(os); os << std::endl;
if (verboseLog) {
@@ -2769,7 +2769,7 @@
os << std::endl;
if ( nsrc != 0 ) {
os << " sources" << std::endl;
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
src=inst->getSrc(i);
os << " <<" <<i<<">> ";
debug_opnd_info(src, os);
@@ -2816,7 +2816,7 @@
void
EscAnalyzer::addMonInst(Inst* inst) {
- uint32 monOpndId = inst->getSrc(0)->getId();
+ U_32 monOpndId = inst->getSrc(0)->getId();
MonUnit* monUnit = NULL;
monUnit = findMonUnit(monOpndId);
if (monUnit == NULL) {
@@ -2831,7 +2831,7 @@
EscAnalyzer::MonUnit*
-EscAnalyzer::findMonUnit(uint32 opndId) {
+EscAnalyzer::findMonUnit(U_32 opndId) {
MonInstUnits::iterator it;
assert(monitorInstUnits != NULL);
for (it = monitorInstUnits->begin( ); it != monitorInstUnits->end( ); it++ ) {
@@ -2895,8 +2895,8 @@
Insts* syncInsts;
Insts* vcInsts;
CnGNode* node;
- uint32 checkedState = 0;
- uint32 nState = 0;
+ U_32 checkedState = 0;
+ U_32 nState = 0;
bool to_fix_ssa = false;
BitSet fgnodes(eaMemManager,irManager.getFlowGraph().getMaxNodeId());
@@ -2975,7 +2975,7 @@
}
if (getVirtualCall(node)!=0) {
if (checkedState > GLOBAL_ESCAPE && do_sync_removal_vc) {
- uint32 bs_size = irManager.getFlowGraph().getMaxNodeId();
+ U_32 bs_size = irManager.getFlowGraph().getMaxNodeId();
if (fgnodes.getSetSize() < bs_size) {
fgnodes.resizeClear(bs_size);
} else {
@@ -3127,12 +3127,12 @@
} // markLockedNodes2(BitSet* bs, Insts* syncInsts)
-uint32
-EscAnalyzer::checkState(Inst* inst,uint32 st) {
- uint32 st1;
+U_32
+EscAnalyzer::checkState(Inst* inst,U_32 st) {
+ U_32 st1;
Inst* inst1;
Opnd* opnd1;
- uint32 nsrc=inst->getNumSrcOperands();
+ U_32 nsrc=inst->getNumSrcOperands();
if (st <= GLOBAL_ESCAPE)
return st;
@@ -3187,7 +3187,7 @@
if (st <= GLOBAL_ESCAPE)
return st;
scannedObjs->push_back(inst->getId());
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
opnd1 = inst->getSrc(i);
if (opnd1->isVarOpnd()) {
inst1 = opnd1->asVarOpnd()->getVarAccessInsts();
@@ -3202,7 +3202,7 @@
}
scannedObjs->pop_back();
return st;
-} // checkState(Inst* inst,uint32 st)
+} // checkState(Inst* inst,U_32 st)
void
@@ -3310,7 +3310,7 @@
void
-EscAnalyzer::insertFlagCheck(Insts* syncInsts, Opnd* muflag, uint32 chk) {
+EscAnalyzer::insertFlagCheck(Insts* syncInsts, Opnd* muflag, U_32 chk) {
Insts::iterator inst_it;
OpndManager& _opndManager = irManager.getOpndManager();
InstFactory& _instFactory = irManager.getInstFactory();
@@ -3373,7 +3373,7 @@
if (verboseLog) {
Log::out() << "=-=-=-=- Finish w3" << std::endl;
}
-} // insertFlagCheck(Insts* syncInsts, Opnd* muflag, uint32 chk)
+} // insertFlagCheck(Insts* syncInsts, Opnd* muflag, U_32 chk)
void
@@ -3531,7 +3531,7 @@
CnGNode* aanode = NULL;
MethodPtrType* mpt = NULL;
CalleeMethodInfo* mtdInfo = NULL;
- uint32 callee_state = 0;
+ U_32 callee_state = 0;
node = (*it);
if (node->nodeType == NT_ACTARG && node->argNumber == 0) {
@@ -3639,7 +3639,7 @@
SsaTmpOpnd*
-EscAnalyzer::insertLdConst(uint32 value) {
+EscAnalyzer::insertLdConst(U_32 value) {
TypeManager& _typeManager = irManager.getTypeManager();
Type* typeInt32 = _typeManager.getInt32Type();
OpndManager& _opndManager = irManager.getOpndManager();
@@ -3661,7 +3661,7 @@
if (value == 0)
return i32_0;
return i32_1;
-} // insertLdConst(uint32 value)
+} // insertLdConst(U_32 value)
@@ -3672,7 +3672,7 @@
void
EscAnalyzer::scanLocalObjects() {
CnGNodes::iterator it;
- uint32 lo_count=0; // number of local objects
+ U_32 lo_count=0; // number of local objects
ObjIds* lnoids = NULL; // list of new opnds to optimize
ObjIds* lloids = NULL; // list of load opnds to optimize
ObjIds::iterator lo_it;
@@ -3799,8 +3799,8 @@
void
EscAnalyzer::scanEscapedObjects() {
CnGNodes::iterator it;
- uint32 vco_count=0; // number of local objects
- uint32 ob_ref_type=0; // object ref type
+ U_32 vco_count=0; // number of local objects
+ U_32 ob_ref_type=0; // object ref type
ObjIds* lnoids = NULL; // list of CnG node Ids for new opnds to optimize
ObjIds* lloids = NULL; // list of CnG node Ids for load opnds to optimize
ObjIds::iterator lo_it;
@@ -4137,14 +4137,14 @@
}
continue;
}
- uint32 nsrc = phi->getNumSrcOperands();
+ U_32 nsrc = phi->getNumSrcOperands();
if (nsrc > 2) {
if (verboseLog) {
os_sc << " doEO 3" << std::endl;
}
continue;
}
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst = phi->getSrc(i)->getInst();
if (verboseLog) {
os_sc << " doEO phi "; inst->print(os_sc);
@@ -4247,7 +4247,7 @@
Inst* lobj_inst = NULL; // load opnd inst for ldvar opnd
VarOpnd* ob_var_opnd = _opndManager.createVarOpnd(nobj_inst->getDst()->getType(), false);
SsaTmpOpnd* ob_init_opnd = _opndManager.createSsaTmpOpnd(ob_var_opnd->getType());
- uint32 ob_id = onode->opndId;
+ U_32 ob_id = onode->opndId;
Insts::iterator itvc;
ScObjFlds::iterator ito;
Node* node_no = nobj_inst->getNode();
@@ -4375,9 +4375,9 @@
if (phi->getOpcode() != Op_Phi) {
assert(0);
}
- uint32 nsrc = phi->getNumSrcOperands();
+ U_32 nsrc = phi->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst = phi->getSrc(i)->getInst();
removeInst(inst);
}
@@ -4466,7 +4466,7 @@
void
-EscAnalyzer::collectCallInsts(uint32 n, Insts* vc_insts, ObjIds* vcids) {
+EscAnalyzer::collectCallInsts(U_32 n, Insts* vc_insts, ObjIds* vcids) {
CnGEdges::iterator ite;
CnGRefs::iterator it2;
@@ -4476,7 +4476,7 @@
for (it2 = (*ite)->refList->begin( ); it2 != (*ite)->refList->end( ); it2++ ) {
if ((*it2)->cngNodeTo->cngNodeId == n) {
Inst* ii=(*ite)->cngNodeFrom->nInst;
- uint32 opc = ii->getOpcode();
+ U_32 opc = ii->getOpcode();
if (opc == Op_IndirectMemoryCall || opc == Op_DirectCall) {
if (!checkScanned(vcids,ii->getId())) {
vc_insts->push_back(ii);
@@ -4493,7 +4493,7 @@
EscAnalyzer::scalarizeOFldUsage(ScObjFld* scfld) {
Insts* sl_insts = scfld->ls_insts;
VarOpnd* fl_var_opnd = scfld->fldVarOpnd;
- uint32 nsrco = 0;
+ U_32 nsrco = 0;
Inst* inst_ad;
Inst* st_ld_var_inst;
Inst* st_ld_inst;
@@ -4552,8 +4552,8 @@
Inst *headInst = (Inst*)node->getFirstInst();
Opnd* opnd;
for (Inst* inst=headInst->getNextInst();inst!=NULL;inst=inst->getNextInst()) {
- uint32 nsrc = inst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc = inst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
if (!(opnd=inst->getSrc(i))->isSsaOpnd()) { // check ssa operands
if (verboseLog) {
os_sc << " not ssa opnd " << i << " ";
@@ -4561,7 +4561,7 @@
}
continue;
}
- uint32 opcode=inst->getOpcode();
+ U_32 opcode=inst->getOpcode();
if (checkScanned(lnoids,opnd->getId())) {
if (verboseLog) {
os_sc << " no "; FlowGraph::printLabel(os_sc,inst->getNode());
@@ -4635,8 +4635,8 @@
const Nodes& nodes = irManager.getFlowGraph().getNodes();
Nodes::const_iterator niter;
bool maydo = true;
- uint32 tau_opnd_id = tau_inst->getDst()->getId();
- uint32 sc_opnd_id = tau_inst->getSrc(0)->getId();
+ U_32 tau_opnd_id = tau_inst->getDst()->getId();
+ U_32 sc_opnd_id = tau_inst->getSrc(0)->getId();
Inst* inst1;
if (verboseLog) {
@@ -4653,12 +4653,12 @@
inst->print(os_sc); os_sc << std::endl;
}
}
- uint32 nsrc = inst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc = inst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
if (!(opnd=inst->getSrc(i))->isSsaOpnd()) // check ssa operands
continue;
if (opnd->getId()==tau_opnd_id) {
- uint32 opcode=inst->getOpcode();
+ U_32 opcode=inst->getOpcode();
if (verboseLog) {
os_sc << " "; FlowGraph::printLabel(os_sc,inst->getNode());
os_sc << " "; inst->print(os_sc); os_sc << std::endl;
@@ -4667,7 +4667,7 @@
}
}
if (opcode == Op_IndirectMemoryCall || opcode == Op_DirectCall) {
- for (uint32 i1=0; i1<nsrc; i1++) {
+ for (U_32 i1=0; i1<nsrc; i1++) {
if (inst->getSrc(i)->getId() == sc_opnd_id)
break;
if (i1 == nsrc) {
@@ -4701,11 +4701,11 @@
bool
-EscAnalyzer::checkOpndUsage(uint32 lobjid) {
+EscAnalyzer::checkOpndUsage(U_32 lobjid) {
const Nodes& nodes = irManager.getFlowGraph().getNodes();
Nodes::const_iterator niter;
bool maydo = true;
- uint32 n_used = 0;
+ U_32 n_used = 0;
if (verboseLog) {
os_sc << " -------- Used in " << std::endl;
@@ -4721,13 +4721,13 @@
inst->print(os_sc); os_sc << std::endl;
}
}
- uint32 nsrc = inst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc = inst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
if (!(opnd=inst->getSrc(i))->isSsaOpnd()) // check ssa operands
continue;
if (opnd->getId()==lobjid) {
n_used++;
- uint32 opcode=inst->getOpcode();
+ U_32 opcode=inst->getOpcode();
if (verboseLog) {
os_sc << " "; FlowGraph::printLabel(os_sc,inst->getNode());
os_sc << " "; inst->print(os_sc); os_sc << std::endl;
@@ -4748,24 +4748,24 @@
os_sc << " -------- opnd used: " << n_used << " maydo " << maydo << std::endl;
}
return maydo;
-} // checkOpndUsage(uint32 lobjid)
+} // checkOpndUsage(U_32 lobjid)
EscAnalyzer::CnGNode*
EscAnalyzer::checkCnGtoScalarize(CnGNode* scnode, bool check_loc) {
- uint32 ob_ref_type=0; // object ref type
- uint32 ob_fld_count=0; // number of object references to fields
- uint32 ob_fin_fld_count=0; // number of object references to final fields
- uint32 ob_nfld_count=0; // number of object references to not a field
- uint32 ref_to_obj_count=0; // number references to object
- uint32 vcall_count=0; // number of virtual calls
- uint32 call_count=0; // number of calls
- uint32 ob_fld_stind_count=0; // number of stores in object field
- uint32 ob_fld_ldind_count=0; // number of loads from object field
- uint32 ob_fld_field_count=0; // number of fields of object field
- uint32 ob_fld_unkn_count=0; // number of unknown references of object field
- uint32 ob_fld_usage_count=0; // number of object field usage
- uint32 ob_stvar_count=0; // number of object stvar
+ U_32 ob_ref_type=0; // object ref type
+ U_32 ob_fld_count=0; // number of object references to fields
+ U_32 ob_fin_fld_count=0; // number of object references to final fields
+ U_32 ob_nfld_count=0; // number of object references to not a field
+ U_32 ref_to_obj_count=0; // number references to object
+ U_32 vcall_count=0; // number of virtual calls
+ U_32 call_count=0; // number of calls
+ U_32 ob_fld_stind_count=0; // number of stores in object field
+ U_32 ob_fld_ldind_count=0; // number of loads from object field
+ U_32 ob_fld_field_count=0; // number of fields of object field
+ U_32 ob_fld_unkn_count=0; // number of unknown references of object field
+ U_32 ob_fld_usage_count=0; // number of object field usage
+ U_32 ob_stvar_count=0; // number of object stvar
bool storeId = false;
CnGRefs::iterator it1;
CnGRefs::iterator it2;
@@ -4773,7 +4773,7 @@
CnGNode* nf = NULL;
CnGNode* vnode = NULL;
CnGNode* rnode = scnode;
- uint32 scnode_type = scnode->nodeType;
+ U_32 scnode_type = scnode->nodeType;
ob_ref_type = scnode->nodeRefType; // object ref type
if (!check_loc && (ob_ref_type != NR_REF))
@@ -4867,7 +4867,7 @@
if (verboseLog) {
os_sc << " -------- end - Ref from node " << std::endl;
}
- uint32 n=scnode->cngNodeId;
+ U_32 n=scnode->cngNodeId;
if (verboseLog) {
os_sc << " -------- begin - Ref to node " << scnode->cngNodeId << " - "
@@ -4877,7 +4877,7 @@
for (it2 = (*ite)->refList->begin( ); it2 != (*ite)->refList->end( ); it2++ ) {
if ((*it2)->cngNodeTo->cngNodeId == n) {
Inst* ii=(*ite)->cngNodeFrom->nInst;
- uint32 opc = ii->getOpcode();
+ U_32 opc = ii->getOpcode();
if (opc == Op_IndirectMemoryCall || opc == Op_DirectCall) {
if (opc == Op_IndirectMemoryCall)
vcall_count++;
@@ -5048,7 +5048,7 @@
double prob = 0;
Node* node = nob_inst->getNode();
Opnd* objOpnd = nob_inst->getDst();
- uint32 objId = objOpnd ->getId();
+ U_32 objId = objOpnd ->getId();
if (verboseLog) {
os_sc << " -------- Find local path for "; FlowGraph::printLabel(os_sc,node);
@@ -5076,7 +5076,7 @@
double
-EscAnalyzer::checkNextNodes(Node* n, uint32 obId, double cprob) {
+EscAnalyzer::checkNextNodes(Node* n, U_32 obId, double cprob) {
Node* node = n;
Inst *headInst = (Inst*)node->getFirstInst();
Opnd* opnd;
@@ -5109,8 +5109,8 @@
}
for (Inst* inst=headInst->getNextInst();inst!=NULL;inst=inst->getNextInst()) {
if (inst->getOpcode()==Op_IndirectMemoryCall || inst->getOpcode()==Op_DirectCall) {
- uint32 nsrc = inst->getNumSrcOperands();
- for (uint32 i=0; i<nsrc; i++) {
+ U_32 nsrc = inst->getNumSrcOperands();
+ for (U_32 i=0; i<nsrc; i++) {
opnd=inst->getSrc(i);
if (opnd->getId()==obId) {
if (verboseLog) {
@@ -5153,11 +5153,11 @@
return r0;
return r;
-} // checkNextNodes(Node* n, uint32 obId, double cprob))
+} // checkNextNodes(Node* n, U_32 obId, double cprob))
void
-EscAnalyzer::restoreEOCreation(Insts* vc_insts, ScObjFlds* scObjFlds, VarOpnd* ob_var_opnd, uint32 oid) {
+EscAnalyzer::restoreEOCreation(Insts* vc_insts, ScObjFlds* scObjFlds, VarOpnd* ob_var_opnd, U_32 oid) {
Insts::iterator itvc;
InstFactory& _instFactory = irManager.getInstFactory();
ControlFlowGraph& fg = irManager.getFlowGraph();
@@ -5175,8 +5175,8 @@
for (itvc = vc_insts->begin( ); itvc != vc_insts->end( ); itvc++ ) {
Inst* vc = *itvc;
- uint32 i;
- uint32 nsrc = vc->getNumSrcOperands();
+ U_32 i;
+ U_32 nsrc = vc->getNumSrcOperands();
for (i=0; i<nsrc; i++) {
Opnd* opnd=vc->getSrc(i);
@@ -5204,14 +5204,14 @@
Inst* ldobj=_instFactory.makeLdVar(ob_opnd,ob_var_opnd);
ldobj->insertBefore(vc);
// reset call inst parameters
- for (uint32 i1=0; i1<nsrc; i1++) {
+ for (U_32 i1=0; i1<nsrc; i1++) {
if (vc->getSrc(i1)->getId()==oid) {
vc->setSrc(i1,ob_opnd );
}
if (Type::isTau(vc->getSrc(i1)->getType()->tag)) {
Inst* tau_inst = NULL;
Insts::iterator iit;
- uint32 to_id = vc->getSrc(i1)->getId();
+ U_32 to_id = vc->getSrc(i1)->getId();
for (iit=checkInsts->begin(); iit!=checkInsts->end(); iit++) {
if ((*iit)->getDst()->isNull()) {
continue;
@@ -5221,7 +5221,7 @@
}
Inst* ti = *iit;
- uint32 ti_oc = ti->getOpcode();
+ U_32 ti_oc = ti->getOpcode();
if (ti_oc == Op_TauCheckNull || ti_oc == Op_TauIsNonNull || ti_oc == Op_TauHasType) {
tau_inst = NULL;
SsaTmpOpnd* to = _opndManager.createSsaTmpOpnd(_typeManager.getTauType());
@@ -5419,14 +5419,14 @@
} // removeInst(Inst* reminst)
void
-EscAnalyzer::fixMethodEndInsts(uint32 ob_id) {
+EscAnalyzer::fixMethodEndInsts(U_32 ob_id) {
Insts::iterator itmei;
InstFactory& _instFactory = irManager.getInstFactory();
OpndManager& _opndManager = irManager.getOpndManager();
for (itmei = methodEndInsts->begin( ); itmei != methodEndInsts->end( ); itmei++ ) {
Inst* mei = *itmei;
- uint32 i = 0;
- uint32 nsrc = mei->getNumSrcOperands();
+ U_32 i = 0;
+ U_32 nsrc = mei->getNumSrcOperands();
if (nsrc == 0)
continue;
@@ -5450,7 +5450,7 @@
os_sc << "++++ " << std::endl;
}
}
-} // fixMethodEndInsts(uint32 ob_id)
+} // fixMethodEndInsts(U_32 ob_id)
EscAnalyzer::CnGNode*
@@ -5472,7 +5472,7 @@
bool
EscAnalyzer::checkVVarSrcs(Inst* inst) {
Inst* inst1;
- uint32 nsrc=inst->getNumSrcOperands();
+ U_32 nsrc=inst->getNumSrcOperands();
std::string text = " checkVVS ";
bool res = true;
@@ -5548,13 +5548,13 @@
res = checkVVarSrcs(inst1);
break;
case Op_TauStInd: // stind
- for (uint32 i=0; i<2; i++) {
+ for (U_32 i=0; i<2; i++) {
inst1 = inst->getSrc(i)->getInst();
res = checkVVarSrcs(inst1);
}
break;
default:
- for (uint32 i=0; i<nsrc; i++) {
+ for (U_32 i=0; i<nsrc; i++) {
inst1 = inst->getSrc(i)->getInst();
bool res1 = checkVVarSrcs(inst1);
res = res && res1;
@@ -5606,7 +5606,7 @@
void
-EscAnalyzer::fixCheckInsts(uint32 opId) {
+EscAnalyzer::fixCheckInsts(U_32 opId) {
Insts::iterator iit;
Edge* excedge;
@@ -5622,7 +5622,7 @@
os_sc << " ** "; (*iit)->print(os_sc); os_sc << std::endl;
}
Inst* inst = (*iit);
- uint32 opcode = inst->getOpcode();
+ U_32 opcode = inst->getOpcode();
if (opcode == Op_Branch) {
excedge = NULL;
if (inst->getComparisonModifier()==Cmp_Zero) {
@@ -5653,7 +5653,7 @@
removeInst(inst);
}
}
-} // fixCheckInsts(uint32 opId)
+} // fixCheckInsts(U_32 opId)
void
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h Thu May 22 06:33:38 2008
@@ -58,7 +58,7 @@
void doAnalysis();
// read from command line to output debug information
- uint32 allProps;
+ U_32 allProps;
private:
/**
@@ -94,49 +94,49 @@
NT_OBJS = NT_OBJECT|NT_RETVAL|NT_LDOBJ //for findCnGNode_op
};
// CnG node reference types
- static const uint32 NR_PRIM = 0;
- static const uint32 NR_REF = 1;
- static const uint32 NR_ARR = 2;
- static const uint32 NR_REFARR = 3;
+ static const U_32 NR_PRIM = 0;
+ static const U_32 NR_REF = 1;
+ static const U_32 NR_ARR = 2;
+ static const U_32 NR_REFARR = 3;
// CnG edge types
- static const uint32 ET_POINT = 1; // Op_TauLdInd (loaded value)
- static const uint32 ET_DEFER = 2;
- static const uint32 ET_FIELD = 3; // Op_LdFieldAddr (object field), Op_AddScaledIndex
+ static const U_32 ET_POINT = 1; // Op_TauLdInd (loaded value)
+ static const U_32 ET_DEFER = 2;
+ static const U_32 ET_FIELD = 3; // Op_LdFieldAddr (object field), Op_AddScaledIndex
// CG node states
- static const uint32 GLOBAL_ESCAPE = 1;
- static const uint32 ARG_ESCAPE = 2;
- static const uint32 NO_ESCAPE = 3;
- static const uint32 ESC_MASK = 3;
- static const uint32 BIT_MASK = 56;
- static const uint32 LOOP_CREATED = 8;
- static const uint32 OUT_ESCAPED = 16;
- static const uint32 VIRTUAL_CALL = 32;
+ static const U_32 GLOBAL_ESCAPE = 1;
+ static const U_32 ARG_ESCAPE = 2;
+ static const U_32 NO_ESCAPE = 3;
+ static const U_32 ESC_MASK = 3;
+ static const U_32 BIT_MASK = 56;
+ static const U_32 LOOP_CREATED = 8;
+ static const U_32 OUT_ESCAPED = 16;
+ static const U_32 VIRTUAL_CALL = 32;
struct CnGNode;
struct CnGRef {
CnGNode* cngNodeTo;
- uint32 edgeType;
+ U_32 edgeType;
Inst* edgeInst;
};
typedef StlList<CnGRef*> CnGRefs;
typedef StlList<Inst*> Insts;
- typedef StlList<uint32> NodeMDs;
+ typedef StlList<U_32> NodeMDs;
// connection graph node structure
struct CnGNode {
- uint32 cngNodeId; // CnG node id
- uint32 opndId; // opnd id (0 for NT_ACTARG)
+ U_32 cngNodeId; // CnG node id
+ U_32 opndId; // opnd id (0 for NT_ACTARG)
void* refObj; // MethodDesc* for NT_ACTARG, Inst* for fields, Opnd* for others
- uint32 nodeType; // CnG node types
- uint32 nodeRefType; // CnG node reference types
- uint32 instrId;
+ U_32 nodeType; // CnG node types
+ U_32 nodeRefType; // CnG node reference types
+ U_32 instrId;
CnGNode* lNode; // ldind from lNode for ldflda & ldsflda
- uint32 state; // escape state
+ U_32 state; // escape state
NodeMDs* nodeMDs; // list of NT_ACTARG nodes
Inst* nInst; // ref to inst
- uint32 argNumber; // number of arg for NT_DEFARG & NT_ACTARG (0 for others)
+ U_32 argNumber; // number of arg for NT_DEFARG & NT_ACTARG (0 for others)
CnGRefs* outEdges; // cngNode out edges
};
@@ -151,13 +151,13 @@
struct InstFld {
MemberIdent* fldIdent;
- uint32 state;
+ U_32 state;
InstFlds* instFlds; // contained instance fields
};
struct ParamInfo {
- uint32 paramNumber;
- uint32 state;
+ U_32 paramNumber;
+ U_32 state;
InstFlds* instFlds; // contained instance fields
};
@@ -166,10 +166,10 @@
// structure of saved by EA information about compiled method
struct CalleeMethodInfo {
MemberIdent* methodIdent;
- uint32 numberOfArgs;
- uint32 properties; // native, final, virtual ...
+ U_32 numberOfArgs;
+ U_32 properties; // native, final, virtual ...
ParamInfos* paramInfos;
- uint32 retValueState;
+ U_32 retValueState;
bool mon_on_this;
};
@@ -187,7 +187,7 @@
// list of connection graph edges definition
typedef StlList<CnGEdge*> CnGEdges;
// list of object Ids definition
- typedef StlList<uint32> ObjIds;
+ typedef StlList<U_32> ObjIds;
static CalleeMethodInfos* calleeMethodInfos;
@@ -222,14 +222,14 @@
Insts* exam2Insts;
// maximum level to analyze callee methods (from command line or default set)
- uint32 maxMethodExamLevel;
+ U_32 maxMethodExamLevel;
// set level for escape analysis
- uint32 method_ea_level;
+ U_32 method_ea_level;
- uint32 lastCnGNodeId;
- uint32 curMDNode;
+ U_32 lastCnGNodeId;
+ U_32 curMDNode;
int defArgNumber;
- uint32 initNodeType; // type of initial scanned node
+ U_32 initNodeType; // type of initial scanned node
// lists to help do CFG scan
ObjIds *scannedObjs;
@@ -273,7 +273,7 @@
* @param ntype - CnG node type.
* @return created CnGnode.
*/
- CnGNode* addCnGNode(Inst* inst, Type* type, uint32 ntype);
+ CnGNode* addCnGNode(Inst* inst, Type* type, U_32 ntype);
/**
* Creates new CnG node for specified instruction dst operand.
@@ -282,7 +282,7 @@
* @param ntype - CnG node type.
* @return created CnGnode.
*/
- CnGNode* addCnGNode_op(Inst* inst, Type* type, uint32 ntype);
+ CnGNode* addCnGNode_op(Inst* inst, Type* type, U_32 ntype);
/**
* Creates new CnG node for specified call instruction argument.
@@ -292,7 +292,7 @@
* @param narg - method argument.
* @return created CnGnode.
*/
- CnGNode* addCnGNode_mp(Inst* inst, MethodPtrType* mpt, uint32 ntype, uint32 narg);
+ CnGNode* addCnGNode_mp(Inst* inst, MethodPtrType* mpt, U_32 ntype, U_32 narg);
/**
* Creates new CnG node for specified return or throw instruction.
@@ -300,7 +300,7 @@
* @param ntype - CnG node type.
* @return created CnGnode.
*/
- CnGNode* addCnGNode_ex(Inst* inst, uint32 ntype);
+ CnGNode* addCnGNode_ex(Inst* inst, U_32 ntype);
/**
* Creates new field CnG node for specified instruction.
@@ -308,28 +308,28 @@
* @param ntype - CnG node type.
* @return created CnGnode.
*/
- CnGNode* addCnGNode_fl(Inst* inst, uint32 ntype);
+ CnGNode* addCnGNode_fl(Inst* inst, U_32 ntype);
/**
* Finds CnG node for specified operand Id.
* @param nId - operand Id.
* @return found CnGnode, or <code>NULL</code>.
*/
- CnGNode* findCnGNode_op(uint32 nId);
+ CnGNode* findCnGNode_op(U_32 nId);
/**
* Finds CnG node for specified CnG node Id.
* @param nId - CnG node Id.
* @return found CnGnode, or <code>NULL</code>.
*/
- CnGNode* findCnGNode_id(uint32 nId);
+ CnGNode* findCnGNode_id(U_32 nId);
/**
* Finds CnG node for specified instruction Id.
* @param nId - instruction Id.
* @return found CnGnode, or <code>NULL</code>.
*/
- CnGNode* findCnGNode_in(uint32 nId);
+ CnGNode* findCnGNode_in(U_32 nId);
/**
* Finds NT_ACTARG CnG node for specified instruction Id and argument number.
@@ -337,7 +337,7 @@
* @param aId - argument number.
* @return found CnGnode, or <code>NULL</code>.
*/
- CnGNode* findCnGNode_mp(uint32 iId, uint32 aId);
+ CnGNode* findCnGNode_mp(U_32 iId, U_32 aId);
/**
* Finds field CnG node for specified instruction and CnG node type.
@@ -345,7 +345,7 @@
* @param ntype - CnG node type.
* @return found CnGnode, or <code>NULL</code>.
*/
- CnGNode* findCnGNode_fl(Inst* inst, uint32 ntype);
+ CnGNode* findCnGNode_fl(Inst* inst, U_32 ntype);
/**
* Creates new CnG edge for specified instruction, adds it to cngEdges and
@@ -356,7 +356,7 @@
* @param inst - instruction.
* @return created CnGnode.
*/
- void addEdge(CnGNode* cgnfrom, CnGNode* cgnto, uint32 etype, Inst* inst);
+ void addEdge(CnGNode* cgnfrom, CnGNode* cgnto, U_32 etype, Inst* inst);
/**
* Sets escape state for method created objects.
@@ -433,7 +433,7 @@
* @param np - parameter number.
* @return specified parameter state.
*/
- uint32 getMethodParamState(CalleeMethodInfo* mi, uint32 np);
+ U_32 getMethodParamState(CalleeMethodInfo* mi, U_32 np);
/**
* Collects instructions creating objects that are not GLOBAL_ESCAPE.
@@ -566,7 +566,7 @@
void debug_opnd_info(Opnd* opnd,::std::ostream& os);
- bool checkScanned(ObjIds* ids, uint32 id) {
+ bool checkScanned(ObjIds* ids, U_32 id) {
ObjIds::iterator it;
if (ids == NULL) {
return false;
@@ -578,24 +578,24 @@
}
return false;
}
- bool checkScannedObjs(uint32 id) {return checkScanned(scannedObjs, id);}
- bool checkScannedObjsRev(uint32 id) {return checkScanned(scannedObjsRev, id);}
- bool checkScannedInsts(uint32 id) {return checkScanned(scannedInsts, id);}
- bool checkScannedSucNodes(uint32 id) {return checkScanned(scannedSucNodes, id);}
+ bool checkScannedObjs(U_32 id) {return checkScanned(scannedObjs, id);}
+ bool checkScannedObjsRev(U_32 id) {return checkScanned(scannedObjsRev, id);}
+ bool checkScannedInsts(U_32 id) {return checkScanned(scannedInsts, id);}
+ bool checkScannedSucNodes(U_32 id) {return checkScanned(scannedSucNodes, id);}
- uint32 getEscState(CnGNode* n) {
+ U_32 getEscState(CnGNode* n) {
return (n->state)&ESC_MASK;
}
- void setEscState(CnGNode* n, uint32 st) {
+ void setEscState(CnGNode* n, U_32 st) {
n->state = ((n->state)&BIT_MASK)+st;
}
- uint32 getFullState(CnGNode* n) {
+ U_32 getFullState(CnGNode* n) {
return n->state;
}
- void setFullState(CnGNode* n, uint32 st) {
+ void setFullState(CnGNode* n, U_32 st) {
n->state = st;
}
- uint32 getLoopCreated(CnGNode* n) {
+ U_32 getLoopCreated(CnGNode* n) {
return (n->state)&LOOP_CREATED;
}
void setLoopCreated(CnGNode* n) {
@@ -604,7 +604,7 @@
void remLoopCreated(CnGNode* n) {
n->state = (n->state|LOOP_CREATED)^LOOP_CREATED;
}
- uint32 getOutEscaped(CnGNode* n) {
+ U_32 getOutEscaped(CnGNode* n) {
return (n->state)&OUT_ESCAPED;
}
void setOutEscaped(CnGNode* n) {
@@ -613,7 +613,7 @@
void remOutEscaped(CnGNode* n) {
n->state = (n->state|OUT_ESCAPED)^OUT_ESCAPED;
}
- uint32 getVirtualCall(CnGNode* n) {
+ U_32 getVirtualCall(CnGNode* n) {
return (n->state)&VIRTUAL_CALL;
}
void setVirtualCall(CnGNode* n) {
@@ -625,15 +625,15 @@
void printState(CnGNode* n,::std::ostream& os=Log::out()) {
os << getEscState(n) << " (" << (getFullState(n)>>3) << ")";
}
- void printState(uint32 st,::std::ostream& os=Log::out()) {
+ void printState(U_32 st,::std::ostream& os=Log::out()) {
os << (st&ESC_MASK) << " (" << (st>>3) << ")";
}
- bool isGlobalState(uint32 state) {
+ bool isGlobalState(U_32 state) {
if ((state&ESC_MASK)==GLOBAL_ESCAPE||(state&VIRTUAL_CALL)!=0)
return true;
return false;
}
- bool isStateNeedGEFix(uint32 state, uint32 nType) {
+ bool isStateNeedGEFix(U_32 state, U_32 nType) {
if ((state&ESC_MASK)==GLOBAL_ESCAPE)
return false;
if ((state&OUT_ESCAPED)!=0 && initNodeType != NT_STFLD)
@@ -646,7 +646,7 @@
// Monitors elimination optimization
struct MonUnit {
- uint32 opndId;
+ U_32 opndId;
Insts* monInsts;
Insts* icallInsts;
};
@@ -665,7 +665,7 @@
* @param opndId - monitor instruction operand Id.
* @return <code>MonUnit</code>, if found, or <code>NULL</code> otherwise.
*/
- MonUnit* findMonUnit(uint32 opndId);
+ MonUnit* findMonUnit(U_32 opndId);
/**
* Adds call instruction to the specified monitor unit.
@@ -710,7 +710,7 @@
* <code>ARG_ESCAPE</code>, if any of source operand state or st is <code>ARG_ESCAPE</code>,
* <code>NO_ESCAPE</code> otherwise.
*/
- uint32 checkState(Inst* inst,uint32 st);
+ U_32 checkState(Inst* inst,U_32 st);
/**
* Checks if CnGNode operand is GLOBAL_ESCAPED while monitor instructions are executed.
@@ -745,7 +745,7 @@
* @param chk - value to check with (0 or 1),
* @param muflag - monitor flag operand (VarOpnd* or SsaTmpOpnd*).
*/
- void insertFlagCheck(Insts* syncInsts, Opnd* muflag, uint32 chk);
+ void insertFlagCheck(Insts* syncInsts, Opnd* muflag, U_32 chk);
/**
* Removes monitor instructions from the specified monitor instruction list.
@@ -800,7 +800,7 @@
* @return i32_0, if value = 0
* i32_1, if value = 1
*/
- SsaTmpOpnd* insertLdConst(uint32 value);
+ SsaTmpOpnd* insertLdConst(U_32 value);
@@ -855,7 +855,7 @@
* @param vc_insts - list of call instructions,
* @param vcids - list of call instructions ids.
*/
- void collectCallInsts(uint32 n, Insts* vc_insts, ObjIds* vcids);
+ void collectCallInsts(U_32 n, Insts* vc_insts, ObjIds* vcids);
/**
* Performs scalar replacement optimization for optimized object field usage.
@@ -887,7 +887,7 @@
* @return <code>true</code> if an object is used only in ldflda or ldbase instructions;
* <code>false<code> otherwise.
*/
- bool checkOpndUsage(uint32 lobjid);
+ bool checkOpndUsage(U_32 lobjid);
/**
* Performs checks for CnGNode operand using connection graph.
@@ -917,7 +917,7 @@
* @return <code>execCount</code> the most value of <code>execCount</code> and
* checkNextNodes execution for next after n node.
*/
- double checkNextNodes(Node* n, uint32 obId, double cExecCount);
+ double checkNextNodes(Node* n, U_32 obId, double cExecCount);
/**
* Checks flag and creates object before call instruction (if it was not created yet).
@@ -926,7 +926,7 @@
* @param ob_var_opnd - varOpnd replacing optimized object,
* @param oid - escaped optimized object Id.
*/
- void restoreEOCreation(Insts* vc_insts, ScObjFlds* objs, VarOpnd* ob_var_opnd, uint32 oid);
+ void restoreEOCreation(Insts* vc_insts, ScObjFlds* objs, VarOpnd* ob_var_opnd, U_32 oid);
/**
* Removes specified instruction from ControlFlowGraph.
@@ -940,7 +940,7 @@
* for scalar replacement optimized object.
* @param ob_id - optimized object Id.
*/
- void fixMethodEndInsts(uint32 ob_id);
+ void fixMethodEndInsts(U_32 ob_id);
/**
* Finds (using connection graph) load varOpnd that should be optimized with
@@ -982,7 +982,7 @@
* Removes check instructions for optimized load varOpnd.
* @param ob_id - optimized load variable operand Id.
*/
- void fixCheckInsts(uint32 opId);
+ void fixCheckInsts(U_32 opId);
/**
* Checks (using connection graph) if CnGNode operand has final fields and scalarizes them.
@@ -994,7 +994,7 @@
void instrExam_processLdFieldAddr(Inst* inst);
void instrExam2_processLdFieldAddr(Inst* inst);
- static void getLdFieldAddrInfo(Inst* inst, Type*& type, uint32& nType);
+ static void getLdFieldAddrInfo(Inst* inst, Type*& type, U_32& nType);
};
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.cpp Thu May 22 06:33:38 2008
@@ -91,7 +91,7 @@
// Also, StVar instructions are assumed to escape until we have SSA form.
//
static bool
-isEscapingSrcObject(Inst* inst,uint32 srcIndex) {
+isEscapingSrcObject(Inst* inst,U_32 srcIndex) {
// only care about escapes of object types
Type* srcType = inst->getSrc(srcIndex)->getType();
if (srcType->isObject() == false && srcType->isManagedPtr() == false)
@@ -206,7 +206,7 @@
}
}
-uint32
+U_32
EscapeAnalyzer::doAnalysis() {
MemoryManager memManager("EscapeAnalyzer::doAnalysis");
StlDeque<Inst*> candidateSet(memManager);
@@ -236,7 +236,7 @@
if (isPotentiallyEscapingInst(inst) == false)
continue;
escapingInsts.setBit(inst->getId(),true);
- for (uint32 i=0; i<inst->getNumSrcOperands(); i++) {
+ for (U_32 i=0; i<inst->getNumSrcOperands(); i++) {
if (isEscapingSrcObject(inst,i) == false)
continue;
// src escapes
@@ -247,7 +247,7 @@
//
// Print out non-escaping instructions
//
- uint32 numTrapped = 0;
+ U_32 numTrapped = 0;
while (candidateSet.empty() == false) {
Inst* inst = candidateSet.front();
candidateSet.pop_front();
@@ -343,7 +343,7 @@
// this instruction creates a free ptr/ref
workList.push_back(inst);
}
- for (uint32 i=0; i<inst->getNumSrcOperands(); i++) {
+ for (U_32 i=0; i<inst->getNumSrcOperands(); i++) {
if (isRefOrPtrType(inst->getSrc(i))) {
workList.push_back(inst->getSrc(i)->getInst());
}
@@ -357,7 +357,7 @@
// this instruction creates a free ptr/ref
workList.push_back(inst);
}
- for (uint32 i=1; i<inst->getNumSrcOperands(); i++) {
+ for (U_32 i=1; i<inst->getNumSrcOperands(); i++) {
if (isRefOrPtrType(inst->getSrc(i))) {
workList.push_back(inst->getSrc(i)->getInst());
}
@@ -391,7 +391,7 @@
}
}
-uint32
+U_32
EscapeAnalyzer::doAggressiveAnalysis() {
//
// Initialization:
@@ -432,7 +432,7 @@
while (freeWorkList.empty() == false) {
freeWorkList.pop_front();
}
- uint32 numTrapped = 0;
+ U_32 numTrapped = 0;
return numTrapped;
}
@@ -449,7 +449,7 @@
}
void
-DefUseBuilder::addDefUse(Inst* defInst,Inst* useInst,uint32 srcIndex) {
+DefUseBuilder::addDefUse(Inst* defInst,Inst* useInst,U_32 srcIndex) {
DefUseLink* newLink = new (memoryManager) DefUseLink(useInst,srcIndex,NULL);
newLink->next = defUseTable[defInst];
defUseTable[defInst] = newLink;
@@ -457,7 +457,7 @@
void
DefUseBuilder::addUses(Inst* useInst) {
- for (uint32 i=0; i<useInst->getNumSrcOperands(); i++) {
+ for (U_32 i=0; i<useInst->getNumSrcOperands(); i++) {
SsaOpnd* opnd = useInst->getSrc(i)->asSsaOpnd();
if(opnd != NULL)
addDefUse(useInst->getSrc(i)->getInst(),useInst,i);
@@ -465,7 +465,7 @@
}
DefUseLink*
-DefUseBuilder::getDefUse(Inst* defInst, Inst* useInst, uint32 srcIndex) {
+DefUseBuilder::getDefUse(Inst* defInst, Inst* useInst, U_32 srcIndex) {
DefUseLink* duLink = defUseTable[defInst];
while(duLink != NULL) {
@@ -484,7 +484,7 @@
}
void
-DefUseBuilder::removeDefUse(Inst* defInst, Inst* useInst, uint32 srcIndex) {
+DefUseBuilder::removeDefUse(Inst* defInst, Inst* useInst, U_32 srcIndex) {
DefUseLink* duLink = defUseTable[defInst];
DefUseLink* prevLink = NULL;
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.h?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escapeanalyzer.h Thu May 22 06:33:38 2008
@@ -47,8 +47,8 @@
// Performs escape analysis and returns the number of instructions
// that do not escape.
//
- uint32 doAnalysis();
- uint32 doAggressiveAnalysis();
+ U_32 doAnalysis();
+ U_32 doAggressiveAnalysis();
private:
IRManager& irManager;
};
@@ -61,15 +61,15 @@
class DefUseLink {
public:
Inst* getUseInst() {return useInst;}
- uint32 getSrcIndex() {return srcIndex;}
+ U_32 getSrcIndex() {return srcIndex;}
DefUseLink* getNext() {return next;}
private:
- DefUseLink(Inst* use,uint32 index,DefUseLink* n)
+ DefUseLink(Inst* use,U_32 index,DefUseLink* n)
: useInst(use), srcIndex(index), next(n)
{
}
Inst* useInst;
- uint32 srcIndex;
+ U_32 srcIndex;
DefUseLink* next;
friend class DefUseBuilder;
};
@@ -85,12 +85,12 @@
}
void addUses(Inst* useInst);
- void addDefUse(Inst* defInst,Inst* srcInst,uint32 srcIndex);
+ void addDefUse(Inst* defInst,Inst* srcInst,U_32 srcIndex);
- DefUseLink* getDefUse(Inst* defInst,Inst* srcInst,uint32 srcIndex);
+ DefUseLink* getDefUse(Inst* defInst,Inst* srcInst,U_32 srcIndex);
void removeDef(Inst* defInst);
- void removeDefUse(Inst* defInst,Inst* srcInst,uint32 srcIndex);
+ void removeDefUse(Inst* defInst,Inst* srcInst,U_32 srcIndex);
private:
MemoryManager& memoryManager;
StlHashMap<Inst*,DefUseLink*> defUseTable;
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp Thu May 22 06:33:38 2008
@@ -84,7 +84,7 @@
StlHashSet<SsaOpnd*> _staticMap(mm);
#ifndef NDEBUG
- uint32 iterCount = 0;
+ U_32 iterCount = 0;
#endif
bool done = false;
while(!done) {
@@ -152,8 +152,8 @@
SsaOpnd* base = NULL;
bool isStatic = false;
bool isAmbiguous = false;
- uint32 nSrcs = phi->getNumSrcOperands();
- for(uint32 i = 0; i < nSrcs; ++i) {
+ U_32 nSrcs = phi->getNumSrcOperands();
+ for(U_32 i = 0; i < nSrcs; ++i) {
SsaVarOpnd* src = phi->getSrc(i)->asSsaVarOpnd();
assert(src != NULL);
if(_baseMap.find(src) != _baseMap.end()) {
@@ -259,10 +259,10 @@
InstFactory& instFactory = _irManager.getInstFactory();
if(ptrOp == Op_Phi) {
PhiInst* ptrPhi = ptrDef->asPhiInst();
- uint32 numOpnds = ptrPhi->getNumSrcOperands();
+ U_32 numOpnds = ptrPhi->getNumSrcOperands();
Opnd** newOpnds = new (_irManager.getMemoryManager()) Opnd*[numOpnds];
Inst* basePhi = instFactory.makePhi(baseSsa, numOpnds, newOpnds);
- for(uint32 i = 0; i < numOpnds; ++i)
+ for(U_32 i = 0; i < numOpnds; ++i)
basePhi->setSrc(i, insertVarDef(ptrPhi->getSrc(i)->asSsaVarOpnd()));
basePhi->insertBefore(ptrPhi);
} else {
@@ -300,7 +300,7 @@
StlVector<Node*>::reverse_iterator niter;
#ifndef NDEBUG
- uint32 k = 0;
+ U_32 k = 0;
#endif
bool done = false;
while(!done) {
@@ -367,8 +367,8 @@
bool rematerialize = false;
PhiInst* phi = inst->asPhiInst();
SsaOpnd* base = NULL;
- uint32 nSrcs = phi->getNumSrcOperands();
- for(uint32 i = 0; i < nSrcs; ++i) {
+ U_32 nSrcs = phi->getNumSrcOperands();
+ for(U_32 i = 0; i < nSrcs; ++i) {
SsaVarOpnd* src = phi->getSrc(i)->asSsaVarOpnd();
assert(src != NULL);
if(_baseMap.find(src) != _baseMap.end()) {
@@ -405,11 +405,11 @@
Opcode opcode = NumOpcodes;
FieldDesc* fieldDesc = NULL;
Type* elementType = NULL;
- uint32 numArgs = 0;
+ U_32 numArgs = 0;
StlVector<SsaTmpOpnd*> args(mm);
StlVector<Type*> argTypes(mm);
StlVector<SsaTmpOpnd*> defs(mm);
- for(uint32 i = 0; i < nSrcs; ++i) {
+ for(U_32 i = 0; i < nSrcs; ++i) {
SsaVarOpnd* src = phi->getSrc(i)->asSsaVarOpnd();
assert(src != NULL);
Inst* stVar = src->getInst();
@@ -439,7 +439,7 @@
default:
break;
}
- for(uint32 j = 0; j < numArgs; ++j) {
+ for(U_32 j = 0; j < numArgs; ++j) {
SsaTmpOpnd* arg = defInst->getSrc(j)->asSsaTmpOpnd();
assert(arg != NULL);
if(Log::isEnabled()) {
@@ -465,7 +465,7 @@
default:
break;
}
- for(uint32 j = 0; j < numArgs; ++j) {
+ for(U_32 j = 0; j < numArgs; ++j) {
SsaTmpOpnd* arg = defInst->getSrc(j)->asSsaTmpOpnd();
if(Log::isEnabled()) {
Log::out() << "Recording ";
@@ -483,7 +483,7 @@
OpndManager& opndManager = _irManager.getOpndManager();
InstFactory& instFactory = _irManager.getInstFactory();
Inst* last = inst;
- for(uint32 j = 0; j < numArgs; ++j) {
+ for(U_32 j = 0; j < numArgs; ++j) {
if(args[j] == NULL) {
VarOpnd* var = opndManager.createVarOpnd(argTypes[j], false);
if(Log::isEnabled()) {
@@ -493,7 +493,7 @@
}
SsaTmpOpnd* tmp = opndManager.createSsaTmpOpnd(argTypes[j]);
Opnd** phiArgs = new (_irManager.getMemoryManager()) Opnd*[nSrcs];
- for(uint32 i = 0; i < nSrcs; ++i) {
+ for(U_32 i = 0; i < nSrcs; ++i) {
SsaTmpOpnd* def = defs[i];
Inst* defInst = def->getInst();
SsaVarOpnd* ssaVar = opndManager.createSsaVarOpnd(var);
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp Thu May 22 06:33:38 2008
@@ -250,8 +250,8 @@
Log::out() << " Inst is not a Phi, processing operands" << std::endl;
}
// for others, record uses in this instruction
- uint32 numSrcs = i->getNumSrcOperands();
- for (uint32 srcNum=0; srcNum < numSrcs; ++srcNum) {
+ U_32 numSrcs = i->getNumSrcOperands();
+ for (U_32 srcNum=0; srcNum < numSrcs; ++srcNum) {
Opnd *srcOpnd = i->getSrc(srcNum);
Inst *srcInst = srcOpnd->getInst();
scheduleEarly(0, srcInst);
@@ -301,8 +301,8 @@
// not pinned, figure out earliest placement
DominatorNode *currentEarliest = dominators.getDominatorRoot();
DominatorNode *srcInstEarliest = NULL;
- uint32 numSrcs = i->getNumSrcOperands();
- for (uint32 srcNum=0; srcNum < numSrcs; ++srcNum) {
+ U_32 numSrcs = i->getNumSrcOperands();
+ for (U_32 srcNum=0; srcNum < numSrcs; ++srcNum) {
Opnd *srcOpnd = i->getSrc(srcNum);
Inst *srcInst = srcOpnd->getInst();
scheduleEarly(0, srcInst);
@@ -686,7 +686,7 @@
void GlobalCodeMotion::sinkConstants(Inst *inst)
{
- for (uint32 i = 0; i < inst->getNumSrcOperands(); i++) {
+ for (U_32 i = 0; i < inst->getNumSrcOperands(); i++) {
Opnd *opnd = inst->getSrc(i);
Inst *opndInst = opnd->getInst();
if (opndInst->isConst()) {
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.cpp Thu May 22 06:33:38 2008
@@ -75,7 +75,7 @@
// Now walk instructions in postorder, marking sources that have not been
// visited as global.
//
- uint32 numInsts = irManager.getInstFactory().getNumInsts();
+ U_32 numInsts = irManager.getInstFactory().getNumInsts();
MemoryManager memManager("GlobalOpndAnalyzer::doAnalysis()");
BitSet markedInstSet(memManager,numInsts);
Nodes::iterator niter;
@@ -86,7 +86,7 @@
// mark as visited
markedInstSet.setBit(inst->getId(),true);
// check sources to see if any span globally
- for (uint32 i=0; i<inst->getNumSrcOperands(); i++) {
+ for (U_32 i=0; i<inst->getNumSrcOperands(); i++) {
Opnd* src = inst->getSrc(i);
//
// we care only about srcs that are temporary
@@ -122,10 +122,10 @@
// Information about a global operand
//
struct AdvancedGlobalOpndAnalyzer::OpndInfo {
- OpndInfo(uint32 h, uint32 ts) : header(h), timeStamp(ts), isGlobal(false) {
+ OpndInfo(U_32 h, U_32 ts) : header(h), timeStamp(ts), isGlobal(false) {
}
- uint32 header; // dfNum of a header where node is used.
- uint32 timeStamp;
+ U_32 header; // dfNum of a header where node is used.
+ U_32 timeStamp;
bool isGlobal;
};
@@ -134,14 +134,14 @@
//
class AdvancedGlobalOpndAnalyzer::OpndTable : public HashTable<Opnd,OpndInfo> {
public:
- OpndTable(MemoryManager& mm, uint32 size) :
+ OpndTable(MemoryManager& mm, U_32 size) :
HashTable<Opnd,OpndInfo>(mm,size), memManager(mm), lastHeaderTimeStamp(0) {
}
void clear() {
lastHeaderTimeStamp = 0;
removeAll();
}
- void recordUse(Opnd * use, uint32 loopHeader, uint32 timeStamp) {
+ void recordUse(Opnd * use, U_32 loopHeader, U_32 timeStamp) {
OpndInfo * info = lookup(use);
if (info == NULL)
insertOpnd(use, loopHeader, timeStamp);
@@ -153,7 +153,7 @@
info->isGlobal = true;
}
}
- void recordDef(Opnd * def, uint32 loopHeader, uint32 timeStamp) {
+ void recordDef(Opnd * def, U_32 loopHeader, U_32 timeStamp) {
OpndInfo * info = lookup(def);
//
// Operand may be not in the table if it's definition is inside
@@ -177,21 +177,21 @@
info->isGlobal = true;
}
}
- void recordLoopHeader(uint32 timeStamp) {
+ void recordLoopHeader(U_32 timeStamp) {
lastHeaderTimeStamp = timeStamp;
}
private:
virtual bool keyEquals(Opnd* key1,Opnd* key2) const {
return key1 == key2;
}
- virtual uint32 getKeyHashCode(Opnd* key) const {
+ virtual U_32 getKeyHashCode(Opnd* key) const {
return key->getId();
}
- void insertOpnd(Opnd * opnd, uint32 header, uint32 timeStamp) {
+ void insertOpnd(Opnd * opnd, U_32 header, U_32 timeStamp) {
insert(opnd, new(memManager) OpndInfo(header,timeStamp));
}
MemoryManager& memManager;
- uint32 lastHeaderTimeStamp;
+ U_32 lastHeaderTimeStamp;
};
void
@@ -243,7 +243,7 @@
AdvancedGlobalOpndAnalyzer::unmarkFalseGlobals() {
MemoryManager localMemManager("RefinedGlobalOpndAnalyzer::doAnalysis.localMemManager");
opndTable = new (localMemManager) OpndTable(localMemManager, 16);
- uint32 timeStamp = 0;
+ U_32 timeStamp = 0;
//
// Walk nodes in postorder
//
@@ -255,7 +255,7 @@
// Figure out the current loop header
//
Node* header = loopInfo.getLoopHeader(node, false);
- uint32 currHeader = header != NULL ? header->getDfNum() : (uint32)-1;
+ U_32 currHeader = header != NULL ? header->getDfNum() : (U_32)-1;
//
// Walk instructions in reverse order
@@ -264,7 +264,7 @@
//
// Analyze sources
//
- for (uint32 i=0; i<inst->getNumSrcOperands(); i++) {
+ for (U_32 i=0; i<inst->getNumSrcOperands(); i++) {
Opnd* src = inst->getSrc(i);
//
// We care only about global tmps
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.h?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/globalopndanalyzer.h Thu May 22 06:33:38 2008
@@ -68,7 +68,7 @@
{}
virtual ~AdvancedGlobalOpndAnalyzer() {};
private:
- void analyzeInst(Inst* inst, uint32 loopHeader, uint32 timeStamp);
+ void analyzeInst(Inst* inst, U_32 loopHeader, U_32 timeStamp);
void unmarkFalseGlobals();
void markManagedPointerBases();
virtual void markGlobals();
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp Thu May 22 06:33:38 2008
@@ -129,8 +129,8 @@
DeadCodeEliminator::copyPropagate(inst);
// then, if we are using constant propagation based on branches, try it
if (constantTable) {
- uint32 numSrcs = inst->getNumSrcOperands();
- for (uint32 i=0; i<numSrcs; ++i) {
+ U_32 numSrcs = inst->getNumSrcOperands();
+ for (U_32 i=0; i<numSrcs; ++i) {
Opnd *thisOpnd = inst->getSrc(i);
Opnd *foundOpnd = constantTable->lookup(thisOpnd);
if (foundOpnd) {
@@ -1025,7 +1025,7 @@
// (tauAnd, ldvar)
// so if first operand is a tau, don't skip any
- uint32 numSrcs = inst->getNumSrcOperands();
+ U_32 numSrcs = inst->getNumSrcOperands();
if (numSrcs > 0) {
if (inst->getSrc(0)->getType()->tag != Type::Tau) {
while ((numSrcs > 0) && (inst->getSrc(numSrcs-1)->getType()->tag == Type::Tau)) {
@@ -1051,7 +1051,7 @@
}
CSEHashKey getKey(FieldAccessInst *inst) {
FieldDesc* fieldDesc = inst->getFieldDesc();
- uint32 numSrcs = inst->getNumSrcOperands();
+ U_32 numSrcs = inst->getNumSrcOperands();
if (numSrcs > 0) {
if (inst->getSrc(0)->getType()->tag != Type::Tau) {
while ((numSrcs > 0) && (inst->getSrc(numSrcs-1)->getType()->tag == Type::Tau)) {
@@ -1072,7 +1072,7 @@
}
CSEHashKey getKey(TypeInst* inst) {
Type* typeInfo = inst->getTypeInfo();
- uint32 numSrcs = inst->getNumSrcOperands();
+ U_32 numSrcs = inst->getNumSrcOperands();
if (numSrcs > 0) {
if (inst->getSrc(0)->getType()->tag != Type::Tau) {
while ((numSrcs > 0) && (inst->getSrc(numSrcs-1)->getType()->tag == Type::Tau)) {
@@ -1097,8 +1097,8 @@
}
CSEHashKey getKey(ConstInst* inst) {
return getKey(inst->getOperation(),
- (uint32)inst->getValue().dword1,
- (uint32)inst->getValue().dword2);
+ (U_32)inst->getValue().dword1,
+ (U_32)inst->getValue().dword2);
}
CSEHashKey getKey(TokenInst* inst) {
return getKey(inst->getOperation(),
@@ -1107,7 +1107,7 @@
}
CSEHashKey getKey(MethodInst* inst) {
MethodDesc* methodDesc = inst->getMethodDesc();
- uint32 numSrcs = inst->getNumSrcOperands();
+ U_32 numSrcs = inst->getNumSrcOperands();
if (numSrcs > 0) {
if (inst->getSrc(0)->getType()->tag != Type::Tau) {
while ((numSrcs > 0) && (inst->getSrc(numSrcs-1)->getType()->tag == Type::Tau)) {
@@ -1144,13 +1144,13 @@
CSEHashKey getKey(Operation operation) {
return CSEHashKey(operation.encodeForHashing());
}
- CSEHashKey getKey(Operation operation, uint32 srcid1) {
+ CSEHashKey getKey(Operation operation, U_32 srcid1) {
return CSEHashKey(operation.encodeForHashing(), srcid1);
}
- CSEHashKey getKey(Operation operation, uint32 srcid1, uint32 srcid2) {
+ CSEHashKey getKey(Operation operation, U_32 srcid1, U_32 srcid2) {
return CSEHashKey(operation.encodeForHashing(), srcid1, srcid2);
}
- CSEHashKey getKey(Operation operation, uint32 srcid1, uint32 srcid2, uint32 srcid3) {
+ CSEHashKey getKey(Operation operation, U_32 srcid1, U_32 srcid2, U_32 srcid3) {
return CSEHashKey(operation.encodeForHashing(), srcid1, srcid2, srcid3);
}
@@ -1361,7 +1361,7 @@
ComparisonModifier mod,
Type::Tag comparisonType,
bool isTrueEdge,
- uint32 numSrcOperands,
+ U_32 numSrcOperands,
Opnd *src0,
Opnd *src1);
void addInfoFromPEI(Inst *pei, bool isExceptionEdge);
@@ -1779,8 +1779,8 @@
Inst *zeroInst = lookupInst(0, getKey(Operation(Op_LdConstant,
comparisonType,
Modifier()),
- (uint32) 0,
- (uint32) 0));
+ (U_32) 0,
+ (U_32) 0));
if (zeroInst) {
*opnd = src0;
*constOpnd = zeroInst->getDst();
@@ -1959,7 +1959,7 @@
Log::out() << ::std::endl;
}
- uint32 numSrcs = branchi->getNumSrcOperands();
+ U_32 numSrcs = branchi->getNumSrcOperands();
addInfoFromBranchCompare(targetNode,
branchi->getComparisonModifier(),
branchi->getType(),
@@ -1974,8 +1974,8 @@
Inst *tauHasTypeInst)
{
// make checks available
- uint32 typeId = type->getId();
- uint32 opndId = opnd->getId();
+ U_32 typeId = type->getId();
+ U_32 opndId = opnd->getId();
CSEHashKey key1 = getKey(Operation(Op_TauCheckCast, Type::SystemObject,
Modifier(Exception_Sometimes)),
@@ -1994,7 +1994,7 @@
ObjectType *objType = (ObjectType *)type;
ObjectType *superClass = objType->getSuperType();
while (superClass) {
- uint32 superClassId = superClass->getId();
+ U_32 superClassId = superClass->getId();
CSEHashKey key1 = getKey(Operation(Op_TauCheckCast, Type::SystemObject,
Modifier(Exception_Sometimes)),
opndId, superClassId);
@@ -2015,7 +2015,7 @@
ComparisonModifier mod,
Type::Tag comparisonType,
bool isTrueEdge,
- uint32 numSrcOperands,
+ U_32 numSrcOperands,
Opnd *src0,
Opnd *src1)
{
@@ -2424,8 +2424,8 @@
// this must happen even for exception code, to
// make sure that GCMed def is made visible to
// exception code
- uint32 numSrcs = inst->getNumSrcOperands();
- for (uint32 i=0; i < numSrcs; ++i) {
+ U_32 numSrcs = inst->getNumSrcOperands();
+ for (U_32 i=0; i < numSrcs; ++i) {
Opnd *opnd = inst->getSrc(i);
SsaOpnd *ssaOpnd = opnd->asSsaOpnd();
if (ssaOpnd) {
@@ -2508,9 +2508,9 @@
Opnd* srcOpnd = NULL;
if (optimizedOpcode == Op_TauUnsafe && instOpcode == Op_Cmp){
// optimizedInst is tauUnsafe so srcOpnd for copying must be 'false'
- copy = irManager.getInstFactory().makeLdConst(dstOpnd,(int32)0);
+ copy = irManager.getInstFactory().makeLdConst(dstOpnd,(I_32)0);
} else if (optimizedOpcode == Op_TauEdge && dstOpnd->getType()->isNumeric()) {
- copy = irManager.getInstFactory().makeLdConst(dstOpnd,(int32)1);
+ copy = irManager.getInstFactory().makeLdConst(dstOpnd,(I_32)1);
} else {
srcOpnd = optimizedInst->getDst();
//
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp?rev=659108&r1=659107&r2=659108&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Thu May 22 06:33:38 2008
@@ -35,7 +35,7 @@
HelperConfig(VM_RT_SUPPORT id) : helperId(id), doInlining(true), hotnessPercentToInline(0) {}
VM_RT_SUPPORT helperId;
bool doInlining;
- uint32 hotnessPercentToInline;
+ U_32 hotnessPercentToInline;
};
struct HelperInlinerFlags {
@@ -90,7 +90,7 @@
class HelperInliner {
public:
HelperInliner(HelperInlinerSession* _sessionAction, MemoryManager& tmpMM, CompilationContext* _cc, Inst* _inst,
- uint32 _hotness, MethodDesc* _helperMethod, VM_RT_SUPPORT _helperId)
+ U_32 _hotness, MethodDesc* _helperMethod, VM_RT_SUPPORT _helperId)
: flags(((HelperInlinerAction*)_sessionAction->getAction())->getFlags()), localMM(tmpMM),
cc(_cc), inst(_inst), session(_sessionAction), method(_helperMethod), helperId(_helperId)
{
@@ -106,7 +106,7 @@
void run();
- uint32 hotness;
+ U_32 hotness;
static MethodDesc* findHelperMethod(CompilationInterface* ci, VM_RT_SUPPORT helperId);
@@ -154,7 +154,7 @@
//finding all helper calls
ControlFlowGraph& fg = irm.getFlowGraph();
double entryExecCount = fg.hasEdgeProfile() ? fg.getEntryNode()->getExecCount(): 1;
- uint32 maxNodeCount = irm.getOptimizerFlags().hir_node_threshold;
+ U_32 maxNodeCount = irm.getOptimizerFlags().hir_node_threshold;
StlPriorityQueue<HelperInliner*, StlVector<HelperInliner*>, HelperInlinerCompare> *helperInlineCandidates =
new (tmpMM) StlPriorityQueue<HelperInliner*, StlVector<HelperInliner*>, HelperInlinerCompare>(tmpMM);
@@ -166,7 +166,7 @@
Node* node = *it;
double execCount = node->getExecCount();
assert (execCount >= 0);
- uint32 nodePercent = fg.hasEdgeProfile() ? (uint32)(execCount*100/entryExecCount) : 0;
+ U_32 nodePercent = fg.hasEdgeProfile() ? (U_32)(execCount*100/entryExecCount) : 0;
if (node->isBlockNode()) {
for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst()) {
Opcode opcode = inst->getOpcode();
@@ -209,13 +209,13 @@
assert(method);
//Convert all inst params into helper params
- uint32 numHelperArgs = method->getNumParams();
- uint32 numInstArgs = inst->getNumSrcOperands();
+ U_32 numHelperArgs = method->getNumParams();
+ U_32 numInstArgs = inst->getNumSrcOperands();
Opnd** helperArgs = new (irm->getMemoryManager()) Opnd*[numHelperArgs];
#ifdef _DEBUG
std::fill(helperArgs, helperArgs + numHelperArgs, (Opnd*)NULL);
#endif
- uint32 currentHelperArg = 0;
+ U_32 currentHelperArg = 0;
if (inst->isType()) {
Type* type = inst->asTypeInst()->getTypeInfo();
assert(type->isNamedType());
@@ -227,11 +227,11 @@
} else if (inst->isToken()) {
TokenInst* tokenInst = inst->asTokenInst();
MethodDesc* methDesc = tokenInst->getEnclosingMethod();
- uint32 cpIndex = tokenInst->getToken();
+ U_32 cpIndex = tokenInst->getToken();
Opnd* classHandleOpnd = opndManager->createSsaTmpOpnd(typeManager->getUnmanagedPtrType(typeManager->getIntPtrType()));
Opnd* cpIndexOpnd = opndManager->createSsaTmpOpnd(typeManager->getUInt32Type());
Inst* ldMethDesc = instFactory->makeLdConst(classHandleOpnd, (POINTER_SIZE_SINT)methDesc->getParentHandle());
- Inst* ldCpIndex = instFactory->makeLdConst(cpIndexOpnd, (int32)cpIndex);
+ Inst* ldCpIndex = instFactory->makeLdConst(cpIndexOpnd, (I_32)cpIndex);
ldMethDesc->insertBefore(inst);
helperArgs[currentHelperArg] = classHandleOpnd;
@@ -242,7 +242,7 @@
currentHelperArg++;
}
- for (uint32 i = 0; i < numInstArgs; i++) {
+ for (U_32 i = 0; i < numInstArgs; i++) {
Opnd* instArg = inst->getSrc(i);
if (instArg->getType()->tag == Type::Tau) {
continue;