org.objectweb.asm.Opcodes# UNINITIALIZED_THIS 源码实例Demo

下面列出了org.objectweb.asm.Opcodes# UNINITIALIZED_THIS 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Concurnas   文件: CheckMethodAdapter.java

/**
 * Checks a stack frame value.
 *
 * @param value the value to be checked.
 */
private 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;
  } else if (value instanceof String) {
    checkInternalName(version, (String) value, "Invalid stack frame value");
  } else if (value instanceof Label) {
    referencedLabels.add((Label) value);
  } else {
    throw new IllegalArgumentException("Invalid stack frame value: " + value);
  }
}
 

/**
 * 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);
  }
}
 

/**
 * Checks a stack frame value.
 *
 * @param value the value to be checked.
 */
private 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;
  } else if (value instanceof String) {
    checkInternalName(version, (String) value, "Invalid stack frame value");
  } else if (value instanceof Label) {
    referencedLabels.add((Label) value);
  } else {
    throw new IllegalArgumentException("Invalid stack frame value: " + value);
  }
}
 

/**
 * Checks a stack frame value.
 *
 * @param value the value to be checked.
 */
private 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;
  } else if (value instanceof String) {
    checkInternalName(version, (String) value, "Invalid stack frame value");
  } else if (value instanceof Label) {
    referencedLabels.add((Label) value);
  } else {
    throw new IllegalArgumentException("Invalid stack frame value: " + value);
  }
}
 
源代码5 项目: copper-engine   文件: StackInfo.java

static Type deferLocalDesc(Object object) {
    if (object instanceof String)
        return Type.getObjectType((String) object);
    // TODO: analyze opcode at pos label
    if (object instanceof Label)
        return Type.getType(Object.class);
    int intObject = (Integer) object;
    if (intObject == Opcodes.TOP)
        return null;
    if (intObject == Opcodes.INTEGER)
        return Type.INT_TYPE;
    if (intObject == Opcodes.FLOAT)
        return Type.FLOAT_TYPE;
    if (intObject == Opcodes.LONG)
        return Type.LONG_TYPE;
    if (intObject == Opcodes.DOUBLE)
        return Type.getType(double.class);
    if (intObject == Opcodes.LONG)
        return Type.getType(long.class);
    if (intObject == Opcodes.NULL)
        return Type.getType(Object.class);
    // TODO: defer from containing class
    if (intObject == Opcodes.UNINITIALIZED_THIS)
        return Type.getType(Object.class);
    throw new BuildStackFrameException("Couldnt defer desc for " + object);
}
 
源代码6 项目: JByteMod-Beta   文件: AnalyzerAdapter.java

private void doVisitMethodInsn(
    final int opcode,
    final String owner,
    final String name,
    final String descriptor,
    final boolean isInterface) {
  if (mv != null) {
    mv.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
  }
  if (this.locals == null) {
    labels = null;
    return;
  }
  pop(descriptor);
  if (opcode != Opcodes.INVOKESTATIC) {
    Object value = pop();
    if (opcode == Opcodes.INVOKESPECIAL && name.equals("<init>")) {
      Object initializedValue;
      if (value == Opcodes.UNINITIALIZED_THIS) {
        initializedValue = this.owner;
      } else {
        initializedValue = uninitializedTypes.get(value);
      }
      for (int i = 0; i < locals.size(); ++i) {
        if (locals.get(i) == value) {
          locals.set(i, initializedValue);
        }
      }
      for (int i = 0; i < stack.size(); ++i) {
        if (stack.get(i) == value) {
          stack.set(i, initializedValue);
        }
      }
    }
  }
  pushDescriptor(descriptor);
  labels = null;
}
 
源代码7 项目: TickDynamic   文件: ASMClassParser.java

