protected JsonObject toJson(LocalPointerKey ptr) {
   JsonObjectBuilder builder = Json.createObjectBuilder();
   builder.add("type", "LocalPointerKey");
   builder.add("method", ptr.getNode().getMethod().getSignature());
   builder.add("valueNumber", ptr.getValueNumber());
   return builder.build();
 }
 private void addParamEdges(LocalPointerKey pk, CGNode node) {
   // get parameter position: value number - 1?
   int paramPos = pk.getValueNumber() - 1;
   // iterate over callers
   for (CGNode caller : cg) {
     // TODO we don't need to add the graph if null is passed
     // as the argument
     addSubgraphForNode(caller);
     IR ir = caller.getIR();
     for (Iterator<CallSiteReference> iterator = ir.iterateCallSites(); iterator.hasNext(); ) {
       CallSiteReference call = iterator.next();
       if (cg.getPossibleTargets(caller, call).contains(node)) {
         SSAAbstractInvokeInstruction[] callInstrs = ir.getCalls(call);
         for (int i = 0; i < callInstrs.length; i++) {
           SSAAbstractInvokeInstruction callInstr = callInstrs[i];
           PointerKey actualPk =
               heapModel.getPointerKeyForLocal(caller, callInstr.getUse(paramPos));
           assert containsNode(actualPk);
           assert containsNode(pk);
           addEdge(pk, actualPk);
         }
       }
     }
   }
 }
  /** @param pk value being def'fed by a call instruction (either normal or exceptional) */
  private void addReturnEdges(LocalPointerKey pk, SSAInvokeInstruction callInstr) {
    boolean isExceptional = pk.getValueNumber() == callInstr.getException();

    // get call targets
    Collection<CGNode> possibleCallees =
        cg.getPossibleTargets(pk.getNode(), callInstr.getCallSite());
    // construct graph for each target
    for (CGNode callee : possibleCallees) {
      addSubgraphForNode(callee);
      PointerKey retVal =
          isExceptional
              ? heapModel.getPointerKeyForExceptionalReturnValue(callee)
              : heapModel.getPointerKeyForReturnValue(callee);
      assert containsNode(retVal);
      addEdge(pk, retVal);
    }
  }