当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.PUTFIELD属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.PUTFIELD属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.PUTFIELD属性的具体用法?Java Opcodes.PUTFIELD怎么用?Java Opcodes.PUTFIELD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.PUTFIELD属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitFieldInsn

@Override
public void visitFieldInsn(final int opcode, final String owner,
        final String name, final String desc) {
    switch (opcode) {
    case Opcodes.GETSTATIC:
        getstatic(owner, name, desc);
        break;
    case Opcodes.PUTSTATIC:
        putstatic(owner, name, desc);
        break;
    case Opcodes.GETFIELD:
        getfield(owner, name, desc);
        break;
    case Opcodes.PUTFIELD:
        putfield(owner, name, desc);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:20,代码来源:InstructionAdapter.java

示例2: visitFieldInsn

@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
  DexField field = application.getField(owner, name, desc);
  switch (opcode) {
    case Opcodes.GETFIELD:
      registry.registerInstanceFieldRead(field);
      break;
    case Opcodes.PUTFIELD:
      registry.registerInstanceFieldWrite(field);
      break;
    case Opcodes.GETSTATIC:
      registry.registerStaticFieldRead(field);
      break;
    case Opcodes.PUTSTATIC:
      registry.registerStaticFieldWrite(field);
      break;
    default:
      throw new Unreachable("Unexpected opcode " + opcode);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:20,代码来源:JarRegisterEffectsVisitor.java

示例3: updateState

private void updateState(FieldInsnNode insn) {
  Type type = Type.getType(insn.desc);
  switch (insn.getOpcode()) {
    case Opcodes.GETSTATIC:
      state.push(type);
      break;
    case Opcodes.PUTSTATIC:
      state.pop();
      break;
    case Opcodes.GETFIELD: {
      state.pop(JarState.OBJECT_TYPE);
      state.push(type);
      break;
    }
    case Opcodes.PUTFIELD: {
      state.pop();
      state.pop(JarState.OBJECT_TYPE);
      break;
    }
    default:
      throw new Unreachable("Unexpected FieldInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:23,代码来源:JarSourceCode.java

示例4: visitFieldInsn

/**
 * Imports field instructions (put and get), both for static and instance
 * fields.
 *
 * @param opcode Opcode.
 * @param owner  Class containing the field.
 * @param name   Name of field.
 * @param desc   Type descriptor of field.
 */
@Override
public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
  Field f = ClassNode.getClass(owner).getField(name, desc);

  if(((opcode == Opcodes.GETSTATIC) || (opcode == Opcodes.PUTSTATIC)) !=
          f.getModifiers().contains(Modifier.STATIC)) {
    throw new RuntimeException("Field staticness conflicts with instruction");
  }

  switch(opcode) {
    // Loads
    case Opcodes.GETSTATIC:
    case Opcodes.GETFIELD:  createFieldRead(f);  break;
    // Stores
    case Opcodes.PUTSTATIC:
    case Opcodes.PUTFIELD:  createFieldWrite(f); break;
  }
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:27,代码来源:MethodImporter.java

示例5: binaryOperation

@Override
public BasicValue binaryOperation(final AbstractInsnNode insn,
    final BasicValue value1, final BasicValue value2) throws AnalyzerException {
  /*
   * We're looking for the assignment of a local holder objectref to a member variable.
   * If we spot that, then the local holder can't be replaced, since we don't (yet)
   * have the mechanics to replace the member variable with the holder's members or
   * to assign all of them when this happens.
   */
  if (insn.getOpcode() == Opcodes.PUTFIELD) {
    if (value2.isReference() && (value1 instanceof ReplacingBasicValue)) {
      final ReplacingBasicValue possibleThis = (ReplacingBasicValue) value1;
      if (possibleThis.isThis() && (value2 instanceof ReplacingBasicValue)) {
        // if this is a reference for a holder class, we can't replace it
        if (HOLDERS.get(value2.getType().getDescriptor()) != null) {
          final ReplacingBasicValue localRef = (ReplacingBasicValue) value2;
          localRef.setAssignedToMember();
        }
      }
    }
  }

  return super.binaryOperation(insn, value1, value2);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:ReplacingInterpreter.java

示例6: visitFieldInsn

/** {@inheritDoc} */
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
	if (opcode == Opcodes.PUTFIELD && className.equals(owner)) {
		if (lastInstructionIsInitConstant && possibleFields.contains(name)) {
			positiveFields.add(name);
		}
		possibleFields.remove(name);
		lastInstructionIsInitConstant = false;
	}
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:11,代码来源:UselessInitClassVisitor.java

示例7: patchNodes

private boolean patchNodes(MethodNode method) {
    InsnList list = method.instructions;
    boolean patched = false;
    boolean foundUrl = false;

    for(int i = 0; i < list.size(); i++) {
        AbstractInsnNode node = list.get(i);

        if(node instanceof LdcInsnNode) {
            LdcInsnNode ldc = (LdcInsnNode)node;

            if(ldc.cst instanceof String && isUrl((String)ldc.cst)) {
                foundUrl = true;
            }

        } else if(foundUrl && (node.getOpcode() == Opcodes.PUTFIELD || node.getOpcode() == Opcodes.ASTORE)) {

            list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC,
                    "guichaguri/skinfixer/SkinWorker", "getURL", "(Ljava/lang/String;)Ljava/lang/String;", false));
            foundUrl = false;
            patched = true;

        }

    }
    return patched;
}
 
开发者ID:Guichaguri,项目名称:SkinFixer,代码行数:27,代码来源:SkinTransformer.java

示例8: addInsn

public void addInsn(String name, InstructionModifier mv, int opcode) {
  switch (opcode) {
  case Opcodes.GETFIELD:
    addKnownInsn(name, mv, Opcodes.ILOAD);
    return;

  case Opcodes.PUTFIELD:
    addKnownInsn(name, mv, Opcodes.ISTORE);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:ValueHolderIden.java

示例9: visitFieldInsn

public void visitFieldInsn(int opcode, String owner, String fieldName,
		String desc) {
	if (firstInstruction)
		addInc();
	if (logPointerChange && opcode == Opcodes.PUTFIELD
			&& desc.charAt(0) == 'L') {
		if (constructor && !doneSuperConstructor && name.equals(owner)
				&& finalFields.contains(fieldName))
			delayedFieldPointer.put(fieldName, desc);
		else {
			// instrument reference changes from
			// putfield ...,obj,v' => ...
			// to
			// dup2 ...,obj,v' => ...,obj,v',obj,v'
			// swap ...,obj,v',obj,v' => ...,obj,v',v',obj
			// dup ...,obj,v',v',obj => ...,obj,v',v',obj,obj
			// getfield ...,obj,v',v',obj,obj => ...,obj,v',v',obj,v
			// invokespecial
			// pointerchangelog(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
			// ...,obj,v',v',obj,v => ...,obj,v'
			// putfield ...,obj,v' =>
			super.visitInsn(Opcodes.DUP2);
			super.visitInsn(Opcodes.SWAP);
			super.visitInsn(Opcodes.DUP);
			super.visitFieldInsn(Opcodes.GETFIELD, owner, fieldName,
					desc);
			super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
					LOG_INTERNAL_POINTER_CHANGE,
					POINTER_CHANGE_SIGNATURE);
		}
	} else if (logPointerChange && opcode == Opcodes.PUTSTATIC
			&& desc.charAt(0) == 'L') {
		// if (finalFields.contains(fieldName)) {
		// // assume field is initially null
		// super.visitInsn(Opcodes.DUP);
		// } else {
		// instrument reference changes from
		// putstatic ...,v' => ...
		// to
		// dup ...,v' => ...,v',v'
		// ldc owner.class ...,v',v' => ...,v',v',k
		// getstatic ...,v',v',k => ...,v',v',k,v
		// invokespecial
		// staticpointerchangelog(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Object;)V
		// ...,v',v',k,v => ...,v'
		super.visitInsn(Opcodes.DUP);
		super.visitLdcInsn(Type.getObjectType(owner));
		super.visitFieldInsn(Opcodes.GETSTATIC, owner, fieldName, desc);
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_STATIC_POINTER_CHANGE,
				STATIC_POINTER_CHANGE_SIGNATURE);
		// }
	}
	super.visitFieldInsn(opcode, owner, fieldName, desc);
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:55,代码来源:AllocateInstrument.java

示例10: visitFieldInsn

public void visitFieldInsn(int opcode, String owner, String name,
    String desc) {
  if (opcode == Opcodes.PUTFIELD && LineNumberReader.this.name.equals(owner)
      && !lines.containsKey(name) && line != -1) {
    lines.put(name, line);
  }
}
 
开发者ID:maetrive,项目名称:businessworks,代码行数:7,代码来源:LineNumbers.java

示例11: canThrow

private boolean canThrow(AbstractInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.AALOAD:
    case Opcodes.AASTORE:
    case Opcodes.ANEWARRAY:
      // ARETURN does not throw in its dex image.
    case Opcodes.ARRAYLENGTH:
    case Opcodes.ATHROW:
    case Opcodes.BALOAD:
    case Opcodes.BASTORE:
    case Opcodes.CALOAD:
    case Opcodes.CASTORE:
    case Opcodes.CHECKCAST:
    case Opcodes.DALOAD:
    case Opcodes.DASTORE:
      // DRETURN does not throw in its dex image.
    case Opcodes.FALOAD:
    case Opcodes.FASTORE:
      // FRETURN does not throw in its dex image.
    case Opcodes.GETFIELD:
    case Opcodes.GETSTATIC:
    case Opcodes.IALOAD:
    case Opcodes.IASTORE:
    case Opcodes.IDIV:
    case Opcodes.INSTANCEOF:
    case Opcodes.INVOKEDYNAMIC:
    case Opcodes.INVOKEINTERFACE:
    case Opcodes.INVOKESPECIAL:
    case Opcodes.INVOKESTATIC:
    case Opcodes.INVOKEVIRTUAL:
    case Opcodes.IREM:
      // IRETURN does not throw in its dex image.
    case Opcodes.LALOAD:
    case Opcodes.LASTORE:
    case Opcodes.LDIV:
    case Opcodes.LREM:
      // LRETURN does not throw in its dex image.
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.MULTIANEWARRAY:
    case Opcodes.NEW:
    case Opcodes.NEWARRAY:
    case Opcodes.PUTFIELD:
    case Opcodes.PUTSTATIC:
      // RETURN does not throw in its dex image.
    case Opcodes.SALOAD:
    case Opcodes.SASTORE:
      return true;
    case Opcodes.LDC: {
      // const-class and const-string* may throw in dex.
      LdcInsnNode ldc = (LdcInsnNode) insn;
      return ldc.cst instanceof String || ldc.cst instanceof Type;
    }
    default:
      return false;
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:57,代码来源:JarSourceCode.java


注:本文中的org.objectweb.asm.Opcodes.PUTFIELD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。