| OLD | NEW |
| 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===// | 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares aspects of the compilation that persist across | 10 // This file declares aspects of the compilation that persist across |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 TimerIdT getTimerID(TimerStackIdT StackID, const IceString &Name); | 273 TimerIdT getTimerID(TimerStackIdT StackID, const IceString &Name); |
| 274 void pushTimer(TimerIdT ID, TimerStackIdT StackID); | 274 void pushTimer(TimerIdT ID, TimerStackIdT StackID); |
| 275 void popTimer(TimerIdT ID, TimerStackIdT StackID); | 275 void popTimer(TimerIdT ID, TimerStackIdT StackID); |
| 276 void resetTimer(TimerStackIdT StackID); | 276 void resetTimer(TimerStackIdT StackID); |
| 277 void setTimerName(TimerStackIdT StackID, const IceString &NewName); | 277 void setTimerName(TimerStackIdT StackID, const IceString &NewName); |
| 278 | 278 |
| 279 // Adds a newly parsed and constructed function to the Cfg work | 279 // Adds a newly parsed and constructed function to the Cfg work |
| 280 // queue. Notifies any idle workers that a new function is | 280 // queue. Notifies any idle workers that a new function is |
| 281 // available for translating. May block if the work queue is too | 281 // available for translating. May block if the work queue is too |
| 282 // large, in order to control memory footprint. | 282 // large, in order to control memory footprint. |
| 283 void cfgQueueBlockingPush(Cfg *Func) { CfgQ.blockingPush(Func); } | 283 void cfgQueueBlockingPush(std::unique_ptr<Cfg> Func); |
| 284 // Takes a Cfg from the work queue for translating. May block if | 284 // Takes a Cfg from the work queue for translating. May block if |
| 285 // the work queue is currently empty. Returns nullptr if there is | 285 // the work queue is currently empty. Returns nullptr if there is |
| 286 // no more work - the queue is empty and either end() has been | 286 // no more work - the queue is empty and either end() has been |
| 287 // called or the Sequential flag was set. | 287 // called or the Sequential flag was set. |
| 288 Cfg *cfgQueueBlockingPop() { return CfgQ.blockingPop(); } | 288 std::unique_ptr<Cfg> cfgQueueBlockingPop(); |
| 289 // Notifies that no more work will be added to the work queue. | 289 // Notifies that no more work will be added to the work queue. |
| 290 void cfgQueueNotifyEnd() { CfgQ.notifyEnd(); } | 290 void cfgQueueNotifyEnd() { CfgQ.notifyEnd(); } |
| 291 | 291 |
| 292 void startWorkerThreads() { | 292 void startWorkerThreads() { |
| 293 size_t NumWorkers = getFlags().NumTranslationThreads; | 293 size_t NumWorkers = getFlags().NumTranslationThreads; |
| 294 auto Timers = getTimers(); | 294 auto Timers = getTimers(); |
| 295 for (size_t i = 0; i < NumWorkers; ++i) { | 295 for (size_t i = 0; i < NumWorkers; ++i) { |
| 296 ThreadContext *WorkerTLS = new ThreadContext(); | 296 ThreadContext *WorkerTLS = new ThreadContext(); |
| 297 Timers->initInto(WorkerTLS->Timers); | 297 Timers->initInto(WorkerTLS->Timers); |
| 298 AllThreadContexts.push_back(WorkerTLS); | 298 AllThreadContexts.push_back(WorkerTLS); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 467 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
| 468 ~OstreamLocker() { Ctx->unlockStr(); } | 468 ~OstreamLocker() { Ctx->unlockStr(); } |
| 469 | 469 |
| 470 private: | 470 private: |
| 471 GlobalContext *const Ctx; | 471 GlobalContext *const Ctx; |
| 472 }; | 472 }; |
| 473 | 473 |
| 474 } // end of namespace Ice | 474 } // end of namespace Ice |
| 475 | 475 |
| 476 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 476 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| OLD | NEW |