| Index: src/IceGlobalContext.cpp
|
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
|
| index 8805cea111ec69b3760ac52ffe6ce8009a744686..adf6d06b80c0908bd9c217fdac112fc1af9d1359 100644
|
| --- a/src/IceGlobalContext.cpp
|
| +++ b/src/IceGlobalContext.cpp
|
| @@ -160,11 +160,11 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
|
| }
|
|
|
| void GlobalContext::translateFunctions() {
|
| - while (Cfg *Func = cfgQueueBlockingPop()) {
|
| + while (std::unique_ptr<Cfg> Func = cfgQueueBlockingPop()) {
|
| + // Install Func in TLS for Cfg-specific container allocators.
|
| + Cfg::updateTLS(Func.get());
|
| // Reset per-function stats being accumulated in TLS.
|
| resetStats();
|
| - // Install Func in TLS for Cfg-specific container allocators.
|
| - Func->updateTLS();
|
| // Set verbose level to none if the current function does NOT
|
| // match the -verbose-focus command-line option.
|
| if (!matchSymbolName(Func->getFunctionName(), getFlags().VerboseFocusOn))
|
| @@ -189,10 +189,10 @@ void GlobalContext::translateFunctions() {
|
| Func->emit();
|
| // TODO(stichnot): actually add to emit queue
|
| }
|
| - // TODO(stichnot): fix multithreaded stats dumping.
|
| dumpStats(Func->getFunctionName());
|
| }
|
| - delete Func;
|
| + // The Cfg now gets deleted as Func goes out of scope. This also
|
| + // resets the thread-local CurrentCfg field.
|
| }
|
| }
|
|
|
| @@ -535,6 +535,10 @@ void GlobalContext::setTimerName(TimerStackIdT StackID,
|
| Timers->at(StackID).setName(NewName);
|
| }
|
|
|
| +std::unique_ptr<Cfg> GlobalContext::cfgQueueBlockingPop() {
|
| + return std::unique_ptr<Cfg>(CfgQ.blockingPop());
|
| +}
|
| +
|
| void GlobalContext::dumpStats(const IceString &Name, bool Final) {
|
| if (!ALLOW_DUMP || !getFlags().DumpStats)
|
| return;
|
|
|