View | Details | Raw Unified | Return to bug 164657 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-10 / +16 lines)
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.
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java (-4 lines)
Lines 213-225 Link Here
213
						}
213
						}
214
				*/
214
				*/
215
				// Beginning of new code
215
				// Beginning of new code
216
				int index = this.codeStream.pcToSourceMapSize - 2;
217
				if (this.codeStream.lastEntryPC == oldPosition) {
216
				if (this.codeStream.lastEntryPC == oldPosition) {
218
					this.codeStream.lastEntryPC = this.position;
217
					this.codeStream.lastEntryPC = this.position;
219
				}
218
				}
220
				if ((index >= 0) && (this.codeStream.pcToSourceMap[index] == this.position)) {
221
					this.codeStream.pcToSourceMapSize-=2;
222
				}
223
				// end of new code
219
				// end of new code
224
				if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP)) != 0) {
220
				if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP)) != 0) {
225
					LocalVariableBinding locals[] = this.codeStream.locals;
221
					LocalVariableBinding locals[] = this.codeStream.locals;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java (+1 lines)
Lines 237-242 Link Here
237
			// place the trailing labels (for break and default case)
237
			// place the trailing labels (for break and default case)
238
			this.breakLabel.place();
238
			this.breakLabel.place();
239
			if (defaultCase == null) {
239
			if (defaultCase == null) {
240
				codeStream.recordPositionsFrom(codeStream.position, this.sourceEnd, true);
240
				defaultLabel.place();
241
				defaultLabel.place();
241
			}
242
			}
242
			codeStream.recordPositionsFrom(pc, this.sourceStart);
243
			codeStream.recordPositionsFrom(pc, this.sourceStart);

Return to bug 164657