Example #1
0
  public RemapInfo doRemap(int index) {
    int remappedIndex;

    if (index < params.getArgsSizeOnStack()) {
      ParameterInfo info = params.getParameterByDeclarationSlot(index);
      StackValue remapped = remapValues[index];
      if (info.isSkipped || remapped == null) {
        return new RemapInfo(info);
      }
      if (info.isRemapped()) {
        return new RemapInfo(remapped, info, REMAPPED);
      } else {
        remappedIndex = ((StackValue.Local) remapped).index;
      }
    } else {
      remappedIndex =
          actualParamsSize
              - params.getArgsSizeOnStack()
              + index; // captured params not used directly in this inlined method, they used in
                       // closure
    }

    return new RemapInfo(
        StackValue.local(remappedIndex + additionalShift, AsmTypes.OBJECT_TYPE), null, SHIFT);
  }
Example #2
0
  public LocalVarRemapper(Parameters params, int additionalShift) {
    this.additionalShift = additionalShift;
    this.params = params;

    remapValues = new StackValue[params.getArgsSizeOnStack()];

    int realSize = 0;
    for (ParameterInfo info : params) {
      Integer shift = params.getDeclarationSlot(info);
      if (!info.isSkippedOrRemapped()) {
        remapValues[shift] = StackValue.local(realSize, AsmTypes.OBJECT_TYPE);
        realSize += info.getType().getSize();
      } else {
        remapValues[shift] = info.isRemapped() ? info.getRemapValue() : null;
      }
    }

    actualParamsSize = realSize;
  }