Ejemplo n.º 1
0
  private static byte[] insertGapCore1(
      byte[] code,
      int where,
      int gapLength,
      boolean exclusive,
      ExceptionTable etable,
      CodeAttribute ca)
      throws BadBytecode, AlignmentException {
    int codeLength = code.length;
    byte[] newcode = new byte[codeLength + gapLength];
    insertGap2(code, where, gapLength, codeLength, newcode, exclusive);
    etable.shiftPc(where, gapLength, exclusive);
    LineNumberAttribute na = (LineNumberAttribute) ca.getAttribute(LineNumberAttribute.tag);
    if (na != null) na.shiftPc(where, gapLength, exclusive);

    LocalVariableAttribute va =
        (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag);
    if (va != null) va.shiftPc(where, gapLength, exclusive);

    LocalVariableAttribute vta =
        (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.typeTag);
    if (vta != null) vta.shiftPc(where, gapLength, exclusive);

    StackMapTable smt = (StackMapTable) ca.getAttribute(StackMapTable.tag);
    if (smt != null) smt.shiftPc(where, gapLength, exclusive);

    StackMap sm = (StackMap) ca.getAttribute(StackMap.tag);
    if (sm != null) sm.shiftPc(where, gapLength, exclusive);

    return newcode;
  }
Ejemplo n.º 2
0
    void shiftPc(int where, int gapLength, boolean exclusive) throws BadBytecode {
      if (where < cursor || (where == cursor && exclusive)) cursor += gapLength;

      if (where < mark || (where == mark && exclusive)) mark += gapLength;

      if (where < mark0 || (where == mark0 && exclusive)) mark0 += gapLength;

      etable.shiftPc(where, gapLength, exclusive);
      if (line != null) line.shiftPc(where, gapLength, exclusive);

      if (vars != null) vars.shiftPc(where, gapLength, exclusive);

      if (types != null) types.shiftPc(where, gapLength, exclusive);

      if (stack != null) stack.shiftPc(where, gapLength, exclusive);

      if (stack2 != null) stack2.shiftPc(where, gapLength, exclusive);
    }