mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 00:04:10 -08:00
Bump ASM version, use common ASM API version everywhere, bump ASM API version to 9
This commit is contained in:
parent
a40c955d39
commit
d097350787
25
core/src/main/java/org/teavm/parsing/AsmUtil.java
Normal file
25
core/src/main/java/org/teavm/parsing/AsmUtil.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2022 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.parsing;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
public final class AsmUtil {
|
||||
public static final int API_VERSION = Opcodes.ASM9;
|
||||
|
||||
private AsmUtil() {
|
||||
}
|
||||
}
|
|
@ -71,8 +71,8 @@ public class Parser {
|
|||
}
|
||||
|
||||
public MethodHolder parseMethod(MethodNode node, String fileName) {
|
||||
MethodNode nodeWithoutJsr = new MethodNode(Opcodes.ASM7, node.access, node.name, node.desc, node.signature,
|
||||
node.exceptions.toArray(new String[0]));
|
||||
MethodNode nodeWithoutJsr = new MethodNode(AsmUtil.API_VERSION, node.access, node.name, node.desc,
|
||||
node.signature, node.exceptions.toArray(new String[0]));
|
||||
JSRInlinerAdapter adapter = new JSRInlinerAdapter(nodeWithoutJsr, node.access, node.name, node.desc,
|
||||
node.signature, node.exceptions.toArray(new String[0]));
|
||||
node.accept(adapter);
|
||||
|
|
|
@ -431,7 +431,7 @@ public class ProgramParser {
|
|||
}
|
||||
|
||||
// TODO: invokedynamic support (a great task, involving not only parser, but every layer of TeaVM)
|
||||
private MethodVisitor methodVisitor = new MethodVisitor(Opcodes.ASM7) {
|
||||
private MethodVisitor methodVisitor = new MethodVisitor(AsmUtil.API_VERSION) {
|
||||
@Override
|
||||
public void visitVarInsn(int opcode, int local) {
|
||||
switch (opcode) {
|
||||
|
|
|
@ -35,9 +35,9 @@ import java.util.stream.Collectors;
|
|||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.teavm.metaprogramming.CompileTime;
|
||||
import org.teavm.parsing.AsmUtil;
|
||||
import org.teavm.vm.spi.After;
|
||||
import org.teavm.vm.spi.Before;
|
||||
import org.teavm.vm.spi.Requires;
|
||||
|
@ -205,8 +205,8 @@ final class TeaVMPluginReader {
|
|||
static class PluginDescriptorFiller extends ClassVisitor {
|
||||
PluginDescriptor descriptor;
|
||||
|
||||
public PluginDescriptorFiller(PluginDescriptor descriptor) {
|
||||
super(Opcodes.ASM7);
|
||||
PluginDescriptorFiller(PluginDescriptor descriptor) {
|
||||
super(AsmUtil.API_VERSION);
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
|
@ -223,12 +223,12 @@ final class TeaVMPluginReader {
|
|||
}
|
||||
|
||||
private AnnotationVisitor readClassArray(Consumer<String[]> resultConsumer) {
|
||||
return new AnnotationVisitor(Opcodes.ASM7) {
|
||||
return new AnnotationVisitor(AsmUtil.API_VERSION) {
|
||||
@Override
|
||||
public AnnotationVisitor visitArray(String name) {
|
||||
List<String> values = new ArrayList<>();
|
||||
if (name.equals("value")) {
|
||||
return new AnnotationVisitor(Opcodes.ASM7) {
|
||||
return new AnnotationVisitor(AsmUtil.API_VERSION) {
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
values.add(((Type) value).getClassName());
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.teavm.metaprogramming.CompileTime;
|
||||
import org.teavm.parsing.AsmUtil;
|
||||
|
||||
public class MetaprogrammingClassLoader extends ClassLoader {
|
||||
private MetaprogrammingInstrumentation instrumentation = new MetaprogrammingInstrumentation();
|
||||
|
@ -129,7 +129,7 @@ public class MetaprogrammingClassLoader extends ClassLoader {
|
|||
boolean compileTime;
|
||||
|
||||
CompileTimeClassVisitor() {
|
||||
super(Opcodes.ASM7, null);
|
||||
super(AsmUtil.API_VERSION, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.teavm.metaprogramming.Action;
|
|||
import org.teavm.metaprogramming.Computation;
|
||||
import org.teavm.metaprogramming.Metaprogramming;
|
||||
import org.teavm.model.MethodReference;
|
||||
import org.teavm.parsing.AsmUtil;
|
||||
|
||||
public class MetaprogrammingInstrumentation {
|
||||
private static String lambdaMetafactory = LambdaMetafactory.class.getName().replace('.', '/');
|
||||
|
@ -44,9 +45,9 @@ public class MetaprogrammingInstrumentation {
|
|||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
class ClassTransformer extends ClassVisitor {
|
||||
static class ClassTransformer extends ClassVisitor {
|
||||
ClassTransformer(ClassVisitor cv) {
|
||||
super(Opcodes.ASM7, cv);
|
||||
super(AsmUtil.API_VERSION, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,11 +57,11 @@ public class MetaprogrammingInstrumentation {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodTransformer extends MethodVisitor {
|
||||
static class MethodTransformer extends MethodVisitor {
|
||||
private boolean instrumented;
|
||||
|
||||
MethodTransformer(MethodVisitor mv) {
|
||||
super(Opcodes.ASM7, mv);
|
||||
super(AsmUtil.API_VERSION, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user