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

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: 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/IceGlobalContext.h ('k') | src/IceInstrumentation.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/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 12 matching lines...) Expand all
23 /// subclass is still responsible for driving the instrumentation, but it can 23 /// subclass is still responsible for driving the instrumentation, but it can
24 /// use other Instrumentation subclasses however it needs to. 24 /// use other Instrumentation subclasses however it needs to.
25 /// 25 ///
26 //===----------------------------------------------------------------------===// 26 //===----------------------------------------------------------------------===//
27 27
28 #ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H 28 #ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H
29 #define SUBZERO_SRC_ICEINSTRUMENTATION_H 29 #define SUBZERO_SRC_ICEINSTRUMENTATION_H
30 30
31 #include "IceDefs.h" 31 #include "IceDefs.h"
32 32
33 #include <condition_variable>
34
33 namespace Ice { 35 namespace Ice {
34 36
35 class LoweringContext; 37 class LoweringContext;
36 38
37 class Instrumentation { 39 class Instrumentation {
38 Instrumentation() = delete; 40 Instrumentation() = delete;
39 Instrumentation(const Instrumentation &) = delete; 41 Instrumentation(const Instrumentation &) = delete;
40 Instrumentation &operator=(const Instrumentation &) = delete; 42 Instrumentation &operator=(const Instrumentation &) = delete;
41 43
42 public: 44 public:
43 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} 45 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {}
46 virtual ~Instrumentation() = default;
44 virtual void instrumentGlobals(VariableDeclarationList &) {} 47 virtual void instrumentGlobals(VariableDeclarationList &) {}
45 void instrumentFunc(Cfg *Func); 48 void instrumentFunc(Cfg *Func);
49 void setHasSeenGlobals();
46 50
47 protected: 51 protected:
48 virtual void instrumentInst(LoweringContext &Context); 52 virtual void instrumentInst(LoweringContext &Context);
53 LockedPtr<VariableDeclarationList> getGlobals();
49 54
50 private: 55 private:
51 virtual bool isInstrumentable(Cfg *) { return true; } 56 virtual bool isInstrumentable(Cfg *) { return true; }
52 virtual void instrumentFuncStart(LoweringContext &) {} 57 virtual void instrumentFuncStart(LoweringContext &) {}
53 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {} 58 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {}
54 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) { 59 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) {
55 } 60 }
56 virtual void instrumentBr(LoweringContext &, class InstBr *) {} 61 virtual void instrumentBr(LoweringContext &, class InstBr *) {}
57 virtual void instrumentCall(LoweringContext &, class InstCall *) {} 62 virtual void instrumentCall(LoweringContext &, class InstCall *) {}
58 virtual void instrumentCast(LoweringContext &, class InstCast *) {} 63 virtual void instrumentCast(LoweringContext &, class InstCast *) {}
(...skipping 12 matching lines...) Expand all
71 virtual void instrumentStore(LoweringContext &, class InstStore *) {} 76 virtual void instrumentStore(LoweringContext &, class InstStore *) {}
72 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {} 77 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {}
73 virtual void instrumentUnreachable(LoweringContext &, 78 virtual void instrumentUnreachable(LoweringContext &,
74 class InstUnreachable *) {} 79 class InstUnreachable *) {}
75 virtual void instrumentStart(Cfg *) {} 80 virtual void instrumentStart(Cfg *) {}
76 virtual void instrumentLocalVars(Cfg *) {} 81 virtual void instrumentLocalVars(Cfg *) {}
77 virtual void finishFunc(Cfg *) {} 82 virtual void finishFunc(Cfg *) {}
78 83
79 protected: 84 protected:
80 GlobalContext *Ctx; 85 GlobalContext *Ctx;
86
87 private:
88 bool HasSeenGlobals = false;
89 std::mutex GlobalsSeenMutex;
90 std::condition_variable GlobalsSeenCV;
81 }; 91 };
82 92
83 } // end of namespace Ice 93 } // end of namespace Ice
84 94
85 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H 95 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H
OLDNEW
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceInstrumentation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698