protected Object parseFrameType(Map<String, Label> labels, String typeStr) throws Exception {
	if(typeStr.length() == 1) //Base type
	{
		if(typeStr.equals("T"))
			return Opcodes.TOP;
		else if(typeStr.equals("I"))
			return Opcodes.INTEGER;
		else if(typeStr.equals("F"))
			return Opcodes.FLOAT;
		else if(typeStr.equals("D"))
			return Opcodes.DOUBLE;
		else if(typeStr.equals("J"))
			return Opcodes.LONG;
		else if(typeStr.equals("N"))
			return Opcodes.NULL;
		else if(typeStr.equals("U"))
			return Opcodes.UNINITIALIZED_THIS;
		else
			throw new Exception(getCurrentTokenLine() + ": Error while parsing frame type, found no type for " + typeStr);
	}
	
	//Label
	if(typeStr.startsWith("L") && StringUtils.isNumeric(typeStr.substring(1)))
		return getLabel(labels, typeStr);
	
	//Class name
	return typeStr;
}
 
源代码8 项目: JReFrameworker   文件: AnalyzerAdapter.java

private void doVisitMethodInsn(
    final int opcode,
    final String owner,
    final String name,
    final String descriptor,
    final boolean isInterface) {
  if (mv != null) {
    mv.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
  }
  if (this.locals == null) {
    labels = null;
    return;
  }
  pop(descriptor);
  if (opcode != Opcodes.INVOKESTATIC) {
    Object value = pop();
    if (opcode == Opcodes.INVOKESPECIAL && name.equals("<init>")) {
      Object initializedValue;
      if (value == Opcodes.UNINITIALIZED_THIS) {
        initializedValue = this.owner;
      } else {
        initializedValue = uninitializedTypes.get(value);
      }
      for (int i = 0; i < locals.size(); ++i) {
        if (locals.get(i) == value) {
          locals.set(i, initializedValue);
        }
      }
      for (int i = 0; i < stack.size(); ++i) {
        if (stack.get(i) == value) {
          stack.set(i, initializedValue);
        }
      }
    }
  }
  pushDescriptor(descriptor);
  labels = null;
}
 
源代码9 项目: JReFrameworker   文件: AnalyzerAdapter.java

private void doVisitMethodInsn(
    final int opcode,
    final String owner,
    final String name,
    final String descriptor,
    final boolean isInterface) {
  if (mv != null) {
    mv.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
  }
  if (this.locals == null) {
    labels = null;
    return;
  }
  pop(descriptor);
  if (opcode != Opcodes.INVOKESTATIC) {
    Object value = pop();
    if (opcode == Opcodes.INVOKESPECIAL && name.equals("<init>")) {
      Object initializedValue;
      if (value == Opcodes.UNINITIALIZED_THIS) {
        initializedValue = this.owner;
      } else {
        initializedValue = uninitializedTypes.get(value);
      }
      for (int i = 0; i < locals.size(); ++i) {
        if (locals.get(i) == value) {
          locals.set(i, initializedValue);
        }
      }
      for (int i = 0; i < stack.size(); ++i) {
        if (stack.get(i) == value) {
          stack.set(i, initializedValue);
        }
      }
    }
  }
  pushDescriptor(descriptor);
  labels = null;
}
 
源代码10 项目: bazel   文件: BytecodeTypeInference.java

/** Convert the type in stack map frame to inference type. */
private InferredType convertTypeInStackMapFrame(Object typeInStackMapFrame) {
  if (typeInStackMapFrame == Opcodes.TOP) {
    return InferredType.TOP;
  } else if (typeInStackMapFrame == Opcodes.INTEGER) {
    return InferredType.INT;
  } else if (typeInStackMapFrame == Opcodes.FLOAT) {
    return InferredType.FLOAT;
  } else if (typeInStackMapFrame == Opcodes.DOUBLE) {
    return InferredType.DOUBLE;
  } else if (typeInStackMapFrame == Opcodes.LONG) {
    return InferredType.LONG;
  } else if (typeInStackMapFrame == Opcodes.NULL) {
    return InferredType.NULL;
  } else if (typeInStackMapFrame == Opcodes.UNINITIALIZED_THIS) {
    return InferredType.UNINITIALIZED_THIS;
  } else if (typeInStackMapFrame instanceof String) {
    String referenceTypeName = (String) typeInStackMapFrame;
    if (referenceTypeName.charAt(0) == '[') {
      return InferredType.create(referenceTypeName);
    } else {
      return InferredType.create('L' + referenceTypeName + ';');
    }
  } else if (typeInStackMapFrame instanceof Label) {
    return InferredType.UNINITIALIZED;
  } else {
    throw new RuntimeException(
        "Cannot reach here. Unhandled element: value="
            + typeInStackMapFrame
            + ", class="
            + typeInStackMapFrame.getClass()
            + ". The current method being desugared is "
            + methodSignature);
  }
}
 
