Java Code Examples for proguard.util.ArrayUtil#extendArray()
The following examples show how to use
proguard.util.ArrayUtil#extendArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeAttributeEditor.java From proguard with GNU General Public License v2.0 | 6 votes |
/** * Extends the size of the accumulated code changes. * @param codeLength the length of the code that will be edited next. */ public void extend(int codeLength) { // Try to reuse the previous arrays. if (preInsertions.length < codeLength) { preInsertions = (Instruction[])ArrayUtil.extendArray(preInsertions, codeLength); replacements = (Instruction[])ArrayUtil.extendArray(replacements, codeLength); postInsertions = (Instruction[])ArrayUtil.extendArray(postInsertions, codeLength); deleted = ArrayUtil.extendArray(deleted, codeLength); } else { Arrays.fill(preInsertions, this.codeLength, codeLength, null); Arrays.fill(replacements, this.codeLength, codeLength, null); Arrays.fill(postInsertions, this.codeLength, codeLength, null); Arrays.fill(deleted, this.codeLength, codeLength, false); } this.codeLength = codeLength; }
Example 2
Source File: CodeAttributeEditor.java From bazel with Apache License 2.0 | 6 votes |
/** * Extends the size of the accumulated code changes. * @param codeLength the length of the code that will be edited next. */ public void extend(int codeLength) { // Try to reuse the previous arrays. if (preInsertions.length < codeLength) { preInsertions = (Instruction[])ArrayUtil.extendArray(preInsertions, codeLength); replacements = (Instruction[])ArrayUtil.extendArray(replacements, codeLength); postInsertions = (Instruction[])ArrayUtil.extendArray(postInsertions, codeLength); deleted = ArrayUtil.extendArray(deleted, codeLength); } else { Arrays.fill(preInsertions, this.codeLength, codeLength, null); Arrays.fill(replacements, this.codeLength, codeLength, null); Arrays.fill(postInsertions, this.codeLength, codeLength, null); Arrays.fill(deleted, this.codeLength, codeLength, false); } this.codeLength = codeLength; }
Example 3
Source File: CodeAttributeComposer.java From proguard with GNU General Public License v2.0 | 5 votes |
/** * Inserts the given line number at the appropriate position in the line * number table. * @param minimumIndex the minimum index where the line number may be * inserted. * @param lineNumberInfo the line number to be inserted. * @return the index where the line number was inserted. */ public int insertLineNumber(int minimumIndex, LineNumberInfo lineNumberInfo) { if (DEBUG) { print(" ", "Line number ["+lineNumberInfo.u2startPC+"]"); } // Remap the line number right away. visitLineNumberInfo(null, null, null, lineNumberInfo); if (DEBUG) { System.out.println(" -> ["+lineNumberInfo.u2startPC+"] line "+lineNumberInfo.u2lineNumber+(lineNumberInfo.getSource()==null ? "":" ["+lineNumberInfo.getSource()+"]")); } lineNumberTable = (LineNumberInfo[])ArrayUtil.extendArray(lineNumberTable, lineNumberTableLength + 1); // Find the insertion index, starting from the end. // Don't insert before a negative line number, in case of a tie. int index = lineNumberTableLength++; while (index > minimumIndex && (lineNumberTable[index - 1].u2startPC > lineNumberInfo.u2startPC || lineNumberTable[index - 1].u2startPC >= lineNumberInfo.u2startPC && lineNumberTable[index - 1].u2lineNumber >= 0)) { lineNumberTable[index] = lineNumberTable[--index]; } lineNumberTable[index] = lineNumberInfo; return index; }
Example 4
Source File: CodeAttributeComposer.java From proguard with GNU General Public License v2.0 | 5 votes |
/** * Make sure the code arrays have at least the given size. */ private void ensureCodeLength(int newCodeLength) { if (code.length < newCodeLength) { // Add 20% to avoid extending the arrays too often. newCodeLength = newCodeLength * 6 / 5; code = ArrayUtil.extendArray(code, newCodeLength); oldInstructionOffsets = ArrayUtil.extendArray(oldInstructionOffsets, newCodeLength); instructionWriter.extend(newCodeLength); } }
Example 5
Source File: CodeAttributeComposer.java From bazel with Apache License 2.0 | 5 votes |
/** * Inserts the given line number at the appropriate position in the line * number table. * @param minimumIndex the minimum index where the line number may be * inserted. * @param lineNumberInfo the line number to be inserted. * @return the index where the line number was inserted. */ public int insertLineNumber(int minimumIndex, LineNumberInfo lineNumberInfo) { if (DEBUG) { print(" ", "Line number ["+lineNumberInfo.u2startPC+"]"); } // Remap the line number right away. visitLineNumberInfo(null, null, null, lineNumberInfo); if (DEBUG) { System.out.println(" -> ["+lineNumberInfo.u2startPC+"] line "+lineNumberInfo.u2lineNumber+(lineNumberInfo.getSource()==null ? "":" ["+lineNumberInfo.getSource()+"]")); } lineNumberTable = (LineNumberInfo[])ArrayUtil.extendArray(lineNumberTable, lineNumberTableLength + 1); // Find the insertion index, starting from the end. // Don't insert before a negative line number, in case of a tie. int index = lineNumberTableLength++; while (index > minimumIndex && (lineNumberTable[index - 1].u2startPC > lineNumberInfo.u2startPC || lineNumberTable[index - 1].u2startPC >= lineNumberInfo.u2startPC && lineNumberTable[index - 1].u2lineNumber >= 0)) { lineNumberTable[index] = lineNumberTable[--index]; } lineNumberTable[index] = lineNumberInfo; return index; }
Example 6
Source File: CodeAttributeComposer.java From bazel with Apache License 2.0 | 5 votes |
/** * Make sure the code arrays have at least the given size. */ private void ensureCodeLength(int newCodeLength) { if (code.length < newCodeLength) { // Add 20% to avoid extending the arrays too often. newCodeLength = newCodeLength * 6 / 5; code = ArrayUtil.extendArray(code, newCodeLength); oldInstructionOffsets = ArrayUtil.extendArray(oldInstructionOffsets, newCodeLength); instructionWriter.extend(newCodeLength); } }