@@ -31,7 +31,6 @@ static VTuneMethodBatch getMethodBatch(LinkGraph &G, bool EmitDebugInfo) {
31
31
if (EmitDebugInfo) {
32
32
auto EDC = createDWARFContext (G);
33
33
if (!EDC) {
34
- // ERROR
35
34
EmitDebugInfo = false ;
36
35
} else {
37
36
DC = std::move (EDC->first );
@@ -42,16 +41,15 @@ static VTuneMethodBatch getMethodBatch(LinkGraph &G, bool EmitDebugInfo) {
42
41
auto GetStringIdx = [Deduplicator = StringMap<uint32_t >(),
43
42
&Batch](StringRef S) mutable {
44
43
auto I = Deduplicator.find (S);
45
- if (I != Deduplicator.end ()) {
44
+ if (I != Deduplicator.end ())
46
45
return I->second ;
47
- }
46
+
48
47
Batch.Strings .push_back (S.str ());
49
48
return Deduplicator[S] = Batch.Strings .size ();
50
49
};
51
50
for (auto Sym : G.defined_symbols ()) {
52
- if (!Sym->isCallable ()) {
51
+ if (!Sym->isCallable ())
53
52
continue ;
54
- }
55
53
56
54
Batch.Methods .push_back (VTuneMethodInfo ());
57
55
auto &Method = Batch.Methods .back ();
@@ -63,10 +61,9 @@ static VTuneMethodBatch getMethodBatch(LinkGraph &G, bool EmitDebugInfo) {
63
61
Method.ClassFileSI = 0 ;
64
62
Method.SourceFileSI = 0 ;
65
63
66
- if (!EmitDebugInfo) {
64
+ if (!EmitDebugInfo)
67
65
continue ;
68
- }
69
- // TODO: Emit debug info
66
+
70
67
auto &Section = Sym->getBlock ().getSection ();
71
68
auto Addr = Sym->getAddress ();
72
69
auto SAddr =
@@ -94,7 +91,6 @@ void VTuneSupportPlugin::modifyPassConfig(MaterializationResponsibility &MR,
94
91
// the object file is generated but not linked yet
95
92
auto Batch = getMethodBatch (G, EmitDebugInfo);
96
93
if (Batch.Methods .empty ()) {
97
- // Nothing to do.
98
94
return Error::success ();
99
95
}
100
96
{
@@ -120,9 +116,9 @@ Error VTuneSupportPlugin::notifyEmitted(MaterializationResponsibility &MR) {
120
116
if (auto Err = MR.withResourceKeyDo ([this , MR = &MR](ResourceKey K) {
121
117
std::lock_guard<std::mutex> Lock (PluginMutex);
122
118
auto I = PendingMethodIDs.find (MR);
123
- if (I == PendingMethodIDs.end ()) {
119
+ if (I == PendingMethodIDs.end ())
124
120
return ;
125
- }
121
+
126
122
LoadedMethodIDs[K].push_back (I->second );
127
123
PendingMethodIDs.erase (I);
128
124
})) {
@@ -146,16 +142,16 @@ Error VTuneSupportPlugin::notifyRemovingResources(JITDylib &JD, ResourceKey K) {
146
142
{
147
143
std::lock_guard<std::mutex> Lock (PluginMutex);
148
144
auto I = LoadedMethodIDs.find (K);
149
- if (I == LoadedMethodIDs.end ()) {
145
+ if (I == LoadedMethodIDs.end ())
150
146
return Error::success ();
151
- }
147
+
152
148
UnloadedIDs = std::move (I->second );
153
149
LoadedMethodIDs.erase (I);
154
150
}
155
151
if (auto Err = EPC.callSPSWrapper <void (shared::SPSVTuneUnloadedMethodIDs)>(
156
- UnregisterVTuneImplAddr, UnloadedIDs)) {
152
+ UnregisterVTuneImplAddr, UnloadedIDs))
157
153
return Err;
158
- }
154
+
159
155
return Error::success ();
160
156
}
161
157
@@ -164,11 +160,12 @@ void VTuneSupportPlugin::notifyTransferringResources(JITDylib &JD,
164
160
ResourceKey SrcKey) {
165
161
std::lock_guard<std::mutex> Lock (PluginMutex);
166
162
auto I = LoadedMethodIDs.find (SrcKey);
167
- if (I == LoadedMethodIDs.end ()) {
163
+ if (I == LoadedMethodIDs.end ())
168
164
return ;
169
- }
165
+
170
166
auto &Dest = LoadedMethodIDs[DstKey];
171
167
Dest.insert (Dest.end (), I->second .begin (), I->second .end ());
168
+ LoadedMethodIDs.erase (SrcKey);
172
169
}
173
170
174
171
Expected<std::unique_ptr<VTuneSupportPlugin>>
0 commit comments