Esempio n. 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);
  }
Esempio n. 2
0
  private void putParameterOnStack(ParameterInfo... infos) {
    int[] index = new int[infos.length];
    for (int i = 0; i < infos.length; i++) {
      ParameterInfo info = infos[i];
      if (!info.isSkippedOrRemapped()) {
        index[i] = codegen.getFrameMap().enterTemp(info.getType());
      } else {
        index[i] = -1;
      }
    }

    for (int i = infos.length - 1; i >= 0; i--) {
      ParameterInfo info = infos[i];
      if (!info.isSkippedOrRemapped()) {
        Type type = info.type;
        StackValue.local(index[i], type).store(StackValue.onStack(type), codegen.v);
      }
    }
  }
Esempio n. 3
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;
  }