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 189809 Details for
Bug 326950
[compiler][null]Do not optimize code generation based on static analysis (dead code)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
another proposed solution
patch326950.txt (text/plain), 4.03 KB, created by
Ayushman Jain
on 2011-02-25 10:14:27 EST
(
hide
)
Description:
another proposed solution
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-02-25 10:14:27 EST
Size:
4.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java,v >retrieving revision 1.69 >diff -u -r1.69 IfStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java 12 Aug 2010 16:58:28 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java 25 Feb 2011 15:07:58 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -89,7 +89,13 @@ > this.thenInitStateIndex = currentScope.methodScope().recordInitializationStates(thenFlowInfo); > if (isConditionOptimizedFalse || ((this.bits & ASTNode.IsThenStatementUnreachable) != 0)) { > if (!isKnowDeadCodePattern(this.condition) || currentScope.compilerOptions().reportDeadCodeInTrivialIfStatement) { >- this.thenStatement.complainIfUnreachable(thenFlowInfo, currentScope, initialComplaintLevel); >+ int complained = this.thenStatement.complainIfUnreachable(thenFlowInfo, currentScope, initialComplaintLevel); >+ if (complained == COMPLAINED_FAKE_REACHABLE && >+ ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)) { >+ // The If-Else construct is reachable but the then branch is dead code. >+ // So don't optimize it away during code gen. >+ this.thenStatement.bits |= ASTNode.IsReachable; >+ } > } else { > // its a known coding pattern which should be tolerated by dead code analysis > // according to isKnowDeadCodePattern() >@@ -115,7 +121,13 @@ > this.elseInitStateIndex = currentScope.methodScope().recordInitializationStates(elseFlowInfo); > if (isConditionOptimizedTrue || ((this.bits & ASTNode.IsElseStatementUnreachable) != 0)) { > if (!isKnowDeadCodePattern(this.condition) || currentScope.compilerOptions().reportDeadCodeInTrivialIfStatement) { >- this.elseStatement.complainIfUnreachable(elseFlowInfo, currentScope, initialComplaintLevel); >+ int complained = this.elseStatement.complainIfUnreachable(elseFlowInfo, currentScope, initialComplaintLevel); >+ if (complained == COMPLAINED_FAKE_REACHABLE && >+ ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)) { >+ // The If-Else construct is reachable but the else branch is dead code. >+ // So don't optimize it away during code gen. >+ this.elseStatement.bits |= ASTNode.IsReachable; >+ } > } else { > // its a known coding pattern which should be tolerated by dead code analysis > // according to isKnowDeadCodePattern() >@@ -164,10 +176,7 @@ > if (hasThenPart) { > BranchLabel falseLabel = null; > // generate boolean condition only if needed >- if (((this.bits & ASTNode.IsElseStatementUnreachable) != 0) || >- (cst != Constant.NotAConstant && cst.booleanValue() == true)) { >- // No need to generate if condition statement when we know that only the then action >- // will be executed >+ if (cst != Constant.NotAConstant && cst.booleanValue() == true) { > this.condition.generateCode(currentScope, codeStream, false); > } else { > this.condition.generateOptimizedBoolean( >@@ -206,10 +215,7 @@ > } > } else if (hasElsePart) { > // generate boolean condition only if needed >- if (((this.bits & ASTNode.IsThenStatementUnreachable) != 0) || >- (cst != Constant.NotAConstant && cst.booleanValue() == false)) { >- // No need to generate if condition statement when we know that only the else action >- // will be executed >+ if (cst != Constant.NotAConstant && cst.booleanValue() == false) { > this.condition.generateCode(currentScope, codeStream, false); > } else { > this.condition.generateOptimizedBoolean(
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 326950
:
189182
|
189809
|
190188
|
190384
|
190394
|
190438
|
190473