源代码11 项目: Concurnas   文件: AnalyzerAdapter.java

@Override
public void visitMethodInsn(
    final int opcodeAndSource,
    final String owner,
    final String name,
    final String descriptor,
    final boolean isInterface) {
  if (api < Opcodes.ASM5 && (opcodeAndSource & Opcodes.SOURCE_DEPRECATED) == 0) {
    // Redirect the call to the deprecated version of this method.
    super.visitMethodInsn(opcodeAndSource, owner, name, descriptor, isInterface);
    return;
  }
  super.visitMethodInsn(opcodeAndSource, owner, name, descriptor, isInterface);
  int opcode = opcodeAndSource & ~Opcodes.SOURCE_MASK;

  if (this.locals == null) {
    labels = null;
    return;
  }
  pop(descriptor);
  if (opcode != Opcodes.INVOKESTATIC) {
    Object value = pop();
    if (opcode == Opcodes.INVOKESPECIAL && name.equals("<init>")) {
      Object initializedValue;
      if (value == Opcodes.UNINITIALIZED_THIS) {
        initializedValue = this.owner;
      } else {
        initializedValue = uninitializedTypes.get(value);
      }
      for (int i = 0; i < locals.size(); ++i) {
        if (locals.get(i) == value) {
          locals.set(i, initializedValue);
        }
      }
      for (int i = 0; i < stack.size(); ++i) {
        if (stack.get(i) == value) {
          stack.set(i, initializedValue);
        }
      }
    }
  }
  pushDescriptor(descriptor);
  labels = null;
}
 
源代码12 项目: glowroot   文件: WeavingMethodVisitor.java

WeavingMethodVisitor(MethodVisitor mv, boolean frames, int access, String name,
        String descriptor, Type owner, List<Advice> advisors,
        @Nullable String metaHolderInternalName, @Nullable Integer methodMetaGroupUniqueNum,
        boolean bootstrapClassLoader) {
    super(ASM7, new FrameDeduppingMethodVisitor(mv), access, name, descriptor);
    this.frames = frames;
    this.access = access;
    this.name = name;
    this.owner = owner;
    this.advisors = ImmutableList.copyOf(advisors);
    argumentTypes = Type.getArgumentTypes(descriptor);
    returnType = Type.getReturnType(descriptor);
    this.metaHolderInternalName = metaHolderInternalName;
    this.methodMetaGroupUniqueNum = methodMetaGroupUniqueNum;
    this.bootstrapClassLoader = bootstrapClassLoader;
    boolean needsOnReturn = false;
    boolean needsOnThrow = false;
    for (Advice advice : advisors) {
        if (!advice.pointcut().nestingGroup().isEmpty()
                || !advice.pointcut().suppressionKey().isEmpty()
                || advice.onAfterAdvice() != null) {
            needsOnReturn = true;
            needsOnThrow = true;
            break;
        }
        if (advice.onReturnAdvice() != null) {
            needsOnReturn = true;
        }
        if (advice.onThrowAdvice() != null) {
            needsOnThrow = true;
        }
    }
    this.needsOnReturn = needsOnReturn;
    this.needsOnThrow = needsOnThrow;

    int nImplicitFrameLocals = argumentTypes.length;
    boolean needsReceiver = !Modifier.isStatic(access);
    if (needsReceiver) {
        nImplicitFrameLocals++;
    }
    Object[] implicitFrameLocals = new Object[nImplicitFrameLocals];
    int i = 0;
    if (needsReceiver) {
        if (name.equals("<init>")) {
            // need explicit import due to same static variable name in super class
            implicitFrameLocals[i++] = Opcodes.UNINITIALIZED_THIS;
        } else {
            implicitFrameLocals[i++] = owner.getInternalName();
        }
    }
    for (Type argumentType : argumentTypes) {
        implicitFrameLocals[i++] = convert(argumentType);
    }
    this.implicitFrameLocals = implicitFrameLocals;
}
 
 方法所在类
 同类方法