# HG changeset patch # User Thomas Wuerthinger # Date 1309261956 -7200 # Node ID b15101f82e2dd07f9e8045dcd039021b20e7f99f # Parent 169287a814ae9f4bc45935efd9b968b2ba9b3756 Added read elimination phase. diff -r 169287a814ae -r b15101f82e2d graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Jun 28 12:20:31 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Jun 28 13:52:36 2011 +0200 @@ -102,6 +102,7 @@ public static boolean TraceInlining = ____; public static boolean TraceDeadCodeElimination = ____; public static boolean TraceMemoryMaps = ____; + public static boolean TraceReadElimination = ____; public static int TraceBytecodeParserLevel = 0; public static boolean QuietBailout = ____; diff -r 169287a814ae -r b15101f82e2d graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Jun 28 12:20:31 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Jun 28 13:52:36 2011 +0200 @@ -109,6 +109,7 @@ if (GraalOptions.Lower) { new LoweringPhase(compilation.runtime).apply(graph); new MemoryPhase().apply(graph); + new ReadEliminationPhase().apply(graph); } IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true); diff -r 169287a814ae -r b15101f82e2d graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java Tue Jun 28 12:20:31 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java Tue Jun 28 13:52:36 2011 +0200 @@ -72,4 +72,8 @@ public Object locationIdentity() { return locationIdentity; } + + public boolean same(LocationNode location) { + return valueKind == location.valueKind && displacement == location.displacement; + } } diff -r 169287a814ae -r b15101f82e2d graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.compiler.phases; + +import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.graph.*; + +/** + * Duplicates every node in the graph to test the implementation of the {@link com.oracle.max.graal.graph.Node#copy()} method in node subclasses. + */ +public class ReadEliminationPhase extends Phase { + + @Override + protected void run(Graph graph) { + for (ReadNode n : graph.getNodes(ReadNode.class)) { + Node memoryInput = n.inputs().variablePart().get(0); + if (memoryInput instanceof WriteNode) { + WriteNode other = (WriteNode) memoryInput; + if (other.object() == n.object() && other.location().same(n.location())) { + if (GraalOptions.TraceReadElimination) { + TTY.println("Eliminated memory read " + n + "and replaced with node " + other.value()); + } + n.replaceAndDelete(other.value()); + } + } + } + } +} diff -r 169287a814ae -r b15101f82e2d src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/Bundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/Bundle.properties Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Text Editor diff -r 169287a814ae -r b15101f82e2d src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/layer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/layer.xml Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff -r 169287a814ae -r b15101f82e2d src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/preferences.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Text Editor/build/classes/at/ssw/visualizer/texteditor/preferences.xml Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 169287a814ae -r b15101f82e2d src/share/tools/IdealGraphVisualizer/Text Editor/build/depcache/dependencies.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Text Editor/build/depcache/dependencies.txt Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,282 @@ +||:at.ssw.visualizer.texteditor.Editor +at.ssw.visualizer.core.selection.SelectionManager +at.ssw.visualizer.core.selection.SelectionProvider +org.openide.text.CloneableEditor +javax.swing.JEditorPane +at.ssw.visualizer.texteditor.Editor$2 +at.ssw.visualizer.texteditor.Editor$1 +at.ssw.visualizer.core.selection.Selection +at.ssw.visualizer.texteditor.Editor +at.ssw.visualizer.texteditor.EditorSupport +||:at.ssw.visualizer.texteditor.EditorSupport +java.lang.StringBuilder +java.lang.UnsupportedOperationException +org.openide.windows.CloneableOpenSupport$Env +org.openide.text.CloneableEditorSupport +at.ssw.visualizer.texteditor.EditorSupport$Env +javax.swing.text.StyledDocument +org.openide.windows.CloneableOpenSupport +at.ssw.visualizer.texteditor.model.Text +org.openide.cookies.EditorCookie$Observable +com.sun.hotspot.igv.data.InputGraph +org.openide.cookies.EditCookie +org.openide.cookies.EditorCookie +org.openide.text.CloneableEditorSupport$Env +at.ssw.visualizer.texteditor.EditorSupport +com.sun.hotspot.igv.data.Group +||:at.ssw.visualizer.texteditor.fold.FoldManager$SideBarFactory +java.lang.Object +at.ssw.visualizer.texteditor.fold.FoldManager$SideBarFactory +org.netbeans.editor.SideBarFactory +at.ssw.visualizer.texteditor.fold.FoldManager +org.netbeans.editor.CodeFoldingSideBar +||:at.ssw.visualizer.texteditor.model.FoldingRegion +at.ssw.visualizer.texteditor.model.FoldingRegion +at.ssw.visualizer.texteditor.model.TextRegion +||:at.ssw.visualizer.texteditor.tooltip.StyledToolTip +java.awt.Color +javax.swing.border.LineBorder +java.awt.BorderLayout +java.lang.StringBuilder +java.awt.Dimension +at.ssw.visualizer.texteditor.tooltip.StyledToolTip +javax.swing.JEditorPane +javax.swing.JPanel +||:at.ssw.visualizer.texteditor.model.TextRegion +java.lang.Object +at.ssw.visualizer.texteditor.model.TextRegion +||:at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent$1 +java.lang.Object +at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent +at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent$1 +javax.swing.event.ChangeListener +||:at.ssw.visualizer.texteditor.model.TextBuilder +java.lang.StringBuilder +com.sun.hotspot.igv.data.InputBlock +java.util.HashSet +java.util.Set +java.util.List +java.util.ArrayList +at.ssw.visualizer.texteditor.model.Text +at.ssw.visualizer.texteditor.model.TextBuilder +java.util.Iterator +java.util.HashMap +java.util.Map +[Lat.ssw.visualizer.texteditor.model.FoldingRegion; +at.ssw.visualizer.texteditor.model.FoldingRegion +java.lang.Object +java.lang.String +||:at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent +at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent +javax.swing.JScrollPane +at.ssw.visualizer.core.selection.SelectionManager +javax.swing.JEditorPane +javax.swing.BorderFactory +java.awt.BorderLayout +com.sun.hotspot.igv.data.InputGraph +[Lcom.sun.hotspot.igv.data.InputBlock; +at.ssw.visualizer.core.selection.Selection +org.openide.windows.TopComponent +at.ssw.visualizer.texteditor.view.AbstractTextViewTopComponent$1 +java.util.Arrays +||:at.ssw.visualizer.texteditor.tooltip.ToolTipAction +at.ssw.visualizer.texteditor.model.Scanner +org.netbeans.editor.PopupManager +org.netbeans.editor.Utilities +org.netbeans.editor.TokenID +org.netbeans.editor.PopupManager$HorizontalBounds +org.netbeans.modules.editor.NbEditorKit$NbBuildToolTipAction +org.netbeans.editor.BaseDocument +org.netbeans.editor.EditorUI +at.ssw.visualizer.texteditor.model.Text +javax.swing.plaf.TextUI +java.awt.event.MouseEvent +org.netbeans.modules.editor.NbEditorKit +org.netbeans.editor.ext.ToolTipSupport +at.ssw.visualizer.texteditor.tooltip.ToolTipAction +javax.swing.text.JTextComponent +at.ssw.visualizer.texteditor.tooltip.StyledToolTip +org.netbeans.editor.PopupManager$Placement +||:at.ssw.visualizer.texteditor.fold.FoldManager$FoldManagerFactory +java.lang.Object +org.netbeans.spi.editor.fold.FoldManagerFactory +at.ssw.visualizer.texteditor.fold.FoldManager$FoldManagerFactory +at.ssw.visualizer.texteditor.fold.FoldManager +||:at.ssw.visualizer.core.selection.Selection +[Ljavax.swing.event.ChangeListener; +at.ssw.visualizer.core.selection.Selection$1 +javax.swing.event.ChangeListener +java.util.List +java.util.ArrayList +at.ssw.visualizer.core.selection.SelectionManager +java.lang.Class +java.util.HashMap +java.util.Map +javax.swing.event.ChangeEvent +at.ssw.visualizer.core.selection.Selection +java.lang.Object +javax.swing.Timer +||:at.ssw.visualizer.texteditor.model.BlockRegion +at.ssw.visualizer.texteditor.model.BlockRegion +at.ssw.visualizer.texteditor.model.TextRegion +||:at.ssw.visualizer.texteditor.highlight.HighlightsContainer$HighlightsLayerFactory +at.ssw.visualizer.texteditor.highlight.HighlightsContainer +at.ssw.visualizer.texteditor.model.Text +org.netbeans.spi.editor.highlighting.HighlightsLayerFactory +org.netbeans.spi.editor.highlighting.HighlightsLayer +java.lang.Object +javax.swing.text.Document +org.netbeans.spi.editor.highlighting.ZOrder +org.netbeans.spi.editor.highlighting.HighlightsLayerFactory$Context +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$HighlightsLayerFactory +||:at.ssw.visualizer.texteditor.highlight.HighlightsContainer +javax.swing.text.JTextComponent +org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer +org.netbeans.api.editor.mimelookup.MimeLookup +org.openide.util.WeakListeners +org.netbeans.api.editor.mimelookup.MimePath +javax.swing.text.SimpleAttributeSet +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$HighlightsLayerFactory +org.openide.util.Lookup +javax.swing.event.CaretListener +at.ssw.visualizer.texteditor.highlight.HighlightsContainer +at.ssw.visualizer.texteditor.model.Text +at.ssw.visualizer.texteditor.model.Scanner +org.netbeans.api.editor.settings.FontColorSettings +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$1 +javax.swing.text.Caret +org.netbeans.editor.TokenID +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$RegionSequence +javax.swing.text.Document +||:at.ssw.visualizer.core.selection.Selection$1 +java.lang.Object +at.ssw.visualizer.core.selection.Selection +at.ssw.visualizer.core.selection.Selection$1 +java.awt.event.ActionListener +||:at.ssw.visualizer.texteditor.model.HoverParser +java.lang.Object +java.util.Iterator +java.lang.String +java.lang.StringBuilder +java.lang.UnsupportedOperationException +at.ssw.visualizer.texteditor.model.HoverParser +||:at.ssw.visualizer.texteditor.Editor$2 +at.ssw.visualizer.texteditor.Editor +java.util.ArrayList +javax.swing.event.CaretEvent +java.util.List +[Lcom.sun.hotspot.igv.data.InputBlock; +com.sun.hotspot.igv.data.InputBlock +java.util.Map +java.util.Collection +at.ssw.visualizer.core.selection.Selection +at.ssw.visualizer.texteditor.model.BlockRegion +java.util.Iterator +javax.swing.event.CaretListener +at.ssw.visualizer.texteditor.Editor$2 +at.ssw.visualizer.texteditor.model.Text +java.lang.Math +java.lang.Object +javax.swing.JEditorPane +javax.swing.text.Document +||:at.ssw.visualizer.texteditor.EditorSupport$Env +java.lang.UnsupportedOperationException +org.openide.text.CloneableEditorSupport +at.ssw.visualizer.texteditor.EditorSupport$Env +java.beans.VetoableChangeSupport +at.ssw.visualizer.texteditor.model.Text +java.io.ByteArrayInputStream +java.io.IOException +java.lang.Object +at.ssw.visualizer.texteditor.EditorSupport +org.openide.text.CloneableEditorSupport$Env +java.beans.PropertyChangeSupport +java.lang.String +||:at.ssw.visualizer.texteditor.Editor$1 +java.lang.Math +at.ssw.visualizer.texteditor.model.BlockRegion +javax.swing.event.ChangeListener +at.ssw.visualizer.texteditor.model.Text +javax.swing.JEditorPane +java.util.Map +[Lcom.sun.hotspot.igv.data.InputBlock; +at.ssw.visualizer.texteditor.Editor$1 +at.ssw.visualizer.core.selection.Selection +java.lang.Object +javax.swing.text.Document +at.ssw.visualizer.texteditor.Editor +java.util.Arrays +||:at.ssw.visualizer.texteditor.model.Text +java.lang.String +[Lat.ssw.visualizer.texteditor.model.TextRegion; +java.lang.Object +java.util.Iterator +java.util.Map +java.util.Set +at.ssw.visualizer.texteditor.model.Text +at.ssw.visualizer.texteditor.model.TextRegion +||:at.ssw.visualizer.core.selection.SelectionProvider +java.lang.Object +at.ssw.visualizer.core.selection.SelectionProvider +||:at.ssw.visualizer.texteditor.EditorKit +javax.swing.Action +at.ssw.visualizer.texteditor.tooltip.ToolTipAction +at.ssw.visualizer.texteditor.EditorKit +org.netbeans.modules.editor.NbEditorKit +javax.swing.text.TextAction +||:at.ssw.visualizer.core.selection.SelectionManager +at.ssw.visualizer.core.selection.Selection +java.lang.Object +at.ssw.visualizer.core.selection.SelectionManager +||:at.ssw.visualizer.texteditor.model.Scanner +at.ssw.visualizer.texteditor.model.Scanner +javax.swing.text.BadLocationException +java.lang.Math +java.util.Set +java.util.BitSet +java.lang.Class +java.util.logging.Level +java.util.logging.Logger +javax.swing.text.Document +java.lang.String +org.netbeans.editor.Syntax +||:at.ssw.visualizer.texteditor.fold.FoldManager +at.ssw.visualizer.texteditor.fold.FoldManager$FoldManagerFactory +javax.swing.text.BadLocationException +at.ssw.visualizer.texteditor.fold.FoldManager +org.netbeans.api.editor.fold.FoldType +at.ssw.visualizer.texteditor.fold.FoldManager$SideBarFactory +org.netbeans.spi.editor.fold.FoldManager +at.ssw.visualizer.texteditor.model.Text +java.lang.Class +java.util.logging.Level +java.util.logging.Logger +at.ssw.visualizer.texteditor.model.FoldingRegion +java.lang.Object +org.netbeans.api.editor.fold.FoldHierarchy +javax.swing.text.Document +javax.swing.text.JTextComponent +org.netbeans.spi.editor.fold.FoldOperation +||:at.ssw.visualizer.texteditor.highlight.HighlightsContainer$1 +java.lang.Object +javax.swing.event.CaretListener +at.ssw.visualizer.texteditor.highlight.HighlightsContainer +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$1 +javax.swing.text.Document +||:at.ssw.visualizer.texteditor.hyperlink.HyperlinkProvider +at.ssw.visualizer.texteditor.model.Scanner +org.netbeans.editor.Utilities +at.ssw.visualizer.texteditor.hyperlink.HyperlinkProvider +org.netbeans.editor.TokenID +org.netbeans.lib.editor.hyperlink.spi.HyperlinkProvider +at.ssw.visualizer.texteditor.model.Text +java.lang.Object +javax.swing.text.Document +at.ssw.visualizer.texteditor.model.TextRegion +javax.swing.text.JTextComponent +||:at.ssw.visualizer.texteditor.highlight.HighlightsContainer$RegionSequence +java.lang.Object +org.netbeans.spi.editor.highlighting.HighlightsSequence +at.ssw.visualizer.texteditor.highlight.HighlightsContainer +at.ssw.visualizer.texteditor.highlight.HighlightsContainer$RegionSequence +at.ssw.visualizer.texteditor.model.TextRegion diff -r 169287a814ae -r b15101f82e2d src/share/tools/IdealGraphVisualizer/Text Editor/build/no-license.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Text Editor/build/no-license.txt Tue Jun 28 13:52:36 2011 +0200 @@ -0,0 +1,1 @@ +[NO LICENSE SPECIFIED] \ No newline at end of file