diff --git a/chibild/chibild.core/CilLinker.cs b/chibild/chibild.core/CilLinker.cs index 14cedb4..f160445 100644 --- a/chibild/chibild.core/CilLinker.cs +++ b/chibild/chibild.core/CilLinker.cs @@ -157,11 +157,8 @@ when Path.GetExtension(relativePath) == ".a": this.logger, baseInputPath, relativePath, - // Create this assembly specific resolver, - // because shared resolver can not resolve on multi-threaded context. - // At the cost of having to load it again later in the primary assembly resolver. this.CreateAssemblyResolver( - ReadingMode.Immediate, + ReadingMode.Deferred, assemblyReferenceBasePaths)), }; break; @@ -194,11 +191,8 @@ when Path.GetExtension(relativePath) == ".a": this.logger, foundEntry.basePath, foundEntry.fileName, - // Create this assembly specific resolver, - // because shared resolver can not resolve on multi-threaded context. - // At the cost of having to load it again later in the primary assembly resolver. this.CreateAssemblyResolver( - ReadingMode.Immediate, + ReadingMode.Deferred, assemblyReferenceBasePaths)), }; } diff --git a/chibild/chibild.core/Internal/MultipleSymbolReaderProvider.cs b/chibild/chibild.core/Internal/MultipleSymbolReaderProvider.cs index 096e03a..949d3f2 100644 --- a/chibild/chibild.core/Internal/MultipleSymbolReaderProvider.cs +++ b/chibild/chibild.core/Internal/MultipleSymbolReaderProvider.cs @@ -8,6 +8,7 @@ ///////////////////////////////////////////////////////////////////////////////////// using chibicc.toolchain.Internal; +using chibicc.toolchain.IO; using chibicc.toolchain.Logging; using Mono.Cecil; using Mono.Cecil.Cil; @@ -53,17 +54,16 @@ public MultipleSymbolReaderProvider(ILogger logger) => if (File.Exists(path)) { var ms = new MemoryStream(); - using (var mdbStream = new FileStream( - path, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (var stream = StreamUtilities.OpenStream(path, false)) { - mdbStream.CopyTo(ms); + stream.CopyTo(ms); } ms.Position = 0; var sr = provider.GetSymbolReader(module, ms); if (this.loaded.Add(path)) { - this.logger.Debug($"Symbol loaded from: {path}"); + this.logger.Debug($"Debug symbol is loaded from: {path}"); } return sr; @@ -98,7 +98,7 @@ public MultipleSymbolReaderProvider(ILogger logger) => var sr = embeddedProvider.GetSymbolReader(module, fullPath); if (this.loaded.Add(fullPath)) { - this.logger.Debug($"Embedded symbol loaded from: {fullPath}"); + this.logger.Debug($"Embedded debug symbol is loaded from: {fullPath}"); } return sr; @@ -119,7 +119,7 @@ public MultipleSymbolReaderProvider(ILogger logger) => if (this.notFound.Add(fileName)) { - this.logger.Trace($"Symbol not found: {fileName}"); + this.logger.Trace($"Debug symbol is not found: {fileName}"); } } } diff --git a/toolchain.common/IO/StreamUtilities.cs b/toolchain.common/IO/StreamUtilities.cs index a6ed0e6..2d48faa 100644 --- a/toolchain.common/IO/StreamUtilities.cs +++ b/toolchain.common/IO/StreamUtilities.cs @@ -21,5 +21,6 @@ public static Stream OpenStream(string path, bool writable) => path, writable ? FileMode.Create : FileMode.Open, writable ? FileAccess.ReadWrite : FileAccess.Read, - FileShare.Read); + FileShare.Read, + 1024 * 1024); }