summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/analysis/index
diff options
context:
space:
mode:
authorGravatar gegy10002019-06-16 23:49:25 +0200
committerGravatar gegy10002019-06-16 23:49:25 +0200
commite27d5967029f4f3da8889dd673ba516dcd9f3ac8 (patch)
tree71c98afad01cafdb2884da288e494e8761c2a8ff /src/main/java/cuchaz/enigma/analysis/index
parentMerge remote-tracking branch 'origin/master' into proposal-tweak (diff)
downloadenigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.tar.gz
enigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.tar.xz
enigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.zip
Plugin rework along with API rework: Enigma split from EnigmaProject; plugins now provide services configurable via a profile
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/index')
-rw-r--r--src/main/java/cuchaz/enigma/analysis/index/JarIndex.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java
index fd4e618..300425b 100644
--- a/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java
+++ b/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java
@@ -13,7 +13,8 @@ package cuchaz.enigma.analysis.index;
13 13
14import com.google.common.collect.HashMultimap; 14import com.google.common.collect.HashMultimap;
15import com.google.common.collect.Multimap; 15import com.google.common.collect.Multimap;
16import cuchaz.enigma.analysis.ParsedJar; 16import cuchaz.enigma.ProgressListener;
17import cuchaz.enigma.analysis.ClassCache;
17import cuchaz.enigma.translation.mapping.EntryResolver; 18import cuchaz.enigma.translation.mapping.EntryResolver;
18import cuchaz.enigma.translation.mapping.IndexEntryResolver; 19import cuchaz.enigma.translation.mapping.IndexEntryResolver;
19import cuchaz.enigma.translation.representation.Lambda; 20import cuchaz.enigma.translation.representation.Lambda;
@@ -23,7 +24,6 @@ import org.objectweb.asm.Opcodes;
23 24
24import java.util.Arrays; 25import java.util.Arrays;
25import java.util.Collection; 26import java.util.Collection;
26import java.util.function.Consumer;
27 27
28public class JarIndex implements JarIndexer { 28public class JarIndex implements JarIndexer {
29 private final EntryIndex entryIndex; 29 private final EntryIndex entryIndex;
@@ -56,23 +56,25 @@ public class JarIndex implements JarIndexer {
56 return new JarIndex(entryIndex, inheritanceIndex, referenceIndex, bridgeMethodIndex, packageVisibilityIndex); 56 return new JarIndex(entryIndex, inheritanceIndex, referenceIndex, bridgeMethodIndex, packageVisibilityIndex);
57 } 57 }
58 58
59 public void indexJar(ParsedJar jar, Consumer<String> progress) { 59 public void indexJar(ClassCache classCache, ProgressListener progress) {
60 progress.accept("Indexing entries (1/4)"); 60 progress.init(4, "Indexing jar");
61 jar.visitReader(name -> new IndexClassVisitor(this, Opcodes.ASM5), ClassReader.SKIP_CODE);
62 61
63 progress.accept("Indexing entry references (2/4)"); 62 progress.step(1, "Entries");
64 jar.visitReader(name -> new IndexReferenceVisitor(this, Opcodes.ASM5), ClassReader.SKIP_FRAMES); 63 classCache.visit(() -> new IndexClassVisitor(this, Opcodes.ASM5), ClassReader.SKIP_CODE);
65 64
66 progress.accept("Finding bridge methods (3/4)"); 65 progress.step(2, "Entry references");
66 classCache.visit(() -> new IndexReferenceVisitor(this, Opcodes.ASM5), ClassReader.SKIP_FRAMES);
67
68 progress.step(3, "Bridge methods");
67 bridgeMethodIndex.findBridgeMethods(); 69 bridgeMethodIndex.findBridgeMethods();
68 70
69 progress.accept("Processing index (4/4)"); 71 progress.step(4, "Processing");
70 processIndex(this); 72 processIndex(this);
71 } 73 }
72 74
73 @Override 75 @Override
74 public void processIndex(JarIndex index) { 76 public void processIndex(JarIndex index) {
75 indexers.forEach(indexer -> indexer.processIndex(index)); 77 indexers.parallelStream().forEach(indexer -> indexer.processIndex(index));
76 } 78 }
77 79
78 @Override 80 @Override