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

Side by Side Diff: src/IceGlobalContext.h

Issue 2165493002: Subzero: Fixed deadlock with _start but no globals (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Moved an include to the proper file Created 4 years, 5 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/IceASanInstrumentation.cpp ('k') | src/IceInstrumentation.h » ('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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 void setDisposeGlobalVariablesAfterLowering(bool Value) { 476 void setDisposeGlobalVariablesAfterLowering(bool Value) {
477 DisposeGlobalVariablesAfterLowering = Value; 477 DisposeGlobalVariablesAfterLowering = Value;
478 } 478 }
479 /// @} 479 /// @}
480 480
481 LockedPtr<StringPool> getStrings() const { 481 LockedPtr<StringPool> getStrings() const {
482 return LockedPtr<StringPool>(Strings.get(), &StringsLock); 482 return LockedPtr<StringPool>(Strings.get(), &StringsLock);
483 } 483 }
484 484
485 LockedPtr<VariableDeclarationList> getGlobals() {
486 return LockedPtr<VariableDeclarationList>(&Globals, &InitAllocLock);
487 }
488
485 /// Number of function blocks that can be queued before waiting for 489 /// Number of function blocks that can be queued before waiting for
486 /// translation 490 /// translation
487 /// threads to consume. 491 /// threads to consume.
488 static constexpr size_t MaxOptQSize = 1 << 16; 492 static constexpr size_t MaxOptQSize = 1 << 16;
489 493
490 private: 494 private:
491 // Try to ensure mutexes are allocated on separate cache lines. 495 // Try to ensure mutexes are allocated on separate cache lines.
492 496
493 // Destructors collaborate with Allocator 497 // Destructors collaborate with Allocator
494 ICE_CACHELINE_BOUNDARY; 498 ICE_CACHELINE_BOUNDARY;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 return LockedPtr<TimerList>(&Timers, &TimerLock); 609 return LockedPtr<TimerList>(&Timers, &TimerLock);
606 } 610 }
607 LockedPtr<DestructorArray> getDestructors() { 611 LockedPtr<DestructorArray> getDestructors() {
608 return LockedPtr<DestructorArray>(&Destructors, &DestructorsLock); 612 return LockedPtr<DestructorArray>(&Destructors, &DestructorsLock);
609 } 613 }
610 614
611 void accumulateGlobals(std::unique_ptr<VariableDeclarationList> Globls) { 615 void accumulateGlobals(std::unique_ptr<VariableDeclarationList> Globls) {
612 LockedPtr<VariableDeclarationList> _(&Globals, &InitAllocLock); 616 LockedPtr<VariableDeclarationList> _(&Globals, &InitAllocLock);
613 if (Globls != nullptr) { 617 if (Globls != nullptr) {
614 Globals.merge(Globls.get()); 618 Globals.merge(Globls.get());
619 if (!BuildDefs::minimal() && Instrumentor != nullptr)
620 Instrumentor->setHasSeenGlobals();
615 } 621 }
616 } 622 }
617 623
618 void lowerGlobalsIfNoCodeHasBeenSeen() { 624 void lowerGlobalsIfNoCodeHasBeenSeen() {
619 if (HasSeenCode) 625 if (HasSeenCode)
620 return; 626 return;
621 constexpr char NoSuffix[] = ""; 627 constexpr char NoSuffix[] = "";
622 lowerGlobals(NoSuffix); 628 lowerGlobals(NoSuffix);
623 HasSeenCode = true; 629 HasSeenCode = true;
624 } 630 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } 698 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); }
693 ~OstreamLocker() { Ctx->unlockStr(); } 699 ~OstreamLocker() { Ctx->unlockStr(); }
694 700
695 private: 701 private:
696 GlobalContext *const Ctx; 702 GlobalContext *const Ctx;
697 }; 703 };
698 704
699 } // end of namespace Ice 705 } // end of namespace Ice
700 706
701 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 707 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceASanInstrumentation.cpp ('k') | src/IceInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698