@@ -179,37 +179,6 @@ class LazyReexportsManager : public ResourceManager {
179
179
lazyReexports (LazyReexportsManager &, SymbolAliasMap);
180
180
181
181
public:
182
- struct CallThroughInfo {
183
- JITDylibSP JD;
184
- SymbolStringPtr Name;
185
- SymbolStringPtr BodyName;
186
- };
187
-
188
- class Listener {
189
- public:
190
- using CallThroughInfo = LazyReexportsManager::CallThroughInfo;
191
-
192
- virtual ~Listener ();
193
-
194
- // / Called under the session lock when new lazy reexports are created.
195
- virtual void onLazyReexportsCreated (JITDylib &JD, ResourceKey K,
196
- const SymbolAliasMap &Reexports) = 0;
197
-
198
- // / Called under the session lock when lazy reexports have their ownership
199
- // / transferred to a new ResourceKey.
200
- virtual void onLazyReexportsTransfered (JITDylib &JD, ResourceKey DstK,
201
- ResourceKey SrcK) = 0;
202
-
203
- // / Called under the session lock when lazy reexports are removed.
204
- virtual Error onLazyReexportsRemoved (JITDylib &JD, ResourceKey K) = 0;
205
-
206
- // / Called outside the session lock when a lazy reexport is called.
207
- // / NOTE: Since this is called outside the session lock there is a chance
208
- // / that the reexport referred to has already been removed. Listeners
209
- // / must be prepared to handle requests for stale reexports.
210
- virtual void onLazyReexportCalled (const CallThroughInfo &CTI) = 0;
211
- };
212
-
213
182
using OnTrampolinesReadyFn = unique_function<void (
214
183
Expected<std::vector<ExecutorSymbolDef>> EntryAddrs)>;
215
184
using EmitTrampolinesFn =
@@ -220,7 +189,7 @@ class LazyReexportsManager : public ResourceManager {
220
189
// / This will work both in-process and out-of-process.
221
190
static Expected<std::unique_ptr<LazyReexportsManager>>
222
191
Create (EmitTrampolinesFn EmitTrampolines, RedirectableSymbolManager &RSMgr,
223
- JITDylib &PlatformJD, Listener *L = nullptr );
192
+ JITDylib &PlatformJD);
224
193
225
194
LazyReexportsManager (LazyReexportsManager &&) = delete ;
226
195
LazyReexportsManager &operator =(LazyReexportsManager &&) = delete ;
@@ -230,6 +199,12 @@ class LazyReexportsManager : public ResourceManager {
230
199
ResourceKey SrcK) override ;
231
200
232
201
private:
202
+ struct CallThroughInfo {
203
+ SymbolStringPtr Name;
204
+ SymbolStringPtr BodyName;
205
+ JITDylibSP JD;
206
+ };
207
+
233
208
class MU ;
234
209
class Plugin ;
235
210
@@ -238,7 +213,7 @@ class LazyReexportsManager : public ResourceManager {
238
213
239
214
LazyReexportsManager (EmitTrampolinesFn EmitTrampolines,
240
215
RedirectableSymbolManager &RSMgr, JITDylib &PlatformJD,
241
- Listener *L, Error &Err);
216
+ Error &Err);
242
217
243
218
std::unique_ptr<MaterializationUnit>
244
219
createLazyReexports (SymbolAliasMap Reexports);
@@ -254,7 +229,6 @@ class LazyReexportsManager : public ResourceManager {
254
229
ExecutionSession &ES;
255
230
EmitTrampolinesFn EmitTrampolines;
256
231
RedirectableSymbolManager &RSMgr;
257
- Listener *L;
258
232
259
233
DenseMap<ResourceKey, std::vector<ExecutorAddr>> KeyToReentryAddrs;
260
234
DenseMap<ExecutorAddr, CallThroughInfo> CallThroughs;
@@ -268,66 +242,6 @@ lazyReexports(LazyReexportsManager &LRM, SymbolAliasMap Reexports) {
268
242
return LRM.createLazyReexports (std::move (Reexports));
269
243
}
270
244
271
- class SimpleLazyReexportsSpeculator : public LazyReexportsManager ::Listener {
272
- friend std::shared_ptr<SimpleLazyReexportsSpeculator> std::make_shared ();
273
-
274
- public:
275
- using RecordExecutionFunction =
276
- unique_function<void (const CallThroughInfo &CTI)>;
277
-
278
- static std::shared_ptr<SimpleLazyReexportsSpeculator>
279
- Create (ExecutionSession &ES, RecordExecutionFunction RecordExec = {}) {
280
- class make_shared_helper : public SimpleLazyReexportsSpeculator {
281
- public:
282
- make_shared_helper (ExecutionSession &ES,
283
- RecordExecutionFunction RecordExec)
284
- : SimpleLazyReexportsSpeculator(ES, std::move(RecordExec)) {}
285
- };
286
-
287
- auto Instance =
288
- std::make_shared<make_shared_helper>(ES, std::move (RecordExec));
289
- Instance->WeakThis = Instance;
290
- return Instance;
291
- }
292
-
293
- SimpleLazyReexportsSpeculator (SimpleLazyReexportsSpeculator &&) = delete ;
294
- SimpleLazyReexportsSpeculator &
295
- operator =(SimpleLazyReexportsSpeculator &&) = delete ;
296
- ~SimpleLazyReexportsSpeculator () override ;
297
-
298
- void onLazyReexportsCreated (JITDylib &JD, ResourceKey K,
299
- const SymbolAliasMap &Reexports) override ;
300
-
301
- void onLazyReexportsTransfered (JITDylib &JD, ResourceKey DstK,
302
- ResourceKey SrcK) override ;
303
-
304
- Error onLazyReexportsRemoved (JITDylib &JD, ResourceKey K) override ;
305
-
306
- void onLazyReexportCalled (const CallThroughInfo &CTI) override ;
307
-
308
- void addSpeculationSuggestions (
309
- std::vector<std::pair<std::string, SymbolStringPtr>> NewSuggestions);
310
-
311
- private:
312
- SimpleLazyReexportsSpeculator (ExecutionSession &ES,
313
- RecordExecutionFunction RecordExec)
314
- : ES(ES), RecordExec(std::move(RecordExec)) {}
315
-
316
- bool doNextSpeculativeLookup ();
317
-
318
- class SpeculateTask ;
319
-
320
- using KeyToFunctionBodiesMap =
321
- DenseMap<ResourceKey, std::vector<SymbolStringPtr>>;
322
-
323
- ExecutionSession &ES;
324
- RecordExecutionFunction RecordExec;
325
- std::weak_ptr<SimpleLazyReexportsSpeculator> WeakThis;
326
- DenseMap<JITDylib *, KeyToFunctionBodiesMap> LazyReexports;
327
- std::deque<std::pair<std::string, SymbolStringPtr>> SpeculateSuggestions;
328
- bool SpeculateTaskActive = false ;
329
- };
330
-
331
245
} // End namespace orc
332
246
} // End namespace llvm
333
247
0 commit comments