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 66071 Details for
Bug 185567
[compiler] dead bytecodes are generated inside optimized boolean condition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
185567.txt (text/plain), 6.14 KB, created by
Philipe Mulet
on 2007-05-07 06:27:07 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-05-07 06:27:07 EDT
Size:
6.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java,v >retrieving revision 1.36 >diff -u -r1.36 AND_AND_Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java 15 Jun 2006 10:33:04 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java 7 May 2007 10:26:38 -0000 >@@ -172,8 +172,7 @@ > /** > * Boolean operator code generation Optimized operations are: && > */ >- public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, >- BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) { >+ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) { > > if (constant != Constant.NotAConstant) { > super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, >@@ -206,8 +205,7 @@ > if (trueLabel != null) { > // implicit falling through the FALSE case > BranchLabel internalFalseLabel = new BranchLabel(codeStream); >- left.generateOptimizedBoolean(currentScope, codeStream, null, >- internalFalseLabel, !leftIsConst); >+ left.generateOptimizedBoolean(currentScope, codeStream, null, internalFalseLabel, !leftIsConst); > // need value, e.g. if (a == 1 && ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a!=1 > if (leftIsConst && !leftIsTrue) { > internalFalseLabel.place(); >@@ -231,7 +229,7 @@ > left.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, !leftIsConst); > // need value, e.g. if (a == 1 && ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a!=1 > if (leftIsConst && !leftIsTrue) { >- codeStream.goto_(falseLabel); >+ if (valueRequired) codeStream.goto_(falseLabel); > codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); > break generateOperands; // no need to generate right operand > } >@@ -239,8 +237,7 @@ > codeStream > .addDefinitelyAssignedVariables(currentScope, rightInitStateIndex); > } >- right.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, >- valueRequired && !rightIsConst); >+ right.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, valueRequired && !rightIsConst); > if (valueRequired && rightIsConst && !rightIsTrue) { > codeStream.goto_(falseLabel); > codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java,v >retrieving revision 1.35 >diff -u -r1.35 OR_OR_Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java 15 Jun 2006 10:33:04 -0000 1.35 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java 7 May 2007 10:26:38 -0000 >@@ -73,7 +73,6 @@ > * Code generation for a binary operation > */ > public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { >- > int pc = codeStream.position; > if (constant != Constant.NotAConstant) { > // inlined value >@@ -176,7 +175,6 @@ > * Boolean operator code generation Optimized operations are: || > */ > public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) { >- > if (constant != Constant.NotAConstant) { > super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired); > return; >@@ -209,17 +207,16 @@ > // implicit falling through the FALSE case > left.generateOptimizedBoolean(currentScope, codeStream, trueLabel, null, !leftIsConst); > // need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1 >- if (leftIsConst && leftIsTrue) { >- codeStream.goto_(trueLabel); >+ if (leftIsTrue) { >+ if (valueRequired) codeStream.goto_(trueLabel); > codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); > break generateOperands; // no need to generate right operand > } > if (rightInitStateIndex != -1) { >- codeStream >- .addDefinitelyAssignedVariables(currentScope, rightInitStateIndex); >+ codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex); > } > right.generateOptimizedBoolean(currentScope, codeStream, trueLabel, null, valueRequired && !rightIsConst); >- if (valueRequired && rightIsConst && rightIsTrue) { >+ if (valueRequired && rightIsTrue) { > codeStream.goto_(trueLabel); > codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); > } >@@ -230,7 +227,7 @@ > BranchLabel internalTrueLabel = new BranchLabel(codeStream); > left.generateOptimizedBoolean(currentScope, codeStream, internalTrueLabel, null, !leftIsConst); > // need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1 >- if (leftIsConst && leftIsTrue) { >+ if (leftIsTrue) { > internalTrueLabel.place(); > break generateOperands; // no need to generate right operand > } >@@ -239,11 +236,9 @@ > .addDefinitelyAssignedVariables(currentScope, rightInitStateIndex); > } > right.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, valueRequired && !rightIsConst); >- if (valueRequired && rightIsConst) { >- if (!rightIsTrue) { >- codeStream.goto_(falseLabel); >- codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); >- } >+ if (valueRequired && rightIsConst && !rightIsTrue) { >+ codeStream.goto_(falseLabel); >+ codeStream.updateLastRecordedEndPC(currentScope, codeStream.position); > } > internalTrueLabel.place(); > } else {
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 185567
: 66071