當前位置: 首頁>>代碼示例>>Java>>正文


Java Label類代碼示例

本文整理匯總了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();
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:22,代碼來源:AllocateInstrument.java

示例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);
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:25,代碼來源:CheckMethodAdapter.java

示例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();
}
 
開發者ID:meili,項目名稱:Aceso,代碼行數:18,代碼來源:IntSwitch.java

示例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;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:23,代碼來源:CheckMethodAdapter.java

示例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;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:26,代碼來源:CheckMethodAdapter.java

示例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();
}
 
開發者ID:primeval-io,項目名稱:primeval-reflex,代碼行數:26,代碼來源:MethodArgumentssUpdaterGenerator.java

示例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;
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:22,代碼來源:OpDouble.java

示例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;
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:21,代碼來源:OpDouble.java

示例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;
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:21,代碼來源:OpDouble.java

示例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();
}
 
開發者ID:Javalbert,項目名稱:faster-than-reflection,代碼行數:21,代碼來源:ClassAccessFactory.java

示例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;
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:22,代碼來源:OpLong.java

示例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;
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:20,代碼來源:OpShort.java

示例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);
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:17,代碼來源:SAXCodeAdapter.java

示例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();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:26,代碼來源:ManagedProxyClassGenerator.java

示例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]);
        }
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:37,代碼來源:ASMifier.java


注:本文中的org.objectweb.asm.Label類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。