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


Java Opcodes.GETFIELD属性代码示例

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


在下文中一共展示了Opcodes.GETFIELD属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CanvasHook

public CanvasHook() {
	super(new Regex(
			new Instruction(Opcodes.GOTO, false),
			new Instruction(Opcodes.GETSTATIC, true),
			new Instruction(Opcodes.CHECKCAST, false),
			new Instruction(Opcodes.ALOAD, false),
			new Instruction(Opcodes.GETFIELD, false),
			new Instruction(Opcodes.LDC, false),
			new Instruction(Opcodes.INVOKEVIRTUAL, true),
			new Instruction(Opcodes.GOTO, false)
		));
}
 
开发者ID:jonathanedgecombe,项目名称:mithril,代码行数:12,代码来源:CanvasHook.java

示例6: 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

示例7: unaryOperation

@Override
public BasicValue unaryOperation(final AbstractInsnNode insn, final BasicValue value)
    throws AnalyzerException {
  /*
   * We're looking for the assignment of an operator member variable that's a holder to a local
   * objectref. If we spot that, we can't replace the local objectref (at least not
   * until we do the work to replace member variable holders).
   *
   * Note that a GETFIELD does not call newValue(), as would happen for a local variable, so we're
   * emulating that here.
   */
  if ((insn.getOpcode() == Opcodes.GETFIELD) && (value instanceof ReplacingBasicValue)) {
    final ReplacingBasicValue possibleThis = (ReplacingBasicValue) value;
    if (possibleThis.isThis()) {
      final FieldInsnNode fieldInsn = (FieldInsnNode) insn;
      if (HOLDERS.get(fieldInsn.desc) != null) {
        final BasicValue fetchedField = super.unaryOperation(insn, value);
        final ReplacingBasicValue replacingValue =
            ReplacingBasicValue.create(fetchedField.getType(), null, -1, valueList);
        replacingValue.setAssignedToMember();
        return replacingValue;
      }
    }
  }

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

示例8: 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

示例9: 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

示例10: isFieldRead

private boolean isFieldRead(int opcode) {
	return opcode == Opcodes.GETFIELD || opcode == Opcodes.GETSTATIC;
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:3,代码来源:Result.java


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