# HG changeset patch # User Gilles Duboscq # Date 1328092557 -3600 # Node ID 168dd8970b964fb1c65dec0b9b209ba24edc6052 # Parent 97e0fb1f4906568c4e811b0517f390408047909c Remove RemovePlaceholderPhase, Add InsertStateAfterPlaceholderPhase for snippets so that a method can not deopt from after a snippet invoke into the inlined snippet diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Mon Jan 30 23:29:59 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Wed Feb 01 11:35:57 2012 +0100 @@ -181,7 +181,6 @@ new ReadEliminationPhase().apply(graph); } } - new RemovePlaceholderPhase().apply(graph); new DeadCodeEliminationPhase().apply(graph); plan.runPhases(PhasePosition.MID_LEVEL, graph); diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InsertStateAfterPlaceholderPhase.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/InsertStateAfterPlaceholderPhase.java Wed Feb 01 11:35:57 2012 +0100 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012, 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.nodes.*; + +public class InsertStateAfterPlaceholderPhase extends Phase { + + @Override + protected void run(StructuredGraph graph) { + for (ReturnNode ret : graph.getNodes(ReturnNode.class)) { + PlaceholderNode p = graph.add(new PlaceholderNode()); + p.setStateAfter(graph.add(new FrameState(null, FrameState.AFTER_BCI, 0, 0, false))); + graph.addBeforeFixed(ret, p); + } + } + +} diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemovePlaceholderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemovePlaceholderPhase.java Mon Jan 30 23:29:59 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * 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.nodes.*; - -public class RemovePlaceholderPhase extends Phase { - @Override - protected void run(StructuredGraph graph) { - for (PlaceholderNode n : graph.getNodes(PlaceholderNode.class)) { - graph.removeFixed(n); - } - } -} diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java Mon Jan 30 23:29:59 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java Wed Feb 01 11:35:57 2012 +0100 @@ -75,27 +75,6 @@ @Input private final NodeInputList virtualObjectMappings; - public FrameState outerFrameState() { - return outerFrameState; - } - - public void setOuterFrameState(FrameState x) { - updateUsages(this.outerFrameState, x); - this.outerFrameState = x; - } - - public FrameState outermostFrameState() { - FrameState fs = this; - while (fs.outerFrameState() != null) { - fs = fs.outerFrameState(); - } - return fs; - } - - public void setValueAt(int i, ValueNode x) { - values.set(i, x); - } - /** * The bytecode index to which this frame state applies. This will be {@code -1} * iff this state is mutable. @@ -143,6 +122,27 @@ assert !rethrowException || stackSize == 1 : "must have exception on top of the stack"; } + public FrameState outerFrameState() { + return outerFrameState; + } + + public void setOuterFrameState(FrameState x) { + updateUsages(this.outerFrameState, x); + this.outerFrameState = x; + } + + public FrameState outermostFrameState() { + FrameState fs = this; + while (fs.outerFrameState() != null) { + fs = fs.outerFrameState(); + } + return fs; + } + + public void setValueAt(int i, ValueNode x) { + values.set(i, x); + } + public boolean rethrowException() { return rethrowException; } diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java --- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java Mon Jan 30 23:29:59 2012 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java Wed Feb 01 11:35:57 2012 +0100 @@ -25,7 +25,6 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition; import com.oracle.max.graal.cri.*; /** diff -r 97e0fb1f4906 -r 168dd8970b96 graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java --- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java Mon Jan 30 23:29:59 2012 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java Wed Feb 01 11:35:57 2012 +0100 @@ -121,6 +121,7 @@ for (LoopEndNode end : graph.getNodes(LoopEndNode.class)) { end.setSafepointPolling(false); } + new InsertStateAfterPlaceholderPhase().apply(graph); Debug.dump(graph, "%s: Final", snippetRiMethod.name()); @@ -128,5 +129,4 @@ return graph; } - }