File |
Line |
org/apache/commons/compress/harmony/unpack200/bytecode/LocalVariableTableAttribute.java |
71 |
org/apache/commons/compress/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java |
71 |
nestedEntries.add(descriptors[i]);
}
return nestedEntries.toArray(NONE);
}
@Override
protected int[] getStartPCs() {
return startPcs;
}
/*
* (non-Javadoc)
*
* @see org.apache.commons.compress.harmony.unpack200.bytecode.BCIRenumberedAttribute#renumber(java.util.List)
*/
@Override
public void renumber(final List<Integer> byteCodeOffsets) throws Pack200Exception {
// Remember the unrenumbered startPcs, since that's used later
// to calculate end position.
final int[] unrenumberedStartPcs = Arrays.copyOf(startPcs, startPcs.length);
// Next renumber startPcs in place
super.renumber(byteCodeOffsets);
// lengths are BRANCH5 encoded, not BCI-encoded.
// In other words:
// startPc is BCI5 startPc
// endPc is byteCodeOffset[(index of startPc in byteCodeOffset) +
// (encoded length)]
// real length = endPc - startPc
// special case if endPc is beyond end of bytecode array
final int maxSize = codeLength;
// Iterate through the lengths and update each in turn.
// This is done in place in the lengths array.
for (int index = 0; index < lengths.length; index++) {
final int startPc = startPcs[index];
int revisedLength = -1;
final int encodedLength = lengths[index];
// First get the index of the startPc in the byteCodeOffsets
final int indexOfStartPC = unrenumberedStartPcs[index];
// Given the index of the startPc, we can now add
// the encodedLength to it to get the stop index.
final int stopIndex = indexOfStartPC + encodedLength;
if (stopIndex < 0) {
throw new Pack200Exception("Error renumbering bytecode indexes");
}
// Length can either be an index into the byte code offsets, or one
// beyond the
// end of the byte code offsets. Need to determine which this is.
if (stopIndex == byteCodeOffsets.size()) {
// Pointing to one past the end of the byte code array
revisedLength = maxSize - startPc;
} else {
// We're indexed into the byte code array
final int stopValue = byteCodeOffsets.get(stopIndex).intValue();
revisedLength = stopValue - startPc;
}
lengths[index] = revisedLength;
}
}
@Override
protected void resolve(final ClassConstantPool pool) {
super.resolve(pool);
nameIndexes = new int[localVariableTableLength]; |