public T pop(int count) { T o = null; for (int i = count; i > 0; i--) { o = this.pop(); } return o; }
private static List<Exprent> getDimensions(int arrayDim, ListStack<Exprent> stack) { List<Exprent> lstDims = new ArrayList<>(); for (int i = 0; i < arrayDim; i++) { lstDims.add(0, stack.pop()); } return lstDims; }
public FunctionExprent(int funcType, ListStack<Exprent> stack, Set<Integer> bytecodeOffsets) { this(funcType, new ArrayList<>(), bytecodeOffsets); if (funcType >= FUNCTION_BIT_NOT && funcType <= FUNCTION_PPI && funcType != FUNCTION_CAST && funcType != FUNCTION_INSTANCEOF) { lstOperands.add(stack.pop()); } else if (funcType == FUNCTION_IIF) { throw new RuntimeException("no direct instantiation possible"); } else { Exprent expr = stack.pop(); lstOperands.add(stack.pop()); lstOperands.add(expr); } }
private void visit(Statement stat) { lstack.push(stat); dfsnummap.put(stat, ncounter); lowmap.put(stat, ncounter); ncounter++; List<Statement> lstSuccs = stat.getNeighbours(StatEdge.TYPE_REGULAR, Statement.DIRECTION_FORWARD); // TODO: set? lstSuccs.removeAll(setProcessed); for (Statement succ : lstSuccs) { int secvalue; if (tset.contains(succ)) { secvalue = dfsnummap.get(succ); } else { tset.add(succ); visit(succ); secvalue = lowmap.get(succ); } lowmap.put(stat, Math.min(lowmap.get(stat), secvalue)); } if (lowmap.get(stat).intValue() == dfsnummap.get(stat).intValue()) { List<Statement> lst = new ArrayList<>(); Statement v; do { v = lstack.pop(); lst.add(v); } while (v != stat); components.add(lst); } }
public IfExprent(int ifType, ListStack<Exprent> stack, Set<Integer> bytecodeOffsets) { this(null, bytecodeOffsets); if (ifType <= IF_LE) { stack.push(new ConstExprent(0, true, null)); } else if (ifType <= IF_NONNULL) { stack.push(new ConstExprent(VarType.VARTYPE_NULL, null, null)); } if (ifType == IF_VALUE) { condition = stack.pop(); } else { condition = new FunctionExprent(FUNC_TYPES[ifType], stack, bytecodeOffsets); } }
var1 = stack.pop(2); stack.push(new VarType(var1.type, var1.arrayDim - 1, var1.value)); break; case CodeConstants.opc_astore: data.setVariable(instr.operand(0), stack.pop()); break; case CodeConstants.opc_dup: break; case CodeConstants.opc_swap: var1 = stack.pop(); stack.insertByOffset(-1, var1); break; case CodeConstants.opc_getfield: stack.pop(); case CodeConstants.opc_getstatic: ck = pool.getLinkConstant(instr.operand(0)); stack.pop(); case CodeConstants.opc_putstatic: ck = pool.getLinkConstant(instr.operand(0)); var1 = new VarType(ck.descriptor); stack.pop(var1.stackSize); break; case CodeConstants.opc_invokevirtual: case CodeConstants.opc_invokespecial: case CodeConstants.opc_invokeinterface: stack.pop(); case CodeConstants.opc_invokestatic:
public T pop(int count) { T o = null; for (int i = count; i > 0; i--) { o = this.pop(); } return o; }
private static List<Exprent> getDimensions(int arrayDim, ListStack<Exprent> stack) { List<Exprent> lstDims = new ArrayList<>(); for (int i = 0; i < arrayDim; i++) { lstDims.add(0, stack.pop()); } return lstDims; }
public FunctionExprent(int funcType, ListStack<Exprent> stack, Set<Integer> bytecodeOffsets) { this(funcType, new ArrayList<>(), bytecodeOffsets); if (funcType >= FUNCTION_BIT_NOT && funcType <= FUNCTION_PPI && funcType != FUNCTION_CAST && funcType != FUNCTION_INSTANCEOF) { lstOperands.add(stack.pop()); } else if (funcType == FUNCTION_IIF) { throw new RuntimeException("no direct instantiation possible"); } else { Exprent expr = stack.pop(); lstOperands.add(stack.pop()); lstOperands.add(expr); } }
Statement v; do { v = lstack.pop(); lst.add(v);
public IfExprent(int ifType, ListStack<Exprent> stack, Set<Integer> bytecodeOffsets) { this(null, bytecodeOffsets); if (ifType <= IF_LE) { stack.push(new ConstExprent(0, true, null)); } else if (ifType <= IF_NONNULL) { stack.push(new ConstExprent(VarType.VARTYPE_NULL, null, null)); } if (ifType == IF_VALUE) { condition = stack.pop(); } else { condition = new FunctionExprent(FUNC_TYPES[ifType], stack, bytecodeOffsets); } }
var1 = stack.pop(2); stack.push(new VarType(var1.type, var1.arrayDim - 1, var1.value)); break; case CodeConstants.opc_astore: data.setVariable(instr.getOperand(0), stack.pop()); break; case CodeConstants.opc_dup: break; case CodeConstants.opc_swap: var1 = stack.pop(); stack.insertByOffset(-1, var1); break; case CodeConstants.opc_getfield: stack.pop(); case CodeConstants.opc_getstatic: ck = pool.getLinkConstant(instr.getOperand(0)); stack.pop(); case CodeConstants.opc_putstatic: ck = pool.getLinkConstant(instr.getOperand(0)); var1 = new VarType(ck.descriptor); stack.pop(var1.stackSize); break; case CodeConstants.opc_invokevirtual: case CodeConstants.opc_invokespecial: case CodeConstants.opc_invokeinterface: stack.pop(); case CodeConstants.opc_invokestatic: