diff options
author | Mike Voorhees <mrvoorhe@users.noreply.github.com> | 2021-02-12 21:51:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 21:51:43 +0300 |
commit | 3c4ea3f8f4fcb688194f5f1e501ab01642d4bdf4 (patch) | |
tree | 3a0fd856b1e4c5e096f27c46f618b6619dee4862 /Mono.Cecil | |
parent | 25f85c94787bc51fd91dba9598aba741c4384e51 (diff) |
Add ModuleDefinition.ImmediateRead (#713)
We are going to use this to do a multi stage load in parallel. We will be able to greatly reduce our load times using this new API. The way it's going to work is
Stage 1 - In parallel, load the assemblies with ReadingMode.Deferred.
Stage 2 - Populate our AssemblyResolver with a cache of all read assemblies.
Stage 3 - In parallel, call ImmediateRead.
What I really want is an API to load everything in stage 3. I found that ImmediateRead does not load method bodies. I don't know if/how you want want something like this exposed via the public API. For now I'm iterating the data model and forcing things to load that ImmediateRead did not cover.
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/ModuleDefinition.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Mono.Cecil/ModuleDefinition.cs b/Mono.Cecil/ModuleDefinition.cs index a18969b..8fb35a5 100644 --- a/Mono.Cecil/ModuleDefinition.cs +++ b/Mono.Cecil/ModuleDefinition.cs @@ -928,6 +928,15 @@ namespace Mono.Cecil { { return Read (token, (t, reader) => reader.LookupToken (t)); } + + public void ImmediateRead () + { + if (!HasImage) + return; + ReadingMode = ReadingMode.Immediate; + var moduleReader = new ImmediateModuleReader (Image); + moduleReader.ReadModule (this, resolve_attributes: true); + } readonly object module_lock = new object(); |