Skip to content

Commit

Permalink
Improved assembly loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Jun 4, 2024
1 parent 2cce68a commit c66a4f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 2 additions & 8 deletions chibild/chibild.core/CilLinker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)),
};
}
Expand Down
10 changes: 5 additions & 5 deletions chibild/chibild.core/Internal/MultipleSymbolReaderProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public MultipleSymbolReaderProvider(ILogger logger) =>
if (File.Exists(path))
{
var ms = new MemoryStream();
using (var mdbStream = new FileStream(
using (var stream = new FileStream(
path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
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;
Expand Down Expand Up @@ -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;
Expand All @@ -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}");
}
}
}
Expand Down

0 comments on commit c66a4f2

Please sign in to comment.