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


Java Opcodes.DSTORE属性代码示例

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


在下文中一共展示了Opcodes.DSTORE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) {
    Type type;
    switch (opcode) {
    case Opcodes.LLOAD:
    case Opcodes.LSTORE:
        type = Type.LONG_TYPE;
        break;

    case Opcodes.DLOAD:
    case Opcodes.DSTORE:
        type = Type.DOUBLE_TYPE;
        break;

    case Opcodes.FLOAD:
    case Opcodes.FSTORE:
        type = Type.FLOAT_TYPE;
        break;

    case Opcodes.ILOAD:
    case Opcodes.ISTORE:
        type = Type.INT_TYPE;
        break;

    default:
        // case Opcodes.ALOAD:
        // case Opcodes.ASTORE:
        // case RET:
        type = OBJECT_TYPE;
        break;
    }
    mv.visitVarInsn(opcode, remap(var, type));
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:33,代码来源:LocalVariablesSorter.java

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

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

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

示例6: transform

@Override
public void transform(ClassNode clazz, MethodNode method, InsnMatcher matcher) {
	@Nullable LocalVariableNode rateModVar = AsmUtils.getLocalVariable(method, "rateMod", "D");
	if (rateModVar == null)
		throw new InjectorException("Couldn't find rateMod variable");

	@Nullable LocalVariableNode skillDividerVar = AsmUtils.getLocalVariable(method, "skillDivider", "D");
	if (skillDividerVar == null)
		throw new InjectorException("Couldn't find skillDivider variable");

	@Nullable AbstractInsnNode insn = null;

	for (AbstractInsnNode it = method.instructions.getFirst(); it.getNext() != null; it = it.getNext()) {
		AbstractInsnNode next = it.getNext();
		if (!(it instanceof LdcInsnNode) || !(next instanceof VarInsnNode)) {
			continue;
		}

		LdcInsnNode ldc = (LdcInsnNode) it;
		VarInsnNode var = (VarInsnNode) next;

		if (!(ldc.cst instanceof Number) || var.getOpcode() != Opcodes.DSTORE || var.var != rateModVar.index) {
			continue;
		}

		Number rateModNumber = (Number) ldc.cst;
		if (rateModNumber.doubleValue() != 1.2D) {
			continue;
		}

		insn = next;
		break;
	}

	if (insn == null) {
		throw new InjectorException("Couldn't find end of sType if block");
	}

	/* this.skillDivider /= (double) Servers.localServer.getSkillGainRate(); */
	InsnList list = new InsnList();
	list.add(new VarInsnNode(Opcodes.DLOAD, skillDividerVar.index));
	list.add(new FieldInsnNode(Opcodes.GETSTATIC, "com/wurmonline/server/Servers", "localServer", "Lcom/wurmonline/server/ServerEntry;"));
	list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "com/wurmonline/server/ServerEntry", "getSkillGainRate", "()F", false));
	list.add(new InsnNode(Opcodes.F2D));
	list.add(new InsnNode(Opcodes.DDIV));
	list.add(new VarInsnNode(Opcodes.DSTORE, skillDividerVar.index));

	method.instructions.insert(insn, list);
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:49,代码来源:SkillGainTransformer.java


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