Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: src/IceGlobalContext.h

Issue 1804133002: Subzero. Uses unique_ptrs in the emit queue. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// \file 10 /// \file
(...skipping 10 matching lines...) Expand all
21 #include "IceIntrinsics.h" 21 #include "IceIntrinsics.h"
22 #include "IceRNG.h" 22 #include "IceRNG.h"
23 #include "IceSwitchLowering.h" 23 #include "IceSwitchLowering.h"
24 #include "IceThreading.h" 24 #include "IceThreading.h"
25 #include "IceTimerTree.h" 25 #include "IceTimerTree.h"
26 #include "IceTypes.h" 26 #include "IceTypes.h"
27 #include "IceUtils.h" 27 #include "IceUtils.h"
28 28
29 #include <array> 29 #include <array>
30 #include <functional> 30 #include <functional>
31 #include <memory>
31 #include <mutex> 32 #include <mutex>
32 #include <thread> 33 #include <thread>
33 #include <type_traits> 34 #include <type_traits>
35 #include <utility>
34 #include <vector> 36 #include <vector>
35 37
36 namespace Ice { 38 namespace Ice {
37 39
38 class ClFlags; 40 class ClFlags;
39 class ConstantPool; 41 class ConstantPool;
40 class EmitterWorkItem; 42 class EmitterWorkItem;
41 class FuncSigType; 43 class FuncSigType;
42 44
43 /// LockedPtr is a way to provide automatically locked access to some object. 45 /// LockedPtr is a way to provide automatically locked access to some object.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 /// Notifies that no more work will be added to the work queue. 331 /// Notifies that no more work will be added to the work queue.
330 void optQueueNotifyEnd() { OptQ.notifyEnd(); } 332 void optQueueNotifyEnd() { OptQ.notifyEnd(); }
331 333
332 /// Emit file header for output file. 334 /// Emit file header for output file.
333 void emitFileHeader(); 335 void emitFileHeader();
334 336
335 void lowerConstants(); 337 void lowerConstants();
336 338
337 void lowerJumpTables(); 339 void lowerJumpTables();
338 340
339 void emitQueueBlockingPush(EmitterWorkItem *Item); 341 void emitQueueBlockingPush(std::unique_ptr<EmitterWorkItem> Item);
340 EmitterWorkItem *emitQueueBlockingPop(); 342 std::unique_ptr<EmitterWorkItem> emitQueueBlockingPop();
341 void emitQueueNotifyEnd() { EmitQ.notifyEnd(); } 343 void emitQueueNotifyEnd() { EmitQ.notifyEnd(); }
342 344
343 void initParserThread() { 345 void initParserThread() {
344 ThreadContext *Tls = new ThreadContext(); 346 ThreadContext *Tls = new ThreadContext();
345 auto Timers = getTimers(); 347 auto Timers = getTimers();
346 Timers->initInto(Tls->Timers); 348 Timers->initInto(Tls->Timers);
347 AllThreadContexts.push_back(Tls); 349 AllThreadContexts.push_back(Tls);
348 ICE_TLS_SET_FIELD(TLS, Tls); 350 ICE_TLS_SET_FIELD(TLS, Tls);
349 } 351 }
350 352
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } 631 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); }
630 ~OstreamLocker() { Ctx->unlockStr(); } 632 ~OstreamLocker() { Ctx->unlockStr(); }
631 633
632 private: 634 private:
633 GlobalContext *const Ctx; 635 GlobalContext *const Ctx;
634 }; 636 };
635 637
636 } // end of namespace Ice 638 } // end of namespace Ice
637 639
638 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 640 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698