• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IINC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.bcel.generic.IINC的典型用法代码示例。如果您正苦于以下问题:Java IINC类的具体用法?Java IINC怎么用?Java IINC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: countLocalStoresLoadsAndIncrements

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Count stores, loads, and increments of local variables in method whose
 * CFG is given.
 * 
 * @param localStoreCount
 *            counts of local stores (indexed by local)
 * @param localLoadCount
 *            counts of local loads (indexed by local)
 * @param localIncrementCount
 *            counts of local increments (indexed by local)
 * @param cfg
 *            control flow graph (CFG) of method
 */
private void countLocalStoresLoadsAndIncrements(int[] localStoreCount, int[] localLoadCount, int[] localIncrementCount,
        CFG cfg) {
    for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
        Location location = i.next();

        if (location.getBasicBlock().isExceptionHandler())
            continue;

        boolean isStore = isStore(location);
        boolean isLoad = isLoad(location);
        if (!isStore && !isLoad)
            continue;

        IndexedInstruction ins = (IndexedInstruction) location.getHandle().getInstruction();
        int local = ins.getIndex();
        if (ins instanceof IINC) {
            localStoreCount[local]++;
            localLoadCount[local]++;
            localIncrementCount[local]++;
        } else if (isStore)
            localStoreCount[local]++;
        else
            localLoadCount[local]++;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:39,代码来源:FindDeadLocalStores.java


示例2: visitIINC

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
@Override
public void visitIINC(IINC obj) {
    if (obj.getIncrement() == 0) {
        // A no-op.
        return;
    }

    // IINC is a special case because its input and output are not on the
    // stack.
    // However, we still want to use the value number cache to ensure that
    // this operation is modeled consistently. (If we do nothing, we miss
    // the fact that the referenced local is modified.)

    int local = obj.getIndex();

    ValueNumber[] input = new ValueNumber[] { getFrame().getValue(local) };
    ValueNumberCache.Entry entry = new ValueNumberCache.Entry(handle, input);
    ValueNumber[] output = cache.lookupOutputValues(entry);
    if (output == null) {
        output = new ValueNumber[] { factory.createFreshValue() };
        cache.addOutputValues(entry, output);
    }

    getFrame().setValue(local, output[0]);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:ValueNumberFrameModelingVisitor.java


示例3: countLocalStoresLoadsAndIncrements

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Count stores, loads, and increments of local variables in method whose
 * CFG is given.
 *
 * @param localStoreCount
 *            counts of local stores (indexed by local)
 * @param localLoadCount
 *            counts of local loads (indexed by local)
 * @param localIncrementCount
 *            counts of local increments (indexed by local)
 * @param cfg
 *            control flow graph (CFG) of method
 */
private void countLocalStoresLoadsAndIncrements(int[] localStoreCount, int[] localLoadCount, int[] localIncrementCount,
        CFG cfg) {
    for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
        Location location = i.next();

        if (location.getBasicBlock().isExceptionHandler())
            continue;

        boolean isStore = isStore(location);
        boolean isLoad = isLoad(location);
        if (!isStore && !isLoad)
            continue;

        IndexedInstruction ins = (IndexedInstruction) location.getHandle().getInstruction();
        int local = ins.getIndex();
        if (ins instanceof IINC) {
            localStoreCount[local]++;
            localLoadCount[local]++;
            localIncrementCount[local]++;
        } else if (isStore)
            localStoreCount[local]++;
        else
            localLoadCount[local]++;
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:39,代码来源:FindDeadLocalStores.java


示例4: removeUnusedLocals

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
void removeUnusedLocals(Method mOrig, MethodGen m) {
    InstructionList il = m.getInstructionList();
    InstructionHandle[] ins = il.getInstructionHandles();
    for (int i = 0; i < ins.length; i++) {
        Instruction in = ins[i].getInstruction();

        if (in instanceof LocalVariableInstruction) {
            LocalVariableInstruction curr = (LocalVariableInstruction) in;
            if (mtab.getLocal(m, curr, ins[i].getPosition()) != null
                && curr.getIndex() < m.getMaxLocals() - 5
                && !mtab.isLocalUsedInInlet(mOrig, curr.getIndex())) {
                if (curr instanceof IINC) {
                    ins[i].setInstruction(new NOP());
                } else if (curr instanceof LSTORE || curr instanceof DSTORE) {
                    ins[i].setInstruction(new POP2());
                } else if (curr instanceof StoreInstruction) {
                    ins[i].setInstruction(new POP());
                } else if (curr instanceof ALOAD) {
                    ins[i].setInstruction(new ACONST_NULL());
                } else if (curr instanceof FLOAD) {
                    ins[i].setInstruction(new FCONST((float) 0.0));
                } else if (curr instanceof ILOAD) {
                    ins[i].setInstruction(new ICONST(0));
                } else if (curr instanceof DLOAD) {
                    ins[i].setInstruction(new DCONST(0.0));
                } else if (curr instanceof LLOAD) {
                    ins[i].setInstruction(new LCONST(0L));
                } else {
                    System.out.println("unhandled ins in "
                        + "removeUnusedLocals: " + curr);
                    System.exit(1);
                }
            }
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:37,代码来源:Cashmerec.java


示例5: createInstructionIinc

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
@SuppressWarnings("unused")
// Called using reflection
private Instruction createInstructionIinc(Element inst) {
    int index = Integer.parseInt(inst.getAttributeValue("index"));
    int incr = Integer.parseInt(inst.getAttributeValue("incr"));
    return new IINC(index, incr);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:JavaByteCodeOutputProcess.java


示例6: visitIINC

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
@Override
public void visitIINC(IINC obj) {
    // System.out.println("before iinc: " + getFrame());
    int v = obj.getIndex();
    int amount = obj.getIncrement();
    ConstantFrame f = getFrame();
    Constant c = f.getValue(v);
    if (c.isConstantInteger())
        f.setValue(v, new Constant(c.getConstantInt() + amount));
    else
        f.setValue(v, Constant.NOT_CONSTANT);
    // System.out.println("after iinc: " + getFrame());
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:14,代码来源:ConstantFrameModelingVisitor.java


示例7: visitIINC

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitIINC(IINC o){
	int idx = o.getIndex();
	if (idx < 0){
		constraintViolated(o, "Index '"+idx+"' must be non-negative.");
	}
	else{
		int maxminus1 =  max_locals()-1;
		if (idx > maxminus1){
			constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'.");
		}
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:14,代码来源:Pass3aVerifier.java


示例8: visitLocalVariableInstruction

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
public void visitLocalVariableInstruction( LocalVariableInstruction i ) {
    short opcode = i.getOpcode();
    Type type = i.getType(_cp);
    if (opcode == Constants.IINC) {
        _out.println("il.append(new IINC(" + i.getIndex() + ", " + ((IINC) i).getIncrement()
                + "));");
    } else {
        String kind = (opcode < Constants.ISTORE) ? "Load" : "Store";
        _out.println("il.append(_factory.create" + kind + "(" + BCELifier.printType(type)
                + ", " + i.getIndex() + "));");
    }
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:13,代码来源:BCELFactory.java


示例9: isStore

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
private boolean isStore(Location location) {
	Instruction ins = location.getHandle().getInstruction();
	return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:FindDeadLocalStores.java


示例10: isLoad

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
private boolean isLoad(Location location) {
	Instruction ins = location.getHandle().getInstruction();
	return (ins instanceof LoadInstruction) || (ins instanceof IINC);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:FindDeadLocalStores.java


示例11: emitIINC

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
private void emitIINC(Element xml_inst, IINC inst) {
    xml_inst.setAttribute("index", java.lang.String.valueOf(inst.getIndex()));
    xml_inst.setAttribute("incr", java.lang.String.valueOf(inst.getIncrement()));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:ClassToXmlvmProcess.java


示例12: isStore

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Is instruction at given location a store?
 * 
 * @param location
 *            the location
 * @return true if instruction at given location is a store, false if not
 */
private boolean isStore(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:FindDeadLocalStores.java


示例13: isLoad

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Is instruction at given location a load?
 * 
 * @param location
 *            the location
 * @return true if instruction at given location is a load, false if not
 */
private boolean isLoad(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof LoadInstruction) || (ins instanceof IINC);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:FindDeadLocalStores.java


示例14: isStore

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Is instruction at given location a store?
 *
 * @param location
 *            the location
 * @return true if instruction at given location is a store, false if not
 */
private boolean isStore(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:12,代码来源:FindDeadLocalStores.java


示例15: isLoad

import org.apache.bcel.generic.IINC; //导入依赖的package包/类
/**
 * Is instruction at given location a load?
 *
 * @param location
 *            the location
 * @return true if instruction at given location is a load, false if not
 */
private boolean isLoad(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof LoadInstruction) || (ins instanceof IINC);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:12,代码来源:FindDeadLocalStores.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Jsr250MethodSecurityMetadataSource类代码示例发布时间:2022-05-23
下一篇:
Java NullableVarCharHolder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap