changeset 21012:f6369bd988c7

Merge
author Chris Seaton <chris.seaton@oracle.com>
date Sat, 18 Apr 2015 13:44:36 +0100
parents a84d57d27727 (current diff) 84ff24bc9604 (diff)
children c11ea4cb5765 609c542c0410
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationVerificationPhase.java
diffstat 16 files changed, 142 insertions(+), 318 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java	Sat Apr 18 13:44:36 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -29,12 +29,8 @@
 
     public abstract void setRegister(int idx, LIRKind kind);
 
-    public abstract void clearRegister(int idx, LIRKind kind);
-
     public abstract void setStackSlot(int offset, LIRKind kind);
 
-    public abstract void clearStackSlot(int offset, LIRKind kind);
-
     public abstract boolean hasRegisterRefMap();
 
     public abstract boolean hasFrameRefMap();
@@ -42,12 +38,4 @@
     public abstract void appendRegisterMap(StringBuilder sb, RefMapFormatter formatterArg);
 
     public abstract void appendFrameMap(StringBuilder sb, RefMapFormatter formatterArg);
-
-    @Override
-    public abstract ReferenceMap clone();
-
-    /**
-     * Updates this map with all references marked in {@code other}.
-     */
-    public abstract void updateUnion(ReferenceMap other);
 }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Sat Apr 18 13:44:36 2015 +0100
@@ -179,6 +179,17 @@
         return v - 1;
     }
 
