Lines 5735-5740
Link Here
|
5735 |
// nothing to do |
5735 |
// nothing to do |
5736 |
} |
5736 |
} |
5737 |
public void recordPositionsFrom(int startPC, int sourcePos) { |
5737 |
public void recordPositionsFrom(int startPC, int sourcePos) { |
|
|
5738 |
this.recordPositionsFrom(startPC, sourcePos, false); |
5739 |
} |
5740 |
public void recordPositionsFrom(int startPC, int sourcePos, boolean widen) { |
5738 |
|
5741 |
|
5739 |
/* Record positions in the table, only if nothing has |
5742 |
/* Record positions in the table, only if nothing has |
5740 |
* already been recorded. Since we output them on the way |
5743 |
* already been recorded. Since we output them on the way |
Lines 5742-5754
Link Here
|
5742 |
* The pcToSourceMap table is always sorted. |
5745 |
* The pcToSourceMap table is always sorted. |
5743 |
*/ |
5746 |
*/ |
5744 |
|
5747 |
|
5745 |
if ((this.generateAttributes & ClassFileConstants.ATTR_LINES) == 0) |
5748 |
if ((this.generateAttributes & ClassFileConstants.ATTR_LINES) == 0 |
5746 |
return; |
5749 |
|| sourcePos == 0 |
5747 |
if (sourcePos == 0) |
5750 |
|| (startPC == position && !widen)) |
5748 |
return; |
|
|
5749 |
|
5750 |
// no code generated for this node. e.g. field without any initialization |
5751 |
if (position == startPC) |
5752 |
return; |
5751 |
return; |
5753 |
|
5752 |
|
5754 |
// Widening an existing entry that already has the same source positions |
5753 |
// Widening an existing entry that already has the same source positions |
Lines 5761-5767
Link Here
|
5761 |
if (pcToSourceMapSize > 0) { |
5760 |
if (pcToSourceMapSize > 0) { |
5762 |
// in this case there is already an entry in the table |
5761 |
// in this case there is already an entry in the table |
5763 |
if (pcToSourceMap[pcToSourceMapSize - 1] != lineNumber) { |
5762 |
if (pcToSourceMap[pcToSourceMapSize - 1] != lineNumber) { |
5764 |
if (startPC < lastEntryPC) { |
5763 |
if (startPC <= lastEntryPC) { |
5765 |
// we forgot to add an entry. |
5764 |
// we forgot to add an entry. |
5766 |
// search if an existing entry exists for startPC |
5765 |
// search if an existing entry exists for startPC |
5767 |
int insertionIndex = insertionIndex(pcToSourceMap, pcToSourceMapSize, startPC); |
5766 |
int insertionIndex = insertionIndex(pcToSourceMap, pcToSourceMapSize, startPC); |
Lines 5789-5796
Link Here
|
5789 |
pcToSourceMapSize += 2; |
5788 |
pcToSourceMapSize += 2; |
5790 |
} |
5789 |
} |
5791 |
} else if (position != lastEntryPC) { // no bytecode since last entry pc |
5790 |
} else if (position != lastEntryPC) { // no bytecode since last entry pc |
5792 |
pcToSourceMap[pcToSourceMapSize++] = lastEntryPC; |
5791 |
if (lastEntryPC == startPC || lastEntryPC == pcToSourceMap[pcToSourceMapSize - 2]) { |
5793 |
pcToSourceMap[pcToSourceMapSize++] = lineNumber; |
5792 |
pcToSourceMap[pcToSourceMapSize - 1] = lineNumber; |
|
|
5793 |
} else { |
5794 |
pcToSourceMap[pcToSourceMapSize++] = lastEntryPC; |
5795 |
pcToSourceMap[pcToSourceMapSize++] = lineNumber; |
5796 |
} |
5797 |
} else if (pcToSourceMap[pcToSourceMapSize - 1] < lineNumber && widen) { |
5798 |
// see if we can widen the existing entry |
5799 |
pcToSourceMap[pcToSourceMapSize - 1] = lineNumber; |
5794 |
} |
5800 |
} |
5795 |
} else { |
5801 |
} else { |
5796 |
// we can safely add the new entry. The endPC of the previous entry is not in conflit with the startPC of the new entry. |
5802 |
// we can safely add the new entry. The endPC of the previous entry is not in conflit with the startPC of the new entry. |