/** {@inheritDoc} */ public int writeSignedLeb128(int value) { int remaining = value >> 7; int count = 0; boolean hasMore = true; int end = ((value & Integer.MIN_VALUE) == 0) ? 0 : -1; while (hasMore) { hasMore = (remaining != end) || ((remaining & 1) != ((value >> 6) & 1)); writeByte((value & 0x7f) | (hasMore ? 0x80 : 0)); value = remaining; remaining >>= 7; count++; } return count; }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits the {@link DebugInfoConstants#DBG_END_SEQUENCE DBG_END_SEQUENCE} * bytecode. */ private void emitEndSequence() { output.writeByte(DBG_END_SEQUENCE); if (annotateTo != null || debugPrint != null) { annotate(1, "end sequence"); } } }
/** * Emits an {@link DebugInfoConstants#DBG_ADVANCE_PC DBG_ADVANCE_PC} * sequence. * * @param deltaAddress {@code >= 0;} amount to change program counter by * @throws IOException */ private void emitAdvancePc(int deltaAddress) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_ADVANCE_PC); output.writeUleb128(deltaAddress); address += deltaAddress; if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: advance pc", address)); } if (DEBUG) { System.err.printf("Emitting advance_pc for %d\n", deltaAddress); } }
/** * Emits an {@link DebugInfoConstants#DBG_ADVANCE_LINE DBG_ADVANCE_LINE} * sequence. * * @param deltaLines amount to change line number register by * @throws IOException */ private void emitAdvanceLine(int deltaLines) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_ADVANCE_LINE); output.writeSleb128(deltaLines); line += deltaLines; if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("line = %d", line)); } if (DEBUG) { System.err.printf("Emitting advance_line for %d\n", deltaLines); } }
/** * Emits an {@link DebugInfoConstants#DBG_ADVANCE_PC DBG_ADVANCE_PC} * sequence. * * @param deltaAddress {@code >= 0;} amount to change program counter by * @throws IOException */ private void emitAdvancePc(int deltaAddress) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_ADVANCE_PC); output.writeUleb128(deltaAddress); address += deltaAddress; if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: advance pc", address)); } if (DEBUG) { System.err.printf("Emitting advance_pc for %d\n", deltaAddress); } }
/** * Emits an {@link DebugInfoConstants#DBG_ADVANCE_LINE DBG_ADVANCE_LINE} * sequence. * * @param deltaLines amount to change line number register by * @throws IOException */ private void emitAdvanceLine(int deltaLines) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_ADVANCE_LINE); output.writeSleb128(deltaLines); line += deltaLines; if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("line = %d", line)); } if (DEBUG) { System.err.printf("Emitting advance_line for %d\n", deltaLines); } }
/** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_END_LOCAL); output.writeUleb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: -local %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local end"); } }
/** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_END_LOCAL); output.writeUleb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: -local %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local end"); } }
/** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_END_LOCAL); output.writeUleb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: -local %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local end"); } }
/** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_END_LOCAL); output.writeUleb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: -local %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local end"); } }
/** * Emits a {@link DebugInfoConstants#DBG_RESTART_LOCAL DBG_RESTART_LOCAL} * sequence. * * @param entry entry associated with this restart * @throws IOException */ private void emitLocalRestart(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_RESTART_LOCAL); emitUnsignedLeb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: +local restart %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local restart"); } }
/** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) throws IOException { int mark = output.getCursor(); output.writeByte(DBG_END_LOCAL); output.writeUleb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, String.format("%04x: -local %s", address, entryAnnotationString(entry))); } if (DEBUG) { System.err.println("emit local end"); } }