+    @Test
+    public void test9() {
+        testCombinedIf("test9Snippet", 2);
+        test("test9Snippet", -1);
+        test("test9Snippet", 1025);
+    }
+
+    public static int test9Snippet(int n) {
+        return (n < 0) ? 1 : (n >= 1024) ? 1024 : n + 1;
+    }
+
     private void testCombinedIf(String snippet, int count) {
         StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
         PhaseContext context = new PhaseContext(getProviders());
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Sat Apr 18 13:44:36 2015 +0100
@@ -49,7 +49,6 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.common.inlining.policy.*;
 import com.oracle.graal.phases.tiers.*;
-import com.oracle.graal.replacements.*;
 
 /**
  * The following unit tests assert the presence of write barriers for both Serial and G1 GCs.
@@ -251,7 +250,6 @@
             StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
             HighTierContext highContext = getDefaultHighTierContext();
             MidTierContext midContext = new MidTierContext(getProviders(), getCodeCache().getTarget(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo(), null);
-            new NodeIntrinsificationPhase(getMetaAccess(), getConstantReflection(), getSnippetReflection(), getProviders().getForeignCalls(), getProviders().getStampProvider()).apply(graph);
             new InliningPhase(new InlineEverythingPolicy(), new CanonicalizerPhase()).apply(graph, highContext);
             new CanonicalizerPhase().apply(graph, highContext);
             new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, highContext);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java	Sat Apr 18 13:44:36 2015 +0100
@@ -128,15 +128,6 @@
             return getEntry(i);
         }
 
-        private boolean isEmpty() {
-            for (int i = 0; i < words.length; i++) {
-                if (words[i] != 0) {
-                    return false;
-                }
-            }
-            return true;
-        }
-
         public void or(HotSpotOopMap src) {
             if (words.length < src.words.length) {
                 long[] newWords = new long[src.words.length];
@@ -224,14 +215,6 @@
             return ((int) (words[wordIndex] >>> shift)) & 0b1111;
         }
 
-        private void clearOop(int offset) {
-            setEntry(offset, 0);
-        }
-
-        private void clearNarrowOop(int offset) {
-            setNarrowEntry(offset, 0);
-        }
-
         @Override
         public boolean equals(Object other) {
             if (this == other) {
@@ -404,58 +387,6 @@
         return registerRefMap == null ? null : (HotSpotOopMap) registerRefMap.clone();
     }
 
-    // clear
-    @Override
-    public void clearRegister(int idx, LIRKind kind) {
-        clear(registerRefMap, idx * 2, kind);
-    }
-
-    @Override
-    public void clearStackSlot(int offset, LIRKind kind) {
-        assert offset % bytesPerElement(kind) == 0 : "unaligned value in ReferenceMap";
-        clear(frameRefMap, offset / 4, kind);
-    }
-
-    private void clear(HotSpotOopMap refMap, int index, LIRKind kind) {
-        int bytesPerElement = bytesPerElement(kind);
-        int length = kind.getPlatformKind().getVectorLength();
-        if (bytesPerElement == 8) {
-            for (int i = 0; i < length; i++) {
-                refMap.clearOop(index + i * 2);
-            }
-        } else if (bytesPerElement == 4) {
-            for (int i = 0; i < length; i++) {
-                refMap.clearNarrowOop(index + i);
-            }
-        } else {
-            assert kind.isValue() : "unknown reference kind " + kind;
-        }
-    }
-
-    @Override
-    public void updateUnion(ReferenceMap otherArg) {
-        HotSpotReferenceMap other = (HotSpotReferenceMap) otherArg;
-        if (registerRefMap != null) {
-            assert other.registerRefMap != null;
-            updateUnionOopMapRaw(registerRefMap, other.registerRefMap);
-        } else {
-            assert other.registerRefMap == null || other.registerRefMap.isEmpty() : "Target register reference map is empty but the source is not: " + other.registerRefMap;
-        }
-        updateUnionOopMapRaw(frameRefMap, other.frameRefMap);
-    }
-
-    /**
-     * Update {@code src} with the union of {@code src} and {@code dst}.
-     *
-     * @see HotSpotReferenceMap#registerRefMap
-     * @see HotSpotReferenceMap#frameRefMap
-     */
-    private static void updateUnionOopMapRaw(HotSpotOopMap dst, HotSpotOopMap src) {
-        assert verifyUpdate(dst, src);
-        dst.or(src);
-        assert verifyUpdate(dst, dst);
-    }
-
     static MapEntry[] entries(HotSpotOopMap fixedMap) {
         MapEntry[] result = new MapEntry[fixedMap.size()];
         for (int idx = 0; idx < fixedMap.size(); idx++) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sat Apr 18 13:44:36 2015 +0100
@@ -404,6 +404,9 @@
                                 }
                                 LoopBeginNode loopBegin = (LoopBeginNode) ((EndNode) merge.next()).merge();
                                 LoopEndNode loopEnd = graph.add(new LoopEndNode(loopBegin));
+                                if (parsingReplacement()) {
+                                    loopEnd.disableSafepoint();
+                                }
                                 endNode.replaceAndDelete(loopEnd);
                             } else if (visited.contains(n)) {
                                 // Normal merge into a branch we are already exploring.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Sat Apr 18 13:44:36 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -162,7 +162,7 @@
     }
 
     /**
-     * Called by the register allocator before {@link #updateUnion} to initialize the frame state.
+     * Called by the register allocator to initialize the frame state.
      *
      * @param frameMap The frame map.
      * @param canHaveRegisters True if there can be any register map entries.
@@ -171,13 +171,6 @@
         debugInfo = new DebugInfo(topFrame, frameMap.initReferenceMap(canHaveRegisters), virtualObjects);
     }
 
-    /**
-     * Updates this reference map with all references that are marked in {@code refMap}.
-     */
-    public void updateUnion(ReferenceMap refMap) {
-        debugInfo.getReferenceMap().updateUnion(refMap);
-    }
-
     @Override
     public String toString() {
         return debugInfo != null ? debugInfo.toString() : topFrame != null ? topFrame.toString() : "<empty>";
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Sat Apr 18 13:44:36 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -30,6 +30,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -102,12 +103,56 @@
         }
     }
 
