From 540ad7f694fd2e674ca31aaea1e43e4300be7884 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 20 Mar 2018 19:10:36 +0300 Subject: [PATCH] Uprage HPPC to 0.7.3 --- core/pom.xml | 2 +- .../wasm/generate/WasmClassGenerator.java | 4 +-- .../org/teavm/callgraph/DefaultCallGraph.java | 8 +++--- .../main/java/org/teavm/common/DJGraph.java | 4 +-- .../common/DefaultGraphSplittingBackend.java | 4 +-- .../java/org/teavm/common/GraphBuilder.java | 12 ++++---- .../java/org/teavm/common/GraphIndexer.java | 8 +++--- .../common/IrreducibleGraphConverter.java | 12 ++++---- .../teavm/common/MutableDirectedGraph.java | 14 +++++----- .../dependency/DataFlowGraphBuilder.java | 26 ++++++++++++----- .../teavm/dependency/DependencyAnalyzer.java | 6 ++-- .../teavm/dependency/SuperClassFilter.java | 4 +-- .../teavm/model/analysis/ClassInference.java | 28 +++++++++---------- .../teavm/model/analysis/EscapeAnalysis.java | 6 ++-- .../analysis/NullnessInformationBuilder.java | 19 ++++--------- .../lowlevel/GCShadowStackContributor.java | 6 ++-- .../model/optimization/LoopInversionImpl.java | 16 +++++------ .../teavm/model/util/LivenessAnalyzer.java | 4 +-- .../java/org/teavm/model/util/PhiUpdater.java | 10 +++---- .../util/ProgramNodeSplittingBackend.java | 4 +-- .../main/java/org/teavm/parsing/Parser.java | 10 +++---- .../test/java/org/teavm/common/GraphTest.java | 4 +-- .../analysis/test/NullnessAnalysisTest.java | 4 +-- .../org/teavm/dependency/DependencyTest.java | 4 +-- 24 files changed, 112 insertions(+), 107 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index b942865fa..a18082983 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -56,7 +56,7 @@ com.carrotsearch hppc - 0.6.1 + 0.7.3 com.fasterxml.jackson.core diff --git a/core/src/main/java/org/teavm/backend/wasm/generate/WasmClassGenerator.java b/core/src/main/java/org/teavm/backend/wasm/generate/WasmClassGenerator.java index 3290f3754..2ab6d044b 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generate/WasmClassGenerator.java +++ b/core/src/main/java/org/teavm/backend/wasm/generate/WasmClassGenerator.java @@ -15,8 +15,8 @@ */ package org.teavm.backend.wasm.generate; +import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntMap; -import com.carrotsearch.hppc.ObjectIntOpenHashMap; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -515,7 +515,7 @@ public class WasmClassGenerator { int alignment; int start; boolean isInferface; - ObjectIntMap fieldLayout = new ObjectIntOpenHashMap<>(); + ObjectIntMap fieldLayout = new ObjectIntHashMap<>(); DataValue data; ClassReader cls; boolean function; diff --git a/core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java b/core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java index 5bacf9bbb..a495fac27 100644 --- a/core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java +++ b/core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java @@ -15,8 +15,8 @@ */ package org.teavm.callgraph; +import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntMap; -import com.carrotsearch.hppc.ObjectIntOpenHashMap; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -65,12 +65,12 @@ public class DefaultCallGraph implements CallGraph, Serializable { static class SerializableCallGraphBuilder { List nodes = new ArrayList<>(); - ObjectIntMap nodeToIndex = new ObjectIntOpenHashMap<>(); + ObjectIntMap nodeToIndex = new ObjectIntHashMap<>(); List callSites = new ArrayList<>(); List originalCallSites = new ArrayList<>(); - ObjectIntMap callSiteToIndex = new ObjectIntOpenHashMap<>(); + ObjectIntMap callSiteToIndex = new ObjectIntHashMap<>(); List fieldAccessList = new ArrayList<>(); - ObjectIntMap fieldAccessToIndex = new ObjectIntOpenHashMap<>(); + ObjectIntMap fieldAccessToIndex = new ObjectIntHashMap<>(); List nodesToProcess = new ArrayList<>(); List callSitesToProcess = new ArrayList<>(); List fieldAccessToProcess = new ArrayList<>(); diff --git a/core/src/main/java/org/teavm/common/DJGraph.java b/core/src/main/java/org/teavm/common/DJGraph.java index 7af91e30c..152893c72 100644 --- a/core/src/main/java/org/teavm/common/DJGraph.java +++ b/core/src/main/java/org/teavm/common/DJGraph.java @@ -15,7 +15,7 @@ */ package org.teavm.common; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.ArrayList; @@ -199,7 +199,7 @@ public class DJGraph { public int collapse(int[] nodes) { // Replace nodes with their classes and find common dominator among them - IntSet set = new IntOpenHashSet(); + IntSet set = new IntHashSet(); int top = nodes[0]; for (int node : nodes) { node = mergeRoot[node]; diff --git a/core/src/main/java/org/teavm/common/DefaultGraphSplittingBackend.java b/core/src/main/java/org/teavm/common/DefaultGraphSplittingBackend.java index 44f774568..5457b62a0 100644 --- a/core/src/main/java/org/teavm/common/DefaultGraphSplittingBackend.java +++ b/core/src/main/java/org/teavm/common/DefaultGraphSplittingBackend.java @@ -15,8 +15,8 @@ */ package org.teavm.common; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; public class DefaultGraphSplittingBackend implements GraphSplittingBackend { private MutableDirectedGraph graph; @@ -48,7 +48,7 @@ public class DefaultGraphSplittingBackend implements GraphSplittingBackend { @Override public int[] split(int[] domain, int[] nodes) { int[] copies = new int[nodes.length]; - IntIntMap map = new IntIntOpenHashMap(); + IntIntMap map = new IntIntHashMap(); for (int i = 0; i < nodes.length; ++i) { copies[i] = index++; map.put(nodes[i], copies[i] + 1); diff --git a/core/src/main/java/org/teavm/common/GraphBuilder.java b/core/src/main/java/org/teavm/common/GraphBuilder.java index bda4123cd..f5d20a6b9 100644 --- a/core/src/main/java/org/teavm/common/GraphBuilder.java +++ b/core/src/main/java/org/teavm/common/GraphBuilder.java @@ -15,7 +15,7 @@ */ package org.teavm.common; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayList; import java.util.Arrays; @@ -47,14 +47,14 @@ public class GraphBuilder { sz = Math.max(sz, Math.max(from, to) + 1); builtGraph = null; if (addedEdges.size() == from) { - addedEdges.add(IntOpenHashSet.from(to)); + addedEdges.add(IntHashSet.from(to)); } else if (addedEdges.size() <= from) { addedEdges.addAll(Collections.nCopies(from - addedEdges.size(), null)); - addedEdges.add(IntOpenHashSet.from(to)); + addedEdges.add(IntHashSet.from(to)); } else { IntSet set = addedEdges.get(from); if (set == null) { - addedEdges.set(from, IntOpenHashSet.from(to)); + addedEdges.set(from, IntHashSet.from(to)); } else { set.add(to); } @@ -68,14 +68,14 @@ public class GraphBuilder { if (from >= addedEdges.size() || to >= addedEdges.size()) { return; } - addedEdges.get(from).removeAllOccurrences(to); + addedEdges.get(from).removeAll(to); } public Graph build() { if (builtGraph == null) { IntSet[] incomingEdges = new IntSet[sz]; for (int i = 0; i < sz; ++i) { - incomingEdges[i] = new IntOpenHashSet(); + incomingEdges[i] = new IntHashSet(); } int[][] outgoingEdgeList = new int[sz][]; for (int i = 0; i < addedEdges.size(); ++i) { diff --git a/core/src/main/java/org/teavm/common/GraphIndexer.java b/core/src/main/java/org/teavm/common/GraphIndexer.java index 1cee54187..4627e6ba9 100644 --- a/core/src/main/java/org/teavm/common/GraphIndexer.java +++ b/core/src/main/java/org/teavm/common/GraphIndexer.java @@ -15,7 +15,7 @@ */ package org.teavm.common; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.ArrayList; @@ -157,7 +157,7 @@ public class GraphIndexer { List succList = new ArrayList<>(successors.length); IntegerArray orderedSuccessors = new IntegerArray(successors.length); if (terminalNodes.size() > 0) { - IntSet loopNodes = IntOpenHashSet.from(findNaturalLoop(node, terminalNodes.getAll())); + IntSet loopNodes = IntHashSet.from(findNaturalLoop(node, terminalNodes.getAll())); for (int succ : successors) { if (loopNodes.contains(succ)) { succList.add(new WeightedNode(succ, priorities[succ], weights[succ])); @@ -168,7 +168,7 @@ public class GraphIndexer { orderedSuccessors.add(wnode.index); } - IntSet outerSuccessors = new IntOpenHashSet(successors.length); + IntSet outerSuccessors = new IntHashSet(successors.length); succList.clear(); for (IntCursor loopNode : loopNodes) { for (int succ : graph.outgoingEdges(loopNode.value)) { @@ -205,7 +205,7 @@ public class GraphIndexer { } private int[] findNaturalLoop(int head, int[] terminals) { - IntSet loop = new IntOpenHashSet(); + IntSet loop = new IntHashSet(); loop.add(head); IntegerStack stack = new IntegerStack(1); for (int pred : terminals) { diff --git a/core/src/main/java/org/teavm/common/IrreducibleGraphConverter.java b/core/src/main/java/org/teavm/common/IrreducibleGraphConverter.java index 942ad429e..7569e4006 100644 --- a/core/src/main/java/org/teavm/common/IrreducibleGraphConverter.java +++ b/core/src/main/java/org/teavm/common/IrreducibleGraphConverter.java @@ -15,7 +15,7 @@ */ package org.teavm.common; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.Arrays; @@ -38,10 +38,10 @@ class IrreducibleGraphConverter { void convertToReducible(Graph cfg, int[] weight, GraphSplittingBackend backend) { this.backend = backend; - nodeCopies = new IntOpenHashSet[cfg.size()]; + nodeCopies = new IntHashSet[cfg.size()]; nodeOriginals = new IntegerArray(cfg.size()); for (int i = 0; i < cfg.size(); ++i) { - nodeCopies[i] = new IntOpenHashSet(); + nodeCopies[i] = new IntHashSet(); nodeOriginals.add(i); } @@ -132,7 +132,7 @@ class IrreducibleGraphConverter { } // Find header of this domain - IntSet domainNodes = new IntOpenHashSet(scc.length); + IntSet domainNodes = new IntHashSet(scc.length); for (int i = 0; i < scc.length; ++i) { int node = scc[i]; if (domains[i] == domain) { @@ -258,7 +258,7 @@ class IrreducibleGraphConverter { } private int[] withoutCopies(int[] nodesWithCopies) { - IntSet visited = new IntOpenHashSet(); + IntSet visited = new IntHashSet(); int[] nodes = new int[nodesWithCopies.length]; int sz = 0; for (int node : nodesWithCopies) { @@ -276,7 +276,7 @@ class IrreducibleGraphConverter { int copy = copies[i]; IntSet knownCopies = nodeCopies[original]; if (knownCopies == null) { - knownCopies = new IntOpenHashSet(); + knownCopies = new IntHashSet(); nodeCopies[original] = knownCopies; } diff --git a/core/src/main/java/org/teavm/common/MutableDirectedGraph.java b/core/src/main/java/org/teavm/common/MutableDirectedGraph.java index 38c532cab..1366aa5c1 100644 --- a/core/src/main/java/org/teavm/common/MutableDirectedGraph.java +++ b/core/src/main/java/org/teavm/common/MutableDirectedGraph.java @@ -15,7 +15,7 @@ */ package org.teavm.common; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.ArrayList; @@ -56,8 +56,8 @@ public class MutableDirectedGraph implements Graph { public void addEdge(int from, int to) { int max = Math.max(from, to); while (max >= successors.size()) { - successors.add(new IntOpenHashSet(1)); - predecessors.add(new IntOpenHashSet(1)); + successors.add(new IntHashSet(1)); + predecessors.add(new IntHashSet(1)); } successors.get(from).add(to); predecessors.get(to).add(from); @@ -67,16 +67,16 @@ public class MutableDirectedGraph implements Graph { if (from >= successors.size() || to >= successors.size()) { return; } - successors.get(from).removeAllOccurrences(to); - predecessors.get(to).removeAllOccurrences(from); + successors.get(from).removeAll(to); + predecessors.get(to).removeAll(from); } public void detachNode(int node) { for (IntCursor succ : successors.get(node)) { - predecessors.get(succ.value).removeAllOccurrences(node); + predecessors.get(succ.value).removeAll(node); } for (IntCursor pred : predecessors.get(node)) { - successors.get(pred.value).removeAllOccurrences(node); + successors.get(pred.value).removeAll(node); } predecessors.get(node).clear(); successors.get(node).clear(); diff --git a/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java b/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java index 1e043241e..66acf24db 100644 --- a/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java +++ b/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java @@ -15,26 +15,38 @@ */ package org.teavm.dependency; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; +import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntMap; -import com.carrotsearch.hppc.ObjectIntOpenHashMap; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.Arrays; import java.util.List; -import org.teavm.common.*; -import org.teavm.model.*; -import org.teavm.model.instructions.*; +import org.teavm.common.DisjointSet; +import org.teavm.common.Graph; +import org.teavm.common.GraphBuilder; +import org.teavm.common.IntegerStack; +import org.teavm.model.BasicBlockReader; +import org.teavm.model.FieldReference; +import org.teavm.model.IncomingReader; +import org.teavm.model.MethodReference; +import org.teavm.model.PhiReader; +import org.teavm.model.ProgramReader; +import org.teavm.model.ValueType; +import org.teavm.model.VariableReader; +import org.teavm.model.instructions.AbstractInstructionReader; +import org.teavm.model.instructions.ArrayElementType; +import org.teavm.model.instructions.InvocationType; public class DataFlowGraphBuilder extends AbstractInstructionReader { private int lastIndex; private GraphBuilder builder = new GraphBuilder(); - private ObjectIntMap fieldNodes = new ObjectIntOpenHashMap<>(); + private ObjectIntMap fieldNodes = new ObjectIntHashMap<>(); private int returnIndex = -1; private int exceptionIndex; private DisjointSet classes = new DisjointSet(); private int paramCount; - private IntSet escaping = new IntOpenHashSet(); + private IntSet escaping = new IntHashSet(); private void join(int a, int b) { if (a < paramCount || b < paramCount) { diff --git a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java index 2a1a0a5f0..687d42c92 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java +++ b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java @@ -15,7 +15,7 @@ */ package org.teavm.dependency; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.ArrayDeque; @@ -266,7 +266,7 @@ public class DependencyAnalyzer implements DependencyInfo { } else { if (consumer.pendingTypes == null) { pendingTransitions.add(consumer); - consumer.pendingTypes = new IntOpenHashSet(); + consumer.pendingTypes = new IntHashSet(); } consumer.pendingTypes.add(type.index); } @@ -288,7 +288,7 @@ public class DependencyAnalyzer implements DependencyInfo { } else { if (consumer.pendingTypes == null) { pendingTransitions.add(consumer); - consumer.pendingTypes = new IntOpenHashSet(); + consumer.pendingTypes = new IntHashSet(); } for (DependencyType type : types) { consumer.pendingTypes.add(type.index); diff --git a/core/src/main/java/org/teavm/dependency/SuperClassFilter.java b/core/src/main/java/org/teavm/dependency/SuperClassFilter.java index 1ac6c6545..96f8fea0d 100644 --- a/core/src/main/java/org/teavm/dependency/SuperClassFilter.java +++ b/core/src/main/java/org/teavm/dependency/SuperClassFilter.java @@ -15,14 +15,14 @@ */ package org.teavm.dependency; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; import org.teavm.model.ClassReaderSource; class SuperClassFilter implements DependencyTypeFilter { private ClassReaderSource classSource; private String superType; - private IntIntMap cache = new IntIntOpenHashMap(); + private IntIntMap cache = new IntIntHashMap(); SuperClassFilter(ClassReaderSource classSource, String superType) { this.classSource = classSource; diff --git a/core/src/main/java/org/teavm/model/analysis/ClassInference.java b/core/src/main/java/org/teavm/model/analysis/ClassInference.java index 89003ed1e..4c1ef45cf 100644 --- a/core/src/main/java/org/teavm/model/analysis/ClassInference.java +++ b/core/src/main/java/org/teavm/model/analysis/ClassInference.java @@ -15,11 +15,11 @@ */ package org.teavm.model.analysis; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import com.carrotsearch.hppc.IntStack; +import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntMap; -import com.carrotsearch.hppc.ObjectIntOpenHashMap; import com.carrotsearch.hppc.cursors.IntCursor; import java.util.ArrayList; import java.util.Arrays; @@ -78,8 +78,8 @@ public class ClassInference { private int[] propagationPath; private int[] nodeMapping; - private IntOpenHashSet[] types; - private ObjectIntMap typeMap = new ObjectIntOpenHashMap<>(); + private IntHashSet[] types; + private ObjectIntMap typeMap = new ObjectIntHashMap<>(); private List typeList = new ArrayList<>(); private boolean changed = true; @@ -108,7 +108,7 @@ public class ClassInference { 8. Repeat 7 until it changes anything (i.e. calculate fixed point). */ - types = new IntOpenHashSet[program.variableCount() << 3]; + types = new IntHashSet[program.variableCount() << 3]; nodeChanged = new boolean[types.length]; formerNodeChanged = new boolean[nodeChanged.length]; nodeMapping = new int[types.length]; @@ -164,7 +164,7 @@ public class ClassInference { } public String[] classesOf(int variableIndex) { - IntOpenHashSet typeSet = types[nodeMapping[packNodeAndDegree(variableIndex, 0)]]; + IntHashSet typeSet = types[nodeMapping[packNodeAndDegree(variableIndex, 0)]]; if (typeSet == null) { return new String[0]; } @@ -228,7 +228,7 @@ public class ClassInference { int variable = extractNode(entry); // Actually, successor nodes in resulting graph - IntSet nextEntries = new IntOpenHashSet(); + IntSet nextEntries = new IntHashSet(); // Start: calculating successor nodes in resulting DAG along different paths // @@ -282,7 +282,7 @@ public class ClassInference { } boolean[] nodeChangedBackup = nodeChanged.clone(); - IntOpenHashSet[] typesBackup = types.clone(); + IntHashSet[] typesBackup = types.clone(); Arrays.fill(nodeChanged, false); Arrays.fill(types, null); @@ -389,7 +389,7 @@ public class ClassInference { continue; } - IntOpenHashSet nodeTypes = getNodeTypes(node); + IntHashSet nodeTypes = getNodeTypes(node); for (int predecessor : graph.incomingEdges(node)) { if (formerNodeChanged[predecessor] || nodeChanged[predecessor]) { if (nodeTypes.addAll(types[predecessor]) > 0) { @@ -411,7 +411,7 @@ public class ClassInference { } int toNode = nodeMapping[packNodeAndDegree(cast.toVariable, 0)]; - IntOpenHashSet targetTypes = getNodeTypes(toNode); + IntHashSet targetTypes = getNodeTypes(toNode); for (IntCursor cursor : types[fromNode]) { if (targetTypes.contains(cursor.value)) { @@ -520,10 +520,10 @@ public class ClassInference { } } - IntOpenHashSet getNodeTypes(int node) { - IntOpenHashSet result = types[node]; + IntHashSet getNodeTypes(int node) { + IntHashSet result = types[node]; if (result == null) { - result = new IntOpenHashSet(); + result = new IntHashSet(); types[node] = result; } return result; @@ -707,7 +707,7 @@ public class ClassInference { static class VirtualCallSite { int instance; - IntSet knownClasses = new IntOpenHashSet(); + IntSet knownClasses = new IntHashSet(); Set resolvedMethods = new HashSet<>(); MethodReference method; int[] arguments; diff --git a/core/src/main/java/org/teavm/model/analysis/EscapeAnalysis.java b/core/src/main/java/org/teavm/model/analysis/EscapeAnalysis.java index 2936eafe5..26ce49361 100644 --- a/core/src/main/java/org/teavm/model/analysis/EscapeAnalysis.java +++ b/core/src/main/java/org/teavm/model/analysis/EscapeAnalysis.java @@ -17,7 +17,7 @@ package org.teavm.model.analysis; import com.carrotsearch.hppc.IntArrayDeque; import com.carrotsearch.hppc.IntDeque; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayDeque; import java.util.ArrayList; @@ -147,7 +147,7 @@ public class EscapeAnalysis { } // If incoming variables of phi functions live after phi, mark them as escaping - IntSet sharedIncomingVars = new IntOpenHashSet(); + IntSet sharedIncomingVars = new IntHashSet(); for (Phi phi : block.getPhis()) { if (escapes(phi.getReceiver().getIndex())) { queue.addLast(definitionClasses[phi.getReceiver().getIndex()]); @@ -163,7 +163,7 @@ public class EscapeAnalysis { } Graph graph = graphBuilder.build(); - IntSet visited = new IntOpenHashSet(); + IntSet visited = new IntHashSet(); while (!queue.isEmpty()) { int var = queue.removeFirst(); if (visited.add(var)) { diff --git a/core/src/main/java/org/teavm/model/analysis/NullnessInformationBuilder.java b/core/src/main/java/org/teavm/model/analysis/NullnessInformationBuilder.java index 4a4871f0f..5258867f0 100644 --- a/core/src/main/java/org/teavm/model/analysis/NullnessInformationBuilder.java +++ b/core/src/main/java/org/teavm/model/analysis/NullnessInformationBuilder.java @@ -17,14 +17,13 @@ package org.teavm.model.analysis; import com.carrotsearch.hppc.IntArrayDeque; import com.carrotsearch.hppc.IntDeque; +import com.carrotsearch.hppc.IntHashSet; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; -import com.carrotsearch.hppc.IntOpenHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayList; import java.util.BitSet; import java.util.List; -import org.teavm.common.DominatorTree; import org.teavm.common.Graph; import org.teavm.common.GraphBuilder; import org.teavm.common.GraphUtils; @@ -189,14 +188,8 @@ class NullnessInformationBuilder { class NullExtensionVisitor extends AbstractInstructionVisitor implements DominatorWalkerCallback { State currentState; BasicBlock currentBlock; - IntIntMap nullSuccessors = new IntIntOpenHashMap(); - IntIntMap notNullSuccessors = new IntIntOpenHashMap(); - private DominatorTree dom; - - @Override - public void setDomTree(DominatorTree domTree) { - dom = domTree; - } + IntIntMap nullSuccessors = new IntIntHashMap(); + IntIntMap notNullSuccessors = new IntIntHashMap(); @Override public State visit(BasicBlock block) { @@ -426,7 +419,7 @@ class NullnessInformationBuilder { } static class State { - IntSet newlyNonNull = new IntOpenHashSet(); - IntSet newlyNull = new IntOpenHashSet(); + IntSet newlyNonNull = new IntHashSet(); + IntSet newlyNull = new IntHashSet(); } } diff --git a/core/src/main/java/org/teavm/model/lowlevel/GCShadowStackContributor.java b/core/src/main/java/org/teavm/model/lowlevel/GCShadowStackContributor.java index cc4feb253..160863488 100644 --- a/core/src/main/java/org/teavm/model/lowlevel/GCShadowStackContributor.java +++ b/core/src/main/java/org/teavm/model/lowlevel/GCShadowStackContributor.java @@ -16,8 +16,8 @@ package org.teavm.model.lowlevel; import com.carrotsearch.hppc.IntArrayList; +import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntMap; -import com.carrotsearch.hppc.ObjectIntOpenHashMap; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; @@ -305,7 +305,7 @@ public class GCShadowStackContributor { } private List sortInstructions(Collection instructions, BasicBlock block) { - ObjectIntMap indexes = new ObjectIntOpenHashMap<>(); + ObjectIntMap indexes = new ObjectIntHashMap<>(); int index = 0; for (Instruction instruction : block) { indexes.put(instruction, index++); @@ -349,7 +349,7 @@ public class GCShadowStackContributor { } private ObjectIntMap getInstructionIndexes(BasicBlock block) { - ObjectIntMap indexes = new ObjectIntOpenHashMap<>(); + ObjectIntMap indexes = new ObjectIntHashMap<>(); for (Instruction instruction : block) { indexes.put(instruction, indexes.size()); } diff --git a/core/src/main/java/org/teavm/model/optimization/LoopInversionImpl.java b/core/src/main/java/org/teavm/model/optimization/LoopInversionImpl.java index 0642d232d..bdc8e7f3f 100644 --- a/core/src/main/java/org/teavm/model/optimization/LoopInversionImpl.java +++ b/core/src/main/java/org/teavm/model/optimization/LoopInversionImpl.java @@ -15,9 +15,9 @@ */ package org.teavm.model.optimization; +import com.carrotsearch.hppc.IntHashSet; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; -import com.carrotsearch.hppc.IntOpenHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayList; import java.util.Arrays; @@ -170,12 +170,12 @@ class LoopInversionImpl { private class LoopWithExits { final int head; final LoopWithExits parent; - final IntSet nodes = new IntOpenHashSet(); - final IntSet nodesAndCopies = new IntOpenHashSet(); - final IntSet exits = new IntOpenHashSet(); + final IntSet nodes = new IntHashSet(); + final IntSet nodesAndCopies = new IntHashSet(); + final IntSet exits = new IntHashSet(); int bodyStart; int headCopy; - final IntIntMap copiedNodes = new IntIntOpenHashMap(); + final IntIntMap copiedNodes = new IntIntHashMap(); boolean shouldSkip; LoopWithExits(int head, LoopWithExits parent) { @@ -260,7 +260,7 @@ class LoopInversionImpl { } private boolean findCondition() { - IntSet tailNodes = new IntOpenHashSet(program.basicBlockCount()); + IntSet tailNodes = new IntHashSet(program.basicBlockCount()); for (int tailCandidate : cfg.incomingEdges(head)) { if (nodes.contains(tailCandidate)) { tailNodes.add(tailCandidate); @@ -298,7 +298,7 @@ class LoopInversionImpl { } private IntSet nodesToCopy() { - IntSet result = new IntOpenHashSet(); + IntSet result = new IntHashSet(); for (int node : nodes.toArray()) { if (node == head || (node != bodyStart && !dom.dominates(bodyStart, node))) { result.add(node); diff --git a/core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java b/core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java index 1d852dd70..ae429b8f8 100644 --- a/core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java +++ b/core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java @@ -15,7 +15,7 @@ */ package org.teavm.model.util; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayDeque; import java.util.BitSet; @@ -59,7 +59,7 @@ public class LivenessAnalyzer { for (Instruction insn : block) { insn.acceptVisitor(usageExtractor); - IntSet usedVars = new IntOpenHashSet(); + IntSet usedVars = new IntHashSet(); for (Variable var : usageExtractor.getUsedVariables()) { Task task = new Task(); task.block = i; diff --git a/core/src/main/java/org/teavm/model/util/PhiUpdater.java b/core/src/main/java/org/teavm/model/util/PhiUpdater.java index 57bbe40ad..c7e9f0ad9 100644 --- a/core/src/main/java/org/teavm/model/util/PhiUpdater.java +++ b/core/src/main/java/org/teavm/model/util/PhiUpdater.java @@ -17,9 +17,9 @@ package org.teavm.model.util; import com.carrotsearch.hppc.IntArrayDeque; import com.carrotsearch.hppc.IntDeque; +import com.carrotsearch.hppc.IntHashSet; +import com.carrotsearch.hppc.IntObjectHashMap; import com.carrotsearch.hppc.IntObjectMap; -import com.carrotsearch.hppc.IntObjectOpenHashMap; -import com.carrotsearch.hppc.IntOpenHashSet; import com.carrotsearch.hppc.IntSet; import java.util.ArrayDeque; import java.util.ArrayList; @@ -91,7 +91,7 @@ public class PhiUpdater { private Phi[][] phiMap; private int[][] phiIndexMap; private List> synthesizedPhisByBlock = new ArrayList<>(); - private IntObjectMap phisByReceiver = new IntObjectOpenHashMap<>(); + private IntObjectMap phisByReceiver = new IntObjectHashMap<>(); private BitSet usedPhis = new BitSet(); private Variable[] originalExceptionVariables; private boolean[] usedDefinitions; @@ -248,7 +248,7 @@ public class PhiUpdater { stack.push(next); } - IntSet exceptionHandlingSuccessors = new IntOpenHashSet(); + IntSet exceptionHandlingSuccessors = new IntHashSet(); for (TryCatchBlock tryCatch : currentBlock.getTryCatchBlocks()) { exceptionHandlingSuccessors.add(tryCatch.getHandler().getIndex()); } @@ -281,7 +281,7 @@ public class PhiUpdater { } } - IntSet visited = new IntOpenHashSet(); + IntSet visited = new IntHashSet(); while (!worklist.isEmpty()) { int varIndex = worklist.removeFirst(); if (!visited.add(varIndex)) { diff --git a/core/src/main/java/org/teavm/model/util/ProgramNodeSplittingBackend.java b/core/src/main/java/org/teavm/model/util/ProgramNodeSplittingBackend.java index 61ea875d6..237bbc6ce 100644 --- a/core/src/main/java/org/teavm/model/util/ProgramNodeSplittingBackend.java +++ b/core/src/main/java/org/teavm/model/util/ProgramNodeSplittingBackend.java @@ -15,8 +15,8 @@ */ package org.teavm.model.util; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; import org.teavm.common.GraphSplittingBackend; import org.teavm.model.BasicBlock; import org.teavm.model.Program; @@ -31,7 +31,7 @@ public class ProgramNodeSplittingBackend implements GraphSplittingBackend { @Override public int[] split(int[] domain, int[] nodes) { int[] copies = new int[nodes.length]; - IntIntMap map = new IntIntOpenHashMap(); + IntIntMap map = new IntIntHashMap(); for (int i = 0; i < nodes.length; ++i) { int node = nodes[i]; BasicBlock block = program.basicBlockAt(node); diff --git a/core/src/main/java/org/teavm/parsing/Parser.java b/core/src/main/java/org/teavm/parsing/Parser.java index ed6686661..4eb159337 100644 --- a/core/src/main/java/org/teavm/parsing/Parser.java +++ b/core/src/main/java/org/teavm/parsing/Parser.java @@ -15,8 +15,8 @@ */ package org.teavm.parsing; +import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntIntMap; -import com.carrotsearch.hppc.IntIntOpenHashMap; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; @@ -157,7 +157,7 @@ public class Parser { Step[] stack = new Step[program.basicBlockCount()]; int top = 0; - IntIntOpenHashMap entryVarMap = new IntIntOpenHashMap(); + IntIntHashMap entryVarMap = new IntIntHashMap(); for (int i = 0; i < argumentMapping.length; ++i) { Variable arg = argumentMapping[i]; if (arg != null) { @@ -169,7 +169,7 @@ public class Parser { while (top > 0) { Step step = stack[--top]; int node = step.node; - IntIntMap varMap = new IntIntOpenHashMap(step.varMap); + IntIntMap varMap = new IntIntHashMap(step.varMap); BasicBlock block = program.basicBlockAt(node); for (Phi phi : block.getPhis()) { @@ -180,7 +180,7 @@ public class Parser { } } - result[node] = new IntIntOpenHashMap(varMap); + result[node] = new IntIntHashMap(varMap); for (Instruction insn : block) { insn.acceptVisitor(defExtractor); @@ -193,7 +193,7 @@ public class Parser { } for (int successor : dom.outgoingEdges(node)) { - stack[top++] = new Step(successor, new IntIntOpenHashMap(varMap)); + stack[top++] = new Step(successor, new IntIntHashMap(varMap)); } } diff --git a/core/src/test/java/org/teavm/common/GraphTest.java b/core/src/test/java/org/teavm/common/GraphTest.java index 0b619ce4a..31905648e 100644 --- a/core/src/test/java/org/teavm/common/GraphTest.java +++ b/core/src/test/java/org/teavm/common/GraphTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import java.util.Arrays; import java.util.Comparator; @@ -210,7 +210,7 @@ public class GraphTest { Graph graph = backend.getGraph(); for (int node = 0; node < graph.size(); ++node) { int nodeProto = backend.prototype(node); - IntSet succProto = new IntOpenHashSet(); + IntSet succProto = new IntHashSet(); for (int succ : graph.outgoingEdges(node)) { succProto.add(backend.prototype(succ)); } diff --git a/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java b/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java index 9592477d9..e5fb67d2e 100644 --- a/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java +++ b/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java @@ -17,8 +17,8 @@ package org.teavm.model.analysis.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import com.carrotsearch.hppc.ObjectByteHashMap; import com.carrotsearch.hppc.ObjectByteMap; -import com.carrotsearch.hppc.ObjectByteOpenHashMap; import com.carrotsearch.hppc.cursors.ObjectCursor; import java.io.BufferedReader; import java.io.IOException; @@ -123,7 +123,7 @@ public class NullnessAnalysisTest { ClassLoader classLoader = NullnessAnalysisTest.class.getClassLoader(); try (InputStream input = classLoader.getResourceAsStream(name); BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"))) { - ObjectByteMap result = new ObjectByteOpenHashMap<>(); + ObjectByteMap result = new ObjectByteHashMap<>(); while (true) { String line = reader.readLine(); diff --git a/tests/src/test/java/org/teavm/dependency/DependencyTest.java b/tests/src/test/java/org/teavm/dependency/DependencyTest.java index 29acb26ff..ffcb1e338 100644 --- a/tests/src/test/java/org/teavm/dependency/DependencyTest.java +++ b/tests/src/test/java/org/teavm/dependency/DependencyTest.java @@ -15,7 +15,7 @@ */ package org.teavm.dependency; -import com.carrotsearch.hppc.IntOpenHashSet; +import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntSet; import java.io.ByteArrayOutputStream; import java.util.ArrayList; @@ -275,7 +275,7 @@ public class DependencyTest { int value = aliases[insn.getValue().getIndex()]; IntSet items = arrayContent[array]; if (items == null) { - items = new IntOpenHashSet(); + items = new IntHashSet(); arrayContent[array] = items; } items.add(value);