Loading...
cache_builder/NewSharedCacheBuilder.h dyld-1340 dyld-1162
--- dyld/dyld-1340/cache_builder/NewSharedCacheBuilder.h
+++ dyld/dyld-1162/cache_builder/NewSharedCacheBuilder.h
@@ -43,7 +43,6 @@
 #include "SubCache.h"
 #include "Timer.h"
 #include "Types.h"
-#include "PropertyList.h"
 
 #include <list>
 #include <memory>
@@ -65,7 +64,6 @@
     uint8_t*        bufferData  = nullptr;
     size_t          bufferSize  = 0;
     std::string     cdHash      = "";
-    std::string     agilecdHash = ""; // if using agile signatures, this is the other signature
     std::string     uuid        = "";
 
     // Something like .development, .development.data, .symbols, etc
@@ -75,6 +73,12 @@
     bool usedByCustomerConfig = false;
     // True if development/universal caches need this buffer
     bool usedByDevelopmentConfig = false;
+
+    // The builder executable also passes back the fd.  This should typically be used instead of the data buffer
+#if !SUPPORT_CACHE_BUILDER_MEMORY_BUFFERS
+    int             fd          = 0;
+    std::string     tempPath    = "";
+#endif
 };
 
 class SharedCacheBuilder
@@ -83,7 +87,6 @@
     SharedCacheBuilder(BuilderOptions& options, const dyld3::closure::FileSystem& fileSystem);
 
     void            forEachWarning(void (^callback)(const std::string_view& str)) const;
-    void            forEachError(void (^callback)(const std::string_view& str)) const;
     void            forEachCacheDylib(void (^callback)(const std::string_view& path)) const;
     void            forEachCacheSymlink(void (^callback)(const std::string_view& path)) const;
     void            addFile(const void* buffer, size_t bufferSize, std::string_view path,
@@ -94,9 +97,8 @@
 
     // If we overflow, then build() should return an error, and this should be the list of evicted dylibs
     std::span<const std::string_view>   getEvictedDylibs() const;
-    void                                getResults(std::vector<CacheBuffer>& results, std::vector<std::byte>& atlas) const;
+    void                                getResults(std::vector<CacheBuffer>& results) const;
     std::string                         getMapFileBuffer() const;
-    std::string_view                    getSwiftPrespecializedDylibBuildError() const;
 
     // All caches have a logging prefix, UUID and JSON map which represents the development cache.
     // Universal caches may also have customer versions of these
@@ -106,7 +108,6 @@
     std::string                 customerLoggingPrefix() const;
     std::string                 customerJSONMap(std::string_view disposition) const;
     std::string                 customerCacheUUID() const;
-    std::string                 stats(uint64_t startTimeNanos) const;
 
 #if BUILDING_CACHE_BUILDER_UNIT_TESTS
     // We need everything public to write tests
@@ -129,12 +130,6 @@
     void            verifySelfContained();
     void            calculateDylibAliases();
     void            sortDylibs();
-    void            sortExecutables();
-
-    bool            shouldBuildSwiftPrespecializedDylib();
-    bool            reserveSwiftPrespecializedInputFile();
-    error::Error    buildSwiftPrespecializedDylibJSON();
-    error::Error    createSwiftPrespecializedDylib();
     error::Error    calculateDylibDependents();
     void            categorizeDylibSegments();
     void            categorizeDylibLinkedit();
@@ -151,10 +146,8 @@
     void            calculateObjCCategoriesSize();
     void            estimateSwiftHashTableSizes();
     void            calculateCacheDylibsTrie();
-    void            initializePatchTableOptimizer();
-    void            estimateFunctionVariantsSize();
+    void            estimatePatchTableSize();
     void            estimateCacheLoadersSize();
-    void            estimatePrewarmingSize();
     void            setupStubOptimizer();
     void            addObjCOptimizationsToSubCache(SubCache& subCache);
     void            addGlobalOptimizationsToSubCache(SubCache& subCache);
@@ -167,7 +160,6 @@
     error::Error    calculateSubCacheSymbolStrings();
     error::Error    calculateUniqueGOTs();
     void            sortSubCacheSegments();
-    void            addAlignmentChunks();
     void            calculateSlideInfoSize();
     void            calculateCodeSignatureSize();
     void            printSubCaches() const;
@@ -198,22 +190,16 @@
     error::Error    emitPreAttachedObjCCategories();
     void            computeSlideInfo();
     void            emitCacheDylibsTrie();
-    error::Error    calculatePatchTableSize();
     error::Error    emitPatchTable();
-    void            emitFunctionVariants();
     error::Error    emitCacheDylibsPrebuiltLoaders();
     error::Error    emitExecutablePrebuiltLoaders();
     void            emitSymbolTable();
     void            emitUnmappedLocalSymbols();
-    error::Error    emitPrewarmingData();
+    void            writeSubCacheHeader(SubCache& subCache);
     uint64_t        getMaxSlide() const;
     void            addObjcSegments();
-    error::Error    patchLinkedDylibs(CacheDylib& dylib);
     void            computeCacheHeaders();
     static bool     regionIsSharedCacheMapping(const Region& region);
-    void            addSubCacheFileInfo(uint64_t cacheVMAddress, PropertyList::Array &files, const SubCache &subCache);
-    void            addCacheAtlasInfo(PropertyList::Dictionary *customerCacheAtlas, const SubCache &subCache);
-    void            buildAtlas();
     void            codeSign();
 
     std::string     generateJSONMap(std::string_view disposition,
@@ -265,15 +251,10 @@
     std::vector<InputFile*>                         nonCacheDylibInputFiles;
     std::vector<std::string_view>                   evictedDylibs;
     std::vector<SubCache>                           subCaches;
-    std::vector<std::byte>                          atlasData;
     CacheVMSize                                     totalVMSize;
     std::unordered_map<std::string, CacheDylib*>    dylibAliases;
     bool                                            dylibHasMissingDependency = false;
     std::vector<std::string>                        warnings;
-    std::vector<std::string>                        errors;
-    std::string                                     swiftPrespecializedDylibJSON;
-    CacheDylib*                                     swiftPrespecializedDylib = nullptr;
-    std::string                                     swiftPrespecializedDylibBuildError;
 
     // Some optimizers are run just once per cache, so live at the top level here
     ObjCOptimizer                        objcOptimizer;
@@ -282,14 +263,12 @@
     ObjCClassOptimizer                   objcClassOptimizer;
     ObjCProtocolOptimizer                objcProtocolOptimizer;
     ObjCCategoryOptimizer                objcCategoryOptimizer;
-    SwiftOptimizer                       swiftOptimizer;
+    SwiftProtocolConformanceOptimizer    swiftProtocolConformanceOptimizer;
     DylibTrieOptimizer                   dylibTrieOptimizer;
     PatchTableOptimizer                  patchTableOptimizer;
     PrebuiltLoaderBuilder                prebuiltLoaderBuilder;
     UnmappedSymbolsOptimizer             unmappedSymbolsOptimizer;
     StubOptimizer                        stubOptimizer;
-    FunctionVariantsOptimizer            functionVariantsOptimizer;
-    PrewarmingOptimizer                  prewarmingOptimizer;
 };
 
 } // namespace cache_builder