derefValueNumber = callInst.getUse(NULL_TEST_APIS.get(sign));
@Override public void act(int x) { vns[i++] = instruction.getUse(x); } });
@Override public void act(int x) { vns[i++] = instruction.getUse(x); } });
/** * @return the value number of the receiver of a virtual call */ public int getReceiver() { assert site.getInvocationCode() != IInvokeInstruction.Dispatch.STATIC : toString(); return getUse(0); }
/** * @return the value number of the receiver of a virtual call */ public int getReceiver() { assert site.getInvocationCode() != IInvokeInstruction.Dispatch.STATIC : toString(); return getUse(0); }
/** * Returns an array of {@code int} with the parameter's var nums of the * invoked method in {@code invokeInstruction}. * * @param invokeInstruction * The instruction that invokes the method. * @return an array of {@code int} with all parameter's var nums * including the this pointer. */ public static int[] getParameterNumbers(SSAAbstractInvokeInstruction invokeInstruction) { final int number = invokeInstruction.getNumberOfPositionalParameters(); final int[] parameterNumbers = new int[number]; assert (parameterNumbers.length == invokeInstruction.getNumberOfUses()); for (int i = 0; i < parameterNumbers.length; i++) { parameterNumbers[i] = invokeInstruction.getUse(i); } return parameterNumbers; }
/** * Returns an array of {@code int} with the parameter's var nums of the * invoked method in {@code invokeInstruction}. * * @param invokeInstruction * The instruction that invokes the method. * @return an array of {@code int} with all parameter's var nums * including the this pointer. */ public static int[] getParameterNumbers(SSAAbstractInvokeInstruction invokeInstruction) { final int number = invokeInstruction.getNumberOfPositionalParameters(); final int[] parameterNumbers = new int[number]; assert (parameterNumbers.length == invokeInstruction.getNumberOfUses()); for (int i = 0; i < parameterNumbers.length; i++) { parameterNumbers[i] = invokeInstruction.getUse(i); } return parameterNumbers; }
protected IntSet getParamObjects(int paramIndex, @SuppressWarnings("unused") int rhsi) { int paramVn = call.getUse(paramIndex); PointerKey var = getPointerKeyForLocal(caller, paramVn); IntSet s = system.findOrCreatePointsToSet(var).getValue(); return s; } }
protected IntSet getParamObjects(int paramIndex, @SuppressWarnings("unused") int rhsi) { int paramVn = call.getUse(paramIndex); PointerKey var = getPointerKeyForLocal(caller, paramVn); IntSet s = system.findOrCreatePointsToSet(var).getValue(); return s; } }
/** * Given a callVertex that can invoke Function.prototype.call, get the * FuncVertex nodes for the reflectively-invoked methods */ private static OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); VarVertex functionParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(1)); return flowGraph.getReachingSet(functionParam, monitor); }
/** * Given a callVertex that can invoke Function.prototype.call, get the * FuncVertex nodes for the reflectively-invoked methods */ private static OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); VarVertex functionParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(1)); return flowGraph.getReachingSet(functionParam, monitor); }
private void propagateToCallee() { // if (caller.getIR() == null) { // return; // } g.addSubgraphForNode(caller); SSAAbstractInvokeInstruction[] callInstrs = getCallInstrs(caller, call); for (SSAAbstractInvokeInstruction callInstr : callInstrs) { PointerKey actualPk = heapModel.getPointerKeyForLocal(caller, callInstr.getUse(paramPos)); assert g.containsNode(actualPk); assert g.containsNode(localPk); handler.handle(curPkAndState, actualPk, paramLabel); } }
private void propagateToCallee() { // if (caller.getIR() == null) { // return; // } g.addSubgraphForNode(caller); SSAAbstractInvokeInstruction[] callInstrs = getCallInstrs(caller, call); for (SSAAbstractInvokeInstruction callInstr : callInstrs) { PointerKey actualPk = heapModel.getPointerKeyForLocal(caller, callInstr.getUse(paramPos)); assert g.containsNode(actualPk); assert g.containsNode(localPk); handler.handle(curPkAndState, actualPk, paramLabel); } }
@Override public Object apply(State callerState) { // hack to get some actual parameter from call site // TODO do this better SSAAbstractInvokeInstruction[] callInstrs = getCallInstrs(caller, call); SSAAbstractInvokeInstruction callInstr = callInstrs[0]; PointerKey actualPk = heapModel.getPointerKeyForLocal(caller, callInstr.getUse(paramPos)); Set<CGNode> possibleTargets = g.getPossibleTargets(caller, call, (LocalPointerKey) actualPk); if (noOnTheFlyNeeded(callSiteAndCGNode, possibleTargets)) { propagateToCallee(); } else { if (callToOTFTargets.get(callSiteAndCGNode).contains(callee.getMethod())) { // already found this target as valid, so do propagation propagateToCallee(); } else { // if necessary, start a query for the call site queryCallTargets(callSiteAndCGNode, callInstrs, callerState); } } return null; }
private IntSet identifyDependentParameters(CGNode caller, CallSiteReference site) { MutableIntSet dependentParameters = IntSetUtil.make(); SSAAbstractInvokeInstruction inst = caller.getIR().getCalls(site)[0]; DefUse du = caller.getDU(); for(int i = 0; i < inst.getNumberOfPositionalParameters(); i++) { MutableIntSet values = IntSetUtil.make(); values.add(inst.getUse(i)); collectValues(du, du.getDef(inst.getUse(i)), values); if (values.contains(index+1)) dependentParameters.add(i); } return dependentParameters; }
private IntSet identifyDependentParameters(CGNode caller, CallSiteReference site) { MutableIntSet dependentParameters = IntSetUtil.make(); SSAAbstractInvokeInstruction inst = caller.getIR().getCalls(site)[0]; DefUse du = caller.getDU(); for(int i = 0; i < inst.getNumberOfPositionalParameters(); i++) { MutableIntSet values = IntSetUtil.make(); values.add(inst.getUse(i)); collectValues(du, du.getDef(inst.getUse(i)), values); if (values.contains(index+1)) dependentParameters.add(i); } return dependentParameters; }
@SuppressWarnings("unused") private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom); VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0)); return flowGraph.getReachingSet(objectParam, monitor); }
@SuppressWarnings("unused") private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom); VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0)); return flowGraph.getReachingSet(objectParam, monitor); }