@@ -308,10 +308,11 @@ class SymbolLookupSet {
308
308
// / If Body returns true then the element just passed in is removed from the
309
309
// / set. If Body returns false then the element is retained.
310
310
template <typename BodyFn>
311
- auto forEachWithRemoval (BodyFn &&Body) -> std::enable_if_t<
312
- std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
313
- std::declval<SymbolLookupFlags>())),
314
- bool>::value> {
311
+ auto forEachWithRemoval (BodyFn &&Body)
312
+ -> std::enable_if_t<
313
+ std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
314
+ std::declval<SymbolLookupFlags>())),
315
+ bool>::value> {
315
316
UnderlyingVector::size_type I = 0 ;
316
317
while (I != Symbols.size ()) {
317
318
const auto &Name = Symbols[I].first ;
@@ -330,11 +331,12 @@ class SymbolLookupSet {
330
331
// / returns true then the element just passed in is removed from the set. If
331
332
// / Body returns false then the element is retained.
332
333
template <typename BodyFn>
333
- auto forEachWithRemoval (BodyFn &&Body) -> std::enable_if_t<
334
- std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
335
- std::declval<SymbolLookupFlags>())),
336
- Expected<bool>>::value,
337
- Error> {
334
+ auto forEachWithRemoval (BodyFn &&Body)
335
+ -> std::enable_if_t<
336
+ std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
337
+ std::declval<SymbolLookupFlags>())),
338
+ Expected<bool>>::value,
339
+ Error> {
338
340
UnderlyingVector::size_type I = 0 ;
339
341
while (I != Symbols.size ()) {
340
342
const auto &Name = Symbols[I].first ;
@@ -525,6 +527,7 @@ class MissingSymbolDefinitions : public ErrorInfo<MissingSymbolDefinitions> {
525
527
std::shared_ptr<SymbolStringPool> getSymbolStringPool () { return SSP; }
526
528
const std::string &getModuleName () const { return ModuleName; }
527
529
const SymbolNameVector &getSymbols () const { return Symbols; }
530
+
528
531
private:
529
532
std::shared_ptr<SymbolStringPool> SSP;
530
533
std::string ModuleName;
@@ -535,7 +538,8 @@ class MissingSymbolDefinitions : public ErrorInfo<MissingSymbolDefinitions> {
535
538
// / symbols that are not claimed by the module's associated
536
539
// / MaterializationResponsibility. If this error is returned it is indicative of
537
540
// / a broken transformation / compiler / object cache.
538
- class UnexpectedSymbolDefinitions : public ErrorInfo <UnexpectedSymbolDefinitions> {
541
+ class UnexpectedSymbolDefinitions
542
+ : public ErrorInfo<UnexpectedSymbolDefinitions> {
539
543
public:
540
544
static char ID;
541
545
@@ -548,6 +552,7 @@ class UnexpectedSymbolDefinitions : public ErrorInfo<UnexpectedSymbolDefinitions
548
552
std::shared_ptr<SymbolStringPool> getSymbolStringPool () { return SSP; }
549
553
const std::string &getModuleName () const { return ModuleName; }
550
554
const SymbolNameVector &getSymbols () const { return Symbols; }
555
+
551
556
private:
552
557
std::shared_ptr<SymbolStringPool> SSP;
553
558
std::string ModuleName;
@@ -693,6 +698,10 @@ class MaterializationResponsibility {
693
698
: JD(RT->getJITDylib ()), RT(std::move(RT)),
694
699
SymbolFlags(std::move(SymbolFlags)), InitSymbol(std::move(InitSymbol)) {
695
700
assert (!this ->SymbolFlags .empty () && " Materializing nothing?" );
701
+ for (auto &KV : this ->SymbolFlags ) {
702
+ dbgs () << " @@@ Init MR " << KV.first << " "
703
+ << format_hex (KV.second .getRawFlagsValue (), 8 ) << " \n " ;
704
+ }
696
705
}
697
706
698
707
JITDylib &JD;
@@ -800,7 +809,6 @@ class AsynchronousSymbolQuery {
800
809
// / resolved.
801
810
bool isComplete () const { return OutstandingSymbolsCount == 0 ; }
802
811
803
-
804
812
private:
805
813
void handleComplete (ExecutionSession &ES);
806
814
@@ -899,8 +907,8 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
899
907
friend class ExecutionSession ;
900
908
friend class Platform ;
901
909
friend class MaterializationResponsibility ;
902
- public:
903
910
911
+ public:
904
912
JITDylib (const JITDylib &) = delete ;
905
913
JITDylib &operator =(const JITDylib &) = delete ;
906
914
JITDylib (JITDylib &&) = delete ;
@@ -1104,7 +1112,7 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
1104
1112
1105
1113
private:
1106
1114
using AsynchronousSymbolQuerySet =
1107
- std::set<std::shared_ptr<AsynchronousSymbolQuery>>;
1115
+ std::set<std::shared_ptr<AsynchronousSymbolQuery>>;
1108
1116
1109
1117
using AsynchronousSymbolQueryList =
1110
1118
std::vector<std::shared_ptr<AsynchronousSymbolQuery>>;
@@ -1160,6 +1168,7 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
1160
1168
const AsynchronousSymbolQueryList &pendingQueries () const {
1161
1169
return PendingQueries;
1162
1170
}
1171
+
1163
1172
private:
1164
1173
AsynchronousSymbolQueryList PendingQueries;
1165
1174
};
@@ -1355,13 +1364,13 @@ class ExecutionSession {
1355
1364
using ErrorReporter = unique_function<void (Error)>;
1356
1365
1357
1366
// / Send a result to the remote.
1358
- using SendResultFunction = unique_function<void (shared::WrapperFunctionResult)>;
1367
+ using SendResultFunction =
1368
+ unique_function<void (shared::WrapperFunctionResult)>;
1359
1369
1360
1370
// / An asynchronous wrapper-function callable from the executor via
1361
1371
// / jit-dispatch.
1362
1372
using JITDispatchHandlerFunction = unique_function<void (
1363
- SendResultFunction SendResult,
1364
- const char *ArgData, size_t ArgSize)>;
1373
+ SendResultFunction SendResult, const char *ArgData, size_t ArgSize)>;
1365
1374
1366
1375
// / A map associating tag names with asynchronous wrapper function
1367
1376
// / implementations in the JIT.
@@ -1589,8 +1598,7 @@ class ExecutionSession {
1589
1598
// / \endcode{.cpp}
1590
1599
// /
1591
1600
// / The given OnComplete function will be called to return the result.
1592
- template <typename ... ArgTs>
1593
- void callWrapperAsync (ArgTs &&... Args) {
1601
+ template <typename ... ArgTs> void callWrapperAsync (ArgTs &&...Args) {
1594
1602
EPC->callWrapperAsync (std::forward<ArgTs>(Args)...);
1595
1603
}
1596
1604
@@ -1635,9 +1643,9 @@ class ExecutionSession {
1635
1643
// / (using registerJITDispatchHandler) and called from the executor.
1636
1644
template <typename SPSSignature, typename HandlerT>
1637
1645
static JITDispatchHandlerFunction wrapAsyncWithSPS (HandlerT &&H) {
1638
- return [H = std::forward<HandlerT>(H)](
1639
- SendResultFunction SendResult ,
1640
- const char *ArgData, size_t ArgSize) mutable {
1646
+ return [H = std::forward<HandlerT>(H)](SendResultFunction SendResult,
1647
+ const char *ArgData ,
1648
+ size_t ArgSize) mutable {
1641
1649
shared::WrapperFunction<SPSSignature>::handleAsync (ArgData, ArgSize, H,
1642
1650
std::move (SendResult));
1643
1651
};
@@ -1742,8 +1750,8 @@ class ExecutionSession {
1742
1750
unique_function<void (Expected<SymbolFlagsMap>)> OnComplete);
1743
1751
1744
1752
// State machine functions for MaterializationResponsibility.
1745
- void OL_destroyMaterializationResponsibility (
1746
- MaterializationResponsibility &MR);
1753
+ void
1754
+ OL_destroyMaterializationResponsibility ( MaterializationResponsibility &MR);
1747
1755
SymbolNameSet OL_getRequestedSymbols (const MaterializationResponsibility &MR);
1748
1756
Error OL_notifyResolved (MaterializationResponsibility &MR,
1749
1757
const SymbolMap &Symbols);
@@ -1965,12 +1973,13 @@ inline MaterializationResponsibility::~MaterializationResponsibility() {
1965
1973
getExecutionSession ().OL_destroyMaterializationResponsibility (*this );
1966
1974
}
1967
1975
1968
- inline SymbolNameSet MaterializationResponsibility::getRequestedSymbols () const {
1976
+ inline SymbolNameSet
1977
+ MaterializationResponsibility::getRequestedSymbols () const {
1969
1978
return getExecutionSession ().OL_getRequestedSymbols (*this );
1970
1979
}
1971
1980
1972
- inline Error MaterializationResponsibility::notifyResolved (
1973
- const SymbolMap &Symbols) {
1981
+ inline Error
1982
+ MaterializationResponsibility::notifyResolved ( const SymbolMap &Symbols) {
1974
1983
return getExecutionSession ().OL_notifyResolved (*this , Symbols);
1975
1984
}
1976
1985
@@ -1979,8 +1988,8 @@ inline Error MaterializationResponsibility::notifyEmitted(
1979
1988
return getExecutionSession ().OL_notifyEmitted (*this , EmittedDeps);
1980
1989
}
1981
1990
1982
- inline Error MaterializationResponsibility::defineMaterializing (
1983
- SymbolFlagsMap SymbolFlags) {
1991
+ inline Error
1992
+ MaterializationResponsibility::defineMaterializing ( SymbolFlagsMap SymbolFlags) {
1984
1993
return getExecutionSession ().OL_defineMaterializing (*this ,
1985
1994
std::move (SymbolFlags));
1986
1995
}
0 commit comments