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


Java Opcodes.ASTORE属性代码示例

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


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

示例1: visitVarInsn

/**
 * Imports variable load and store operations, as well as RET?!?
 *
 * @param opcode Opcode.
 * @param var    Variable index.
 */
@Override
public void visitVarInsn(final int opcode, final int var) {
  switch(opcode) {
    case Opcodes.ILOAD:  createVarRead(var, Type.INT);                  break;
    case Opcodes.LLOAD:  createVarRead(var, Type.LONG);                 break;
    case Opcodes.FLOAD:  createVarRead(var, Type.FLOAT);                break;
    case Opcodes.DLOAD:  createVarRead(var, Type.DOUBLE);               break;
    case Opcodes.ALOAD:  createVarRead(var, Type.getFreshRef());        break;
    case Opcodes.ISTORE: createVarWrite(var, Type.INT);                 break;
    case Opcodes.LSTORE: createVarWrite(var, Type.LONG);                break;
    case Opcodes.FSTORE: createVarWrite(var, Type.FLOAT);               break;
    case Opcodes.DSTORE: createVarWrite(var, Type.DOUBLE);              break;
    case Opcodes.ASTORE: createVarWrite(var, Type.getFreshRef());       break;
    
    // TODO: RET (paired with JSR)
    case Opcodes.RET: throw new RuntimeException("visitVarInsn: RET");
  }
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:24,代码来源:MethodImporter.java

示例2: visitVarInsn

@Override
public void visitVarInsn(final int opcode, final int var) {
  ReplacingBasicValue v;
  if (opcode == Opcodes.ASTORE && (v = peekFromTop(0)) != null) {
    final ValueHolderSub from = oldToNew.get(v.getIndex());

    final ReplacingBasicValue current = getLocal(var);
    // if local var is set, then transfer to it to the existing holders in the local position.
    if (current != null) {
      final ValueHolderSub newSub = oldToNew.get(current.getIndex());
      if (newSub.iden() == from.iden()) {
        final int targetFirst = newSub.first();
        from.transfer(this, targetFirst);
        return;
      }
    }

    // if local var is not set, then check map to see if existing holders are mapped to local var.
    if (oldLocalToFirst.containsKey(var)) {
      final ValueHolderSub sub = oldToNew.get(oldLocalToFirst.lget());
      if (sub.iden() == from.iden()) {
        // if they are, then transfer to that.
        from.transfer(this, sub.first());
        return;
      }
    }

    // map from variables to global space for future use.
    oldLocalToFirst.put(var, v.getIndex());
    return;
  } else if (opcode == Opcodes.ALOAD && (v = getLocal(var)) != null) {
    /*
     * Not forwarding this removes a now unnecessary ALOAD for a holder. The required LOAD/STORE
     * sequences will be generated by the ASTORE code above.
     */
    return;
  }

  super.visitVarInsn(opcode, var);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:40,代码来源:InstructionModifier.java

示例3: visitTypeInsn

public void visitTypeInsn(int opcode, String type) {
	if (firstInstruction)
		addInc();
	super.visitTypeInsn(opcode, type);
	// we deal with Opcodes.NEW through the constructors
	if (opcode == Opcodes.ANEWARRAY) {
		int   siteId = getNextSiteId();
		addLog(true, siteId);
	} else if (DO_NEW_INVOKESPECIAL_SEQUENCE && opcode == Opcodes.NEW) {
		super.visitInsn(Opcodes.DUP);
		Triplet p = new Triplet();
		p.type = type;
		p.var = this.localsBase + 1 + newTypeStack.size();
		p.siteId = getNextSiteId();
		if (this.maxLocals < p.var) {
			this.maxLocals = p.var;
			methodToLargestLocal.put(this.encodedName, new Integer(
					p.var));
		}
		super.setLocalType(p.var, JAVA_LANG_OBJECT_TYPE); // super.newLocal(OBJECT_TYPE);
		newTypeStack.addLast(p);
		super.visitVarInsn(Opcodes.ASTORE, p.var);
	}
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:24,代码来源:AllocateInstrument.java

示例4: visitVarInsn

@Override
public void visitVarInsn(final int opcode, final int var) {
    switch (opcode) {
    case Opcodes.ILOAD:
        load(var, Type.INT_TYPE);
        break;
    case Opcodes.LLOAD:
        load(var, Type.LONG_TYPE);
        break;
    case Opcodes.FLOAD:
        load(var, Type.FLOAT_TYPE);
        break;
    case Opcodes.DLOAD:
        load(var, Type.DOUBLE_TYPE);
        break;
    case Opcodes.ALOAD:
        load(var, OBJECT_TYPE);
        break;
    case Opcodes.ISTORE:
        store(var, Type.INT_TYPE);
        break;
    case Opcodes.LSTORE:
        store(var, Type.LONG_TYPE);
        break;
    case Opcodes.FSTORE:
        store(var, Type.FLOAT_TYPE);
        break;
    case Opcodes.DSTORE:
        store(var, Type.DOUBLE_TYPE);
        break;
    case Opcodes.ASTORE:
        store(var, OBJECT_TYPE);
        break;
    case Opcodes.RET:
        ret(var);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:40,代码来源:InstructionAdapter.java

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

示例6: visitVarInsn

@Override
public void visitVarInsn(int opcode, int var) {
    super.visitVarInsn(opcode, var);
    if (this.captureNextStore && opcode == Opcodes.ASTORE) {
        this.local = var;
        this.captureNextStore = false;
    }
}
 
开发者ID:SpongePowered,项目名称:Metronome,代码行数:8,代码来源:Agent.java

示例7: callBack

@SuppressWarnings("deprecation")
private static void callBack(MethodNode mn) {

    InsnList nl = new InsnList();
    boolean  b  = false;
    for (int i = 0; i < mn.instructions.size(); i++) {
        AbstractInsnNode abs = mn.instructions.get(i);
        if (abs.getOpcode() == Opcodes.ASTORE && !b) {
            VarInsnNode varInsnNode = (VarInsnNode) abs;
            nl.add(abs);
            if (varInsnNode.var == 10) {
                System.out.println("Found place to inject ModelCallback");
                b = true;
                nl.add(new VarInsnNode(Opcodes.ALOAD, 0));
                nl.add(new TypeInsnNode(Opcodes.NEW, Model.class.getCanonicalName().replace('.', '/')));
                nl.add(new InsnNode(Opcodes.DUP));
                nl.add(new VarInsnNode(Opcodes.ALOAD, 10));
                nl.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, Model.class.getCanonicalName().replace('.', '/'), "<init>", "(Ljava/lang/Object;)V"));
                nl.add(new VarInsnNode(Opcodes.ALOAD, 0));
                nl.add(new MethodInsnNode(Opcodes.INVOKESTATIC, (ModelCallBack.class.getCanonicalName().replace('.', '/')), "add", "(L" + Model.class.getCanonicalName().replace('.', '/') + ";Ljava/lang/Object;)V"));
            }
        } else {
            nl.add(abs);
        }
    }
    mn.instructions = nl;
    mn.visitMaxs(0, 0);
    mn.visitEnd();
}
 
开发者ID:Parabot,项目名称:Parabot-317-API-Minified-OS-Scape,代码行数:29,代码来源:ModelInjector.java

示例8: getStoreInsn

static VarInsnNode getStoreInsn(Type type, int position) {
    int opCode;
    switch (type.getDescriptor().charAt(0)) {
        case 'B':
            opCode = Opcodes.ISTORE;
            break;
        case 'C':
            opCode = Opcodes.ISTORE;
            break;
        case 'D':
            opCode = Opcodes.DSTORE;
            break;
        case 'F':
            opCode = Opcodes.FSTORE;
            break;
        case 'I':
            opCode = Opcodes.ISTORE;
            break;
        case 'J':
            opCode = Opcodes.LSTORE;
            break;
        case 'L':
            opCode = Opcodes.ASTORE;
            break;
        case '[':
            opCode = Opcodes.ASTORE;
            break;
        case 'Z':
            opCode = Opcodes.ISTORE;
            break;
        case 'S':
            opCode = Opcodes.ISTORE;
            break;
        default:
            throw new ClassFormatError("Invalid method signature: "
                    + type.getDescriptor());
    }
    return new VarInsnNode(opCode, position);
}
 
开发者ID:yutian-tianpl,项目名称:byte-cobweb,代码行数:39,代码来源:TreeInsn.java

示例9: isStore

static boolean isStore(int opcode) {
	return opcode == Opcodes.ASTORE || opcode == Opcodes.ISTORE || opcode == Opcodes.FSTORE
			|| opcode == Opcodes.LSTORE || opcode == Opcodes.DSTORE;
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:4,代码来源:LocalVariablesAnalyzer.java


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