mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Switch to asm4
This commit is contained in:
parent
b144d474f2
commit
45fe202740
|
@ -24,7 +24,7 @@ import org.teavm.model.ClassReader;
|
|||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
class JCLComparisonVisitor implements ClassVisitor {
|
||||
class JCLComparisonVisitor extends ClassVisitor {
|
||||
private Map<String, JCLPackage> packageMap;
|
||||
private ClassReaderSource classSource;
|
||||
private ClassReader classReader;
|
||||
|
@ -32,6 +32,7 @@ class JCLComparisonVisitor implements ClassVisitor {
|
|||
private JCLClass jclClass;
|
||||
|
||||
public JCLComparisonVisitor(ClassReaderSource classSource, Map<String, JCLPackage> packageMap) {
|
||||
super(Opcodes.ASM4);
|
||||
this.classSource = classSource;
|
||||
this.packageMap = packageMap;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>asm</groupId>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-debug-all</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>4.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public final class Parser {
|
|||
SSATransformer ssaProducer = new SSATransformer();
|
||||
ssaProducer.transformToSSA(program, method.getParameterTypes());
|
||||
method.setProgram(program);
|
||||
parseAnnotations(method.getAnnotations(), node);
|
||||
parseAnnotations(method.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations);
|
||||
while (program.variableCount() <= method.parameterCount()) {
|
||||
program.createVariable();
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public final class Parser {
|
|||
cls.setOwnerName(node.name.substring(0, lastIndex).replace('/', '.'));
|
||||
}
|
||||
}
|
||||
parseAnnotations(cls.getAnnotations(), node);
|
||||
parseAnnotations(cls.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations);
|
||||
return cls;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public final class Parser {
|
|||
field.setType(ValueType.parse(node.desc));
|
||||
field.setInitialValue(node.value);
|
||||
parseModifiers(node.access, field);
|
||||
parseAnnotations(field.getAnnotations(), node);
|
||||
parseAnnotations(field.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations);
|
||||
return field;
|
||||
}
|
||||
|
||||
|
@ -147,14 +147,14 @@ public final class Parser {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void parseAnnotations(AnnotationContainer annotations, MemberNode node) {
|
||||
private static void parseAnnotations(AnnotationContainer annotations, List<AnnotationNode> visibleAnnotations,
|
||||
List<AnnotationNode> invisibleAnnotations) {
|
||||
List<Object> annotNodes = new ArrayList<>();
|
||||
if (node.visibleAnnotations != null) {
|
||||
annotNodes.addAll(node.visibleAnnotations);
|
||||
if (visibleAnnotations != null) {
|
||||
annotNodes.addAll(visibleAnnotations);
|
||||
}
|
||||
if (node.invisibleAnnotations != null) {
|
||||
annotNodes.addAll(node.invisibleAnnotations);
|
||||
if (invisibleAnnotations != null) {
|
||||
annotNodes.addAll(invisibleAnnotations);
|
||||
}
|
||||
for (Object obj : annotNodes) {
|
||||
AnnotationNode annotNode = (AnnotationNode)obj;
|
||||
|
@ -180,7 +180,6 @@ public final class Parser {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static AnnotationValue parseAnnotationValue(Object value) {
|
||||
if (value instanceof String[]) {
|
||||
String[] enumInfo = (String[])value;
|
||||
|
|
|
@ -296,7 +296,8 @@ public class ProgramParser {
|
|||
return local;
|
||||
}
|
||||
|
||||
private MethodVisitor methodVisitor = new MethodVisitor() {
|
||||
// TODO: invokedynamic support (a great task, involving not only parser, but every layer of TeaVM)
|
||||
private MethodVisitor methodVisitor = new MethodVisitor(Opcodes.ASM4) {
|
||||
@Override
|
||||
public void visitVarInsn(int opcode, int local) {
|
||||
switch (opcode) {
|
||||
|
@ -373,7 +374,7 @@ public class ProgramParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) {
|
||||
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
|
||||
SwitchTableEntry[] table = new SwitchTableEntry[labels.length];
|
||||
nextIndexes = new int[labels.length + 1];
|
||||
for (int i = 0; i < labels.length; ++i) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user