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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java (-1 / +2 lines)
Lines 221-227 Link Here
221
					this.codeStream.pcToSourceMapSize-=2;
221
					this.codeStream.pcToSourceMapSize-=2;
222
				}
222
				}
223
				// end of new code
223
				// end of new code
224
				if ((this.codeStream.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
224
				if ((this.codeStream.generateAttributes & ClassFileConstants.ATTR_VARS) != 0
225
						|| (this.codeStream.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
225
					LocalVariableBinding locals[] = this.codeStream.locals;
226
					LocalVariableBinding locals[] = this.codeStream.locals;
226
					for (int i = 0, max = locals.length; i < max; i++) {
227
					for (int i = 0, max = locals.length; i < max; i++) {
227
						LocalVariableBinding local = locals[i];
228
						LocalVariableBinding local = locals[i];
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-20 / +11 lines)
Lines 202-219 Link Here
202
}
202
}
203
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
203
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
204
	// Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
204
	// Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
205
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
205
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
206
		return;
206
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
207
/*	if (initStateIndex == lastInitStateIndexWhenAddingInits)
208
		return;
207
		return;
209
	lastInitStateIndexWhenAddingInits = initStateIndex;
208
	for (int i = 0; i < visibleLocalsCount; i++) {
210
	if (lastInitStateIndexWhenRemovingInits != initStateIndex){
211
		lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index 
212
		// remove(1)-add(1)-remove(1) -> ignore second remove
213
		// remove(1)-add(2)-remove(1) -> perform second remove
214
	}
215
	
216
*/	for (int i = 0; i < visibleLocalsCount; i++) {
217
		LocalVariableBinding localBinding = visibleLocals[i];
209
		LocalVariableBinding localBinding = visibleLocals[i];
218
		if (localBinding != null) {
210
		if (localBinding != null) {
219
			// Check if the local is definitely assigned
211
			// Check if the local is definitely assigned
Lines 1044-1050 Link Here
1044
		}
1036
		}
1045
1037
1046
		// there may be some preserved locals never initialized
1038
		// there may be some preserved locals never initialized
1047
		if (visibleLocal.initializationCount > 0 && ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)){
1039
		if (visibleLocal.initializationCount > 0) {
1048
			visibleLocal.recordInitializationEndPC(position);
1040
			visibleLocal.recordInitializationEndPC(position);
1049
		}
1041
		}
1050
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
1042
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
Lines 1052-1058 Link Here
1052
}
1044
}
1053
public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
1045
public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
1054
	// mark all the scope's locals as losing their definite assignment
1046
	// mark all the scope's locals as losing their definite assignment
1055
1056
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
1047
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
1057
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
1048
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
1058
		return;
1049
		return;
Lines 1065-1071 Link Here
1065
			continue;
1056
			continue;
1066
		}
1057
		}
1067
		// there may be some preserved locals never initialized
1058
		// there may be some preserved locals never initialized
1068
		if (visibleLocal.initializationCount > 0 && ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)){
1059
		if (visibleLocal.initializationCount > 0) {
1069
			visibleLocal.recordInitializationEndPC(position);
1060
			visibleLocal.recordInitializationEndPC(position);
1070
		}
1061
		}
1071
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
1062
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
Lines 5740-5749 Link Here
5740
		System.arraycopy(locals, 0, locals = new LocalVariableBinding[allLocalsCounter + LOCALS_INCREMENT], 0, allLocalsCounter);
5731
		System.arraycopy(locals, 0, locals = new LocalVariableBinding[allLocalsCounter + LOCALS_INCREMENT], 0, allLocalsCounter);
5741
	}
5732
	}
5742
	locals[allLocalsCounter++] = local;
5733
	locals[allLocalsCounter++] = local;
5743
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
5734
	local.initializationPCs = new int[4];
5744
		local.initializationPCs = new int[4];
5735
	local.initializationCount = 0;
5745
		local.initializationCount = 0;
5746
	}
5747
}
5736
}
5748
5737
5749
public void recordExpressionType(TypeBinding typeBinding) {
5738
public void recordExpressionType(TypeBinding typeBinding) {
Lines 5861-5867 Link Here
5861
public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
5850
public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
5862
	// given some flow info, make sure we did not loose some variables initialization
5851
	// given some flow info, make sure we did not loose some variables initialization
5863
	// if this happens, then we must update their pc entries to reflect it in debug attributes
5852
	// if this happens, then we must update their pc entries to reflect it in debug attributes
5864
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
5853
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
5854
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
5865
		return;
5855
		return;
5866
/*	if (initStateIndex == lastInitStateIndexWhenRemovingInits)
5856
/*	if (initStateIndex == lastInitStateIndexWhenRemovingInits)
5867
		return;
5857
		return;
Lines 6315-6321 Link Here
6315
		this.lastEntryPC = pos;
6305
		this.lastEntryPC = pos;
6316
	}
6306
	}
6317
	// need to update the initialization endPC in case of generation of local variable attributes.
6307
	// need to update the initialization endPC in case of generation of local variable attributes.
6318
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
6308
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)
6309
			|| ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0)) {
6319
		for (int i = 0, max = this.locals.length; i < max; i++) {
6310
		for (int i = 0, max = this.locals.length; i < max; i++) {
6320
			LocalVariableBinding local = this.locals[i];
6311
			LocalVariableBinding local = this.locals[i];
6321
			if (local != null && local.declaringScope == scope && local.initializationCount > 0) {
6312
			if (local != null && local.declaringScope == scope && local.initializationCount > 0) {

Return to bug 157247