soot.jimple.NewMultiArrayExpr Java Examples
The following examples show how to use
soot.jimple.NewMultiArrayExpr.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValueTemplatePrinter.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public void caseNewMultiArrayExpr(NewMultiArrayExpr v) { p.openBlock(); String oldName = varName; ttp.setVariableName("arrayType"); v.getType().apply(ttp); p.println("List<IntConstant> sizes = new LinkedList<IntConstant>();"); int i=0; for(Value s: v.getSizes()) { this.suggestVariableName("size"+i); s.apply(this); i++; p.println("sizes.add(sizes"+i+");"); } p.println("Value "+oldName+" = Jimple.v().newNewMultiArrayExpr(arrayType, sizes);"); varName = oldName; p.closeBlock(); }
Example #2
Source File: DavaBody.java From JAADAS with GNU General Public License v3.0 | 6 votes |
private void javafy_expr(ValueBox vb) { Expr e = (Expr) vb.getValue(); if (e instanceof BinopExpr) javafy_binop_expr(vb); else if (e instanceof UnopExpr) javafy_unop_expr(vb); else if (e instanceof CastExpr) javafy_cast_expr(vb); else if (e instanceof NewArrayExpr) javafy_newarray_expr(vb); else if (e instanceof NewMultiArrayExpr) javafy_newmultiarray_expr(vb); else if (e instanceof InstanceOfExpr) javafy_instanceof_expr(vb); else if (e instanceof InvokeExpr) javafy_invoke_expr(vb); else if (e instanceof NewExpr) javafy_new_expr(vb); }
Example #3
Source File: NullnessAnalysis.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void handleRefTypeAssignment(DefinitionStmt assignStmt, AnalysisInfo out) { Value left = assignStmt.getLeftOp(); Value right = assignStmt.getRightOp(); //unbox casted value if(right instanceof JCastExpr) { JCastExpr castExpr = (JCastExpr) right; right = castExpr.getOp(); } //if we have a definition (assignment) statement to a ref-like type, handle it, if ( isAlwaysNonNull(right) || right instanceof NewExpr || right instanceof NewArrayExpr || right instanceof NewMultiArrayExpr || right instanceof ThisRef || right instanceof StringConstant || right instanceof ClassConstant || right instanceof CaughtExceptionRef) { //if we assign new... or @this, the result is non-null out.put(left,NON_NULL); } else if(right==NullConstant.v()) { //if we assign null, well, it's null out.put(left, NULL); } else if(left instanceof Local && right instanceof Local) { out.put(left, out.get(right)); } else { out.put(left, TOP); } }
Example #4
Source File: ExprVisitor.java From JAADAS with GNU General Public License v3.0 | 5 votes |
@Override public void caseNewMultiArrayExpr(NewMultiArrayExpr nmae) { constantV.setOrigStmt(origStmt); // get array dimensions if (nmae.getSizeCount() > 255) { throw new RuntimeException("number of dimensions is too high (> 255) for the filled-new-array* opcodes: " + nmae.getSizeCount()); } short dimensions = (short) nmae.getSizeCount(); // get array base type ArrayType arrayType = ArrayType.v(nmae.getBaseType().baseType, dimensions); BuilderReference arrayTypeItem = DexPrinter.toTypeReference (arrayType, stmtV.getBelongingFile()); // get the dimension size registers List<Register> dimensionSizeRegs = new ArrayList<Register>(); for (int i = 0; i < dimensions; i++) { Value currentDimensionSize = nmae.getSize(i); Register currentReg = regAlloc.asImmediate(currentDimensionSize, constantV); dimensionSizeRegs.add(currentReg); } // create filled-new-array instruction, depending on the dimension sizes if (dimensions <= 5) { Register[] paddedRegs = pad35cRegs(dimensionSizeRegs); stmtV.addInsn(new Insn35c(Opcode.FILLED_NEW_ARRAY, dimensions, paddedRegs[0], paddedRegs[1], paddedRegs[2], paddedRegs[3], paddedRegs[4], arrayTypeItem), null); } else { stmtV.addInsn(new Insn3rc(Opcode.FILLED_NEW_ARRAY_RANGE, dimensionSizeRegs, dimensions, arrayTypeItem), null); } // check for > 255 is done already // move the resulting array into the destination register stmtV.addInsn(new Insn11x(Opcode.MOVE_RESULT_OBJECT, destinationReg), origStmt); }
Example #5
Source File: UnitThrowAnalysis.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void caseNewMultiArrayExpr(NewMultiArrayExpr expr) { result = result.add(mgr.RESOLVE_CLASS_ERRORS); for (int i = 0; i < expr.getSizeCount(); i++) { Value count = expr.getSize(i); if ((! (count instanceof IntConstant)) || (((IntConstant) count).lessThan(INT_CONSTANT_ZERO) .equals(INT_CONSTANT_ZERO))) { result = result.add(mgr.NEGATIVE_ARRAY_SIZE_EXCEPTION); } result = result.add(mightThrow(count)); } }
Example #6
Source File: PointsToGraph.java From vasco with GNU Lesser General Public License v2.1 | 5 votes |
/** * Assigns a root variable to a new object at a given allocation site. */ public void assignNew(Local lhs, AnyNewExpr allocSite) { // If creating a new string or class, re-use the constant site if (allocSite != SUMMARY_NODE) { if (allocSite.getType().equals(STRING_CONST.getType())) { allocSite = STRING_SITE; } else if (allocSite.getType().equals(CLASS_CONST.getType())) { allocSite = CLASS_SITE; } } // We do not handle multi-dimensional arrays in this version if (allocSite instanceof NewMultiArrayExpr) { allocSite = SUMMARY_NODE; } // Create this node in the heap, if it doesn't already exist newNode(allocSite, false); // Assign LHS to the new node Set<AnyNewExpr> target = new HashSet<AnyNewExpr>(); target.add(allocSite); roots.put(lhs, Collections.unmodifiableSet(target)); // Ensure reachability. gc(); }
Example #7
Source File: JimpleExprVisitorImpl.java From FuzzDroid with Apache License 2.0 | 4 votes |
@Override public void caseNewMultiArrayExpr(NewMultiArrayExpr v) { throw new RuntimeException("todo"); }
Example #8
Source File: DavaBody.java From JAADAS with GNU General Public License v3.0 | 4 votes |
private void javafy_newmultiarray_expr(ValueBox vb) { NewMultiArrayExpr nmae = (NewMultiArrayExpr) vb.getValue(); for (int i = 0; i < nmae.getSizeCount(); i++) javafy(nmae.getSizeBox(i)); vb.setValue(new DNewMultiArrayExpr(nmae.getBaseType(), nmae .getSizes())); }
Example #9
Source File: WeightedBoomerang.java From SPDS with Eclipse Public License 2.0 | 4 votes |
private boolean isMultiArrayAllocation(Stmt stmt) { return (stmt instanceof AssignStmt) && ((AssignStmt) stmt).getRightOp() instanceof NewMultiArrayExpr; }