faster imageToShape

This commit is contained in:
2015-03-17 07:03:56 +01:00
parent 22ad9655c2
commit 2664d692ba
42 changed files with 117 additions and 103 deletions
@@ -132,7 +132,7 @@ public abstract class AVM2Item extends GraphTargetItem {
ops.add(o);
}
}
int opArr[] = new int[ops.size()];
int[] opArr = new int[ops.size()];
for (int i = 0; i < ops.size(); i++) {
opArr[i] = ops.get(i);
}
@@ -52,7 +52,7 @@ public class InitVectorAVM2Item extends AVM2Item {
List<Integer> openedNamespaces;
private int allNsSet(ABC abc) {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -178,7 +178,7 @@ public class ASM3Parser {
}
loopn:
for (int n = 1; n < constants.getNamespaceSetCount(); n++) {
int nss[] = constants.getNamespaceSet(n).namespaces;
int[] nss = constants.getNamespaceSet(n).namespaces;
if (nss.length != namespaceList.size()) {
continue;
}
@@ -189,7 +189,7 @@ public class ASM3Parser {
}
return n;
}
int nss[] = new int[namespaceList.size()];
int[] nss = new int[namespaceList.size()];
for (int i = 0; i < nss.length; i++) {
nss[i] = namespaceList.get(i);
}
@@ -158,7 +158,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, GetDescendantsAVM2Item item) throws CompilationException {
int nssa[] = new int[item.openedNamespaces.size()];
int[] nssa = new int[item.openedNamespaces.size()];
for (int i = 0; i < item.openedNamespaces.size(); i++) {
nssa[i] = item.openedNamespaces.get(i);
}
@@ -332,7 +332,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, xmlListReg)));
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, counterReg)));
trueBody.addAll(toInsList(AssignableAVM2Item.getTemp(localData, this, tempVal1)));
int nss[] = new int[item.openedNamespaces.size()];
int[] nss = new int[item.openedNamespaces.size()];
for (int i = 0; i < item.openedNamespaces.size(); i++) {
nss[i] = item.openedNamespaces.get(i);
}
@@ -1583,9 +1583,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
}
int param_types[] = new int[paramTypes.size()];
ValueKind optional[] = new ValueKind[paramValues.size()];
//int param_names[] = new int[paramNames.size()];
int[] param_types = new int[paramTypes.size()];
ValueKind[] optional = new ValueKind[paramValues.size()];
//int[] param_names = new int[paramNames.size()];
for (int i = 0; i < paramTypes.size(); i++) {
param_types[i] = typeName(localData, paramTypes.get(i));
//param_names[i] = str(paramNames.get(i));
@@ -1931,7 +1931,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
TypeItem sup = (TypeItem) un;
int propId = resolveType(localData, sup, abc, allABCs);
int nss[] = new int[]{abc.constants.constant_multiname.get(propId).namespace_index};
int[] nss = new int[]{abc.constants.constant_multiname.get(propId).namespace_index};
return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(propId).name_index, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<Integer>()), true);
}
@@ -50,7 +50,7 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item {
}
private int allNsSetWithVec(ABC abc) {
int nssa[] = new int[openedNamespaces.size() + 1];
int[] nssa = new int[openedNamespaces.size() + 1];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -64,7 +64,7 @@ public class IndexAVM2Item extends AssignableAVM2Item {
}
private int allNsSet(ABC abc) {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -169,7 +169,7 @@ public class NameAVM2Item extends AssignableAVM2Item {
}
private int allNsSet(ABC abc) {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -74,7 +74,7 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
}
private int allNsSet(ABC abc) {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -95,7 +95,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
}
private int allNsSet() {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -187,7 +187,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
}
private int allNsSet(ABC abc) {
int nssa[] = new int[openedNamespaces.size()];
int[] nssa = new int[openedNamespaces.size()];
for (int i = 0; i < openedNamespaces.size(); i++) {
nssa[i] = openedNamespaces.get(i);
}
@@ -292,7 +292,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
public GraphTargetItem resolve(GraphTargetItem thisType, List<GraphTargetItem> paramTypes, List<String> paramNames, ABC abc, List<ABC> otherAbcs, List<MethodBody> callStack, List<AssignableAVM2Item> variables) throws CompilationException {
List<String> parts = new ArrayList<>();
if (name.contains(".")) {
String partsArr[] = name.split("\\.");
String[] partsArr = name.split("\\.");
parts.addAll(Arrays.asList(partsArr));
} else {
parts.add(name);