+    private static final class LiveValueSet implements Iterable<Value> {
+        private static final Object MARKER = new Object();
+
+        private final HashMap<Value, Object> map;
+
+        public LiveValueSet() {
+            map = new HashMap<>();
+        }
+
+        public LiveValueSet(LiveValueSet s) {
+            map = new HashMap<>(s.map);
+        }
+
+        public void put(Value v) {
+            map.put(v, MARKER);
+        }
+
+        public void putAll(LiveValueSet v) {
+            map.putAll(v.map);
+        }
+
+        public void remove(Value v) {
+            map.remove(v);
+        }
+
+        public Iterator<Value> iterator() {
+            return map.keySet().iterator();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof LiveValueSet) {
+                return map.equals(((LiveValueSet) obj).map);
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        public int hashCode() {
+            return map.hashCode();
+        }
+    }
+
     private static final class Marker<T extends AbstractBlockBase<T>> {
         private final LIR lir;
         private final FrameMap frameMap;
         private final RegisterAttributes[] registerAttributes;
-        private final BlockMap<ReferenceMap> liveInMap;
-        private final BlockMap<ReferenceMap> liveOutMap;
+        private final BlockMap<LiveValueSet> liveInMap;
+        private final BlockMap<LiveValueSet> liveOutMap;
 
         private Marker(LIR lir, FrameMap frameMap) {
             this.lir = lir;
@@ -124,7 +169,7 @@
                 worklist.add((T) lir.getControlFlowGraph().getBlocks().get(i));
             }
             for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) {
-                liveInMap.put(block, frameMap.initReferenceMap(true));
+                liveInMap.put(block, new LiveValueSet());
             }
             while (!worklist.isEmpty()) {
                 AbstractBlockBase<T> block = worklist.poll();
@@ -136,9 +181,9 @@
          * Merge outSet with in-set of successors.
          */
         private boolean updateOutBlock(AbstractBlockBase<?> block) {
-            ReferenceMap union = frameMap.initReferenceMap(true);
-            block.getSuccessors().forEach(succ -> union.updateUnion(liveInMap.get(succ)));
-            ReferenceMap outSet = liveOutMap.get(block);
+            LiveValueSet union = new LiveValueSet();
+            block.getSuccessors().forEach(succ -> union.putAll(liveInMap.get(succ)));
+            LiveValueSet outSet = liveOutMap.get(block);
             // check if changed
             if (outSet == null || !union.equals(outSet)) {
                 liveOutMap.put(block, union);
@@ -150,7 +195,7 @@
         private void processBlock(AbstractBlockBase<T> block, UniqueWorkList<T> worklist) {
             if (updateOutBlock(block)) {
                 try (Indent indent = Debug.logAndIndent("handle block %s", block)) {
-                    BlockClosure closure = new BlockClosure(liveOutMap.get(block).clone());
+                    BlockClosure closure = new BlockClosure(new LiveValueSet(liveOutMap.get(block)));
                     List<LIRInstruction> instructions = lir.getLIRforBlock(block);
                     for (int i = instructions.size() - 1; i >= 0; i--) {
                         LIRInstruction inst = instructions.get(i);
@@ -166,13 +211,13 @@
         private static final LIRKind REFERENCE_KIND = LIRKind.reference(Kind.Object);
 
         private final class BlockClosure {
-            private final ReferenceMap currentSet;
+            private final LiveValueSet currentSet;
 
-            private BlockClosure(ReferenceMap set) {
+            private BlockClosure(LiveValueSet set) {
                 currentSet = set;
             }
 
-            private ReferenceMap getCurrentSet() {
+            private LiveValueSet getCurrentSet() {
                 return currentSet;
             }
 
@@ -210,13 +255,12 @@
 
             ValueConsumer useConsumer = new ValueConsumer() {
                 public void visitValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
-                    LIRKind kind = operand.getLIRKind();
-                    if (shouldProcessValue(operand) && !kind.isValue() && !kind.isDerivedReference()) {
+                    if (shouldProcessValue(operand)) {
                         // no need to insert values and derived reference
                         if (Debug.isLogEnabled()) {
                             Debug.log("set operand: %s", operand);
                         }
-                        frameMap.setReference(operand, currentSet);
+                        currentSet.put(operand);
                     }
                 }
             };
@@ -227,7 +271,7 @@
                         if (Debug.isLogEnabled()) {
                             Debug.log("clear operand: %s", operand);
                         }
-                        frameMap.clearReference(operand, currentSet);
+                        currentSet.remove(operand);
                     } else {
                         assert isIllegal(operand) || operand.getPlatformKind() != Kind.Illegal || mode == OperandMode.TEMP : String.format(
                                         "Illegal PlatformKind is only allowed for TEMP mode: %s, %s", operand, mode);
@@ -243,11 +287,23 @@
         /**
          * This method does the actual marking.
          */
-        private void markLocation(LIRInstruction op, LIRFrameState info, ReferenceMap refMap) {
+        private void markLocation(LIRInstruction op, LIRFrameState info, LiveValueSet values) {
             if (!info.hasDebugInfo()) {
                 info.initDebugInfo(frameMap, !op.destroysCallerSavedRegisters() || !frameMap.getRegisterConfig().areAllAllocatableRegistersCallerSaved());
             }
-            info.updateUnion(refMap);
+
+            try (Scope s = Debug.scope("markLocation", op)) {
+                ReferenceMap refMap = info.debugInfo().getReferenceMap();
+                for (Value v : values) {
+                    try (Scope x = Debug.scope("loop", v)) {
+                        frameMap.setReference(v, refMap);
+                    } catch (Throwable e) {
+                        throw Debug.handle(e);
+                    }
+                }
+            } catch (Throwable e) {
+                throw Debug.handle(e);
+            }
         }
 
         /**
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java	Sat Apr 18 13:44:36 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -347,16 +347,4 @@
             assert isConstant(location);
         }
     }
-
-    public void clearReference(Value location, ReferenceMap refMap) {
-        LIRKind kind = location.getLIRKind();
-        if (isRegister(location)) {
-            refMap.clearRegister(asRegister(location).getReferenceMapIndex(), kind);
-        } else if (isStackSlot(location)) {
-            int offset = offsetForStackSlot(asStackSlot(location));
-            refMap.clearStackSlot(offset, kind);
-        } else {
-            assert isConstant(location);
-        }
-    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Sat Apr 18 13:44:36 2015 +0100
@@ -340,7 +340,12 @@
             EndNode end1 = (EndNode) next1;
             EndNode end2 = (EndNode) next2;
             if (end1.merge() == end2.merge()) {
-                // They go to the same MergeNode
+                for (PhiNode phi : end1.merge().phis()) {
+                    if (phi.valueAt(end1) != phi.valueAt(end2)) {
+                        return false;
+                    }
+                }
+                // They go to the same MergeNode and merge the same values
                 return true;
             }
         } else if (next1 instanceof DeoptimizeNode && next2 instanceof DeoptimizeNode) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Sat Apr 18 13:44:36 2015 +0100
@@ -59,15 +59,6 @@
     void registerSnippet(ResolvedJavaMethod method);
 
     /**
-     * Notifies this object during snippet specialization once the specialized snippet's constant
-     * parameters have been replaced with constant values.
-     *
-     * @param specializedSnippet the snippet in the process of being specialized. This is a copy of
-     *            the unspecialized snippet graph created during snippet preparation.
-     */
-    void notifyAfterConstantsBound(StructuredGraph specializedSnippet);
-
-    /**
      * Gets a graph that is a substitution for a given method.
      *
      * @param invokeBci the call site BCI if this request is made for inlining a substitute
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Sat Apr 18 13:44:36 2015 +0100
@@ -29,6 +29,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
@@ -56,6 +57,21 @@
         this.structuralInputType = metaAccess.lookupJavaType(StructuralInput.class);
     }
 
+    /**
+     * Calls in replacements to methods matching one of these filters are elided. Only void methods
+     * are considered for elision. The use of "snippets" in name of the variable and system property
+     * is purely for legacy reasons.
+     */
+    private static final MethodFilter[] MethodsElidedInSnippets = getMethodsElidedInSnippets();
+
+    private static MethodFilter[] getMethodsElidedInSnippets() {
+        String commaSeparatedPatterns = System.getProperty("graal.MethodsElidedInSnippets");
+        if (commaSeparatedPatterns != null) {
+            return MethodFilter.parse(commaSeparatedPatterns);
+        }
+        return null;
+    }
+
     public boolean apply(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
         if (b.parsingReplacement() && wordOperationPlugin.apply(b, method, args)) {
             return true;
@@ -93,6 +109,13 @@
                     }
                     return true;
                 }
+            } else if (MethodsElidedInSnippets != null) {
+                if (MethodFilter.matches(MethodsElidedInSnippets, method)) {
+                    if (method.getSignature().getReturnKind() != Kind.Void) {
+                        throw new GraalInternalError("Cannot elide non-void method " + method.format("%H.%n(%p)"));
+                    }
+                    return true;
+                }
             }
         }
         return false;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationVerificationPhase.java	Sat Apr 18 13:44:13 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.graal.replacements;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.Node.ConstantNodeParameter;
-import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.phases.*;
-
-/**
- * Checks that a graph contains no calls to {@link NodeIntrinsic} or {@link Fold} methods.
- */
-public class NodeIntrinsificationVerificationPhase extends Phase {
-
-    public static void verify(StructuredGraph graph) {
-        new NodeIntrinsificationVerificationPhase().apply(graph);
-    }
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        for (MethodCallTargetNode n : graph.getNodes(MethodCallTargetNode.TYPE)) {
-            checkInvoke(n);
-        }
-    }
-
-    private static void checkInvoke(MethodCallTargetNode n) {
-        ResolvedJavaMethod target = n.targetMethod();
-        if (target.getAnnotation(Node.NodeIntrinsic.class) != null) {
-            error(n, "Intrinsification");
-        } else if (target.getAnnotation(Fold.class) != null) {
-            error(n, "Folding");
-        }
-    }
-
-    private static void error(MethodCallTargetNode n, String failedAction) throws GraalInternalError {
-        String context = n.graph().method().format("%H.%n");
-        String target = n.invoke().callTarget().targetName();
-        throw new GraalInternalError(failedAction + " of call to '" + target + "' in '" + context + "' failed, most likely due to a parameter annotated with @" +
-                        ConstantNodeParameter.class.getSimpleName() + " not being resolvable to a constant during compilation");
-    }
-}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sat Apr 18 13:44:36 2015 +0100
@@ -38,7 +38,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
@@ -64,7 +63,6 @@
     public final Providers providers;
     public final SnippetReflectionProvider snippetReflection;
     public final TargetDescription target;
-    public final NodeIntrinsificationPhase nodeIntrinsificationPhase;
     private GraphBuilderConfiguration.Plugins graphBuilderPlugins;
 
     /**
@@ -78,7 +76,7 @@
     }
 
     protected boolean hasGenericInvocationPluginAnnotation(ResolvedJavaMethod method) {
-        return nodeIntrinsificationPhase.getIntrinsic(method) != null || method.getAnnotation(Word.Operation.class) != null || nodeIntrinsificationPhase.isFoldable(method);
+        return method.getAnnotation(Node.NodeIntrinsic.class) != null || method.getAnnotation(Word.Operation.class) != null || method.getAnnotation(Fold.class) != null;
     }
 
     private static final int MAX_GRAPH_INLINING_DEPTH = 100; // more than enough
@@ -112,7 +110,7 @@
             // Force inlining when parsing replacements
             return new InlineInfo(method, true, true);
         } else {
-            assert nodeIntrinsificationPhase.getIntrinsic(method) == null : String.format("@%s method %s must only be called from within a replacement%n%s", NodeIntrinsic.class.getSimpleName(),
+            assert method.getAnnotation(NodeIntrinsic.class) == null : String.format("@%s method %s must only be called from within a replacement%n%s", NodeIntrinsic.class.getSimpleName(),
                             method.format("%h.%n"), b);
         }
         return null;
@@ -265,7 +263,6 @@
         this.target = target;
         this.graphs = new ConcurrentHashMap<>();
         this.snippetTemplateCache = CollectionsFactory.newMap();
-        this.nodeIntrinsificationPhase = createNodeIntrinsificationPhase();
     }
 
     private static final boolean UseSnippetGraphCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetGraphCache", "true"));
@@ -320,20 +317,6 @@
     }
 
     @Override
-    public void notifyAfterConstantsBound(StructuredGraph specializedSnippet) {
-
-        // Do deferred intrinsification of node intrinsics
-
-        nodeIntrinsificationPhase.apply(specializedSnippet);
-        new CanonicalizerPhase().apply(specializedSnippet, new PhaseContext(providers));
-        NodeIntrinsificationVerificationPhase.verify(specializedSnippet);
-    }
-
-    protected NodeIntrinsificationPhase createNodeIntrinsificationPhase() {
-        return new NodeIntrinsificationPhase(providers.getMetaAccess(), providers.getConstantReflection(), snippetReflection, providers.getForeignCalls(), providers.getStampProvider());
-    }
-
-    @Override
     public StructuredGraph getSubstitution(ResolvedJavaMethod original, boolean fromBytecodeOnly, int invokeBci) {
         ResolvedJavaMethod substitute = null;
         if (!fromBytecodeOnly) {
@@ -491,20 +474,6 @@
     }
 
     /**
-     * Calls in snippets to methods matching one of these filters are elided. Only void methods are
-     * considered for elision.
-     */
-    private static final MethodFilter[] MethodsElidedInSnippets = getMethodsElidedInSnippets();
-
-    private static MethodFilter[] getMethodsElidedInSnippets() {
-        String commaSeparatedPatterns = System.getProperty("graal.MethodsElidedInSnippets");
-        if (commaSeparatedPatterns != null) {
-            return MethodFilter.parse(commaSeparatedPatterns);
-        }
-        return null;
-    }
-
-    /**
      * Creates and preprocesses a graph for a replacement.
      */
     public static class GraphMaker {
@@ -558,10 +527,6 @@
          * Does final processing of a snippet graph.
          */
         protected void finalizeGraph(StructuredGraph graph) {
-            replacements.nodeIntrinsificationPhase.apply(graph);
-            if (!SnippetTemplate.hasConstantParameter(method)) {
-                NodeIntrinsificationVerificationPhase.verify(graph);
-            }
             int sideEffectCount = 0;
             assert (sideEffectCount = graph.getNodes().filter(e -> hasSideEffect(e)).count()) >= 0;
             new ConvertDeoptimizeToGuardPhase().apply(graph, null);
@@ -612,20 +577,15 @@
         }
 
         private StructuredGraph parseGraph(final ResolvedJavaMethod methodToParse, Object[] args) {
-            StructuredGraph graph = args == null ? replacements.graphCache.get(methodToParse) : null;
+            assert methodToParse.hasBytecodes() : methodToParse;
+            if (args != null) {
+                return buildInitialGraph(methodToParse, args);
+            }
+            StructuredGraph graph = replacements.graphCache.get(methodToParse);
             if (graph == null) {
-                StructuredGraph newGraph = null;
-                try (Scope s = Debug.scope("ParseGraph", methodToParse)) {
-                    newGraph = buildGraph(methodToParse, args);
-                } catch (Throwable e) {
-                    throw Debug.handle(e);
-                }
-                if (args == null) {
-                    replacements.graphCache.putIfAbsent(methodToParse, newGraph);
-                    graph = replacements.graphCache.get(methodToParse);
-                } else {
-                    graph = newGraph;
-                }
+                StructuredGraph newGraph = buildInitialGraph(methodToParse, args);
+                replacements.graphCache.putIfAbsent(methodToParse, newGraph);
+                graph = replacements.graphCache.get(methodToParse);
                 assert graph != null;
             }
             return graph;
@@ -645,17 +605,12 @@
             try (Scope s = Debug.scope("buildInitialGraph", graph)) {
                 MetaAccessProvider metaAccess = replacements.providers.getMetaAccess();
 
-                if (MethodsElidedInSnippets != null && methodToParse.getSignature().getReturnKind() == Kind.Void && MethodFilter.matches(MethodsElidedInSnippets, methodToParse)) {
-                    graph.addAfterFixed(graph.start(), graph.add(new ReturnNode(null)));
-                } else {
-                    Plugins plugins = new Plugins(replacements.graphBuilderPlugins);
-                    GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins);
-                    if (args != null) {
-                        plugins.setParameterPlugin(new ConstantBindingParameterPlugin(args, plugins.getParameterPlugin(), metaAccess, replacements.snippetReflection));
-                    }
-                    createGraphBuilder(metaAccess, replacements.providers.getStampProvider(), replacements.providers.getConstantReflection(), config, OptimisticOptimizations.NONE).apply(graph);
+                Plugins plugins = new Plugins(replacements.graphBuilderPlugins);
+                GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins);
+                if (args != null) {
+                    plugins.setParameterPlugin(new ConstantBindingParameterPlugin(args, plugins.getParameterPlugin(), metaAccess, replacements.snippetReflection));
                 }
-                afterParsing(graph);
+                createGraphBuilder(metaAccess, replacements.providers.getStampProvider(), replacements.providers.getConstantReflection(), config, OptimisticOptimizations.NONE).apply(graph);
 
                 if (OptCanonicalizer.getValue()) {
                     new CanonicalizerPhase().apply(graph, new PhaseContext(replacements.providers));
@@ -679,56 +634,6 @@
             }
             return new GraphBuilderPhase.Instance(metaAccess, stampProvider, constantReflection, graphBuilderConfig, optimisticOpts, initialReplacementContext);
         }
-
-        /**
-         * @param graph
-         */
-        protected void afterParsing(StructuredGraph graph) {
-        }
-
-        protected Object beforeInline(@SuppressWarnings("unused") MethodCallTargetNode callTarget, @SuppressWarnings("unused") StructuredGraph callee) {
-            return null;
-        }
-
-        /**
-         * Called after a graph is inlined.
-         *
-         * @param caller the graph into which {@code callee} was inlined
-         * @param callee the graph that was inlined into {@code caller}
-         * @param beforeInlineData value returned by {@link #beforeInline}.
-         */
-        protected void afterInline(StructuredGraph caller, StructuredGraph callee, Object beforeInlineData) {
-            if (OptCanonicalizer.getValue()) {
-                new CanonicalizerPhase().apply(caller, new PhaseContext(replacements.providers));
-            }
-        }
-
-        /**
-         * Called after all inlining for a given graph is complete.
-         */
-        protected void afterInlining(StructuredGraph graph) {
-            replacements.nodeIntrinsificationPhase.apply(graph);
-            new DeadCodeEliminationPhase(Optional).apply(graph);
-            if (OptCanonicalizer.getValue()) {
-                new CanonicalizerPhase().apply(graph, new PhaseContext(replacements.providers));
-            }
-        }
-
-        private StructuredGraph buildGraph(final ResolvedJavaMethod methodToParse, Object[] args) {
-            assert methodToParse.hasBytecodes() : methodToParse;
-            final StructuredGraph graph = buildInitialGraph(methodToParse, args);
-            try (Scope s = Debug.scope("buildGraph", graph)) {
-
-                for (LoopEndNode end : graph.getNodes(LoopEndNode.TYPE)) {
-                    end.disableSafepoint();
-                }
-
-                new DeadCodeEliminationPhase(Required).apply(graph);
-            } catch (Throwable e) {
-                throw Debug.handle(e);
-            }
-            return graph;
-        }
     }
 
     private static String originalName(Method substituteMethod, String methodSubstitution) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sat Apr 18 13:44:13 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sat Apr 18 13:44:36 2015 +0100
@@ -612,9 +612,6 @@
         snippetCopy.addDuplicates(snippetGraph.getNodes(), snippetGraph, snippetGraph.getNodeCount(), nodeReplacements);
 
         Debug.dump(snippetCopy, "Before specialization");
-        if (!nodeReplacements.isEmpty()) {
-            providers.getReplacements().notifyAfterConstantsBound(snippetCopy);
-        }
 
         // Gather the template parameters
         parameters = new Object[parameterCount];
--- a/src/cpu/sparc/vm/sparc.ad	Sat Apr 18 13:44:13 2015 +0100
+++ b/src/cpu/sparc/vm/sparc.ad	Sat Apr 18 13:44:36 2015 +0100
@@ -6355,17 +6355,18 @@
   ins_pipe(iload_mem);
 %}
 
-// Use BIS instruction to prefetch for allocation.
+// Use PREFETCHA instruction to prefetch for allocation.
 // Could fault, need space at the end of TLAB.
 instruct prefetchAlloc_bis( iRegP dst ) %{
   predicate(AllocatePrefetchInstr == 1);
   match( PrefetchAllocation dst );
   ins_cost(MEMORY_REF_COST);
   size(4);
-
-  format %{ "STXA   [$dst]\t! // Prefetch allocation using BIS" %}
-  ins_encode %{
-    __ stxa(G0, $dst$$Register, G0, Assembler::ASI_ST_BLKINIT_PRIMARY);
+  // Using prefetcha insteadof stxa. Because stxa does write to the tlab 32 bytes with zero, which leads to an overzero of 
+  // TLAB which triggers assertion error in ThreadLocalAllocBuffer::clear_before_allocation
+  format %{ "PREFETCHA   [$dst] #ASI_BLK_INIT_QUAD_LDD_P, severalWritesAndPossiblyReads\t! // Prefetch allocation using PREFETCHA" %}
+  ins_encode %{
+    __ prefetcha($dst$$Register, G0, Assembler::ASI_ST_BLKINIT_PRIMARY,  Assembler::severalWritesAndPossiblyReads);
   %}
   ins_pipe(istore_mem_reg);
 %}
--- a/src/share/vm/adlc/Doc/Syntax.doc	Sat Apr 18 13:44:13 2015 +0100
+++ b/src/share/vm/adlc/Doc/Syntax.doc	Sat Apr 18 13:44:36 2015 +0100
@@ -33,7 +33,7 @@
 the architecture of a processor, and is the input to the ADL Compiler.  The
 ADL Compiler compiles an ADL file into code which is incorporated into the
 Optimizing Just In Time Compiler (OJIT) to generate efficient and correct code
-for the target architecture.  The ADL describes three bassic different types
+for the target architecture.  The ADL describes three basic different types
 of architectural features.  It describes the instruction set (and associated
 operands) of the target architecture.  It describes the register set of the
 target architecture along with relevant information for the register allocator.