src/main/java/org/plumelib/bcelutil/StackMapUtils.java
protected final void update_full_frame_stack_map_entries(
      int offset, Type type_new_var, LocalVariableGen[] locals) {
    @NonNegative int index; // locals index

    for (int i = 0; i < stack_map_table.length; i++) {
      if (stack_map_table[i].getFrameType() == Const.FULL_FRAME) {

        int num_locals = stack_map_table[i].getNumberOfLocals();
        StackMapType[] new_local_types = new StackMapType[num_locals + 1];
        StackMapType[] old_local_types = stack_map_table[i].getTypesOfLocals();

        // System.out.printf ("update_full_frame %s %s %s %n", offset, num_locals, locals.length);

        for (index = 0; index < num_locals; index++) {
          if (index >= locals.length) {
            // there are hidden compiler temps in map
            break;
          }
          if (locals[index].getIndex() >= offset) {
            // we've reached the point of insertion
            break;
          }
          new_local_types[index] = old_local_types[index];
        }
        new_local_types[index++] = generate_StackMapType_from_Type(type_new_var);
        while (index <= num_locals) {
          new_local_types[index] = old_local_types[index - 1];
          index++;
        }

        stack_map_table[i].setTypesOfLocals(new_local_types);
      }
    }
  }
protected final void update_full_frame_stack_map_entries(
      int offset, Type type_new_var, LocalVariableGen[] locals) {
    @NonNegative int index; // locals index

    for (int i = 0; i < stack_map_table.length; i++) {
      if (stack_map_table[i].getFrameType() == Const.FULL_FRAME) {

        int num_locals = stack_map_table[i].getNumberOfLocals();
        StackMapType[] new_local_types = new StackMapType[num_locals + 1];
        StackMapType[] old_local_types = stack_map_table[i].getTypesOfLocals();

        // System.out.printf ("update_full_frame %s %s %s %n", offset, num_locals, locals.length);

        for (index = 0; index < num_locals; index++) {
          if (index >= locals.length) {
            // there are hidden compiler temps in map
            break;
          }
          if (locals[index].getIndex() >= offset) {
            // we've reached the point of insertion
            break;
          }
          new_local_types[index] = old_local_types[index];
        }
        new_local_types[index++] = generate_StackMapType_from_Type(type_new_var);
        while (index <= num_locals) {
          new_local_types[index] = old_local_types[index - 1];
          index++;
        }

        stack_map_table[i].setTypesOfLocals(new_local_types);
      }
    }
  }
protected final void update_full_frame_stack_map_entries ( int offset , Type type_new_var , LocalVariableGen [ ] locals ) { @ NonNegative int index ; // locals index for ( int i = 0 ; i < stack_map_table . length ; i ++ ) { if ( stack_map_table [ i ] . getFrameType ( ) == Const . FULL_FRAME ) { int num_locals = stack_map_table [ i ] . getNumberOfLocals ( ) ; StackMapType [ ] new_local_types = new StackMapType [ num_locals + 1 ] ; StackMapType [ ] old_local_types = stack_map_table [ i ] . getTypesOfLocals ( ) ; // System.out.printf ("update_full_frame %s %s %s %n", offset, num_locals, locals.length); for ( index = 0 ; index < num_locals ; index ++ ) { if ( index >= locals . length ) { // there are hidden compiler temps in map break ; } if ( locals [ index ] . getIndex ( ) >= offset ) { // we've reached the point of insertion break ; } new_local_types [ index ] = old_local_types [ index ] ; } new_local_types [ index ++ ] = generate_StackMapType_from_Type ( type_new_var ) ; while ( index <= num_locals ) { new_local_types [ index ] = old_local_types [ index - 1 ] ; index ++ ; } stack_map_table [ i ] . setTypesOfLocals ( new_local_types ) ; } } }
Update any FULL_FRAME StackMap entries to include a new local var. The locals array is a copy
of the local variables PRIOR to the addition of the new local in question.

@param offset offset into stack of the new variable we are adding
@param type_new_var type of new variable we are adding
@param locals a copy of the local variable table prior to this modification
Update any FULL_FRAME StackMap entries to include a new local var . The locals array is a copy of the local variables PRIOR to the addition of the new local in question .