public void writeLineNumber(int codeAddress, int lineNumber) throws IOException { int lineDelta = lineNumber - currentLine; int addressDelta = codeAddress - currentAddress; if (addressDelta < 0) { throw new ExceptionWithContext("debug info items must have non-decreasing code addresses"); } if (lineDelta < -4 || lineDelta > 10) { writeAdvanceLine(lineNumber); lineDelta = 0; } // no else is intentional here. we might need to advance the PC as well as the line if ((lineDelta < 2 && addressDelta > 16) || (lineDelta > 1 && addressDelta > 15)) { writeAdvancePC(codeAddress); addressDelta = 0; } // we need to emit the special opcode even if both lineDelta and addressDelta are 0, otherwise a positions // entry isn't generated writeSpecialOpcode(lineDelta, addressDelta); }
public void writeLineNumber(int codeAddress, int lineNumber) throws IOException { int lineDelta = lineNumber - currentLine; int addressDelta = codeAddress - currentAddress; if (addressDelta < 0) { throw new ExceptionWithContext("debug info items must have non-decreasing code addresses"); } if (lineDelta < -4 || lineDelta > 10) { writeAdvanceLine(lineNumber); lineDelta = 0; } // no else is intentional here. we might need to advance the PC as well as the line if ((lineDelta < 2 && addressDelta > 16) || (lineDelta > 1 && addressDelta > 15)) { writeAdvancePC(codeAddress); addressDelta = 0; } // we need to emit the special opcode even if both lineDelta and addressDelta are 0, otherwise a positions // entry isn't generated writeSpecialOpcode(lineDelta, addressDelta); }
public void writeLineNumber(int codeAddress, int lineNumber) throws IOException { int lineDelta = lineNumber - currentLine; int addressDelta = codeAddress - currentAddress; if (addressDelta < 0) { throw new ExceptionWithContext("debug info items must have non-decreasing code addresses"); } if (lineDelta < -4 || lineDelta > 10) { writeAdvanceLine(lineNumber); lineDelta = 0; } // no else is intentional here. we might need to advance the PC as well as the line if ((lineDelta < 2 && addressDelta > 16) || (lineDelta > 1 && addressDelta > 15)) { writeAdvancePC(codeAddress); addressDelta = 0; } // we need to emit the special opcode even if both lineDelta and addressDelta are 0, otherwise a positions // entry isn't generated writeSpecialOpcode(lineDelta, addressDelta); }