Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 43656 Details for
Bug 145397
[1.6][compiler] Invalid StackMap attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_145397.txt (text/plain), 5.41 KB, created by
Olivier Thomann
on 2006-06-06 17:39:14 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2006-06-06 17:39:14 EDT
Size:
5.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java,v >retrieving revision 1.7 >diff -u -r1.7 StackMapFrameCodeStream.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 3 Apr 2006 13:51:36 -0000 1.7 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 6 Jun 2006 21:41:00 -0000 >@@ -436,11 +436,12 @@ > } > } > public void exitUserScope(BlockScope currentScope) { >- int index = this.visibleLocalsCount; >- while (index > 0) { >- LocalVariableBinding visibleLocal = visibleLocals[index - 1]; >+ int index = this.visibleLocalsCount - 1; >+ while (index >= 0) { >+ LocalVariableBinding visibleLocal = visibleLocals[index]; > if (visibleLocal == null) { >- return; >+ index--; >+ continue; > } > if (visibleLocal.declaringScope != currentScope) // left currentScope > break; >@@ -730,7 +731,13 @@ > this.frames = newFrame; > framesCounter++; > } else { >- // the frame already exists >+ // we replace the existing frame with the current frame >+ StackMapFrame newFrame = (StackMapFrame) this.currentFrame.clone(); >+ StackMapFrame prevFrame = this.frames.prevFrame; >+ prevFrame.nextFrame = newFrame; >+ newFrame.prevFrame = prevFrame; >+ this.frames = newFrame; >+ newFrame.pc = pos; > this.frames.tagBits |= StackMapFrame.USED; > } > } catch (CloneNotSupportedException e) { >@@ -1702,6 +1709,16 @@ > super.recordExpressionType(typeBinding); > this.currentFrame.setTopOfStack(typeBinding); > } >+public void removeVariable(LocalVariableBinding localBinding) { >+ for (int i = visibleLocalsCount - 1; i >= 0; i--) { >+ LocalVariableBinding visibleLocal = visibleLocals[i]; >+ if (visibleLocal == localBinding && visibleLocal.initializationCount > 0){ >+ this.currentFrame.removeLocals(localBinding.resolvedPosition); >+ break; >+ } >+ } >+ super.removeVariable(localBinding); >+} > public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) { > int index = this.visibleLocalsCount; > for (int i = 0; i < index; i++) { >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java,v >retrieving revision 1.133 >diff -u -r1.133 CodeStream.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 20 Apr 2006 14:53:23 -0000 1.133 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 6 Jun 2006 21:40:59 -0000 >@@ -1025,18 +1025,20 @@ > if (((this.generateAttributes & ClassFileConstants.ATTR_VARS) == 0) > && ((this.generateAttributes & ClassFileConstants.ATTR_STACK_MAP) == 0)) > return; >- while (visibleLocalsCount > 0) { >- LocalVariableBinding visibleLocal = visibleLocals[this.visibleLocalsCount - 1]; >+ int index = this.visibleLocalsCount - 1; >+ while (index >= 0) { >+ LocalVariableBinding visibleLocal = visibleLocals[index]; > if (visibleLocal == null || visibleLocal.declaringScope != currentScope) { > // left currentScope >- break; >+ index--; >+ continue; > } > > // there may be some preserved locals never initialized > if (visibleLocal.initializationCount > 0 && ((this.generateAttributes & ClassFileConstants.ATTR_VARS) != 0)){ > visibleLocal.recordInitializationEndPC(position); > } >- visibleLocals[--this.visibleLocalsCount] = null; // this variable is no longer visible afterwards >+ visibleLocals[index--] = null; // this variable is no longer visible afterwards > } > } > public void f2d() { >@@ -5883,7 +5885,16 @@ > // no need to resize. So just add the new exception label > exceptionLabels[exceptionLabelsCounter++] = anExceptionLabel; > } >- >+public void removeVariable(LocalVariableBinding localBinding) { >+ for (int i = visibleLocalsCount - 1; i >= 0; i--) { >+ LocalVariableBinding visibleLocal = visibleLocals[i]; >+ if (visibleLocal == localBinding && visibleLocal.initializationCount > 0){ >+ visibleLocal.recordInitializationEndPC(position); >+ visibleLocals[i] = null; // this variable is no longer visible afterwards >+ return; >+ } >+ } >+} > public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) { > // given some flow info, make sure we did not loose some variables initialization > // if this happens, then we must update their pc entries to reflect it in debug attributes >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java,v >retrieving revision 1.35 >diff -u -r1.35 ForeachStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java 28 Mar 2006 20:29:56 -0000 1.35 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java 6 Jun 2006 21:40:59 -0000 >@@ -275,6 +275,7 @@ > } > this.action.generateCode(scope, codeStream); > >+ codeStream.removeVariable(this.elementVariable.binding); > // continuation point > if (this.continueLabel != null) { > this.continueLabel.place();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 145397
:
43501
|
43656
|
45323
|
48472
|
48473