/** {@inheritDoc} */ @Override public void visitBranch(int opcode, int offset, int length, int target) { switch (opcode) { case ByteOps.GOTO: { visitCommon(offset, length, false); targetLists[offset] = IntList.makeImmutable(target); break; } case ByteOps.JSR: { /* * Each jsr is quarantined into a separate block (containing * only the jsr instruction) but is otherwise treated * as a conditional branch. (That is to say, both its * target and next instruction begin new blocks.) */ addWorkIfNecessary(offset, true); // Fall through to next case... } default: { int next = offset + length; visitCommon(offset, length, true); addWorkIfNecessary(next, true); targetLists[offset] = IntList.makeImmutable(next, target); break; } } addWorkIfNecessary(target, true); }
/** {@inheritDoc} */ public void visitBranch(int opcode, int offset, int length, int target) { switch (opcode) { case ByteOps.GOTO: { visitCommon(offset, length, false); targetLists[offset] = IntList.makeImmutable(target); break; } case ByteOps.JSR: { /* * Each jsr is quarantined into a separate block (containing * only the jsr instruction) but is otherwise treated * as a conditional branch. (That is to say, both its * target and next instruction begin new blocks.) */ addWorkIfNecessary(offset, true); // Fall through to next case... } default: { int next = offset + length; visitCommon(offset, length, true); addWorkIfNecessary(next, true); targetLists[offset] = IntList.makeImmutable(next, target); break; } } addWorkIfNecessary(target, true); }
/** {@inheritDoc} */ public void visitBranch(int opcode, int offset, int length, int target) { switch (opcode) { case ByteOps.GOTO: { visitCommon(offset, length, false); targetLists[offset] = IntList.makeImmutable(target); break; } case ByteOps.JSR: { /* * Each jsr is quarantined into a separate block (containing * only the jsr instruction) but is otherwise treated * as a conditional branch. (That is to say, both its * target and next instruction begin new blocks.) */ addWorkIfNecessary(offset, true); // Fall through to next case... } default: { int next = offset + length; visitCommon(offset, length, true); addWorkIfNecessary(next, true); targetLists[offset] = IntList.makeImmutable(next, target); break; } } addWorkIfNecessary(target, true); }
/** {@inheritDoc} */ public void visitBranch(int opcode, int offset, int length, int target) { switch (opcode) { case ByteOps.GOTO: { visitCommon(offset, length, false); targetLists[offset] = IntList.makeImmutable(target); break; } case ByteOps.JSR: { /* * Each jsr is quarantined into a separate block (containing * only the jsr instruction) but is otherwise treated * as a conditional branch. (That is to say, both its * target and next instruction begin new blocks.) */ addWorkIfNecessary(offset, true); // Fall through to next case... } default: { int next = offset + length; visitCommon(offset, length, true); addWorkIfNecessary(next, true); targetLists[offset] = IntList.makeImmutable(next, target); break; } } addWorkIfNecessary(target, true); }
/** {@inheritDoc} */ public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** {@inheritDoc} */ @Override public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** {@inheritDoc} */ @Override public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** {@inheritDoc} */ public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** {@inheritDoc} */ public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** {@inheritDoc} */ public void visitSwitch(int opcode, int offset, int length, SwitchList cases, int padding) { visitCommon(offset, length, false); addWorkIfNecessary(cases.getDefaultTarget(), true); int sz = cases.size(); for (int i = 0; i < sz; i++) { addWorkIfNecessary(cases.getTarget(i), true); } targetLists[offset] = cases.getTargets(); }
/** * Helper method used by all the visitor methods. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional branch, a return, or a switch) */ private void visitCommon(int offset, int length, boolean nextIsLive) { Bits.set(liveSet, offset); if (nextIsLive) { /* * If the next instruction is flowed to by this one, just * add it to the work set, and then a subsequent visit*() * will deal with it as appropriate. */ addWorkIfNecessary(offset + length, false); } else { /* * If the next instruction isn't flowed to by this one, * then mark it as a start of a block but *don't* add it * to the work set, so that in the final phase we can know * dead code blocks as those marked as blocks but not also marked * live. */ Bits.set(blockSet, offset + length); } }
/** * Helper method used by all the visitor methods. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional branch, a return, or a switch) */ private void visitCommon(int offset, int length, boolean nextIsLive) { Bits.set(liveSet, offset); if (nextIsLive) { /* * If the next instruction is flowed to by this one, just * add it to the work set, and then a subsequent visit*() * will deal with it as appropriate. */ addWorkIfNecessary(offset + length, false); } else { /* * If the next instruction isn't flowed to by this one, * then mark it as a start of a block but *don't* add it * to the work set, so that in the final phase we can know * dead code blocks as those marked as blocks but not also marked * live. */ Bits.set(blockSet, offset + length); } }
/** * Helper method used by all the visitor methods. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional branch, a return, or a switch) */ private void visitCommon(int offset, int length, boolean nextIsLive) { Bits.set(liveSet, offset); if (nextIsLive) { /* * If the next instruction is flowed to by this one, just * add it to the work set, and then a subsequent visit*() * will deal with it as appropriate. */ addWorkIfNecessary(offset + length, false); } else { /* * If the next instruction isn't flowed to by this one, * then mark it as a start of a block but *don't* add it * to the work set, so that in the final phase we can know * dead code blocks as those marked as blocks but not also marked * live. */ Bits.set(blockSet, offset + length); } }
/** * Helper method used by all the visitor methods. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional branch, a return, or a switch) */ private void visitCommon(int offset, int length, boolean nextIsLive) { Bits.set(liveSet, offset); if (nextIsLive) { /* * If the next instruction is flowed to by this one, just * add it to the work set, and then a subsequent visit*() * will deal with it as appropriate. */ addWorkIfNecessary(offset + length, false); } else { /* * If the next instruction isn't flowed to by this one, * then mark it as a start of a block but *don't* add it * to the work set, so that in the final phase we can know * dead code blocks as those marked as blocks but not also marked * live. */ Bits.set(blockSet, offset + length); } }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }
/** * Helper method used by all the visitor methods that deal with * opcodes that possibly throw. This method should be called after calling * {@link #visitCommon}. * * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ private void visitThrowing(int offset, int length, boolean nextIsLive) { int next = offset + length; if (nextIsLive) { addWorkIfNecessary(next, true); } ByteCatchList catches = method.getCatches().listFor(offset); catchLists[offset] = catches; targetLists[offset] = catches.toTargetList(nextIsLive ? next : -1); }