Index: vm/jitrino/src/optimizer/globalcodemotion.cpp =================================================================== --- vm/jitrino/src/optimizer/globalcodemotion.cpp (revision 599293) +++ 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. + // 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); } 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; Index: vm/jitrino/src/optimizer/globalcodemotion.h =================================================================== --- vm/jitrino/src/optimizer/globalcodemotion.h (revision 599293) +++ vm/jitrino/src/optimizer/globalcodemotion.h (working copy) @@ -86,8 +86,8 @@ StlHashMap latest; typedef StlHashSet VisitedSet; VisitedSet visited; - typedef ::std::set UsesSet; - typedef StlHashMap UsesMap; + typedef StlHashSet UsesSet; + typedef StlHashMap UsesMap; UsesMap uses; void scheduleAllEarly();