Example #1
0
  @Override
  public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) {
    // FIXME: receiver should never be null (checkArity seems to be one culprit)
    if (receiver != null) receiver = receiver.getSimplifiedOperand(valueMap, force);
    methAddr = (MethAddr) methAddr.getSimplifiedOperand(valueMap, force);
    for (int i = 0; i < arguments.length; i++) {
      arguments[i] = arguments[i].getSimplifiedOperand(valueMap, force);
    }

    // Recompute containsArgSplat flag
    containsArgSplat = containsArgSplat(arguments);

    if (closure != null) closure = closure.getSimplifiedOperand(valueMap, force);
    flagsComputed = false; // Forces recomputation of flags

    // recompute whenever instr operands change! (can this really change though?)
    callSite = getCallSiteFor(callType, methAddr);
  }
Example #2
0
  private static CallSite getCallSiteFor(CallType callType, MethAddr methAddr) {
    assert callType != null : "Calltype should never be null";

    String name = methAddr.getName();

    switch (callType) {
      case NORMAL:
        return MethodIndex.getCallSite(name);
      case FUNCTIONAL:
        return MethodIndex.getFunctionalCallSite(name);
      case VARIABLE:
        return MethodIndex.getVariableCallSite(name);
      case SUPER:
        return MethodIndex.getSuperCallSite();
      case UNKNOWN:
    }

    return null; // fallthrough for unknown
  }