Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono][tasks] Extract EmitWasmBundle into generic EmitBundle task and…
… enable bundling in mono self-contained library (#84191) * [tasks] Move EmitWasmBundle out of wasm specific task * [tasks] Make EmitBundle more generic * [tasks] Generate EmitBundle task and replace invocations of old task * Extend preloading assemblies with mono_assembly_open * [LibraryBuilder] Integrate bundling * Refactor LibraryBuilder targets to isolate Bundling * [mono] Add mono_get_bundled_assembly in preparation for bundled runtimeconfig data * [mono][librarymode] Bundle runtimeconfig.bin * Address feedback Redesign bundling apis to handle various types of resources Move bundle registering into generated function and handle all forms of bundle registering there Move bundling api into assembly.c and prototypes into assembly-internals.h Rename assemblies to resources in bundling context Include EmitBundle task in wasm nuget Declare macro for case invariant string comparison Add documentation for bundling apis * Consolidate runtimeconfig functions * [LibraryBuilder] Enable bundling by default * Handle pdb bundling * Default EmitBundle callback function to mono_add_bundled_resource * Combine bundled resource types into generic bundled data * Add api to free memory dynamically allocated for the bundled resources hash table * Prepend enum and entries with mono * Move bundling api into separate source and header * Fix source file name * Prefix struct with Mono * Integrate new bundling api into mono debug * Fix types in autoinit * [mono] Base bundling apis around preallocation of MonoBundled*Resource structs * [mono] Clean up bundled assembly and satellite assembly search * [mono] Incorporate new bundling APIs into bundled resource retrievals * [EmitBundle][task] Add templates for bundled source files Templates added: - header mirroring bundled-resources-internals.h and MonoBundledSatelliteAssembly - source file template for each resource's byte data and size - individual templates to build preallocated MonoBundled*Resource structs - source file template to hold preallocated MonoBundled*Resource structs * [EmitBundle] Enable consolidation of bundled resource symbols * [EmitBundle] Generate bundled source file to preallocate MonoBundled*Resources * [EmitBundle] Output symbol to resource type map for populating function to add bundled resources * [LibraryBuilder] Generate source file to add preallocated MonoBundled*Resources * [LibraryBuilder] Incorporate EmitBundle templates into targets flow * [EmitBundle] Move bundle registration back into EmitBundle [EmitBundle] Leverage Emit for file generation * Update invocations of EmitBundle task * Address feedback Migrate logic to check hash table for assemblies or satellite assemblies back to bundled-resources.c Prepend apis with consistent mono_bundled_resources prefix * [mono] Prefer C99 compliant types for partially exposed APIs * Address various fixups Remove unused function Remove unnecessary string duplication Add length checks for comparisons Fix spacing in MonoBundledResource structs Avoid g_hash_table_lookup_extended precondition macro assertion fail * Combine preallocation registration and rename to templates * Prefer symbol data over symfile * Differentiate resource name and symbol * Update invocations of EmitBundle * Add inlined resource getters * Add unique id field for each MonoBundledResource * Include culture information for satellite resources * Generate preallocation and registration source file iff BundleFile provided * Generate output itemgroup detailing resource data * Leverage new bundling api from old bundling api and deprecate * [mono][debug] Migrate symbol data registration to new bundling api * Remove symbol data from MonoBundleSatelliteAssemblyResource * Directly determine resource type * Update bundled header and switch to non internal types Update bundled header to declare resource symbols and registration function Switch types from mono internal types to C99 compliant as bundling apis are partially exposed to public * Update Autoinitialization logic to leverage bundled runtimeconfig symbols * Integrate header into bundled source * Add functions to free allocated MonoBundledResources * Fixup Leverage new bundling api from old bundling api and deprecate * Fixup Address various fixups * Remove unnecessary includes * Fix trailing commas in structs and extra lines in generated files * Move specific bundled resource getters into source file * Various cleanups Instantiating boolean variables More direct insertion into hash table Removing unnecessary assertions Proper type casting Preferring symbol_data over symfile Adding void to prototype functions arg Fix indentation and spacing Prefer id over name * Cleanup logic surrounding EmitBundle task invocations * Rename output metadata to DataLenSymbol and DataLenSymbolValue * Simplify bundled resource hashtable insertion * Cleanup variable instantiation * Fixup mono-debug * Cleanup header * fixup wasi * fixup template format * Add flexibility to auto initialize runtime without bundled runtimeconfig * Various fixups * Use g_free for memory allocated through glib apis * Move condition end tag into LibraryBuilder to avoid empty line and cluttered line * Add bundled resource getters to access data values without MonoBundledResource structs * Emit one object file for single resource data source file mode * Rename resource size symbol * Use public friendly API in file linking towards runtime * Cleanup types populated through bundled resource getters * Move extern block completely to LibraryBuilder side * Update EmitBundle task invocations to use BundleRegistrationFunctionName * Refactor EmitBundle to account for timezone duplicate resource contents * wip * wip * WIP * [mono] Alias assemblies with known extension in bundled resources hashtable * [tasks] Calculate destination files within EmitBundle task itself * Update invocations of EmitBundle to grab DestinationFiles from output * Guard webcil specific logic * Include OutputDirectory path into output destinationFiles * Fix debugger tests and memory leak * Various fixups and Documentation * Try adding resources with known assembly extensions as dll * Revert to custom hash and equal without WEBCIL guard This reverts commit 0e33442. * Consolidate file and bundledResource variables * Add culture metadata to SatelliteAssembly resources * Truncate Encoding for readability * Enable custom hash for bundling resources on wasm * Leverage new bundling api for wasm wasi drivers * Add helper to dynamically add bundled assembly and satellite_assembly resources * Limit when bundled resources can be added and freed * Restrict MonoBundledResource getters * Restrict exposure of underlying MonoBundledAssemblyResource modification * WIP * Free function chaining. * Fix crash when output parameters are NULL. * Fix WASM/WASI build errors. * Align bundled resources registration struct * [task] Check PE metadata to determine resource type * Cleanup Satellite Assembly bundling * Address Feedback * Split MonoBundledAssemblyResource getter * Addressing more feedback * Validate OutputDirectory --------- Co-authored-by: Larry Ewing <[email protected]> Co-authored-by: lateralusX <[email protected]>
- Loading branch information