Index: trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp =================================================================== --- trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp (revision 598263) +++ trunk/vm/jitrino/src/optimizer/globalcodemotion.cpp (working copy) @@ -260,7 +260,14 @@ Log::out() << " is used by "; i->print(Log::out()); Log::out() << std::endl; } - uses[srcInst].insert(i); + UsesMap::iterator it = uses.find(srcInst); + UsesSet* theSet = NULL; + if (it == uses.end()) { + theSet = new (mm) UsesSet(mm); + it = uses.insert(::std::make_pair(srcInst, *theSet)).first; + } + theSet = &(it->second); + theSet->insert(i); } } @@ -312,7 +319,15 @@ Log::out() << ", which has early placement in "; FlowGraph::printLabel(Log::out(), srcInstEarliest); Log::out() << std::endl; } - uses[srcInst].insert(i); // record the use while we're iterating. + UsesMap::iterator it = uses.find(srcInst); + UsesSet* theSet = NULL; + if (it == uses.end()) { + theSet = new (mm) UsesSet(mm); + it = uses.insert(::std::make_pair(srcInst, *theSet)).first; + } + theSet = &(it->second); + theSet->insert(i); + //uses[srcInst].insert(i); // record the use while we're iterating. } srcInstEarliest = currentEarliest; // now is the latest placement of src insts // moving above catch inst may cause problems in code emitter @@ -438,10 +453,18 @@ // schedule users DominatorNode *lca = 0; - UsesSet &users = uses[i]; - UsesSet::iterator uiter = users.begin(); - UsesSet::iterator uend = users.end(); + UsesMap::iterator it = uses.find(i); + UsesSet* users = NULL; + if (it == uses.end()) { + users = new (mm) UsesSet(mm); + it = uses.insert(::std::make_pair(i, *users)).first; + } + + users = &(it->second); + UsesSet::iterator uiter = users->begin(); + UsesSet::iterator uend = users->end(); + for ( ; uiter != uend; ++uiter) { Inst *useri = *uiter; @@ -452,7 +475,7 @@ Log::out() << "Inst "; i->print(Log::out()); Log::out() << " is used by inst "; useri->print(Log::out()); Log::out() << " which is in "; FlowGraph::printLabel(Log::out(), latest[useri]); - Log::out() << std::endl; + Log::out() << std::endl; } if (pinned) continue; Index: trunk/vm/jitrino/src/optimizer/globalcodemotion.h =================================================================== --- trunk/vm/jitrino/src/optimizer/globalcodemotion.h (revision 598263) +++ trunk/vm/jitrino/src/optimizer/globalcodemotion.h (working copy) @@ -86,7 +86,7 @@ StlHashMap latest; typedef StlHashSet VisitedSet; VisitedSet visited; - typedef ::std::set UsesSet; + typedef StlHashSet UsesSet; typedef StlHashMap UsesMap; UsesMap uses;