use of jdk.internal.org.objectweb.asm.Type in project Bytecoder by mirkosertic.
the class LocalVariablesSorter method visitLocalVariableAnnotation.
@Override
public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) {
Type t = Type.getType(desc);
int[] newIndex = new int[index.length];
for (int i = 0; i < newIndex.length; ++i) {
newIndex[i] = remap(index[i], t);
}
return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, newIndex, desc, visible);
}
use of jdk.internal.org.objectweb.asm.Type in project Bytecoder by mirkosertic.
the class SimpleVerifier method merge.
@Override
public BasicValue merge(final BasicValue v, final BasicValue w) {
if (!v.equals(w)) {
Type t = v.getType();
Type u = w.getType();
if (t != null && (t.getSort() == Type.OBJECT || t.getSort() == Type.ARRAY)) {
if (u != null && (u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY)) {
if ("Lnull;".equals(t.getDescriptor())) {
return w;
}
if ("Lnull;".equals(u.getDescriptor())) {
return v;
}
if (isAssignableFrom(t, u)) {
return v;
}
if (isAssignableFrom(u, t)) {
return w;
}
// interfaces
do {
if (t == null || isInterface(t)) {
return BasicValue.REFERENCE_VALUE;
}
t = getSuperClass(t);
if (isAssignableFrom(t, u)) {
return newValue(t);
}
} while (true);
}
}
return BasicValue.UNINITIALIZED_VALUE;
}
return v;
}
use of jdk.internal.org.objectweb.asm.Type in project Bytecoder by mirkosertic.
the class GeneratorAdapter method valueOf.
/**
* Generates the instructions to box the top stack value using Java 5's
* valueOf() method. This value is replaced by its boxed equivalent on top
* of the stack.
*
* @param type
* the type of the top stack value.
*/
public void valueOf(final Type type) {
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
return;
}
if (type == Type.VOID_TYPE) {
push((String) null);
} else {
Type boxed = getBoxedType(type);
invokeStatic(boxed, new Method("valueOf", boxed, new Type[] { type }));
}
}
use of jdk.internal.org.objectweb.asm.Type in project Bytecoder by mirkosertic.
the class GeneratorAdapter method loadArgs.
/**
* Generates the instructions to load the given method arguments on the
* stack.
*
* @param arg
* the index of the first method argument to be loaded.
* @param count
* the number of method arguments to be loaded.
*/
public void loadArgs(final int arg, final int count) {
int index = getArgIndex(arg);
for (int i = 0; i < count; ++i) {
Type t = argumentTypes[arg + i];
loadInsn(t, index);
index += t.getSize();
}
}
use of jdk.internal.org.objectweb.asm.Type in project jdk8u_jdk by JetBrains.
the class AdviceAdapter method visitInvokeDynamicInsn.
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
if (constructor) {
Type[] types = Type.getArgumentTypes(desc);
for (int i = 0; i < types.length; i++) {
popValue();
if (types[i].getSize() == 2) {
popValue();
}
}
Type returnType = Type.getReturnType(desc);
if (returnType != Type.VOID_TYPE) {
pushValue(OTHER);
if (returnType.getSize() == 2) {
pushValue(OTHER);
}
}
}
}
Aggregations