mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Uprage HPPC to 0.7.3
This commit is contained in:
parent
de88541b64
commit
540ad7f694
|
@ -56,7 +56,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.carrotsearch</groupId>
|
<groupId>com.carrotsearch</groupId>
|
||||||
<artifactId>hppc</artifactId>
|
<artifactId>hppc</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.7.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.backend.wasm.generate;
|
package org.teavm.backend.wasm.generate;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -515,7 +515,7 @@ public class WasmClassGenerator {
|
||||||
int alignment;
|
int alignment;
|
||||||
int start;
|
int start;
|
||||||
boolean isInferface;
|
boolean isInferface;
|
||||||
ObjectIntMap<String> fieldLayout = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<String> fieldLayout = new ObjectIntHashMap<>();
|
||||||
DataValue data;
|
DataValue data;
|
||||||
ClassReader cls;
|
ClassReader cls;
|
||||||
boolean function;
|
boolean function;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.callgraph;
|
package org.teavm.callgraph;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
|
@ -65,12 +65,12 @@ public class DefaultCallGraph implements CallGraph, Serializable {
|
||||||
|
|
||||||
static class SerializableCallGraphBuilder {
|
static class SerializableCallGraphBuilder {
|
||||||
List<SerializableCallGraph.Node> nodes = new ArrayList<>();
|
List<SerializableCallGraph.Node> nodes = new ArrayList<>();
|
||||||
ObjectIntMap<DefaultCallGraphNode> nodeToIndex = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<DefaultCallGraphNode> nodeToIndex = new ObjectIntHashMap<>();
|
||||||
List<SerializableCallGraph.CallSite> callSites = new ArrayList<>();
|
List<SerializableCallGraph.CallSite> callSites = new ArrayList<>();
|
||||||
List<DefaultCallSite> originalCallSites = new ArrayList<>();
|
List<DefaultCallSite> originalCallSites = new ArrayList<>();
|
||||||
ObjectIntMap<DefaultCallSite> callSiteToIndex = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<DefaultCallSite> callSiteToIndex = new ObjectIntHashMap<>();
|
||||||
List<SerializableCallGraph.FieldAccess> fieldAccessList = new ArrayList<>();
|
List<SerializableCallGraph.FieldAccess> fieldAccessList = new ArrayList<>();
|
||||||
ObjectIntMap<DefaultFieldAccessSite> fieldAccessToIndex = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<DefaultFieldAccessSite> fieldAccessToIndex = new ObjectIntHashMap<>();
|
||||||
List<DefaultCallGraphNode> nodesToProcess = new ArrayList<>();
|
List<DefaultCallGraphNode> nodesToProcess = new ArrayList<>();
|
||||||
List<DefaultCallSite> callSitesToProcess = new ArrayList<>();
|
List<DefaultCallSite> callSitesToProcess = new ArrayList<>();
|
||||||
List<DefaultFieldAccessSite> fieldAccessToProcess = new ArrayList<>();
|
List<DefaultFieldAccessSite> fieldAccessToProcess = new ArrayList<>();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -199,7 +199,7 @@ public class DJGraph {
|
||||||
|
|
||||||
public int collapse(int[] nodes) {
|
public int collapse(int[] nodes) {
|
||||||
// Replace nodes with their classes and find common dominator among them
|
// Replace nodes with their classes and find common dominator among them
|
||||||
IntSet set = new IntOpenHashSet();
|
IntSet set = new IntHashSet();
|
||||||
int top = nodes[0];
|
int top = nodes[0];
|
||||||
for (int node : nodes) {
|
for (int node : nodes) {
|
||||||
node = mergeRoot[node];
|
node = mergeRoot[node];
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
|
|
||||||
public class DefaultGraphSplittingBackend implements GraphSplittingBackend {
|
public class DefaultGraphSplittingBackend implements GraphSplittingBackend {
|
||||||
private MutableDirectedGraph graph;
|
private MutableDirectedGraph graph;
|
||||||
|
@ -48,7 +48,7 @@ public class DefaultGraphSplittingBackend implements GraphSplittingBackend {
|
||||||
@Override
|
@Override
|
||||||
public int[] split(int[] domain, int[] nodes) {
|
public int[] split(int[] domain, int[] nodes) {
|
||||||
int[] copies = new int[nodes.length];
|
int[] copies = new int[nodes.length];
|
||||||
IntIntMap map = new IntIntOpenHashMap();
|
IntIntMap map = new IntIntHashMap();
|
||||||
for (int i = 0; i < nodes.length; ++i) {
|
for (int i = 0; i < nodes.length; ++i) {
|
||||||
copies[i] = index++;
|
copies[i] = index++;
|
||||||
map.put(nodes[i], copies[i] + 1);
|
map.put(nodes[i], copies[i] + 1);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -47,14 +47,14 @@ public class GraphBuilder {
|
||||||
sz = Math.max(sz, Math.max(from, to) + 1);
|
sz = Math.max(sz, Math.max(from, to) + 1);
|
||||||
builtGraph = null;
|
builtGraph = null;
|
||||||
if (addedEdges.size() == from) {
|
if (addedEdges.size() == from) {
|
||||||
addedEdges.add(IntOpenHashSet.from(to));
|
addedEdges.add(IntHashSet.from(to));
|
||||||
} else if (addedEdges.size() <= from) {
|
} else if (addedEdges.size() <= from) {
|
||||||
addedEdges.addAll(Collections.nCopies(from - addedEdges.size(), null));
|
addedEdges.addAll(Collections.nCopies(from - addedEdges.size(), null));
|
||||||
addedEdges.add(IntOpenHashSet.from(to));
|
addedEdges.add(IntHashSet.from(to));
|
||||||
} else {
|
} else {
|
||||||
IntSet set = addedEdges.get(from);
|
IntSet set = addedEdges.get(from);
|
||||||
if (set == null) {
|
if (set == null) {
|
||||||
addedEdges.set(from, IntOpenHashSet.from(to));
|
addedEdges.set(from, IntHashSet.from(to));
|
||||||
} else {
|
} else {
|
||||||
set.add(to);
|
set.add(to);
|
||||||
}
|
}
|
||||||
|
@ -68,14 +68,14 @@ public class GraphBuilder {
|
||||||
if (from >= addedEdges.size() || to >= addedEdges.size()) {
|
if (from >= addedEdges.size() || to >= addedEdges.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addedEdges.get(from).removeAllOccurrences(to);
|
addedEdges.get(from).removeAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Graph build() {
|
public Graph build() {
|
||||||
if (builtGraph == null) {
|
if (builtGraph == null) {
|
||||||
IntSet[] incomingEdges = new IntSet[sz];
|
IntSet[] incomingEdges = new IntSet[sz];
|
||||||
for (int i = 0; i < sz; ++i) {
|
for (int i = 0; i < sz; ++i) {
|
||||||
incomingEdges[i] = new IntOpenHashSet();
|
incomingEdges[i] = new IntHashSet();
|
||||||
}
|
}
|
||||||
int[][] outgoingEdgeList = new int[sz][];
|
int[][] outgoingEdgeList = new int[sz][];
|
||||||
for (int i = 0; i < addedEdges.size(); ++i) {
|
for (int i = 0; i < addedEdges.size(); ++i) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -157,7 +157,7 @@ public class GraphIndexer {
|
||||||
List<WeightedNode> succList = new ArrayList<>(successors.length);
|
List<WeightedNode> succList = new ArrayList<>(successors.length);
|
||||||
IntegerArray orderedSuccessors = new IntegerArray(successors.length);
|
IntegerArray orderedSuccessors = new IntegerArray(successors.length);
|
||||||
if (terminalNodes.size() > 0) {
|
if (terminalNodes.size() > 0) {
|
||||||
IntSet loopNodes = IntOpenHashSet.from(findNaturalLoop(node, terminalNodes.getAll()));
|
IntSet loopNodes = IntHashSet.from(findNaturalLoop(node, terminalNodes.getAll()));
|
||||||
for (int succ : successors) {
|
for (int succ : successors) {
|
||||||
if (loopNodes.contains(succ)) {
|
if (loopNodes.contains(succ)) {
|
||||||
succList.add(new WeightedNode(succ, priorities[succ], weights[succ]));
|
succList.add(new WeightedNode(succ, priorities[succ], weights[succ]));
|
||||||
|
@ -168,7 +168,7 @@ public class GraphIndexer {
|
||||||
orderedSuccessors.add(wnode.index);
|
orderedSuccessors.add(wnode.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntSet outerSuccessors = new IntOpenHashSet(successors.length);
|
IntSet outerSuccessors = new IntHashSet(successors.length);
|
||||||
succList.clear();
|
succList.clear();
|
||||||
for (IntCursor loopNode : loopNodes) {
|
for (IntCursor loopNode : loopNodes) {
|
||||||
for (int succ : graph.outgoingEdges(loopNode.value)) {
|
for (int succ : graph.outgoingEdges(loopNode.value)) {
|
||||||
|
@ -205,7 +205,7 @@ public class GraphIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] findNaturalLoop(int head, int[] terminals) {
|
private int[] findNaturalLoop(int head, int[] terminals) {
|
||||||
IntSet loop = new IntOpenHashSet();
|
IntSet loop = new IntHashSet();
|
||||||
loop.add(head);
|
loop.add(head);
|
||||||
IntegerStack stack = new IntegerStack(1);
|
IntegerStack stack = new IntegerStack(1);
|
||||||
for (int pred : terminals) {
|
for (int pred : terminals) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -38,10 +38,10 @@ class IrreducibleGraphConverter {
|
||||||
void convertToReducible(Graph cfg, int[] weight, GraphSplittingBackend backend) {
|
void convertToReducible(Graph cfg, int[] weight, GraphSplittingBackend backend) {
|
||||||
this.backend = backend;
|
this.backend = backend;
|
||||||
|
|
||||||
nodeCopies = new IntOpenHashSet[cfg.size()];
|
nodeCopies = new IntHashSet[cfg.size()];
|
||||||
nodeOriginals = new IntegerArray(cfg.size());
|
nodeOriginals = new IntegerArray(cfg.size());
|
||||||
for (int i = 0; i < cfg.size(); ++i) {
|
for (int i = 0; i < cfg.size(); ++i) {
|
||||||
nodeCopies[i] = new IntOpenHashSet();
|
nodeCopies[i] = new IntHashSet();
|
||||||
nodeOriginals.add(i);
|
nodeOriginals.add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class IrreducibleGraphConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find header of this domain
|
// 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) {
|
for (int i = 0; i < scc.length; ++i) {
|
||||||
int node = scc[i];
|
int node = scc[i];
|
||||||
if (domains[i] == domain) {
|
if (domains[i] == domain) {
|
||||||
|
@ -258,7 +258,7 @@ class IrreducibleGraphConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] withoutCopies(int[] nodesWithCopies) {
|
private int[] withoutCopies(int[] nodesWithCopies) {
|
||||||
IntSet visited = new IntOpenHashSet();
|
IntSet visited = new IntHashSet();
|
||||||
int[] nodes = new int[nodesWithCopies.length];
|
int[] nodes = new int[nodesWithCopies.length];
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
for (int node : nodesWithCopies) {
|
for (int node : nodesWithCopies) {
|
||||||
|
@ -276,7 +276,7 @@ class IrreducibleGraphConverter {
|
||||||
int copy = copies[i];
|
int copy = copies[i];
|
||||||
IntSet knownCopies = nodeCopies[original];
|
IntSet knownCopies = nodeCopies[original];
|
||||||
if (knownCopies == null) {
|
if (knownCopies == null) {
|
||||||
knownCopies = new IntOpenHashSet();
|
knownCopies = new IntHashSet();
|
||||||
nodeCopies[original] = knownCopies;
|
nodeCopies[original] = knownCopies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.common;
|
package org.teavm.common;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -56,8 +56,8 @@ public class MutableDirectedGraph implements Graph {
|
||||||
public void addEdge(int from, int to) {
|
public void addEdge(int from, int to) {
|
||||||
int max = Math.max(from, to);
|
int max = Math.max(from, to);
|
||||||
while (max >= successors.size()) {
|
while (max >= successors.size()) {
|
||||||
successors.add(new IntOpenHashSet(1));
|
successors.add(new IntHashSet(1));
|
||||||
predecessors.add(new IntOpenHashSet(1));
|
predecessors.add(new IntHashSet(1));
|
||||||
}
|
}
|
||||||
successors.get(from).add(to);
|
successors.get(from).add(to);
|
||||||
predecessors.get(to).add(from);
|
predecessors.get(to).add(from);
|
||||||
|
@ -67,16 +67,16 @@ public class MutableDirectedGraph implements Graph {
|
||||||
if (from >= successors.size() || to >= successors.size()) {
|
if (from >= successors.size() || to >= successors.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
successors.get(from).removeAllOccurrences(to);
|
successors.get(from).removeAll(to);
|
||||||
predecessors.get(to).removeAllOccurrences(from);
|
predecessors.get(to).removeAll(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void detachNode(int node) {
|
public void detachNode(int node) {
|
||||||
for (IntCursor succ : successors.get(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)) {
|
for (IntCursor pred : predecessors.get(node)) {
|
||||||
successors.get(pred.value).removeAllOccurrences(node);
|
successors.get(pred.value).removeAll(node);
|
||||||
}
|
}
|
||||||
predecessors.get(node).clear();
|
predecessors.get(node).clear();
|
||||||
successors.get(node).clear();
|
successors.get(node).clear();
|
||||||
|
|
|
@ -15,26 +15,38 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.dependency;
|
package org.teavm.dependency;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
|
import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.teavm.common.*;
|
import org.teavm.common.DisjointSet;
|
||||||
import org.teavm.model.*;
|
import org.teavm.common.Graph;
|
||||||
import org.teavm.model.instructions.*;
|
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 {
|
public class DataFlowGraphBuilder extends AbstractInstructionReader {
|
||||||
private int lastIndex;
|
private int lastIndex;
|
||||||
private GraphBuilder builder = new GraphBuilder();
|
private GraphBuilder builder = new GraphBuilder();
|
||||||
private ObjectIntMap<FieldReference> fieldNodes = new ObjectIntOpenHashMap<>();
|
private ObjectIntMap<FieldReference> fieldNodes = new ObjectIntHashMap<>();
|
||||||
private int returnIndex = -1;
|
private int returnIndex = -1;
|
||||||
private int exceptionIndex;
|
private int exceptionIndex;
|
||||||
private DisjointSet classes = new DisjointSet();
|
private DisjointSet classes = new DisjointSet();
|
||||||
private int paramCount;
|
private int paramCount;
|
||||||
private IntSet escaping = new IntOpenHashSet();
|
private IntSet escaping = new IntHashSet();
|
||||||
|
|
||||||
private void join(int a, int b) {
|
private void join(int a, int b) {
|
||||||
if (a < paramCount || b < paramCount) {
|
if (a < paramCount || b < paramCount) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.dependency;
|
package org.teavm.dependency;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
@ -266,7 +266,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
||||||
} else {
|
} else {
|
||||||
if (consumer.pendingTypes == null) {
|
if (consumer.pendingTypes == null) {
|
||||||
pendingTransitions.add(consumer);
|
pendingTransitions.add(consumer);
|
||||||
consumer.pendingTypes = new IntOpenHashSet();
|
consumer.pendingTypes = new IntHashSet();
|
||||||
}
|
}
|
||||||
consumer.pendingTypes.add(type.index);
|
consumer.pendingTypes.add(type.index);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
||||||
} else {
|
} else {
|
||||||
if (consumer.pendingTypes == null) {
|
if (consumer.pendingTypes == null) {
|
||||||
pendingTransitions.add(consumer);
|
pendingTransitions.add(consumer);
|
||||||
consumer.pendingTypes = new IntOpenHashSet();
|
consumer.pendingTypes = new IntHashSet();
|
||||||
}
|
}
|
||||||
for (DependencyType type : types) {
|
for (DependencyType type : types) {
|
||||||
consumer.pendingTypes.add(type.index);
|
consumer.pendingTypes.add(type.index);
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.dependency;
|
package org.teavm.dependency;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
import org.teavm.model.ClassReaderSource;
|
import org.teavm.model.ClassReaderSource;
|
||||||
|
|
||||||
class SuperClassFilter implements DependencyTypeFilter {
|
class SuperClassFilter implements DependencyTypeFilter {
|
||||||
private ClassReaderSource classSource;
|
private ClassReaderSource classSource;
|
||||||
private String superType;
|
private String superType;
|
||||||
private IntIntMap cache = new IntIntOpenHashMap();
|
private IntIntMap cache = new IntIntHashMap();
|
||||||
|
|
||||||
SuperClassFilter(ClassReaderSource classSource, String superType) {
|
SuperClassFilter(ClassReaderSource classSource, String superType) {
|
||||||
this.classSource = classSource;
|
this.classSource = classSource;
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.model.analysis;
|
package org.teavm.model.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import com.carrotsearch.hppc.IntStack;
|
import com.carrotsearch.hppc.IntStack;
|
||||||
|
import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.cursors.IntCursor;
|
import com.carrotsearch.hppc.cursors.IntCursor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -78,8 +78,8 @@ public class ClassInference {
|
||||||
private int[] propagationPath;
|
private int[] propagationPath;
|
||||||
private int[] nodeMapping;
|
private int[] nodeMapping;
|
||||||
|
|
||||||
private IntOpenHashSet[] types;
|
private IntHashSet[] types;
|
||||||
private ObjectIntMap<String> typeMap = new ObjectIntOpenHashMap<>();
|
private ObjectIntMap<String> typeMap = new ObjectIntHashMap<>();
|
||||||
private List<String> typeList = new ArrayList<>();
|
private List<String> typeList = new ArrayList<>();
|
||||||
|
|
||||||
private boolean changed = true;
|
private boolean changed = true;
|
||||||
|
@ -108,7 +108,7 @@ public class ClassInference {
|
||||||
8. Repeat 7 until it changes anything (i.e. calculate fixed point).
|
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];
|
nodeChanged = new boolean[types.length];
|
||||||
formerNodeChanged = new boolean[nodeChanged.length];
|
formerNodeChanged = new boolean[nodeChanged.length];
|
||||||
nodeMapping = new int[types.length];
|
nodeMapping = new int[types.length];
|
||||||
|
@ -164,7 +164,7 @@ public class ClassInference {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] classesOf(int variableIndex) {
|
public String[] classesOf(int variableIndex) {
|
||||||
IntOpenHashSet typeSet = types[nodeMapping[packNodeAndDegree(variableIndex, 0)]];
|
IntHashSet typeSet = types[nodeMapping[packNodeAndDegree(variableIndex, 0)]];
|
||||||
if (typeSet == null) {
|
if (typeSet == null) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ public class ClassInference {
|
||||||
int variable = extractNode(entry);
|
int variable = extractNode(entry);
|
||||||
|
|
||||||
// Actually, successor nodes in resulting graph
|
// Actually, successor nodes in resulting graph
|
||||||
IntSet nextEntries = new IntOpenHashSet();
|
IntSet nextEntries = new IntHashSet();
|
||||||
|
|
||||||
// Start: calculating successor nodes in resulting DAG along different paths
|
// Start: calculating successor nodes in resulting DAG along different paths
|
||||||
//
|
//
|
||||||
|
@ -282,7 +282,7 @@ public class ClassInference {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean[] nodeChangedBackup = nodeChanged.clone();
|
boolean[] nodeChangedBackup = nodeChanged.clone();
|
||||||
IntOpenHashSet[] typesBackup = types.clone();
|
IntHashSet[] typesBackup = types.clone();
|
||||||
Arrays.fill(nodeChanged, false);
|
Arrays.fill(nodeChanged, false);
|
||||||
Arrays.fill(types, null);
|
Arrays.fill(types, null);
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ public class ClassInference {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntOpenHashSet nodeTypes = getNodeTypes(node);
|
IntHashSet nodeTypes = getNodeTypes(node);
|
||||||
for (int predecessor : graph.incomingEdges(node)) {
|
for (int predecessor : graph.incomingEdges(node)) {
|
||||||
if (formerNodeChanged[predecessor] || nodeChanged[predecessor]) {
|
if (formerNodeChanged[predecessor] || nodeChanged[predecessor]) {
|
||||||
if (nodeTypes.addAll(types[predecessor]) > 0) {
|
if (nodeTypes.addAll(types[predecessor]) > 0) {
|
||||||
|
@ -411,7 +411,7 @@ public class ClassInference {
|
||||||
}
|
}
|
||||||
|
|
||||||
int toNode = nodeMapping[packNodeAndDegree(cast.toVariable, 0)];
|
int toNode = nodeMapping[packNodeAndDegree(cast.toVariable, 0)];
|
||||||
IntOpenHashSet targetTypes = getNodeTypes(toNode);
|
IntHashSet targetTypes = getNodeTypes(toNode);
|
||||||
|
|
||||||
for (IntCursor cursor : types[fromNode]) {
|
for (IntCursor cursor : types[fromNode]) {
|
||||||
if (targetTypes.contains(cursor.value)) {
|
if (targetTypes.contains(cursor.value)) {
|
||||||
|
@ -520,10 +520,10 @@ public class ClassInference {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntOpenHashSet getNodeTypes(int node) {
|
IntHashSet getNodeTypes(int node) {
|
||||||
IntOpenHashSet result = types[node];
|
IntHashSet result = types[node];
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = new IntOpenHashSet();
|
result = new IntHashSet();
|
||||||
types[node] = result;
|
types[node] = result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -707,7 +707,7 @@ public class ClassInference {
|
||||||
|
|
||||||
static class VirtualCallSite {
|
static class VirtualCallSite {
|
||||||
int instance;
|
int instance;
|
||||||
IntSet knownClasses = new IntOpenHashSet();
|
IntSet knownClasses = new IntHashSet();
|
||||||
Set<MethodReference> resolvedMethods = new HashSet<>();
|
Set<MethodReference> resolvedMethods = new HashSet<>();
|
||||||
MethodReference method;
|
MethodReference method;
|
||||||
int[] arguments;
|
int[] arguments;
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.teavm.model.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntArrayDeque;
|
import com.carrotsearch.hppc.IntArrayDeque;
|
||||||
import com.carrotsearch.hppc.IntDeque;
|
import com.carrotsearch.hppc.IntDeque;
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -147,7 +147,7 @@ public class EscapeAnalysis {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If incoming variables of phi functions live after phi, mark them as escaping
|
// 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()) {
|
for (Phi phi : block.getPhis()) {
|
||||||
if (escapes(phi.getReceiver().getIndex())) {
|
if (escapes(phi.getReceiver().getIndex())) {
|
||||||
queue.addLast(definitionClasses[phi.getReceiver().getIndex()]);
|
queue.addLast(definitionClasses[phi.getReceiver().getIndex()]);
|
||||||
|
@ -163,7 +163,7 @@ public class EscapeAnalysis {
|
||||||
}
|
}
|
||||||
Graph graph = graphBuilder.build();
|
Graph graph = graphBuilder.build();
|
||||||
|
|
||||||
IntSet visited = new IntOpenHashSet();
|
IntSet visited = new IntHashSet();
|
||||||
while (!queue.isEmpty()) {
|
while (!queue.isEmpty()) {
|
||||||
int var = queue.removeFirst();
|
int var = queue.removeFirst();
|
||||||
if (visited.add(var)) {
|
if (visited.add(var)) {
|
||||||
|
|
|
@ -17,14 +17,13 @@ package org.teavm.model.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntArrayDeque;
|
import com.carrotsearch.hppc.IntArrayDeque;
|
||||||
import com.carrotsearch.hppc.IntDeque;
|
import com.carrotsearch.hppc.IntDeque;
|
||||||
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.teavm.common.DominatorTree;
|
|
||||||
import org.teavm.common.Graph;
|
import org.teavm.common.Graph;
|
||||||
import org.teavm.common.GraphBuilder;
|
import org.teavm.common.GraphBuilder;
|
||||||
import org.teavm.common.GraphUtils;
|
import org.teavm.common.GraphUtils;
|
||||||
|
@ -189,14 +188,8 @@ class NullnessInformationBuilder {
|
||||||
class NullExtensionVisitor extends AbstractInstructionVisitor implements DominatorWalkerCallback<State> {
|
class NullExtensionVisitor extends AbstractInstructionVisitor implements DominatorWalkerCallback<State> {
|
||||||
State currentState;
|
State currentState;
|
||||||
BasicBlock currentBlock;
|
BasicBlock currentBlock;
|
||||||
IntIntMap nullSuccessors = new IntIntOpenHashMap();
|
IntIntMap nullSuccessors = new IntIntHashMap();
|
||||||
IntIntMap notNullSuccessors = new IntIntOpenHashMap();
|
IntIntMap notNullSuccessors = new IntIntHashMap();
|
||||||
private DominatorTree dom;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDomTree(DominatorTree domTree) {
|
|
||||||
dom = domTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public State visit(BasicBlock block) {
|
public State visit(BasicBlock block) {
|
||||||
|
@ -426,7 +419,7 @@ class NullnessInformationBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
static class State {
|
static class State {
|
||||||
IntSet newlyNonNull = new IntOpenHashSet();
|
IntSet newlyNonNull = new IntHashSet();
|
||||||
IntSet newlyNull = new IntOpenHashSet();
|
IntSet newlyNull = new IntHashSet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
package org.teavm.model.lowlevel;
|
package org.teavm.model.lowlevel;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntArrayList;
|
import com.carrotsearch.hppc.IntArrayList;
|
||||||
|
import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
@ -305,7 +305,7 @@ public class GCShadowStackContributor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Instruction> sortInstructions(Collection<Instruction> instructions, BasicBlock block) {
|
private List<Instruction> sortInstructions(Collection<Instruction> instructions, BasicBlock block) {
|
||||||
ObjectIntMap<Instruction> indexes = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<Instruction> indexes = new ObjectIntHashMap<>();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Instruction instruction : block) {
|
for (Instruction instruction : block) {
|
||||||
indexes.put(instruction, index++);
|
indexes.put(instruction, index++);
|
||||||
|
@ -349,7 +349,7 @@ public class GCShadowStackContributor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectIntMap<Instruction> getInstructionIndexes(BasicBlock block) {
|
private ObjectIntMap<Instruction> getInstructionIndexes(BasicBlock block) {
|
||||||
ObjectIntMap<Instruction> indexes = new ObjectIntOpenHashMap<>();
|
ObjectIntMap<Instruction> indexes = new ObjectIntHashMap<>();
|
||||||
for (Instruction instruction : block) {
|
for (Instruction instruction : block) {
|
||||||
indexes.put(instruction, indexes.size());
|
indexes.put(instruction, indexes.size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.model.optimization;
|
package org.teavm.model.optimization;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -170,12 +170,12 @@ class LoopInversionImpl {
|
||||||
private class LoopWithExits {
|
private class LoopWithExits {
|
||||||
final int head;
|
final int head;
|
||||||
final LoopWithExits parent;
|
final LoopWithExits parent;
|
||||||
final IntSet nodes = new IntOpenHashSet();
|
final IntSet nodes = new IntHashSet();
|
||||||
final IntSet nodesAndCopies = new IntOpenHashSet();
|
final IntSet nodesAndCopies = new IntHashSet();
|
||||||
final IntSet exits = new IntOpenHashSet();
|
final IntSet exits = new IntHashSet();
|
||||||
int bodyStart;
|
int bodyStart;
|
||||||
int headCopy;
|
int headCopy;
|
||||||
final IntIntMap copiedNodes = new IntIntOpenHashMap();
|
final IntIntMap copiedNodes = new IntIntHashMap();
|
||||||
boolean shouldSkip;
|
boolean shouldSkip;
|
||||||
|
|
||||||
LoopWithExits(int head, LoopWithExits parent) {
|
LoopWithExits(int head, LoopWithExits parent) {
|
||||||
|
@ -260,7 +260,7 @@ class LoopInversionImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean findCondition() {
|
private boolean findCondition() {
|
||||||
IntSet tailNodes = new IntOpenHashSet(program.basicBlockCount());
|
IntSet tailNodes = new IntHashSet(program.basicBlockCount());
|
||||||
for (int tailCandidate : cfg.incomingEdges(head)) {
|
for (int tailCandidate : cfg.incomingEdges(head)) {
|
||||||
if (nodes.contains(tailCandidate)) {
|
if (nodes.contains(tailCandidate)) {
|
||||||
tailNodes.add(tailCandidate);
|
tailNodes.add(tailCandidate);
|
||||||
|
@ -298,7 +298,7 @@ class LoopInversionImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IntSet nodesToCopy() {
|
private IntSet nodesToCopy() {
|
||||||
IntSet result = new IntOpenHashSet();
|
IntSet result = new IntHashSet();
|
||||||
for (int node : nodes.toArray()) {
|
for (int node : nodes.toArray()) {
|
||||||
if (node == head || (node != bodyStart && !dom.dominates(bodyStart, node))) {
|
if (node == head || (node != bodyStart && !dom.dominates(bodyStart, node))) {
|
||||||
result.add(node);
|
result.add(node);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.model.util;
|
package org.teavm.model.util;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
@ -59,7 +59,7 @@ public class LivenessAnalyzer {
|
||||||
|
|
||||||
for (Instruction insn : block) {
|
for (Instruction insn : block) {
|
||||||
insn.acceptVisitor(usageExtractor);
|
insn.acceptVisitor(usageExtractor);
|
||||||
IntSet usedVars = new IntOpenHashSet();
|
IntSet usedVars = new IntHashSet();
|
||||||
for (Variable var : usageExtractor.getUsedVariables()) {
|
for (Variable var : usageExtractor.getUsedVariables()) {
|
||||||
Task task = new Task();
|
Task task = new Task();
|
||||||
task.block = i;
|
task.block = i;
|
||||||
|
|
|
@ -17,9 +17,9 @@ package org.teavm.model.util;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntArrayDeque;
|
import com.carrotsearch.hppc.IntArrayDeque;
|
||||||
import com.carrotsearch.hppc.IntDeque;
|
import com.carrotsearch.hppc.IntDeque;
|
||||||
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
|
import com.carrotsearch.hppc.IntObjectHashMap;
|
||||||
import com.carrotsearch.hppc.IntObjectMap;
|
import com.carrotsearch.hppc.IntObjectMap;
|
||||||
import com.carrotsearch.hppc.IntObjectOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -91,7 +91,7 @@ public class PhiUpdater {
|
||||||
private Phi[][] phiMap;
|
private Phi[][] phiMap;
|
||||||
private int[][] phiIndexMap;
|
private int[][] phiIndexMap;
|
||||||
private List<List<Phi>> synthesizedPhisByBlock = new ArrayList<>();
|
private List<List<Phi>> synthesizedPhisByBlock = new ArrayList<>();
|
||||||
private IntObjectMap<Phi> phisByReceiver = new IntObjectOpenHashMap<>();
|
private IntObjectMap<Phi> phisByReceiver = new IntObjectHashMap<>();
|
||||||
private BitSet usedPhis = new BitSet();
|
private BitSet usedPhis = new BitSet();
|
||||||
private Variable[] originalExceptionVariables;
|
private Variable[] originalExceptionVariables;
|
||||||
private boolean[] usedDefinitions;
|
private boolean[] usedDefinitions;
|
||||||
|
@ -248,7 +248,7 @@ public class PhiUpdater {
|
||||||
stack.push(next);
|
stack.push(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntSet exceptionHandlingSuccessors = new IntOpenHashSet();
|
IntSet exceptionHandlingSuccessors = new IntHashSet();
|
||||||
for (TryCatchBlock tryCatch : currentBlock.getTryCatchBlocks()) {
|
for (TryCatchBlock tryCatch : currentBlock.getTryCatchBlocks()) {
|
||||||
exceptionHandlingSuccessors.add(tryCatch.getHandler().getIndex());
|
exceptionHandlingSuccessors.add(tryCatch.getHandler().getIndex());
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ public class PhiUpdater {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntSet visited = new IntOpenHashSet();
|
IntSet visited = new IntHashSet();
|
||||||
while (!worklist.isEmpty()) {
|
while (!worklist.isEmpty()) {
|
||||||
int varIndex = worklist.removeFirst();
|
int varIndex = worklist.removeFirst();
|
||||||
if (!visited.add(varIndex)) {
|
if (!visited.add(varIndex)) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.model.util;
|
package org.teavm.model.util;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
import org.teavm.common.GraphSplittingBackend;
|
import org.teavm.common.GraphSplittingBackend;
|
||||||
import org.teavm.model.BasicBlock;
|
import org.teavm.model.BasicBlock;
|
||||||
import org.teavm.model.Program;
|
import org.teavm.model.Program;
|
||||||
|
@ -31,7 +31,7 @@ public class ProgramNodeSplittingBackend implements GraphSplittingBackend {
|
||||||
@Override
|
@Override
|
||||||
public int[] split(int[] domain, int[] nodes) {
|
public int[] split(int[] domain, int[] nodes) {
|
||||||
int[] copies = new int[nodes.length];
|
int[] copies = new int[nodes.length];
|
||||||
IntIntMap map = new IntIntOpenHashMap();
|
IntIntMap map = new IntIntHashMap();
|
||||||
for (int i = 0; i < nodes.length; ++i) {
|
for (int i = 0; i < nodes.length; ++i) {
|
||||||
int node = nodes[i];
|
int node = nodes[i];
|
||||||
BasicBlock block = program.basicBlockAt(node);
|
BasicBlock block = program.basicBlockAt(node);
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.parsing;
|
package org.teavm.parsing;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.IntIntHashMap;
|
||||||
import com.carrotsearch.hppc.IntIntMap;
|
import com.carrotsearch.hppc.IntIntMap;
|
||||||
import com.carrotsearch.hppc.IntIntOpenHashMap;
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -157,7 +157,7 @@ public class Parser {
|
||||||
Step[] stack = new Step[program.basicBlockCount()];
|
Step[] stack = new Step[program.basicBlockCount()];
|
||||||
int top = 0;
|
int top = 0;
|
||||||
|
|
||||||
IntIntOpenHashMap entryVarMap = new IntIntOpenHashMap();
|
IntIntHashMap entryVarMap = new IntIntHashMap();
|
||||||
for (int i = 0; i < argumentMapping.length; ++i) {
|
for (int i = 0; i < argumentMapping.length; ++i) {
|
||||||
Variable arg = argumentMapping[i];
|
Variable arg = argumentMapping[i];
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
|
@ -169,7 +169,7 @@ public class Parser {
|
||||||
while (top > 0) {
|
while (top > 0) {
|
||||||
Step step = stack[--top];
|
Step step = stack[--top];
|
||||||
int node = step.node;
|
int node = step.node;
|
||||||
IntIntMap varMap = new IntIntOpenHashMap(step.varMap);
|
IntIntMap varMap = new IntIntHashMap(step.varMap);
|
||||||
BasicBlock block = program.basicBlockAt(node);
|
BasicBlock block = program.basicBlockAt(node);
|
||||||
|
|
||||||
for (Phi phi : block.getPhis()) {
|
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) {
|
for (Instruction insn : block) {
|
||||||
insn.acceptVisitor(defExtractor);
|
insn.acceptVisitor(defExtractor);
|
||||||
|
@ -193,7 +193,7 @@ public class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int successor : dom.outgoingEdges(node)) {
|
for (int successor : dom.outgoingEdges(node)) {
|
||||||
stack[top++] = new Step(successor, new IntIntOpenHashMap(varMap));
|
stack[top++] = new Step(successor, new IntIntHashMap(varMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -210,7 +210,7 @@ public class GraphTest {
|
||||||
Graph graph = backend.getGraph();
|
Graph graph = backend.getGraph();
|
||||||
for (int node = 0; node < graph.size(); ++node) {
|
for (int node = 0; node < graph.size(); ++node) {
|
||||||
int nodeProto = backend.prototype(node);
|
int nodeProto = backend.prototype(node);
|
||||||
IntSet succProto = new IntOpenHashSet();
|
IntSet succProto = new IntHashSet();
|
||||||
for (int succ : graph.outgoingEdges(node)) {
|
for (int succ : graph.outgoingEdges(node)) {
|
||||||
succProto.add(backend.prototype(succ));
|
succProto.add(backend.prototype(succ));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ package org.teavm.model.analysis.test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import com.carrotsearch.hppc.ObjectByteHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectByteMap;
|
import com.carrotsearch.hppc.ObjectByteMap;
|
||||||
import com.carrotsearch.hppc.ObjectByteOpenHashMap;
|
|
||||||
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -123,7 +123,7 @@ public class NullnessAnalysisTest {
|
||||||
ClassLoader classLoader = NullnessAnalysisTest.class.getClassLoader();
|
ClassLoader classLoader = NullnessAnalysisTest.class.getClassLoader();
|
||||||
try (InputStream input = classLoader.getResourceAsStream(name);
|
try (InputStream input = classLoader.getResourceAsStream(name);
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"))) {
|
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"))) {
|
||||||
ObjectByteMap<String> result = new ObjectByteOpenHashMap<>();
|
ObjectByteMap<String> result = new ObjectByteHashMap<>();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
String line = reader.readLine();
|
String line = reader.readLine();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.dependency;
|
package org.teavm.dependency;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
import com.carrotsearch.hppc.IntHashSet;
|
||||||
import com.carrotsearch.hppc.IntSet;
|
import com.carrotsearch.hppc.IntSet;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -275,7 +275,7 @@ public class DependencyTest {
|
||||||
int value = aliases[insn.getValue().getIndex()];
|
int value = aliases[insn.getValue().getIndex()];
|
||||||
IntSet items = arrayContent[array];
|
IntSet items = arrayContent[array];
|
||||||
if (items == null) {
|
if (items == null) {
|
||||||
items = new IntOpenHashSet();
|
items = new IntHashSet();
|
||||||
arrayContent[array] = items;
|
arrayContent[array] = items;
|
||||||
}
|
}
|
||||||
items.add(value);
|
items.add(value);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user