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

Side by Side Diff: src/IceInstrumentation.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: 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.h - ICE instrumentation ---*- C++ -*-===// 1 //===- subzero/src/IceInstrumentation.h - ICE instrumentation ---*- 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 25 matching lines...) Expand all
36 36
37 class Instrumentation { 37 class Instrumentation {
38 Instrumentation() = delete; 38 Instrumentation() = delete;
39 Instrumentation(const Instrumentation &) = delete; 39 Instrumentation(const Instrumentation &) = delete;
40 Instrumentation &operator=(const Instrumentation &) = delete; 40 Instrumentation &operator=(const Instrumentation &) = delete;
41 41
42 public: 42 public:
43 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} 43 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {}
44 virtual void instrumentGlobals(VariableDeclarationList &) {} 44 virtual void instrumentGlobals(VariableDeclarationList &) {}
45 void instrumentFunc(Cfg *Func); 45 void instrumentFunc(Cfg *Func);
46 void setHasSeenGlobals();
46 47
47 protected: 48 protected:
48 virtual void instrumentInst(LoweringContext &Context); 49 virtual void instrumentInst(LoweringContext &Context);
50 LockedPtr<VariableDeclarationList> getGlobals();
49 51
50 private: 52 private:
51 virtual bool isInstrumentable(Cfg *) { return true; } 53 virtual bool isInstrumentable(Cfg *) { return true; }
52 virtual void instrumentFuncStart(LoweringContext &) {} 54 virtual void instrumentFuncStart(LoweringContext &) {}
53 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {} 55 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {}
54 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) { 56 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) {
55 } 57 }
56 virtual void instrumentBr(LoweringContext &, class InstBr *) {} 58 virtual void instrumentBr(LoweringContext &, class InstBr *) {}
57 virtual void instrumentCall(LoweringContext &, class InstCall *) {} 59 virtual void instrumentCall(LoweringContext &, class InstCall *) {}
58 virtual void instrumentCast(LoweringContext &, class InstCast *) {} 60 virtual void instrumentCast(LoweringContext &, class InstCast *) {}
(...skipping 12 matching lines...) Expand all
71 virtual void instrumentStore(LoweringContext &, class InstStore *) {} 73 virtual void instrumentStore(LoweringContext &, class InstStore *) {}
72 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {} 74 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {}
73 virtual void instrumentUnreachable(LoweringContext &, 75 virtual void instrumentUnreachable(LoweringContext &,
74 class InstUnreachable *) {} 76 class InstUnreachable *) {}
75 virtual void instrumentStart(Cfg *) {} 77 virtual void instrumentStart(Cfg *) {}
76 virtual void instrumentLocalVars(Cfg *) {} 78 virtual void instrumentLocalVars(Cfg *) {}
77 virtual void finishFunc(Cfg *) {} 79 virtual void finishFunc(Cfg *) {}
78 80
79 protected: 81 protected:
80 GlobalContext *Ctx; 82 GlobalContext *Ctx;
83
84 private:
85 bool HasSeenGlobals = false;
86 std::mutex GlobalsSeenMutex;
87 std::condition_variable GlobalsSeenCV;
81 }; 88 };
82 89
83 } // end of namespace Ice 90 } // end of namespace Ice
84 91
85 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H 92 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698