本文整理汇总了Java中org.objectweb.asm.Label类的典型用法代码示例。如果您正苦于以下问题:Java Label类的具体用法?Java Label怎么用?Java Label使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Label类属于org.objectweb.asm包,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitEnd
import org.objectweb.asm.Label; //导入依赖的package包/类
public void visitEnd() {
if (!methodDone && methodStartLabel != null && constructor) {
methodDone = true;
Label methodEndLabel = super.mark();
super.catchException(methodStartLabel, methodEndLabel, Type
.getType(RuntimeException.class));
super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
super.visitInsn(Opcodes.ATHROW);
if (exceptions != null) {
for (String ex : exceptions) {
super.catchException(methodStartLabel, methodEndLabel,
Type.getObjectType(ex));
super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
super.visitInsn(Opcodes.ATHROW);
}
}
}
super.visitEnd();
}
示例2: checkFrameValue
import org.objectweb.asm.Label; //导入依赖的package包/类
/**
* Checks a stack frame value.
*
* @param value
* the value to be checked.
*/
void checkFrameValue(final Object value) {
if (value == Opcodes.TOP || value == Opcodes.INTEGER
|| value == Opcodes.FLOAT || value == Opcodes.LONG
|| value == Opcodes.DOUBLE || value == Opcodes.NULL
|| value == Opcodes.UNINITIALIZED_THIS) {
return;
}
if (value instanceof String) {
checkInternalName((String) value, "Invalid stack frame value");
return;
}
if (!(value instanceof Label)) {
throw new IllegalArgumentException("Invalid stack frame value: "
+ value);
} else {
usedLabels.add((Label) value);
}
}
示例3: visitx
import org.objectweb.asm.Label; //导入依赖的package包/类
private void visitx(GeneratorAdapter mv, List<String> strings) {
if (strings.size() == 1) {
visitCase(strings.get(0));
return;
}
for (String string : strings) {
Label label = new Label();
visitString();
mv.visitLdcInsn(string);
mv.invokeVirtual(STRING_TYPE, Method.getMethod("boolean equals(Object)"));
mv.visitJumpInsn(Opcodes.IFEQ, label);
visitCase(string);
mv.visitLabel(label);
}
visitDefault();
}
示例4: visitLookupSwitchInsn
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
checkEndCode();
checkStartCode();
checkLabel(dflt, false, "default label");
checkNonDebugLabel(dflt);
if (keys == null || labels == null || keys.length != labels.length) {
throw new IllegalArgumentException(
"There must be the same number of keys and labels");
}
for (int i = 0; i < labels.length; ++i) {
checkLabel(labels[i], false, "label at index " + i);
checkNonDebugLabel(labels[i]);
}
super.visitLookupSwitchInsn(dflt, keys, labels);
usedLabels.add(dflt);
for (int i = 0; i < labels.length; ++i) {
usedLabels.add(labels[i]);
}
++insnCount;
}
示例5: visitTableSwitchInsn
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public void visitTableSwitchInsn(final int min, final int max,
final Label dflt, final Label... labels) {
checkStartCode();
checkEndCode();
if (max < min) {
throw new IllegalArgumentException("Max = " + max
+ " must be greater than or equal to min = " + min);
}
checkLabel(dflt, false, "default label");
checkNonDebugLabel(dflt);
if (labels == null || labels.length != max - min + 1) {
throw new IllegalArgumentException(
"There must be max - min + 1 labels");
}
for (int i = 0; i < labels.length; ++i) {
checkLabel(labels[i], false, "label at index " + i);
checkNonDebugLabel(labels[i]);
}
super.visitTableSwitchInsn(min, max, dflt, labels);
for (int i = 0; i < labels.length; ++i) {
usedLabels.add(labels[i]);
}
++insnCount;
}
示例6: generateUpdateMethod
import org.objectweb.asm.Label; //导入依赖的package包/类
private static void generateUpdateMethod(ClassWriter cw, String selfClassInternalName, String selfClassDescriptor,
String argsClassInternalName,
String constDesc, Parameter[] parameters) {
MethodVisitor mv;
mv = cw.visitMethod(ACC_PUBLIC, "update", "()Lio/primeval/reflex/arguments/Arguments;", null, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitTypeInsn(NEW, argsClassInternalName);
mv.visitInsn(DUP);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, selfClassInternalName, "parameters", "Ljava/util/List;");
for (int i = 0; i < parameters.length; i++) {
Parameter parameter = parameters[i];
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, selfClassInternalName, parameter.getName(), Type.getDescriptor(parameter.getType()));
}
mv.visitMethodInsn(INVOKESPECIAL, argsClassInternalName, "<init>", constDesc, false);
mv.visitInsn(ARETURN);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLocalVariable("this", selfClassDescriptor, null, l0, l1, 0);
mv.visitMaxs(-1, -1);
mv.visitEnd();
}
示例7: smaller
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public Container smaller(Container lval, Container rvalue, OpInfo opinfo) throws CompileException {
Label not_smaller_label = new Label();
Label end_label = new Label();
opinfo.mv.visitInsn(Opcodes.DCMPG);
opinfo.mv.visitJumpInsn(Opcodes.IFGE, not_smaller_label);
opinfo.mv.visitInsn(Opcodes.ICONST_1);
opinfo.mv.visitJumpInsn(Opcodes.GOTO, end_label);
opinfo.mv.visitLabel(not_smaller_label);
opinfo.mv.visitInsn(Opcodes.ICONST_0);
opinfo.mv.visitLabel(end_label);
Container anony_bool = new Container("anonymous", Container.FORM_OPSTACK_VAR, true, false);
anony_bool.initializeType((AbsType) cpLoader.findClassFull(TPrimitiveClass.NAME_BOOL));
anony_bool.setAssigned(true);
return anony_bool;
}
示例8: bigger
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public Container bigger(Container lval, Container rvalue, OpInfo opinfo) throws CompileException {
Label not_bigger_label = new Label();
Label end_label = new Label();
opinfo.mv.visitInsn(Opcodes.DCMPL);
opinfo.mv.visitJumpInsn(Opcodes.IFLE, not_bigger_label);
opinfo.mv.visitInsn(Opcodes.ICONST_1);
opinfo.mv.visitJumpInsn(Opcodes.GOTO, end_label);
opinfo.mv.visitLabel(not_bigger_label);
opinfo.mv.visitInsn(Opcodes.ICONST_0);
opinfo.mv.visitLabel(end_label);
Container anony_bool = new Container("anonymous", Container.FORM_OPSTACK_VAR, true, false);
anony_bool.initializeType((AbsType) cpLoader.findClassFull(TPrimitiveClass.NAME_BOOL));
anony_bool.setAssigned(true);
return anony_bool;
}
示例9: not_equal
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public Container not_equal(Container lval, Container rvalue, OpInfo opinfo) throws CompileException {
Label not_eq_label = new Label();
Label end_label = new Label();
opinfo.mv.visitInsn(Opcodes.DCMPL);
opinfo.mv.visitJumpInsn(Opcodes.IFNE, not_eq_label);
opinfo.mv.visitInsn(Opcodes.ICONST_0);
opinfo.mv.visitJumpInsn(Opcodes.GOTO, end_label);
opinfo.mv.visitLabel(not_eq_label);
opinfo.mv.visitInsn(Opcodes.ICONST_1);
opinfo.mv.visitLabel(end_label);
Container anony_bool = new Container("anonymous", Container.FORM_OPSTACK_VAR, true, false);
anony_bool.initializeType((AbsType) cpLoader.findClassFull(TPrimitiveClass.NAME_BOOL));
anony_bool.setAssigned(true);
return anony_bool;
}
示例10: visitAccessGetterLastPart
import org.objectweb.asm.Label; //导入依赖的package包/类
private void visitAccessGetterLastPart(String memberType, Label firstLabel) {
mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
mv.visitInsn(DUP);
mv.visitTypeInsn(NEW, "java/lang/StringBuilder");
mv.visitInsn(DUP);
mv.visitLdcInsn("No " + memberType + " with index: ");
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V", false);
mv.visitVarInsn(ILOAD, 2);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;", false);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V", false);
mv.visitInsn(ATHROW);
Label lastLabel = new Label();
mv.visitLabel(lastLabel);
mv.visitLocalVariable("this", classAccessTypeDescriptor, null, firstLabel, lastLabel, 0);
mv.visitLocalVariable("obj", classTypeDescriptor, null, firstLabel, lastLabel, 1);
mv.visitLocalVariable(memberType + "Index", "I", null, firstLabel, lastLabel, 2);
mv.visitMaxs(5, 3);
mv.visitEnd();
}
示例11: equal
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public Container equal(Container lval, Container rvalue, OpInfo opinfo) throws CompileException {
Label not_eq_label = new Label();
Label end_label = new Label();
opinfo.mv.visitInsn(Opcodes.LCMP);
opinfo.mv.visitJumpInsn(Opcodes.IFNE, not_eq_label);
opinfo.mv.visitInsn(Opcodes.ICONST_1);
opinfo.mv.visitJumpInsn(Opcodes.GOTO, end_label);
opinfo.mv.visitLabel(not_eq_label);
opinfo.mv.visitInsn(Opcodes.ICONST_0);
opinfo.mv.visitLabel(end_label);
Container anony_bool = new Container("anonymous", Container.FORM_OPSTACK_VAR, true, false);
anony_bool.initializeType((AbsType) cpLoader.findClassFull(TPrimitiveClass.NAME_BOOL));
anony_bool.setAssigned(true);
return anony_bool;
}
示例12: smaller
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public Container smaller(Container lval, Container rvalue, OpInfo opinfo) throws CompileException {
Label greater_equal_label = new Label();
Label end_label = new Label();
opinfo.mv.visitJumpInsn(Opcodes.IF_ICMPGE, greater_equal_label);
opinfo.mv.visitInsn(Opcodes.ICONST_1);
opinfo.mv.visitJumpInsn(Opcodes.GOTO, end_label);
opinfo.mv.visitLabel(greater_equal_label);
opinfo.mv.visitInsn(Opcodes.ICONST_0);
opinfo.mv.visitLabel(end_label);
Container anony_bool = new Container("anonymous", Container.FORM_OPSTACK_VAR, true, false);
anony_bool.initializeType((AbsType) cpLoader.findClassFull(TPrimitiveClass.NAME_BOOL));
anony_bool.setAssigned(true);
return anony_bool;
}
示例13: visitTableSwitchInsn
import org.objectweb.asm.Label; //导入依赖的package包/类
@Override
public final void visitTableSwitchInsn(final int min, final int max,
final Label dflt, final Label... labels) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "min", "min", "", Integer.toString(min));
attrs.addAttribute("", "max", "max", "", Integer.toString(max));
attrs.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
String o = Printer.OPCODES[Opcodes.TABLESWITCH];
sa.addStart(o, attrs);
for (int i = 0; i < labels.length; i++) {
AttributesImpl att2 = new AttributesImpl();
att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
sa.addElement("label", att2);
}
sa.addEnd(o);
}
示例14: writeNonAbstractMethodWrapper
import org.objectweb.asm.Label; //导入依赖的package包/类
private void writeNonAbstractMethodWrapper(ClassVisitor visitor, Type generatedType, Class<?> managedTypeClass, Method method) {
Label start = new Label();
Label end = new Label();
Label handler = new Label();
MethodVisitor methodVisitor = declareMethod(visitor, method);
methodVisitor.visitTryCatchBlock(start, end, handler, null);
setCanCallSettersField(methodVisitor, generatedType, false);
methodVisitor.visitLabel(start);
invokeSuperMethod(methodVisitor, managedTypeClass, method);
methodVisitor.visitLabel(end);
setCanCallSettersField(methodVisitor, generatedType, true);
methodVisitor.visitInsn(ARETURN);
methodVisitor.visitLabel(handler);
setCanCallSettersField(methodVisitor, generatedType, true);
methodVisitor.visitInsn(ATHROW);
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
}
示例15: appendFrameTypes
import org.objectweb.asm.Label; //导入依赖的package包/类
private void appendFrameTypes(final int n, final Object[] o) {
for (int i = 0; i < n; ++i) {
if (i > 0) {
buf.append(", ");
}
if (o[i] instanceof String) {
appendConstant(o[i]);
} else if (o[i] instanceof Integer) {
switch (((Integer) o[i]).intValue()) {
case 0:
buf.append("Opcodes.TOP");
break;
case 1:
buf.append("Opcodes.INTEGER");
break;
case 2:
buf.append("Opcodes.FLOAT");
break;
case 3:
buf.append("Opcodes.DOUBLE");
break;
case 4:
buf.append("Opcodes.LONG");
break;
case 5:
buf.append("Opcodes.NULL");
break;
case 6:
buf.append("Opcodes.UNINITIALIZED_THIS");
break;
}
} else {
appendLabel((Label) o[i]);
}
}
}