diff --git a/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java b/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java index 018538cf4..044b6f612 100644 --- a/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java +++ b/core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java @@ -26,7 +26,7 @@ import org.teavm.common.*; import org.teavm.model.*; import org.teavm.model.instructions.*; -public class DataFlowGraphBuilder implements InstructionReader { +public class DataFlowGraphBuilder extends AbstractInstructionReader { private int lastIndex; private GraphBuilder builder = new GraphBuilder(); private ObjectIntMap fieldNodes = new ObjectIntOpenHashMap<>(); @@ -127,51 +127,6 @@ public class DataFlowGraphBuilder implements InstructionReader { } } - @Override - public void location(TextLocation location) { - } - - @Override - public void nop() { - } - - @Override - public void classConstant(VariableReader receiver, ValueType cst) { - } - - @Override - public void nullConstant(VariableReader receiver) { - } - - @Override - public void integerConstant(VariableReader receiver, int cst) { - } - - @Override - public void longConstant(VariableReader receiver, long cst) { - } - - @Override - public void floatConstant(VariableReader receiver, float cst) { - } - - @Override - public void doubleConstant(VariableReader receiver, double cst) { - } - - @Override - public void stringConstant(VariableReader receiver, String cst) { - } - - @Override - public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, - NumericOperandType type) { - } - - @Override - public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { - } - private void connect(int a, int b) { builder.addEdge(a, b); join(a, b); @@ -187,35 +142,6 @@ public class DataFlowGraphBuilder implements InstructionReader { builder.addEdge(value.getIndex(), receiver.getIndex()); } - @Override - public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - @Override public void exit(VariableReader valueToReturn) { if (valueToReturn != null && returnIndex >= 0) { @@ -229,18 +155,6 @@ public class DataFlowGraphBuilder implements InstructionReader { escaping.add(exceptionIndex); } - @Override - public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, List dimensions) { - } - - @Override - public void create(VariableReader receiver, String type) { - } - private int getFieldNode(FieldReference field) { int fieldNode = fieldNodes.getOrDefault(field, -1); if (fieldNode < 0) { @@ -267,10 +181,6 @@ public class DataFlowGraphBuilder implements InstructionReader { builder.addEdge(value.getIndex(), getFieldNode(field)); } - @Override - public void arrayLength(VariableReader receiver, VariableReader array) { - } - @Override public void cloneArray(VariableReader receiver, VariableReader array) { builder.addEdge(array.getIndex(), receiver.getIndex()); @@ -318,14 +228,6 @@ public class DataFlowGraphBuilder implements InstructionReader { // Should be eliminated by bootstrap method substitutor } - @Override - public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { - } - - @Override - public void initClass(String className) { - } - @Override public void nullCheck(VariableReader receiver, VariableReader value) { connect(value.getIndex(), receiver.getIndex()); diff --git a/core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java b/core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java index 5cc00422b..60df1b718 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java +++ b/core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java @@ -49,24 +49,14 @@ import org.teavm.model.ValueType; import org.teavm.model.VariableReader; import org.teavm.model.emit.ProgramEmitter; import org.teavm.model.emit.ValueEmitter; +import org.teavm.model.instructions.AbstractInstructionReader; import org.teavm.model.instructions.ArrayElementType; import org.teavm.model.instructions.AssignInstruction; -import org.teavm.model.instructions.BinaryBranchingCondition; -import org.teavm.model.instructions.BinaryOperation; -import org.teavm.model.instructions.BranchingCondition; -import org.teavm.model.instructions.CastIntegerDirection; import org.teavm.model.instructions.InstructionReader; -import org.teavm.model.instructions.IntegerSubtype; import org.teavm.model.instructions.InvocationType; import org.teavm.model.instructions.NullConstantInstruction; -import org.teavm.model.instructions.NumericOperandType; -import org.teavm.model.instructions.SwitchTableEntryReader; import org.teavm.model.util.ListingBuilder; -/** - * - * @author Alexey Andreev - */ class DependencyGraphBuilder { private DependencyChecker dependencyChecker; private DependencyNode[] nodes; @@ -390,16 +380,12 @@ class DependencyGraphBuilder { } } - private InstructionReader reader = new InstructionReader() { + private InstructionReader reader = new AbstractInstructionReader() { @Override public void location(TextLocation location) { currentLocation = location; } - @Override - public void nop() { - } - @Override public void classConstant(VariableReader receiver, ValueType cst) { DependencyNode node = nodes[receiver.getIndex()]; @@ -428,26 +414,6 @@ class DependencyGraphBuilder { } } - @Override - public void nullConstant(VariableReader receiver) { - } - - @Override - public void integerConstant(VariableReader receiver, int cst) { - } - - @Override - public void longConstant(VariableReader receiver, long cst) { - } - - @Override - public void floatConstant(VariableReader receiver, float cst) { - } - - @Override - public void doubleConstant(VariableReader receiver, double cst) { - } - @Override public void stringConstant(VariableReader receiver, String cst) { DependencyNode node = nodes[receiver.getIndex()]; @@ -459,15 +425,6 @@ class DependencyGraphBuilder { method.use(); } - @Override - public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, - NumericOperandType type) { - } - - @Override - public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { - } - @Override public void assign(VariableReader receiver, VariableReader assignee) { DependencyNode valueNode = nodes[assignee.getIndex()]; @@ -501,36 +458,6 @@ class DependencyGraphBuilder { valueNode.connect(receiverNode); } } - - @Override - public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - @Override public void exit(VariableReader valueToReturn) { if (valueToReturn != null) { @@ -631,10 +558,6 @@ class DependencyGraphBuilder { initClass(field.getClassName()); } - @Override - public void arrayLength(VariableReader receiver, VariableReader array) { - } - @Override public void cloneArray(VariableReader receiver, VariableReader array) { DependencyNode arrayNode = nodes[array.getIndex()]; diff --git a/core/src/main/java/org/teavm/model/instructions/AbstractInstructionReader.java b/core/src/main/java/org/teavm/model/instructions/AbstractInstructionReader.java new file mode 100644 index 000000000..ccf7180f1 --- /dev/null +++ b/core/src/main/java/org/teavm/model/instructions/AbstractInstructionReader.java @@ -0,0 +1,192 @@ +/* + * Copyright 2016 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.model.instructions; + +import java.util.List; +import org.teavm.model.BasicBlockReader; +import org.teavm.model.FieldReference; +import org.teavm.model.MethodDescriptor; +import org.teavm.model.MethodHandle; +import org.teavm.model.MethodReference; +import org.teavm.model.RuntimeConstant; +import org.teavm.model.TextLocation; +import org.teavm.model.ValueType; +import org.teavm.model.VariableReader; + +public class AbstractInstructionReader implements InstructionReader { + @Override + public void location(TextLocation location) { + } + + @Override + public void nop() { + } + + @Override + public void classConstant(VariableReader receiver, ValueType cst) { + } + + @Override + public void nullConstant(VariableReader receiver) { + } + + @Override + public void integerConstant(VariableReader receiver, int cst) { + } + + @Override + public void longConstant(VariableReader receiver, long cst) { + } + + @Override + public void floatConstant(VariableReader receiver, float cst) { + } + + @Override + public void doubleConstant(VariableReader receiver, double cst) { + } + + @Override + public void stringConstant(VariableReader receiver, String cst) { + } + + @Override + public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, + NumericOperandType type) { + } + + @Override + public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { + } + + @Override + public void assign(VariableReader receiver, VariableReader assignee) { + } + + @Override + public void cast(VariableReader receiver, VariableReader value, ValueType targetType) { + } + + @Override + public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, + NumericOperandType targetType) { + } + + @Override + public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, + CastIntegerDirection targetType) { + } + + @Override + public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, + BasicBlockReader alternative) { + } + + @Override + public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, + BasicBlockReader consequent, BasicBlockReader alternative) { + } + + @Override + public void jump(BasicBlockReader target) { + } + + @Override + public void choose(VariableReader condition, List table, + BasicBlockReader defaultTarget) { + } + + @Override + public void exit(VariableReader valueToReturn) { + } + + @Override + public void raise(VariableReader exception) { + } + + @Override + public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { + } + + @Override + public void createArray(VariableReader receiver, ValueType itemType, List dimensions) { + } + + @Override + public void create(VariableReader receiver, String type) { + } + + @Override + public void getField(VariableReader receiver, VariableReader instance, FieldReference field, ValueType fieldType) { + } + + @Override + public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) { + } + + @Override + public void arrayLength(VariableReader receiver, VariableReader array) { + } + + @Override + public void cloneArray(VariableReader receiver, VariableReader array) { + } + + @Override + public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { + } + + @Override + public void getElement(VariableReader receiver, VariableReader array, VariableReader index, + ArrayElementType elementType) { + } + + @Override + public void putElement(VariableReader array, VariableReader index, VariableReader value, + ArrayElementType elementType) { + } + + @Override + public void invoke(VariableReader receiver, VariableReader instance, MethodReference method, + List arguments, InvocationType type) { + } + + @Override + public void invokeDynamic(VariableReader receiver, VariableReader instance, MethodDescriptor method, + List arguments, MethodHandle bootstrapMethod, + List bootstrapArguments) { + } + + @Override + public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { + } + + @Override + public void initClass(String className) { + } + + @Override + public void nullCheck(VariableReader receiver, VariableReader value) { + } + + @Override + public void monitorEnter(VariableReader objectRef) { + } + + @Override + public void monitorExit(VariableReader objectRef) { + } +} diff --git a/core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java b/core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java index c46d0992a..ca95bbd71 100644 --- a/core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java +++ b/core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java @@ -29,36 +29,17 @@ import org.teavm.callgraph.CallSite; import org.teavm.diagnostics.Diagnostics; import org.teavm.interop.Async; import org.teavm.interop.Sync; -import org.teavm.model.BasicBlockReader; import org.teavm.model.CallLocation; import org.teavm.model.ClassReader; import org.teavm.model.ElementModifier; -import org.teavm.model.FieldReference; import org.teavm.model.ListableClassReaderSource; import org.teavm.model.MethodDescriptor; -import org.teavm.model.MethodHandle; import org.teavm.model.MethodReader; import org.teavm.model.MethodReference; import org.teavm.model.ProgramReader; -import org.teavm.model.RuntimeConstant; -import org.teavm.model.TextLocation; -import org.teavm.model.ValueType; import org.teavm.model.VariableReader; -import org.teavm.model.instructions.ArrayElementType; -import org.teavm.model.instructions.BinaryBranchingCondition; -import org.teavm.model.instructions.BinaryOperation; -import org.teavm.model.instructions.BranchingCondition; -import org.teavm.model.instructions.CastIntegerDirection; -import org.teavm.model.instructions.InstructionReader; -import org.teavm.model.instructions.IntegerSubtype; -import org.teavm.model.instructions.InvocationType; -import org.teavm.model.instructions.NumericOperandType; -import org.teavm.model.instructions.SwitchTableEntryReader; +import org.teavm.model.instructions.AbstractInstructionReader; -/** - * - * @author Alexey Andreev - */ public class AsyncMethodFinder { private Set asyncMethods = new HashSet<>(); private Map asyncFamilyMethods = new HashMap<>(); @@ -262,174 +243,12 @@ public class AsyncMethodFinder { } } - class AsyncInstructionReader implements InstructionReader { + class AsyncInstructionReader extends AbstractInstructionReader { boolean async; - @Override - public void location(TextLocation location) { - } - - @Override - public void nop() { - } - - @Override - public void classConstant(VariableReader receiver, ValueType cst) { - } - - @Override - public void nullConstant(VariableReader receiver) { - } - - @Override - public void integerConstant(VariableReader receiver, int cst) { - } - - @Override - public void longConstant(VariableReader receiver, long cst) { - } - - @Override - public void floatConstant(VariableReader receiver, float cst) { - } - - @Override - public void doubleConstant(VariableReader receiver, double cst) { - } - - @Override - public void stringConstant(VariableReader receiver, String cst) { - } - - @Override - public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, - NumericOperandType type) { - } - - @Override - public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { - } - - @Override - public void assign(VariableReader receiver, VariableReader assignee) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, ValueType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - - @Override - public void exit(VariableReader valueToReturn) { - } - - @Override - public void raise(VariableReader exception) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, - List dimensions) { - } - - @Override - public void create(VariableReader receiver, String type) { - } - - @Override - public void getField(VariableReader receiver, VariableReader instance, FieldReference field, - ValueType fieldType) { - } - - @Override - public void putField(VariableReader instance, FieldReference field, VariableReader value, - ValueType fieldType) { - } - - @Override - public void arrayLength(VariableReader receiver, VariableReader array) { - } - - @Override - public void cloneArray(VariableReader receiver, VariableReader array) { - } - - @Override - public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { - } - - @Override - public void getElement(VariableReader receiver, VariableReader array, VariableReader index, - ArrayElementType type) { - } - - @Override - public void putElement(VariableReader array, VariableReader index, VariableReader value, - ArrayElementType type) { - } - - @Override - public void invoke(VariableReader receiver, VariableReader instance, MethodReference method, - List arguments, InvocationType type) { - } - - @Override - public void invokeDynamic(VariableReader receiver, VariableReader instance, MethodDescriptor method, - List arguments, MethodHandle bootstrapMethod, - List bootstrapArguments) { - } - - @Override - public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { - } - - @Override - public void initClass(String className) { - } - - @Override - public void nullCheck(VariableReader receiver, VariableReader value) { - } - @Override public void monitorEnter(VariableReader objectRef) { async = true; } - - @Override - public void monitorExit(VariableReader objectRef) { - } } } diff --git a/core/src/main/java/org/teavm/model/util/TypeInferer.java b/core/src/main/java/org/teavm/model/util/TypeInferer.java index 49ca3ced2..e617bff93 100644 --- a/core/src/main/java/org/teavm/model/util/TypeInferer.java +++ b/core/src/main/java/org/teavm/model/util/TypeInferer.java @@ -191,7 +191,7 @@ public class TypeInferer { return VariableType.OBJECT_ARRAY; } - InstructionReader reader = new InstructionReader() { + InstructionReader reader = new AbstractInstructionReader() { @Override public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { builder.addEdge(array.getIndex(), receiver.getIndex()); @@ -202,19 +202,6 @@ public class TypeInferer { types[receiver.getIndex()] = VariableType.OBJECT; } - @Override - public void raise(VariableReader exception) { - } - - @Override - public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) { - } - - @Override - public void putElement(VariableReader array, VariableReader index, VariableReader value, - ArrayElementType type) { - } - @Override public void nullConstant(VariableReader receiver) { types[receiver.getIndex()] = VariableType.OBJECT; @@ -225,46 +212,16 @@ public class TypeInferer { builder.addEdge(value.getIndex(), receiver.getIndex()); } - @Override - public void nop() { - } - @Override public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { types[receiver.getIndex()] = convert(type); } - @Override - public void monitorExit(VariableReader objectRef) { - } - - @Override - public void monitorEnter(VariableReader objectRef) { - } - @Override public void longConstant(VariableReader receiver, long cst) { types[receiver.getIndex()] = VariableType.LONG; } - @Override - public void location(TextLocation location) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - @Override public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { types[receiver.getIndex()] = VariableType.INT; @@ -292,10 +249,6 @@ public class TypeInferer { types[receiver.getIndex()] = VariableType.INT; } - @Override - public void initClass(String className) { - } - @Override public void getField(VariableReader receiver, VariableReader instance, FieldReference field, ValueType fieldType) { @@ -313,10 +266,6 @@ public class TypeInferer { types[receiver.getIndex()] = VariableType.FLOAT; } - @Override - public void exit(VariableReader valueToReturn) { - } - @Override public void doubleConstant(VariableReader receiver, double cst) { types[receiver.getIndex()] = VariableType.DOUBLE; @@ -348,11 +297,6 @@ public class TypeInferer { types[receiver.getIndex()] = VariableType.OBJECT; } - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - @Override public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, CastIntegerDirection targetType) { @@ -381,7 +325,6 @@ public class TypeInferer { types[receiver.getIndex()] = convert(type); break; } - } @Override diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/AliasFinder.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/AliasFinder.java index d0df8414e..13e87a876 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/AliasFinder.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/AliasFinder.java @@ -16,33 +16,18 @@ package org.teavm.metaprogramming.impl; import java.util.Arrays; -import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.teavm.common.DisjointSet; import org.teavm.model.BasicBlockReader; -import org.teavm.model.FieldReference; -import org.teavm.model.MethodDescriptor; -import org.teavm.model.MethodHandle; -import org.teavm.model.MethodReference; import org.teavm.model.PhiReader; import org.teavm.model.ProgramReader; -import org.teavm.model.RuntimeConstant; -import org.teavm.model.TextLocation; import org.teavm.model.TryCatchBlockReader; import org.teavm.model.TryCatchJointReader; 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.BinaryBranchingCondition; -import org.teavm.model.instructions.BinaryOperation; -import org.teavm.model.instructions.BranchingCondition; -import org.teavm.model.instructions.CastIntegerDirection; -import org.teavm.model.instructions.InstructionReader; -import org.teavm.model.instructions.IntegerSubtype; -import org.teavm.model.instructions.InvocationType; -import org.teavm.model.instructions.NumericOperandType; -import org.teavm.model.instructions.SwitchTableEntryReader; class AliasFinder { private int[] aliases; @@ -122,7 +107,7 @@ class AliasFinder { return arrayElements.clone(); } - private static class AliasReader implements InstructionReader { + private static class AliasReader extends AbstractInstructionReader { DisjointSet disjointSet; Object[] constants; ArrayElement[] arrayElements; @@ -133,23 +118,11 @@ class AliasFinder { this.arrayElements = new ArrayElement[variableCount]; } - @Override - public void location(TextLocation location) { - } - - @Override - public void nop() { - } - @Override public void classConstant(VariableReader receiver, ValueType cst) { constants[receiver.getIndex()] = cst; } - @Override - public void nullConstant(VariableReader receiver) { - } - @Override public void integerConstant(VariableReader receiver, int cst) { constants[receiver.getIndex()] = cst; @@ -175,91 +148,11 @@ class AliasFinder { constants[receiver.getIndex()] = cst; } - @Override - public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, - NumericOperandType type) { - } - - @Override - public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { - } - @Override public void assign(VariableReader receiver, VariableReader assignee) { disjointSet.union(receiver.getIndex(), assignee.getIndex()); } - @Override - public void cast(VariableReader receiver, VariableReader value, ValueType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - - @Override - public void exit(VariableReader valueToReturn) { - } - - @Override - public void raise(VariableReader exception) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, - List dimensions) { - } - - @Override - public void create(VariableReader receiver, String type) { - } - - @Override - public void getField(VariableReader receiver, VariableReader instance, FieldReference field, - ValueType fieldType) { - } - - @Override - public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) { - } - - @Override - public void arrayLength(VariableReader receiver, VariableReader array) { - } - - @Override - public void cloneArray(VariableReader receiver, VariableReader array) { - } - @Override public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { disjointSet.union(receiver.getIndex(), array.getIndex()); @@ -273,41 +166,5 @@ class AliasFinder { elem.index = index.getIndex(); arrayElements[receiver.getIndex()] = elem; } - - @Override - public void putElement(VariableReader array, VariableReader index, VariableReader value, - ArrayElementType type) { - } - - @Override - public void invoke(VariableReader receiver, VariableReader instance, MethodReference method, - List arguments, InvocationType type) { - } - - @Override - public void invokeDynamic(VariableReader receiver, VariableReader instance, MethodDescriptor method, - List arguments, MethodHandle bootstrapMethod, - List bootstrapArguments) { - } - - @Override - public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { - } - - @Override - public void initClass(String className) { - } - - @Override - public void nullCheck(VariableReader receiver, VariableReader value) { - } - - @Override - public void monitorEnter(VariableReader objectRef) { - } - - @Override - public void monitorExit(VariableReader objectRef) { - } } } diff --git a/tools/core/src/main/java/org/teavm/tooling/InstructionLocationReader.java b/tools/core/src/main/java/org/teavm/tooling/InstructionLocationReader.java index 667f1ed72..88324964a 100644 --- a/tools/core/src/main/java/org/teavm/tooling/InstructionLocationReader.java +++ b/tools/core/src/main/java/org/teavm/tooling/InstructionLocationReader.java @@ -15,21 +15,11 @@ */ package org.teavm.tooling; -import java.util.List; import java.util.Set; -import org.teavm.model.*; -import org.teavm.model.instructions.ArrayElementType; -import org.teavm.model.instructions.BinaryBranchingCondition; -import org.teavm.model.instructions.BinaryOperation; -import org.teavm.model.instructions.BranchingCondition; -import org.teavm.model.instructions.CastIntegerDirection; -import org.teavm.model.instructions.InstructionReader; -import org.teavm.model.instructions.IntegerSubtype; -import org.teavm.model.instructions.InvocationType; -import org.teavm.model.instructions.NumericOperandType; -import org.teavm.model.instructions.SwitchTableEntryReader; +import org.teavm.model.TextLocation; +import org.teavm.model.instructions.AbstractInstructionReader; -class InstructionLocationReader implements InstructionReader { +class InstructionLocationReader extends AbstractInstructionReader { private Set resources; public InstructionLocationReader(Set resources) { @@ -42,163 +32,4 @@ class InstructionLocationReader implements InstructionReader { resources.add(location.getFileName()); } } - - @Override - public void nop() { - } - - @Override - public void classConstant(VariableReader receiver, ValueType cst) { - } - - @Override - public void nullConstant(VariableReader receiver) { - } - - @Override - public void integerConstant(VariableReader receiver, int cst) { - } - - @Override - public void longConstant(VariableReader receiver, long cst) { - } - - @Override - public void floatConstant(VariableReader receiver, float cst) { - } - - @Override - public void doubleConstant(VariableReader receiver, double cst) { - } - - @Override - public void stringConstant(VariableReader receiver, String cst) { - } - - @Override - public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, VariableReader second, - NumericOperandType type) { - } - - @Override - public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { - } - - @Override - public void assign(VariableReader receiver, VariableReader assignee) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, ValueType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { - } - - @Override - public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { - } - - @Override - public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { - } - - @Override - public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { - } - - @Override - public void jump(BasicBlockReader target) { - } - - @Override - public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { - } - - @Override - public void exit(VariableReader valueToReturn) { - } - - @Override - public void raise(VariableReader exception) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { - } - - @Override - public void createArray(VariableReader receiver, ValueType itemType, List dimensions) { - } - - @Override - public void create(VariableReader receiver, String type) { - } - - @Override - public void getField(VariableReader receiver, VariableReader instance, FieldReference field, ValueType fieldType) { - } - - @Override - public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) { - } - - @Override - public void arrayLength(VariableReader receiver, VariableReader array) { - } - - @Override - public void cloneArray(VariableReader receiver, VariableReader array) { - } - - @Override - public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { - } - - @Override - public void getElement(VariableReader receiver, VariableReader array, VariableReader index, - ArrayElementType type) { - } - - @Override - public void putElement(VariableReader array, VariableReader index, VariableReader value, - ArrayElementType type) { - } - - @Override - public void invoke(VariableReader receiver, VariableReader instance, MethodReference method, - List arguments, InvocationType type) { - } - - @Override - public void invokeDynamic(VariableReader receiver, VariableReader instance, MethodDescriptor method, - List arguments, MethodHandle bootstrapMethod, - List bootstrapArguments) { - } - - @Override - public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { - } - - @Override - public void initClass(String className) { - } - - @Override - public void nullCheck(VariableReader receiver, VariableReader value) { - } - - @Override - public void monitorEnter(VariableReader objectRef) { - } - - @Override - public void monitorExit(VariableReader objectRef) { - } } diff --git a/tools/core/src/main/java/org/teavm/tooling/sources/ProgramSourceAggregator.java b/tools/core/src/main/java/org/teavm/tooling/sources/ProgramSourceAggregator.java index 138f1cec7..d2c5a6ec6 100644 --- a/tools/core/src/main/java/org/teavm/tooling/sources/ProgramSourceAggregator.java +++ b/tools/core/src/main/java/org/teavm/tooling/sources/ProgramSourceAggregator.java @@ -15,12 +15,13 @@ */ package org.teavm.tooling.sources; -import java.util.List; import java.util.Set; -import org.teavm.model.*; -import org.teavm.model.instructions.*; +import org.teavm.model.BasicBlockReader; +import org.teavm.model.ProgramReader; +import org.teavm.model.TextLocation; +import org.teavm.model.instructions.AbstractInstructionReader; -class ProgramSourceAggregator implements InstructionReader { +class ProgramSourceAggregator extends AbstractInstructionReader { private Set sourceFiles; public ProgramSourceAggregator(Set sourceFiles) { @@ -40,56 +41,4 @@ class ProgramSourceAggregator implements InstructionReader { sourceFiles.add(location.getFileName()); } } - - @Override public void nop() { } - @Override public void classConstant(VariableReader receiver, ValueType cst) { } - @Override public void nullConstant(VariableReader receiver) { } - @Override public void integerConstant(VariableReader receiver, int cst) { } - @Override public void longConstant(VariableReader receiver, long cst) { } - @Override public void floatConstant(VariableReader receiver, float cst) { } - @Override public void doubleConstant(VariableReader receiver, double cst) { } - @Override public void stringConstant(VariableReader receiver, String cst) { } - @Override public void binary(BinaryOperation op, VariableReader receiver, VariableReader first, - VariableReader second, NumericOperandType type) { } - @Override public void negate(VariableReader receiver, VariableReader operand, NumericOperandType type) { } - @Override public void assign(VariableReader receiver, VariableReader assignee) { } - @Override public void cast(VariableReader receiver, VariableReader value, ValueType targetType) { } - @Override public void cast(VariableReader receiver, VariableReader value, NumericOperandType sourceType, - NumericOperandType targetType) { } - @Override public void cast(VariableReader receiver, VariableReader value, IntegerSubtype type, - CastIntegerDirection targetType) { } - @Override public void jumpIf(BranchingCondition cond, VariableReader operand, BasicBlockReader consequent, - BasicBlockReader alternative) { } - @Override public void jumpIf(BinaryBranchingCondition cond, VariableReader first, VariableReader second, - BasicBlockReader consequent, BasicBlockReader alternative) { } - @Override public void jump(BasicBlockReader target) { } - @Override public void choose(VariableReader condition, List table, - BasicBlockReader defaultTarget) { } - @Override public void exit(VariableReader valueToReturn) { } - @Override public void raise(VariableReader exception) { } - @Override public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { } - @Override public void createArray(VariableReader receiver, ValueType itemType, - List dimensions) { } - @Override public void create(VariableReader receiver, String type) { } - @Override public void getField(VariableReader receiver, VariableReader instance, FieldReference field, - ValueType fieldType) { } - @Override public void putField(VariableReader instance, FieldReference field, VariableReader value, - ValueType fieldType) { } - @Override public void arrayLength(VariableReader receiver, VariableReader array) { } - @Override public void cloneArray(VariableReader receiver, VariableReader array) { } - @Override public void unwrapArray(VariableReader receiver, VariableReader array, ArrayElementType elementType) { } - @Override public void getElement(VariableReader receiver, VariableReader array, VariableReader index, - ArrayElementType type) { } - @Override public void putElement(VariableReader array, VariableReader index, VariableReader value, - ArrayElementType type) { } - @Override public void invoke(VariableReader receiver, VariableReader instance, MethodReference method, - List arguments, InvocationType type) { } - @Override public void invokeDynamic(VariableReader receiver, VariableReader instance, MethodDescriptor method, - List arguments, MethodHandle bootstrapMethod, - List bootstrapArguments) { } - @Override public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { } - @Override public void initClass(String className) { } - @Override public void nullCheck(VariableReader receiver, VariableReader value) { } - @Override public void monitorEnter(VariableReader objectRef) { } - @Override public void monitorExit(VariableReader objectRef) { } }