Lines Matching refs:JDS

188   void runAtExits(JITDylibState &JDS);
202 static Error registerObjCSelectors(JITDylibState &JDS);
203 static Error registerObjCClasses(JITDylibState &JDS);
204 static Error registerSwift5Protocols(JITDylibState &JDS);
205 static Error registerSwift5ProtocolConformances(JITDylibState &JDS);
206 static Error registerSwift5Types(JITDylibState &JDS);
207 static Error runModInits(JITDylibState &JDS);
210 Error dlopenFull(JITDylibState &JDS);
211 Error dlopenInitialize(JITDylibState &JDS, MachOJITDylibDepInfoMap &DepInfo);
214 Error dlcloseDeinitialize(JITDylibState &JDS);
265 auto &JDS = JDStates[Header]; in registerJITDylib() local
266 JDS.Name = std::move(Name); in registerJITDylib()
267 JDS.Header = Header; in registerJITDylib()
268 JDNameToHeader[JDS.Name] = Header; in registerJITDylib()
331 auto *JDS = getJITDylibStateByHeader(HeaderAddr.toPtr<void *>()); in registerObjectPlatformSections() local
332 if (!JDS) { in registerObjectPlatformSections()
346 JDS->ObjCSelRefsSectionsNew.push_back(KV.second.toSpan<uintptr_t>()); in registerObjectPlatformSections()
348 JDS->ObjCClassListSectionsNew.push_back(KV.second.toSpan<uintptr_t>()); in registerObjectPlatformSections()
350 JDS->Swift5ProtosSectionsNew.push_back(KV.second.toSpan<char>()); in registerObjectPlatformSections()
352 JDS->Swift5ProtoSectionsNew.push_back(KV.second.toSpan<char>()); in registerObjectPlatformSections()
354 JDS->Swift5TypesSectionsNew.push_back(KV.second.toSpan<char>()); in registerObjectPlatformSections()
356 JDS->ModInitsSectionsNew.push_back(KV.second.toSpan<void (*)()>()); in registerObjectPlatformSections()
395 auto *JDS = getJITDylibStateByHeader(HeaderAddr.toPtr<void *>()); in deregisterObjectPlatformSections() local
396 if (!JDS) { in deregisterObjectPlatformSections()
414 if (!removeIfPresent(JDS->ObjCSelRefsSections, KV.second)) in deregisterObjectPlatformSections()
415 removeIfPresent(JDS->ObjCSelRefsSectionsNew, KV.second); in deregisterObjectPlatformSections()
417 if (!removeIfPresent(JDS->ObjCClassListSections, KV.second)) in deregisterObjectPlatformSections()
418 removeIfPresent(JDS->ObjCClassListSectionsNew, KV.second); in deregisterObjectPlatformSections()
420 if (!removeIfPresent(JDS->Swift5ProtosSections, KV.second)) in deregisterObjectPlatformSections()
421 removeIfPresent(JDS->Swift5ProtosSectionsNew, KV.second); in deregisterObjectPlatformSections()
423 if (!removeIfPresent(JDS->Swift5ProtoSections, KV.second)) in deregisterObjectPlatformSections()
424 removeIfPresent(JDS->Swift5ProtoSectionsNew, KV.second); in deregisterObjectPlatformSections()
426 if (!removeIfPresent(JDS->Swift5TypesSections, KV.second)) in deregisterObjectPlatformSections()
427 removeIfPresent(JDS->Swift5TypesSectionsNew, KV.second); in deregisterObjectPlatformSections()
429 if (!removeIfPresent(JDS->ModInitsSections, KV.second)) in deregisterObjectPlatformSections()
430 removeIfPresent(JDS->ModInitsSectionsNew, KV.second); in deregisterObjectPlatformSections()
461 auto *JDS = getJITDylibStateByHeader(DSOHandle); in dlclose()
463 if (JDS) { in dlclose()
493 auto *JDS = getJITDylibStateByHeader(DSOHandle); in registerAtExit() local
494 if (!JDS) { in registerAtExit()
502 JDS->AtExits.push_back({F, Arg}); in registerAtExit()
506 void MachOPlatformRuntimeState::runAtExits(JITDylibState &JDS) { in runAtExits() argument
507 while (!JDS.AtExits.empty()) { in runAtExits()
508 auto &AE = JDS.AtExits.back(); in runAtExits()
510 JDS.AtExits.pop_back(); in runAtExits()
516 auto *JDS = getJITDylibStateByHeader(DSOHandle); in runAtExits() local
522 if (JDS) in runAtExits()
523 runAtExits(*JDS); in runAtExits()
584 Error MachOPlatformRuntimeState::registerObjCSelectors(JITDylibState &JDS) { in registerObjCSelectors() argument
586 if (JDS.ObjCSelRefsSectionsNew.empty()) in registerObjCSelectors()
592 for (const auto &ObjCSelRefs : JDS.ObjCSelRefsSectionsNew) { in registerObjCSelectors()
600 moveAppendSections(JDS.ObjCSelRefsSections, JDS.ObjCSelRefsSectionsNew); in registerObjCSelectors()
604 Error MachOPlatformRuntimeState::registerObjCClasses(JITDylibState &JDS) { in registerObjCClasses() argument
606 if (JDS.ObjCClassListSectionsNew.empty()) in registerObjCClasses()
624 for (const auto &ObjCClassList : JDS.ObjCClassListSectionsNew) { in registerObjCClasses()
629 auto Registered = objc_readClassPair(Cls, JDS.ObjCImageInfo); in registerObjCClasses()
637 moveAppendSections(JDS.ObjCClassListSections, JDS.ObjCClassListSectionsNew); in registerObjCClasses()
641 Error MachOPlatformRuntimeState::registerSwift5Protocols(JITDylibState &JDS) { in registerSwift5Protocols() argument
643 if (JDS.Swift5ProtosSectionsNew.empty()) in registerSwift5Protocols()
649 for (const auto &Swift5Protocols : JDS.Swift5ProtoSectionsNew) in registerSwift5Protocols()
655 moveAppendSections(JDS.Swift5ProtoSections, JDS.Swift5ProtoSectionsNew); in registerSwift5Protocols()
660 JITDylibState &JDS) { in registerSwift5ProtocolConformances() argument
662 if (JDS.Swift5ProtosSectionsNew.empty()) in registerSwift5ProtocolConformances()
669 for (const auto &ProtoConfSec : JDS.Swift5ProtosSectionsNew) in registerSwift5ProtocolConformances()
676 moveAppendSections(JDS.Swift5ProtosSections, JDS.Swift5ProtosSectionsNew); in registerSwift5ProtocolConformances()
680 Error MachOPlatformRuntimeState::registerSwift5Types(JITDylibState &JDS) { in registerSwift5Types() argument
682 if (JDS.Swift5TypesSectionsNew.empty()) in registerSwift5Types()
689 for (const auto &TypeSec : JDS.Swift5TypesSectionsNew) in registerSwift5Types()
695 moveAppendSections(JDS.Swift5TypesSections, JDS.Swift5TypesSectionsNew); in registerSwift5Types()
699 Error MachOPlatformRuntimeState::runModInits(JITDylibState &JDS) { in runModInits() argument
701 for (const auto &ModInits : JDS.ModInitsSectionsNew) { in runModInits()
706 moveAppendSections(JDS.ModInitsSections, JDS.ModInitsSectionsNew); in runModInits()
713 auto *JDS = getJITDylibStateByName(Path); in dlopenImpl() local
715 if (!JDS) in dlopenImpl()
722 if (!JDS->referenced() || !JDS->Sealed) { in dlopenImpl()
723 if (auto Err = dlopenFull(*JDS)) in dlopenImpl()
728 ++JDS->DlRefCount; in dlopenImpl()
731 return JDS->Header; in dlopenImpl()
734 Error MachOPlatformRuntimeState::dlopenFull(JITDylibState &JDS) { in dlopenFull() argument
739 DepInfo, ExecutorAddr::fromPtr(JDS.Header))) in dlopenFull()
744 if (auto Err = dlopenInitialize(JDS, *DepInfo)) in dlopenFull()
750 JDS.Name.c_str()); in dlopenFull()
755 << JDS.Name; in dlopenFull()
763 JITDylibState &JDS, MachOJITDylibDepInfoMap &DepInfo) { in dlopenInitialize() argument
766 JDS.Name.c_str()); in dlopenInitialize()
774 auto I = DepInfo.find(ExecutorAddr::fromPtr(JDS.Header)); in dlopenInitialize()
783 if (JDS.Sealed) { in dlopenInitialize()
786 ErrStream << "Sealed JITDylib " << JDS.Header in dlopenInitialize()
790 if (JDS.referenced()) in dlopenInitialize()
793 JDS.Sealed = DI.Sealed; in dlopenInitialize()
797 std::swap(JDS.Deps, OldDeps); in dlopenInitialize()
798 JDS.Deps.reserve(DI.DepHeaders.size()); in dlopenInitialize()
805 << JDS.Name; in dlopenInitialize()
814 if (auto Err = registerObjCSelectors(JDS)) in dlopenInitialize()
816 if (auto Err = registerObjCClasses(JDS)) in dlopenInitialize()
818 if (auto Err = registerSwift5Protocols(JDS)) in dlopenInitialize()
820 if (auto Err = registerSwift5ProtocolConformances(JDS)) in dlopenInitialize()
822 if (auto Err = registerSwift5Types(JDS)) in dlopenInitialize()
824 if (auto Err = runModInits(JDS)) in dlopenInitialize()
842 auto *JDS = getJITDylibStateByHeader(DSOHandle); in dlcloseImpl() local
844 if (!JDS) { in dlcloseImpl()
851 --JDS->DlRefCount; in dlcloseImpl()
853 if (!JDS->referenced()) in dlcloseImpl()
854 return dlcloseDeinitialize(*JDS); in dlcloseImpl()
859 Error MachOPlatformRuntimeState::dlcloseDeinitialize(JITDylibState &JDS) { in dlcloseDeinitialize() argument
863 JDS.Name.c_str()); in dlcloseDeinitialize()
866 runAtExits(JDS); in dlcloseDeinitialize()
869 moveAppendSections(JDS.ModInitsSections, JDS.ModInitsSectionsNew); in dlcloseDeinitialize()
870 JDS.ModInitsSectionsNew = std::move(JDS.ModInitsSections); in dlcloseDeinitialize()
873 for (auto *DepJDS : JDS.Deps) { in dlcloseDeinitialize()