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


Java OrdinalSetMapping类代码示例

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


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

示例1: numberPutStatics

import com.ibm.wala.util.intset.OrdinalSetMapping; //导入依赖的package包/类
/**
 * generate a numbering of the putstatic instructions
 */
private OrdinalSetMapping<Integer> numberPutStatics() {
  ArrayList<Integer> putInstrs = new ArrayList<Integer>();
  IR ir = ecfg.getIR();
  SSAInstruction[] instructions = ir.getInstructions();
  for (int i = 0; i < instructions.length; i++) {
    SSAInstruction instruction = instructions[i];
    if (instruction instanceof SSAPutInstruction && ((SSAPutInstruction) instruction).isStatic()) {
      SSAPutInstruction putInstr = (SSAPutInstruction) instruction;
      // instrNum is the number that will be assigned to this putstatic
      int instrNum = putInstrs.size();
      putInstrs.add(i);
      // also update the mapping of static fields to def'ing statements
      IField field = cha.resolveField(putInstr.getDeclaredField());
      assert field != null;
      BitVector bv = staticField2DefStatements.get(field);
      if (bv == null) {
        bv = new BitVector();
        staticField2DefStatements.put(field, bv);
      }
      bv.set(instrNum);
    }
  }
  return new ObjectArrayMapping<Integer>(putInstrs.toArray(new Integer[putInstrs.size()]));
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:28,代码来源:IntraprocReachingDefs.java

示例2: numberPutStatics

import com.ibm.wala.util.intset.OrdinalSetMapping; //导入依赖的package包/类
/**
 * generate a numbering of the putstatic instructions
 */
@SuppressWarnings("unchecked")
private OrdinalSetMapping<Pair<CGNode, Integer>> numberPutStatics() {
  ArrayList<Pair<CGNode, Integer>> putInstrs = new ArrayList<Pair<CGNode, Integer>>();
  for (CGNode node : icfg.getCallGraph()) {
    IR ir = node.getIR();
    if (ir == null) {
      continue;
    }
    SSAInstruction[] instructions = ir.getInstructions();
    for (int i = 0; i < instructions.length; i++) {
      SSAInstruction instruction = instructions[i];
      if (instruction instanceof SSAPutInstruction && ((SSAPutInstruction) instruction).isStatic()) {
        SSAPutInstruction putInstr = (SSAPutInstruction) instruction;
        // instrNum is the number that will be assigned to this putstatic
        int instrNum = putInstrs.size();
        putInstrs.add(Pair.make(node, i));
        // also update the mapping of static fields to def'ing statements
        IField field = cha.resolveField(putInstr.getDeclaredField());
        assert field != null;
        BitVector bv = staticField2DefStatements.get(field);
        if (bv == null) {
          bv = new BitVector();
          staticField2DefStatements.put(field, bv);
        }
        bv.set(instrNum);
      }
    }
  }
  return new ObjectArrayMapping<Pair<CGNode, Integer>>(putInstrs.toArray(new Pair[putInstrs.size()]));
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:34,代码来源:ContextInsensitiveReachingDefs.java


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