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 181676 Details for
Bug 328519
[compiler] local variable cannot be optimized out despite warning "not used"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
First draft
patch_328519.txt (text/plain), 4.22 KB, created by
Olivier Thomann
on 2010-10-25 15:21:41 EDT
(
hide
)
Description:
First draft
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-10-25 15:21:41 EDT
Size:
4.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v >retrieving revision 1.125 >diff -u -r1.125 SingleNameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 22 Oct 2010 22:42:55 -0000 1.125 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 25 Oct 2010 19:20:29 -0000 >@@ -422,6 +422,10 @@ > break; > case Binding.LOCAL : // reading a local > LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; >+ if (localBinding.resolvedPosition == -1) { >+ codeStream.recordPositionsFrom(pc, this.sourceStart); >+ return; >+ } > if (!valueRequired && (this.implicitConversion & TypeIds.UNBOXING) == 0) { > // if no valueRequired, optimize out entire gen > codeStream.recordPositionsFrom(pc, this.sourceStart); >@@ -525,6 +529,9 @@ > case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) > LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; > // using incr bytecode if possible >+ if (localBinding.resolvedPosition == -1) { >+ return; >+ } > switch (localBinding.type.id) { > case T_JavaLangString : > codeStream.generateStringConcatenationAppend(currentScope, this, expression); >@@ -687,6 +694,9 @@ > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=185682 > // check if postIncrement is the only usage of this local > Reference.reportOnlyUselesslyReadLocal(currentScope, localBinding, valueRequired); >+ if (localBinding.resolvedPosition == -1) { >+ return; >+ } > > // using incr bytecode if possible > if (localBinding.type == TypeBinding.INT) { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java,v >retrieving revision 1.119 >diff -u -r1.119 BlockScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 13 Sep 2010 13:26:20 -0000 1.119 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 25 Oct 2010 19:20:29 -0000 >@@ -191,7 +191,7 @@ > LocalVariableBinding local = this.locals[ilocal]; // if no local at all, will be locals[ilocal]==null > > // check if variable is actually used, and may force it to be preserved >- boolean generateCurrentLocalVar = (local.useFlag != LocalVariableBinding.UNUSED && local.constant() == Constant.NotAConstant); >+ boolean generateCurrentLocalVar = (local.useFlag > LocalVariableBinding.UNUSED && local.constant() == Constant.NotAConstant); > > // do not report fake used variable > if (local.useFlag == LocalVariableBinding.UNUSED >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java,v >retrieving revision 1.59 >diff -u -r1.59 CodeSnippetSingleNameReference.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 22 Oct 2010 22:42:56 -0000 1.59 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 25 Oct 2010 19:20:29 -0000 >@@ -270,6 +270,10 @@ > break; > case Binding.LOCAL : // reading a local > LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; >+ if (localBinding.resolvedPosition == -1) { >+ codeStream.recordPositionsFrom(pc, this.sourceStart); >+ return; >+ } > if (!valueRequired) > break; > // outer local? >@@ -340,6 +344,9 @@ > break; > case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) > LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; >+ if (localBinding.resolvedPosition == -1) { >+ return; >+ } > // using incr bytecode if possible > switch (localBinding.type.id) { > case T_JavaLangString :
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 328519
:
181676
|
181728
|
181737
|
182485
|
182577
|
182648
|
182652
|
182714
|
182763