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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-20 / +11 lines)
Lines 200-217 Link Here
200
}
200
}
201
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
201
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
202
	// Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
202
	// Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
203
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
203
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
204
		return;
204
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
205
/*	if (initStateIndex == lastInitStateIndexWhenAddingInits)
206
		return;
205
		return;
207
	lastInitStateIndexWhenAddingInits = initStateIndex;
206
	for (int i = 0; i < visibleLocalsCount; i++) {
208
	if (lastInitStateIndexWhenRemovingInits != initStateIndex){
209
		lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index 
210
		// remove(1)-add(1)-remove(1) -> ignore second remove
211
		// remove(1)-add(2)-remove(1) -> perform second remove
212
	}
213
	
214
*/	for (int i = 0; i < visibleLocalsCount; i++) {
215
		LocalVariableBinding localBinding = visibleLocals[i];
207
		LocalVariableBinding localBinding = visibleLocals[i];
216
		if (localBinding != null) {
208
		if (localBinding != null) {
217
			// Check if the local is definitely assigned
209
			// Check if the local is definitely assigned
Lines 1039-1045 Link Here
1039
		}
1031
		}
1040
1032
1041
		// there may be some preserved locals never initialized
1033
		// there may be some preserved locals never initialized
1042
		if (visibleLocal.initializationCount > 0 && ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)){
1034
		if (visibleLocal.initializationCount > 0) {
1043
			visibleLocal.recordInitializationEndPC(position);
1035
			visibleLocal.recordInitializationEndPC(position);
1044
		}
1036
		}
1045
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
1037
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
Lines 1047-1053 Link Here
1047
}
1039
}
1048
public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
1040
public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
1049
	// mark all the scope's locals as losing their definite assignment
1041
	// mark all the scope's locals as losing their definite assignment
1050
1051
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
1042
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
1052
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
1043
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
1053
		return;
1044
		return;
Lines 1060-1066 Link Here
1060
			continue;
1051
			continue;
1061
		}
1052
		}
1062
		// there may be some preserved locals never initialized
1053
		// there may be some preserved locals never initialized
1063
		if (visibleLocal.initializationCount > 0 && ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)){
1054
		if (visibleLocal.initializationCount > 0) {
1064
			visibleLocal.recordInitializationEndPC(position);
1055
			visibleLocal.recordInitializationEndPC(position);
1065
		}
1056
		}
1066
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
1057
		visibleLocals[index--] = null; // this variable is no longer visible afterwards
Lines 5729-5738 Link Here
5729
		System.arraycopy(locals, 0, locals = new LocalVariableBinding[allLocalsCounter + LOCALS_INCREMENT], 0, allLocalsCounter);
5720
		System.arraycopy(locals, 0, locals = new LocalVariableBinding[allLocalsCounter + LOCALS_INCREMENT], 0, allLocalsCounter);
5730
	}
5721
	}
5731
	locals[allLocalsCounter++] = local;
5722
	locals[allLocalsCounter++] = local;
5732
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
5723
	local.initializationPCs = new int[4];
5733
		local.initializationPCs = new int[4];
5724
	local.initializationCount = 0;
5734
		local.initializationCount = 0;
5735
	}
5736
}
5725
}
5737
5726
5738
public void recordExpressionType(TypeBinding typeBinding) {
5727
public void recordExpressionType(TypeBinding typeBinding) {
Lines 5850-5856 Link Here
5850
public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
5839
public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
5851
	// given some flow info, make sure we did not loose some variables initialization
5840
	// given some flow info, make sure we did not loose some variables initialization
5852
	// if this happens, then we must update their pc entries to reflect it in debug attributes
5841
	// if this happens, then we must update their pc entries to reflect it in debug attributes
5853
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
5842
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0)
5843
			&& ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0))
5854
		return;
5844
		return;
5855
/*	if (initStateIndex == lastInitStateIndexWhenRemovingInits)
5845
/*	if (initStateIndex == lastInitStateIndexWhenRemovingInits)
5856
		return;
5846
		return;
Lines 6303-6309 Link Here
6303
		this.lastEntryPC = pos;
6293
		this.lastEntryPC = pos;
6304
	}
6294
	}
6305
	// need to update the initialization endPC in case of generation of local variable attributes.
6295
	// need to update the initialization endPC in case of generation of local variable attributes.
6306
	if ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
6296
	if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)
6297
			|| ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0)) {
6307
		for (int i = 0, max = this.locals.length; i < max; i++) {
6298
		for (int i = 0, max = this.locals.length; i < max; i++) {
6308
			LocalVariableBinding local = this.locals[i];
6299
			LocalVariableBinding local = this.locals[i];
6309
			if (local != null && local.declaringScope == scope && local.initializationCount > 0) {
6300
			if (local != null && local.declaringScope == scope && local.initializationCount > 0) {
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java (-1 / +2 lines)
Lines 191-197 Link Here
191
					this.codeStream.pcToSourceMapSize-=2;
191
					this.codeStream.pcToSourceMapSize-=2;
192
				}
192
				}
193
				// end of new code
193
				// end of new code
194
				if ((this.codeStream.generateAttributes & ClassFileConstants.ATTR_VARS) != 0) {
194
				if ((this.codeStream.generateAttributes & ClassFileConstants.ATTR_VARS) != 0
195
						|| (this.codeStream.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
195
					LocalVariableBinding locals[] = this.codeStream.locals;
196
					LocalVariableBinding locals[] = this.codeStream.locals;
196
					for (int i = 0, max = locals.length; i < max; i++) {
197
					for (int i = 0, max = locals.length; i < max; i++) {
197
						LocalVariableBinding local = locals[i];
198
						LocalVariableBinding local = locals[i];

Return to bug 157247