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

Side by Side Diff: src/IceInstrumentation.cpp

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: Added condition variable and moved synchronization to Instrumentation 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
OLDNEW
1 //===- subzero/src/IceInstrumentation.cpp - ICE instrumentation framework -===// 1 //===- subzero/src/IceInstrumentation.cpp - ICE instrumentation framework -===//
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 case Inst::Unreachable: 111 case Inst::Unreachable:
112 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr)); 112 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr));
113 break; 113 break;
114 default: 114 default:
115 // Only instrument high-level ICE instructions 115 // Only instrument high-level ICE instructions
116 assert(false && "Instrumentation encountered an unexpected instruction"); 116 assert(false && "Instrumentation encountered an unexpected instruction");
117 break; 117 break;
118 } 118 }
119 } 119 }
120 120
121 void Instrumentation::setHasSeenGlobals() {
122 std::unique_lock<std::mutex> GlobalsLock(GlobalsSeenMutex);
Jim Stichnoth 2016/07/19 22:39:00 I think this could be simpler: void Instrumentati
tlively 2016/07/19 23:20:14 Done.
123 HasSeenGlobals = true;
124 GlobalsLock.unlock();
125 GlobalsSeenCV.notify_all();
126 }
127
128 LockedPtr<VariableDeclarationList> Instrumentation::getGlobals() {
129 std::unique_lock<std::mutex> GlobalsLock(GlobalsSeenMutex);
130 GlobalsSeenCV.wait(GlobalsLock, [&] { return HasSeenGlobals; });
Jim Stichnoth 2016/07/19 22:39:00 Instead of default capture, can you capture "this"
tlively 2016/07/19 23:20:14 Done.
131 return Ctx->getGlobals();
132 }
133
121 } // end of namespace Ice 134 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698