Package org.objectweb.asm

Examples of org.objectweb.asm.MethodVisitor.visitFrame()


      final MethodVisitor mv = cv.visitMethod(
          InstrSupport.INITMETHOD_ACC, InstrSupport.INITMETHOD_NAME,
          InstrSupport.INITMETHOD_DESC, null, null);
      mv.visitCode();
      if (withFrames) {
        mv.visitFrame(Opcodes.F_NEW, 0, NO_LOCALS, 0, STACK_ARRZ);
      }

      // Load the value of the static data field:
      mv.visitFieldInsn(Opcodes.GETSTATIC, className,
          InstrSupport.DATAFIELD_NAME, InstrSupport.DATAFIELD_DESC);
View Full Code Here


      // Stack[0]: [Z

      // Return the class' probe array:
      if (withFrames) {
        mv.visitFrame(Opcodes.F_NEW, 0, NO_LOCALS, 1, STACK_ARRZ);
      }
      mv.visitLabel(alreadyInitialized);
      mv.visitInsn(Opcodes.ARETURN);

      mv.visitMaxs(Math.max(size, 2), 0); // Maximum local stack size is 2
View Full Code Here

            StringBuilder buffer = new StringBuilder(128);
            for (int i = 0; i < n; i++) {
              mv.visitLabel(labels[i]);
              if (i == 0)
                mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] {classNameInternal}, 0, null);
              else
                mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
              mv.visitVarInsn(ALOAD, 4);

              buffer.setLength(0);
View Full Code Here

            for (int i = 0; i < n; i++) {
              mv.visitLabel(labels[i]);
              if (i == 0)
                mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] {classNameInternal}, 0, null);
              else
                mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
              mv.visitVarInsn(ALOAD, 4);

              buffer.setLength(0);
              buffer.append('(');
View Full Code Here

      for (int i = 0, n = labels.length; i < n; i++) {
        Field field = fields.get(i);
        Type fieldType = Type.getType(field.getType());

        mv.visitLabel(labels[i]);
        mv.visitFrame(F_SAME, 0, null, 0, null);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitTypeInsn(CHECKCAST, classNameInternal);
        mv.visitVarInsn(ALOAD, 3);

        switch (fieldType.getSort()) {
View Full Code Here

        mv.visitFieldInsn(PUTFIELD, classNameInternal, field.getName(), fieldType.getDescriptor());
        mv.visitInsn(RETURN);
      }

      mv.visitLabel(defaultLabel);
      mv.visitFrame(F_SAME, 0, null, 0, null);
    }
    mv = insertThrowExceptionForFieldNotFound(mv);
    mv.visitMaxs(maxStack, 4);
    mv.visitEnd();
  }
View Full Code Here

      for (int i = 0, n = labels.length; i < n; i++) {
        Field field = fields.get(i);

        mv.visitLabel(labels[i]);
        mv.visitFrame(F_SAME, 0, null, 0, null);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitTypeInsn(CHECKCAST, classNameInternal);
        mv.visitFieldInsn(GETFIELD, classNameInternal, field.getName(), Type.getDescriptor(field.getType()));

        Type fieldType = Type.getType(field.getType());
View Full Code Here

        mv.visitInsn(ARETURN);
      }

      mv.visitLabel(defaultLabel);
      mv.visitFrame(F_SAME, 0, null, 0, null);
    }
    insertThrowExceptionForFieldNotFound(mv);
    mv.visitMaxs(maxStack, 3);
    mv.visitEnd();
  }
View Full Code Here

      mv.visitTableSwitchInsn(0, labels.length - 1, defaultLabel, labels);

      for (int i = 0, n = labels.length; i < n; i++) {
        if (!labels[i].equals(labelForInvalidTypes)) {
          mv.visitLabel(labels[i]);
          mv.visitFrame(F_SAME, 0, null, 0, null);
          mv.visitVarInsn(ALOAD, 1);
          mv.visitTypeInsn(CHECKCAST, classNameInternal);
          mv.visitFieldInsn(GETFIELD, classNameInternal, fields.get(i).getName(), "Ljava/lang/String;");
          mv.visitInsn(ARETURN);
        }
View Full Code Here

        }
      }
      // Rest of fields: different type
      if (hasAnyBadTypeLabel) {
        mv.visitLabel(labelForInvalidTypes);
        mv.visitFrame(F_SAME, 0, null, 0, null);
        insertThrowExceptionForFieldType(mv, "String");
      }
      // Default: field not found
      mv.visitLabel(defaultLabel);
      mv.visitFrame(F_SAME, 0, null, 0, null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.