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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 // no more work - the queue is empty and either end() has been | 293 // no more work - the queue is empty and either end() has been |
294 // called or the Sequential flag was set. | 294 // called or the Sequential flag was set. |
295 std::unique_ptr<Cfg> optQueueBlockingPop(); | 295 std::unique_ptr<Cfg> optQueueBlockingPop(); |
296 // Notifies that no more work will be added to the work queue. | 296 // Notifies that no more work will be added to the work queue. |
297 void optQueueNotifyEnd() { OptQ.notifyEnd(); } | 297 void optQueueNotifyEnd() { OptQ.notifyEnd(); } |
298 | 298 |
299 void emitQueueBlockingPush(EmitterWorkItem *Item); | 299 void emitQueueBlockingPush(EmitterWorkItem *Item); |
300 EmitterWorkItem *emitQueueBlockingPop(); | 300 EmitterWorkItem *emitQueueBlockingPop(); |
301 void emitQueueNotifyEnd() { EmitQ.notifyEnd(); } | 301 void emitQueueNotifyEnd() { EmitQ.notifyEnd(); } |
302 | 302 |
303 void initParserThread() { | |
304 ThreadContext *TLS = new ThreadContext(); | |
Jim Stichnoth
2015/03/25 16:34:06
I guess this gets renamed to Tls after https://cod
jvoung (off chromium)
2015/03/25 18:14:35
Oops -- Done.
| |
305 auto Timers = getTimers(); | |
306 Timers->initInto(TLS->Timers); | |
307 AllThreadContexts.push_back(TLS); | |
308 ICE_TLS_SET_FIELD(TLS, TLS); | |
309 } | |
310 | |
303 void startWorkerThreads() { | 311 void startWorkerThreads() { |
304 size_t NumWorkers = getFlags().getNumTranslationThreads(); | 312 size_t NumWorkers = getFlags().getNumTranslationThreads(); |
305 auto Timers = getTimers(); | 313 auto Timers = getTimers(); |
306 for (size_t i = 0; i < NumWorkers; ++i) { | 314 for (size_t i = 0; i < NumWorkers; ++i) { |
307 ThreadContext *WorkerTLS = new ThreadContext(); | 315 ThreadContext *WorkerTLS = new ThreadContext(); |
308 Timers->initInto(WorkerTLS->Timers); | 316 Timers->initInto(WorkerTLS->Timers); |
309 AllThreadContexts.push_back(WorkerTLS); | 317 AllThreadContexts.push_back(WorkerTLS); |
310 TranslationThreads.push_back(std::thread( | 318 TranslationThreads.push_back(std::thread( |
311 &GlobalContext::translateFunctionsWrapper, this, WorkerTLS)); | 319 &GlobalContext::translateFunctionsWrapper, this, WorkerTLS)); |
312 } | 320 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 505 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
498 ~OstreamLocker() { Ctx->unlockStr(); } | 506 ~OstreamLocker() { Ctx->unlockStr(); } |
499 | 507 |
500 private: | 508 private: |
501 GlobalContext *const Ctx; | 509 GlobalContext *const Ctx; |
502 }; | 510 }; |
503 | 511 |
504 } // end of namespace Ice | 512 } // end of namespace Ice |
505 | 513 |
506 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 514 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |