Chromium Code Reviews| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 TimerIdT getTimerID(TimerStackIdT StackID, const IceString &Name); | 270 TimerIdT getTimerID(TimerStackIdT StackID, const IceString &Name); |
| 271 void pushTimer(TimerIdT ID, TimerStackIdT StackID); | 271 void pushTimer(TimerIdT ID, TimerStackIdT StackID); |
| 272 void popTimer(TimerIdT ID, TimerStackIdT StackID); | 272 void popTimer(TimerIdT ID, TimerStackIdT StackID); |
| 273 void resetTimer(TimerStackIdT StackID); | 273 void resetTimer(TimerStackIdT StackID); |
| 274 void setTimerName(TimerStackIdT StackID, const IceString &NewName); | 274 void setTimerName(TimerStackIdT StackID, const IceString &NewName); |
| 275 | 275 |
| 276 // Adds a newly parsed and constructed function to the Cfg work | 276 // Adds a newly parsed and constructed function to the Cfg work |
| 277 // queue. Notifies any idle workers that a new function is | 277 // queue. Notifies any idle workers that a new function is |
| 278 // available for translating. May block if the work queue is too | 278 // available for translating. May block if the work queue is too |
| 279 // large, in order to control memory footprint. | 279 // large, in order to control memory footprint. |
| 280 void cfgQueueBlockingPush(Cfg *Func) { CfgQ.blockingPush(Func); } | 280 void cfgQueueBlockingPush(Cfg *Func) { CfgQ.blockingPush(Func); } |
|
Jim Stichnoth
2015/02/02 16:51:15
I've designed this such that the underlying queue
JF
2015/02/02 17:11:47
I'm not sure I understand, someone pushes by doing
Jim Stichnoth
2015/02/02 18:48:48
Heh, I was afraid you'd catch that before I fixed
| |
| 281 // Takes a Cfg from the work queue for translating. May block if | 281 // Takes a Cfg from the work queue for translating. May block if |
| 282 // the work queue is currently empty. Returns nullptr if there is | 282 // the work queue is currently empty. Returns nullptr if there is |
| 283 // no more work - the queue is empty and either end() has been | 283 // no more work - the queue is empty and either end() has been |
| 284 // called or the Sequential flag was set. | 284 // called or the Sequential flag was set. |
| 285 Cfg *cfgQueueBlockingPop() { return CfgQ.blockingPop(); } | 285 std::unique_ptr<Cfg> cfgQueueBlockingPop(); |
| 286 // Notifies that no more work will be added to the work queue. | 286 // Notifies that no more work will be added to the work queue. |
| 287 void cfgQueueNotifyEnd() { CfgQ.notifyEnd(); } | 287 void cfgQueueNotifyEnd() { CfgQ.notifyEnd(); } |
| 288 | 288 |
| 289 void startWorkerThreads() { | 289 void startWorkerThreads() { |
| 290 size_t NumWorkers = getFlags().NumTranslationThreads; | 290 size_t NumWorkers = getFlags().NumTranslationThreads; |
| 291 auto Timers = getTimers(); | 291 auto Timers = getTimers(); |
| 292 for (size_t i = 0; i < NumWorkers; ++i) { | 292 for (size_t i = 0; i < NumWorkers; ++i) { |
| 293 ThreadContext *WorkerTLS = new ThreadContext(); | 293 ThreadContext *WorkerTLS = new ThreadContext(); |
| 294 Timers->initInto(WorkerTLS->Timers); | 294 Timers->initInto(WorkerTLS->Timers); |
| 295 AllThreadContexts.push_back(WorkerTLS); | 295 AllThreadContexts.push_back(WorkerTLS); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 464 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
| 465 ~OstreamLocker() { Ctx->unlockStr(); } | 465 ~OstreamLocker() { Ctx->unlockStr(); } |
| 466 | 466 |
| 467 private: | 467 private: |
| 468 GlobalContext *const Ctx; | 468 GlobalContext *const Ctx; |
| 469 }; | 469 }; |
| 470 | 470 |
| 471 } // end of namespace Ice | 471 } // end of namespace Ice |
| 472 | 472 |
| 473 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 473 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| OLD | NEW |