# HG changeset patch # User Lukas Stadler # Date 1345468891 -7200 # Node ID fd8832ae511d58a1af893954e076e11821e0377b # Parent c241963cda6dc507baac3fa636d809d95978cc74 removed artifacts of defunct type system diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Aug 20 15:21:31 2012 +0200 @@ -35,7 +35,6 @@ import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition; import com.oracle.graal.compiler.schedule.*; import com.oracle.graal.compiler.target.*; -import com.oracle.graal.compiler.types.*; import com.oracle.graal.debug.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; @@ -117,10 +116,6 @@ new ComputeProbabilityPhase().apply(graph); } - if (GraalOptions.PropagateTypes) { - new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); - } - if (GraalOptions.OptCanonicalizer) { new CanonicalizerPhase(target, runtime, assumptions).apply(graph); } @@ -132,10 +127,6 @@ if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) { new InliningPhase(target, runtime, null, assumptions, cache, plan, optimisticOpts).apply(graph); - if (GraalOptions.PropagateTypes) { - new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); - } - if (GraalOptions.OptCanonicalizer) { new CanonicalizerPhase(target, runtime, assumptions).apply(graph); } @@ -188,10 +179,6 @@ } } - if (GraalOptions.PropagateTypes) { - new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); - } - if (GraalOptions.OptLoopTransform) { new LoopTransformLowPhase().apply(graph); } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java Mon Aug 20 15:21:31 2012 +0200 @@ -171,7 +171,6 @@ public static boolean AssumeVerifiedBytecode = true; // Code generator settings - public static boolean PropagateTypes = ____; public static boolean CheckCastElimination = true; public static boolean CullFrameStates = ____; public static boolean UseProfilingInformation = true; diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateObjectTypeFeedback.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateObjectTypeFeedback.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.compiler.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.spi.types.*; - - -public class NegateObjectTypeFeedback implements ObjectTypeFeedbackTool { - - private final ObjectTypeFeedbackTool delegate; - - public NegateObjectTypeFeedback(ObjectTypeFeedbackTool delegate) { - this.delegate = delegate; - } - - @Override - public void constantBound(Condition condition, Constant constant) { - delegate.constantBound(condition.negate(), constant); - } - - @Override - public void valueBound(Condition condition, ValueNode otherValue) { - delegate.valueBound(condition.negate(), otherValue); - } - - @Override - public void declaredType(ResolvedJavaType type, boolean nonNull) { - delegate.notDeclaredType(type, nonNull); - } - - @Override - public void exactType(ResolvedJavaType type) { - delegate.notExactType(type); - } - - @Override - public void notDeclaredType(ResolvedJavaType type, boolean includesNull) { - delegate.declaredType(type, includesNull); - } - - @Override - public void notExactType(ResolvedJavaType type) { - delegate.exactType(type); - } - -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateScalarTypeFeedback.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateScalarTypeFeedback.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.compiler.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.spi.types.*; - - -public class NegateScalarTypeFeedback implements ScalarTypeFeedbackTool { - - private final ScalarTypeFeedbackTool delegate; - - public NegateScalarTypeFeedback(ScalarTypeFeedbackTool delegate) { - this.delegate = delegate; - } - - @Override - public void constantBound(Condition condition, Constant constant) { - delegate.constantBound(condition.negate(), constant); - } - - @Override - public void valueBound(Condition condition, ValueNode otherValue, ScalarTypeQuery type) { - delegate.valueBound(condition.negate(), otherValue, type); - } - - @Override - public void setTranslated(Constant delta, ScalarTypeQuery old) { - throw new UnsupportedOperationException(); - } -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/PropagateTypeCachePhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/PropagateTypeCachePhase.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.compiler.types; - -import java.io.*; -import java.util.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.compiler.phases.*; -import com.oracle.graal.compiler.schedule.*; -import com.oracle.graal.debug.*; -import com.oracle.graal.graph.Graph.InputChangedListener; -import com.oracle.graal.graph.*; -import com.oracle.graal.lir.cfg.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.spi.types.*; -import com.oracle.graal.nodes.spi.types.TypeCanonicalizable.Result; - -public class PropagateTypeCachePhase extends Phase { - - private static final boolean DUMP = false; - - private final TargetDescription target; - private final CodeCacheProvider runtime; - private final Assumptions assumptions; - - private StructuredGraph currentGraph; - private SchedulePhase schedule; - - private TypeFeedbackChanged changed = new TypeFeedbackChanged(); - private static PrintStream out = System.out; - - private int changes = 0; - -// private static int totalChanges = 0; -// -// static { -// Runtime.getRuntime().addShutdownHook(new Thread() { -// @Override -// public void run() { -// System.out.println("Total changes: " + totalChanges); -// } -// }); -// } - - public PropagateTypeCachePhase(TargetDescription target, CodeCacheProvider runtime, Assumptions assumptions) { - this.target = target; - this.runtime = runtime; - this.assumptions = assumptions; - } - - @Override - protected void run(StructuredGraph graph) { - -// if (!graph.method().holder().name().contains("IntegerAddNode") || !graph.method().name().equals("canonical")) { -// return; -// } - -// if (!graph.method().name().equals("notifySourceElementRequestor")) { -// return; -// } - -// if (graph.method().holder().name().contains("jj_3R_75")) { -// return; -// } - - this.currentGraph = graph; - new DeadCodeEliminationPhase().apply(graph); - - for (GuardNode guard : graph.getNodes(GuardNode.class)) { - if (guard.condition() != null && guard.condition().usages().size() > 1) { - BooleanNode clone = (BooleanNode) guard.condition().copyWithInputs(); - if (DUMP) { - out.println("replaced!! " + clone); - } - guard.setCondition(clone); - } - } - for (FixedGuardNode guard : graph.getNodes(FixedGuardNode.class)) { - BooleanNode condition = guard.condition(); - if (condition != null && condition.usages().size() > 1) { - BooleanNode clone = (BooleanNode) condition.copyWithInputs(); - if (DUMP) { - out.println("replaced!! " + clone); - } - guard.setCondition(clone); - } - } - - - schedule = new SchedulePhase(); - schedule.apply(graph); - - final NodeBitMap changedNodes = graph.createNodeBitMap(true); - graph.trackInputChange(new InputChangedListener() { - @Override - public void inputChanged(Node node) { - changedNodes.mark(node); - } - }); - - new Iterator().apply(schedule.getCFG().getStartBlock()); - - graph.stopTrackingInputChange(); - - Debug.dump(graph, "After PropagateType iteration"); - if (changes > 0) { -// totalChanges += changes; -// out.println(graph.method() + ": " + changes + " changes"); - } - - new CanonicalizerPhase(target, runtime, assumptions, changedNodes, null).apply(graph); - -// outputGraph(graph); - } - - public void outputGraph(StructuredGraph graph) { - SchedulePhase printSchedule = new SchedulePhase(); - printSchedule.apply(graph); - for (Block block : printSchedule.getCFG().getBlocks()) { - System.out.print("Block " + block + " "); - if (block == printSchedule.getCFG().getStartBlock()) { - out.print("* "); - } - System.out.print("-> "); - for (Block succ : block.getSuccessors()) { - out.print(succ + " "); - } - System.out.println(); - for (Node node : printSchedule.getBlockToNodesMap().get(block)) { - out.println(" " + node + " (" + node.usages().size() + ")"); - } - } - } - - private class Iterator extends PostOrderBlockIterator { - - private final HashMap caches = new HashMap<>(); - - @Override - protected void block(Block block) { - if (DUMP) { - out.println("======= block B" + block.getId()); - } - final TypeFeedbackCache cache; - if (block.getPredecessors().isEmpty()) { - cache = new TypeFeedbackCache(runtime, currentGraph, changed); - } else { - if (block.getPredecessors().size() == 1) { - cache = caches.get(block.getPredecessors().get(0)).clone(); - Node lastInstruction = block.getPredecessors().get(0).getEndNode(); - if (lastInstruction instanceof ControlSplitNode && lastInstruction instanceof SplitTypeFeedbackProvider) { - ControlSplitNode split = (ControlSplitNode) lastInstruction; - int successorIndex = -1; - for (int i = 0; i < split.blockSuccessorCount(); i++) { - if (split.blockSuccessor(i) == block.getBeginNode()) { - successorIndex = i; - break; - } - } - assert successorIndex != -1; - changed.node = block.getBeginNode(); - ((SplitTypeFeedbackProvider) split).typeFeedback(successorIndex, cache); - if (DUMP) { - out.println("split (edge " + successorIndex + ") " + split + ": " + cache); - } - changed.node = null; - } - } else { - TypeFeedbackCache[] cacheList = new TypeFeedbackCache[block.getPredecessors().size()]; - MergeNode merge = (MergeNode) block.getBeginNode(); - for (int i = 0; i < block.getPredecessors().size(); i++) { - Block predecessor = block.getPredecessors().get(i); - TypeFeedbackCache other = caches.get(predecessor); - int endIndex = merge.forwardEndIndex((EndNode) predecessor.getEndNode()); - cacheList[endIndex] = other; - } - changed.node = merge; - cache = TypeFeedbackCache.meet(cacheList, merge.phis()); - changed.node = null; - if (DUMP) { - out.println("merge " + merge + ": " + cache); - } - } - } - processNodes(block, cache); - } - - private void processNodes(Block block, TypeFeedbackCache cache) { - for (Node node : schedule.nodesFor(block)) { - if (node.isAlive()) { - if (DUMP) { - out.println(node); - } - if (node instanceof TypeCanonicalizable) { - Result canonical = ((TypeCanonicalizable) node).canonical(cache); - - if (canonical != null) { - changes++; -// System.out.print("!"); - if (DUMP) { - out.println("TypeCanonicalizable: replacing " + node + " with " + canonical); - } - if (canonical.dependencies.length > 0) { - for (Node usage : node.usages()) { - if (usage instanceof ValueNode) { - for (ValueNode dependency : canonical.dependencies) { - // TODO(lstadler) dead dependencies should be handled differently - if (dependency.isAlive()) { - ((ValueNode) usage).dependencies().add(dependency); - } - } - } - } - } - ValueNode replacement = canonical.replacement; - if (node instanceof FloatingNode) { - currentGraph.replaceFloating((FloatingNode) node, replacement); - } else { - assert node instanceof FixedWithNextNode; - currentGraph.replaceFixed((FixedWithNextNode) node, replacement); - } - } - } - if (node.isAlive() && node instanceof TypeFeedbackProvider) { - changed.node = (ValueNode) node; - ((TypeFeedbackProvider) node).typeFeedback(cache); - if (DUMP) { - out.println(" " + cache); - } - changed.node = null; - } - } - } - caches.put(block, cache); - } - - @Override - protected void loopHeaderInitial(Block block) { - if (DUMP) { - out.println("======= loop block B" + block.getId()); - } - assert block.getPredecessors().get(0) == block.getDominator(); - TypeFeedbackCache cache = caches.get(block.getPredecessors().get(0)).clone(); - processNodes(block, cache); - } - - @Override - protected boolean loopHeader(Block block, int loopVisitedCount) { - if (DUMP) { - out.println("======= loop again block B" + block.getId()); - } - if (loopVisitedCount == 1) { - TypeFeedbackCache[] cacheList = new TypeFeedbackCache[block.getPredecessors().size()]; - LoopBeginNode loop = (LoopBeginNode) block.getBeginNode(); - for (int i = 0; i < block.getPredecessors().size(); i++) { - Block predecessor = block.getPredecessors().get(i); - TypeFeedbackCache other = caches.get(predecessor); - int endIndex; - if (loop.forwardEnd() == predecessor.getEndNode()) { - endIndex = 0; - } else { - endIndex = loop.orderedLoopEnds().indexOf(predecessor.getEndNode()) + 1; - assert endIndex != 0; - } - cacheList[endIndex] = other; - } - TypeFeedbackCache cache = TypeFeedbackCache.meet(cacheList, loop.phis()); - if (DUMP) { - out.println("loop merge " + loop + ": " + cache); - } - processNodes(block, cache); - return true; - } else { - return false; - } - } - } - -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/TypeFeedbackCache.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/TypeFeedbackCache.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.compiler.types; - -import java.util.*; -import java.util.Map.Entry; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.types.*; - -public class TypeFeedbackCache implements TypeFeedbackTool, Cloneable { - - public static final boolean NO_OBJECT_TYPES = false; - public static final boolean NO_SCALAR_TYPES = false; - - private final CodeCacheProvider runtime; - private final StructuredGraph graph; - private final HashMap scalarTypeFeedback; - private final HashMap objectTypeFeedback; - private final TypeFeedbackChanged changed; - private final boolean negated; - - public TypeFeedbackCache(CodeCacheProvider runtime, StructuredGraph graph, TypeFeedbackChanged changed) { - this.runtime = runtime; - this.graph = graph; - scalarTypeFeedback = new HashMap<>(); - objectTypeFeedback = new HashMap<>(); - negated = false; - this.changed = changed; - } - - public TypeFeedbackCache(CodeCacheProvider runtime, StructuredGraph graph, HashMap scalarTypeFeedback, HashMap objectTypeFeedback, boolean negated, TypeFeedbackChanged changed) { - this.runtime = runtime; - this.graph = graph; - this.scalarTypeFeedback = scalarTypeFeedback; - this.objectTypeFeedback = objectTypeFeedback; - this.negated = negated; - this.changed = changed; - } - - @Override - public ScalarTypeFeedbackTool addScalar(ValueNode value) { - assert value.kind() == Kind.Int || value.kind() == Kind.Long || value.kind() == Kind.Float || value.kind() == Kind.Double; - ScalarTypeFeedbackStore result = scalarTypeFeedback.get(value); - if (result == null) { - if (value.stamp().scalarType() != null) { - result = value.stamp().scalarType().store().clone(); - } else { - result = new ScalarTypeFeedbackStore(value.kind(), changed); - } - scalarTypeFeedback.put(value, result); - } - return negated ? new NegateScalarTypeFeedback(result) : result; - } - - @Override - public ObjectTypeFeedbackTool addObject(ValueNode value) { - assert value.kind() == Kind.Object; - ObjectTypeFeedbackStore result = objectTypeFeedback.get(value); - if (result == null) { - if (value.stamp().objectType() != null) { - result = value.stamp().objectType().store().clone(); - } else { - result = new ObjectTypeFeedbackStore(changed); - } - objectTypeFeedback.put(value, result); - } - return negated ? new NegateObjectTypeFeedback(result) : result; - } - - @Override - public TypeFeedbackTool negate() { - return new TypeFeedbackCache(runtime, graph, scalarTypeFeedback, objectTypeFeedback, !negated, changed); - } - - @Override - public CodeCacheProvider runtime() { - return runtime; - } - - @Override - public TypeFeedbackCache clone() { - return new TypeFeedbackCache(runtime, graph, deepClone(scalarTypeFeedback), deepClone(objectTypeFeedback), negated, changed); - } - - @SuppressWarnings("unchecked") - private static HashMap deepClone(HashMap map) { - HashMap result = new HashMap<>(); - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() == null) { - System.out.println(entry.getKey()); - } else { - result.put(entry.getKey(), (ValueT) entry.getValue().clone()); - } - } - return result; - } - - @Override - public String toString() { - StringBuilder str = new StringBuilder().append("types [\n"); - for (Map.Entry entry : scalarTypeFeedback.entrySet()) { - if (!entry.getValue().isEmpty()) { - str.append(" ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\n"); - } - } - for (Map.Entry entry : objectTypeFeedback.entrySet()) { - if (!entry.getValue().isEmpty()) { - str.append(" ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\n"); - } - } - str.setLength(str.length() - 1); - return str.append(" ]").toString(); - } - - public static TypeFeedbackCache meet(TypeFeedbackCache[] cacheList, Iterable phis) { - TypeFeedbackCache result = new TypeFeedbackCache(cacheList[0].runtime, cacheList[0].graph, cacheList[0].changed); - - for (int i = 1; i < cacheList.length; i++) { - assert result.runtime == cacheList[i].runtime; - assert !result.negated && !cacheList[i].negated : "cannot meet negated type feedback caches"; - } - - // meet the scalar types - for (Entry entry : cacheList[0].scalarTypeFeedback.entrySet()) { - ScalarTypeFeedbackStore[] types = new ScalarTypeFeedbackStore[cacheList.length]; - for (int i = 0; i < cacheList.length; i++) { - types[i] = cacheList[i].scalarTypeFeedback.get(entry.getKey()); - } - ScalarTypeFeedbackStore scalar = ScalarTypeFeedbackStore.meet(types); - if (scalar != null && !scalar.isEmpty()) { - result.scalarTypeFeedback.put(entry.getKey(), scalar); - } - } - // meet the object types - for (Entry entry : cacheList[0].objectTypeFeedback.entrySet()) { - ObjectTypeFeedbackStore[] types = new ObjectTypeFeedbackStore[cacheList.length]; - for (int i = 0; i < cacheList.length; i++) { - types[i] = cacheList[i].objectTypeFeedback.get(entry.getKey()); - } - ObjectTypeFeedbackStore object = ObjectTypeFeedbackStore.meet(types); - if (object != null && !object.isEmpty()) { - result.objectTypeFeedback.put(entry.getKey(), object); - } - } - // meet the phi nodes - for (PhiNode phi : phis) { - assert phi.valueCount() == cacheList.length; - if (phi.kind() == Kind.Int || phi.kind() == Kind.Long) { - ScalarTypeFeedbackStore[] types = new ScalarTypeFeedbackStore[phi.valueCount()]; - for (int i = 0; i < phi.valueCount(); i++) { - ScalarTypeFeedbackStore other = cacheList[i].scalarTypeFeedback.get(phi.valueAt(i)); - if (other == null && phi.valueAt(i).stamp().scalarType() != null) { - other = phi.valueAt(i).stamp().scalarType().store(); - } - types[i] = other; - } - ScalarTypeFeedbackStore scalar = ScalarTypeFeedbackStore.meet(types); - if (scalar != null && !scalar.isEmpty()) { - result.scalarTypeFeedback.put(phi, scalar); -// phi.setStamp(StampFactory.forKind(phi.kind(), scalar.query(), null)); - } - } else if (phi.kind() == Kind.Object) { - ObjectTypeFeedbackStore[] types = new ObjectTypeFeedbackStore[phi.valueCount()]; - for (int i = 0; i < phi.valueCount(); i++) { - ObjectTypeFeedbackStore other = cacheList[i].objectTypeFeedback.get(phi.valueAt(i)); - if (other == null && phi.valueAt(i).stamp().objectType() != null) { - other = phi.valueAt(i).stamp().objectType().store(); - } - types[i] = other; - } - ObjectTypeFeedbackStore object = ObjectTypeFeedbackStore.meet(types); - if (object != null && !object.isEmpty()) { - result.objectTypeFeedback.put(phi, object); -// phi.setStamp(StampFactory.forKind(phi.kind(), null, object.query())); - } - } - } - return result; - } - - @Override - public ScalarTypeQuery queryScalar(ValueNode value) { - assert value.kind() == Kind.Int || value.kind() == Kind.Long || value.kind() == Kind.Float || value.kind() == Kind.Double; - if (NO_SCALAR_TYPES) { - return new ScalarTypeFeedbackStore(value.kind(), changed).query(); - } - ScalarTypeFeedbackStore result = scalarTypeFeedback.get(value); - if (result == null) { - if (value.stamp().scalarType() != null) { - return value.stamp().scalarType(); - } - result = new ScalarTypeFeedbackStore(value.kind(), changed); - scalarTypeFeedback.put(value, result); - } - return result.query(); - } - - @Override - public ObjectTypeQuery queryObject(ValueNode value) { - assert value != null; - assert value.kind() == Kind.Object; - if (NO_OBJECT_TYPES) { - return new ObjectTypeFeedbackStore(changed).query(); - } - ObjectTypeFeedbackStore result = objectTypeFeedback.get(value); - if (result == null) { - if (value.stamp().objectType() != null) { - return value.stamp().objectType(); - } - result = new ObjectTypeFeedbackStore(changed); - objectTypeFeedback.put(value, result); - } - return result.query(); - } -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -27,7 +27,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** @@ -42,7 +41,7 @@ * reached the guarded node (without taking exceptions into account). */ @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}") -public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, TypeFeedbackProvider, Node.IterableNodeType, Negatable { +public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Negatable { @Input private BooleanNode condition; private final DeoptimizationReason reason; @@ -117,13 +116,6 @@ } @Override - public void typeFeedback(TypeFeedbackTool tool) { - if (condition instanceof ConditionalTypeFeedbackProvider) { - ((ConditionalTypeFeedbackProvider) condition).typeFeedback(tool); - } - } - - @Override public Negatable negate() { negated = !negated; return this; diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -26,14 +26,13 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome of a * comparison. */ -public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, SplitTypeFeedbackProvider, Negatable { +public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, Negatable { public static final int TRUE_EDGE = 0; public static final int FALSE_EDGE = 1; private final long leafGraphId; @@ -189,13 +188,6 @@ } @Override - public void typeFeedback(int blockSuccessor, TypeFeedbackTool tool) { - if (compare instanceof ConditionalTypeFeedbackProvider) { - ((ConditionalTypeFeedbackProvider) compare).typeFeedback(blockSuccessor == TRUE_EDGE ? tool : tool.negate()); - } - } - - @Override public Negatable negate() { BeginNode trueSucc = trueSuccessor(); BeginNode falseSucc = falseSuccessor(); diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -26,11 +26,10 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; @NodeInfo(shortName = "+") -public class IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable, TypeFeedbackProvider { +public class IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable { public IntegerAddNode(Kind kind, ValueNode x, ValueNode y) { super(kind, x, y); @@ -108,13 +107,4 @@ } gen.setResult(this, gen.emitAdd(op1, op2)); } - - @Override - public void typeFeedback(TypeFeedbackTool tool) { - if (y().isConstant() && !x().isConstant()) { - tool.addScalar(this).setTranslated(y().asConstant(), tool.queryScalar(x())); - } else if (x().isConstant() && !y().isConstant()) { - tool.addScalar(this).setTranslated(x().asConstant(), tool.queryScalar(y())); - } - } } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -24,15 +24,13 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** * The {@code AccessIndexedNode} class is the base class of instructions that read or write * elements of an array. */ -public abstract class AccessIndexedNode extends AccessArrayNode implements TypeFeedbackProvider { +public abstract class AccessIndexedNode extends AccessArrayNode { @Input private ValueNode index; private final Kind elementType; @@ -67,9 +65,4 @@ public long leafGraphId() { return leafGraphId; } - - @Override - public void typeFeedback(TypeFeedbackTool tool) { - tool.addScalar(index()).constantBound(Condition.GE, Constant.INT_0); - } } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -25,15 +25,13 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** * Implements a type check that results in a {@link ClassCastException} if it fails. */ -public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Lowerable, Node.IterableNodeType, TypeFeedbackProvider, TypeCanonicalizable { +public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Lowerable, Node.IterableNodeType { @Input private ValueNode object; @Input private ValueNode targetClassInstruction; @@ -95,26 +93,6 @@ return this; } - @Override - public void typeFeedback(TypeFeedbackTool tool) { - if (targetClass() != null) { - tool.addObject(object()).declaredType(targetClass(), false); - } - } - - @Override - public Result canonical(TypeFeedbackTool tool) { - ObjectTypeQuery query = tool.queryObject(object()); - if (query.constantBound(Condition.EQ, Constant.NULL_OBJECT)) { - return new Result(object(), query); - } else if (targetClass() != null) { - if (query.declaredType(targetClass())) { - return new Result(object(), query); - } - } - return null; - } - public ValueNode object() { return object; } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -26,13 +26,12 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** * The {@code InstanceOfNode} represents an instanceof test. */ -public final class InstanceOfNode extends BooleanNode implements Canonicalizable, LIRLowerable, ConditionalTypeFeedbackProvider, TypeCanonicalizable { +public final class InstanceOfNode extends BooleanNode implements Canonicalizable, LIRLowerable { @Input private ValueNode object; @Input private ValueNode targetClassInstruction; @@ -109,29 +108,6 @@ return this; } - @Override - public void typeFeedback(TypeFeedbackTool tool) { - tool.addObject(object()).declaredType(targetClass(), true); - } - - @Override - public Result canonical(TypeFeedbackTool tool) { - ObjectTypeQuery query = tool.queryObject(object()); - if (query.constantBound(Condition.EQ, Constant.NULL_OBJECT)) { - return new Result(ConstantNode.forBoolean(false, graph()), query); - } else if (targetClass() != null) { - if (query.notDeclaredType(targetClass())) { - return new Result(ConstantNode.forBoolean(false, graph()), query); - } - if (query.constantBound(Condition.NE, Constant.NULL_OBJECT)) { - if (query.declaredType(targetClass())) { - return new Result(ConstantNode.forBoolean(true, graph()), query); - } - } - } - return null; - } - public ValueNode object() { return object; } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -27,16 +27,14 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; /** * The {@code NewArrayNode} class is the base of all instructions that allocate arrays. */ -public abstract class NewArrayNode extends FixedWithNextNode implements Lowerable, EscapeAnalyzable, TypeFeedbackProvider, ArrayLengthProvider { +public abstract class NewArrayNode extends FixedWithNextNode implements Lowerable, EscapeAnalyzable, ArrayLengthProvider { @Input private ValueNode length; private final ResolvedJavaType elementType; @@ -81,12 +79,6 @@ return 1; } - @Override - public void typeFeedback(TypeFeedbackTool tool) { - assert length.kind() == Kind.Int; - tool.addScalar(length).constantBound(Condition.GE, Constant.INT_0); - } - public EscapeOp getEscapeOp() { return ESCAPE; } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Aug 20 15:21:31 2012 +0200 @@ -25,16 +25,14 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; /** * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object * array. */ -public final class NewMultiArrayNode extends FixedWithNextNode implements LIRLowerable, TypeFeedbackProvider { +public final class NewMultiArrayNode extends FixedWithNextNode implements LIRLowerable { @Input private final NodeInputList dimensions; private final ResolvedJavaType type; @@ -67,12 +65,4 @@ public ResolvedJavaType type() { return type; } - - @Override - public void typeFeedback(TypeFeedbackTool tool) { - for (ValueNode length : dimensions) { - assert length.kind() == Kind.Int; - tool.addScalar(length).constantBound(Condition.GE, Constant.INT_0); - } - } } diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/CloneableTypeFeedback.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/CloneableTypeFeedback.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -public interface CloneableTypeFeedback { - - Object clone(); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ConditionalTypeFeedbackProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ConditionalTypeFeedbackProvider.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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.nodes.spi.types; - -public interface ConditionalTypeFeedbackProvider { - - void typeFeedback(TypeFeedbackTool tool); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackStore.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackStore.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,781 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public class ObjectTypeFeedbackStore extends TypeFeedbackStore implements ObjectTypeFeedbackTool, CloneableTypeFeedback { - - private abstract static class BooleanPredicate { - public abstract boolean evaluate(T element); - } - - public static class Query implements ObjectTypeQuery { - - private final ObjectTypeFeedbackStore store; - - public Query(ObjectTypeFeedbackStore store) { - this.store = store; - } - - @Override - public boolean constantBound(Condition condition, final Constant constant) { - assert condition == Condition.EQ || condition == Condition.NE; - if (condition == Condition.EQ) { - return store.prove(Equals.class, new BooleanPredicate() { - @Override - public boolean evaluate(Equals element) { - return element.constant.equals(constant); - } - }); - } else if (condition == Condition.NE) { - boolean result = store.prove(Equals.class, new BooleanPredicate() { - @Override - public boolean evaluate(Equals element) { - return !element.constant.equals(constant); - } - }); - if (result) { - return true; - } - return store.prove(NotEquals.class, new BooleanPredicate() { - @Override - public boolean evaluate(NotEquals element) { - return element.constant.equals(constant); - } - }); - } - return false; - } - - @Override - public boolean valueBound(Condition condition, ValueNode otherValue) { - Condition cond = store.valueBounds == null ? null : store.valueBounds.get(otherValue); - if (cond == null) { - return false; - } else { - return cond.implies(condition); - } - } - - @Override - public boolean declaredType(final ResolvedJavaType type) { - return store.prove(Info.class, new BooleanPredicate() { - @Override - public boolean evaluate(Info element) { - if (element instanceof ObjectType) { - return ((ObjectType) element).type.isSubtypeOf(type); - } else { - return (element instanceof Equals) && ((Equals) element).constant.isNull(); - } - } - }); - } - - @Override - public boolean exactType(final ResolvedJavaType type) { - return store.prove(ObjectTypeExact.class, new BooleanPredicate() { - @Override - public boolean evaluate(ObjectTypeExact element) { - return type == element.type; - } - }); - } - - @Override - public boolean notDeclaredType(ResolvedJavaType type) { - return false; - } - - @Override - public boolean notExactType(final ResolvedJavaType type) { - return store.prove(Info.class, new BooleanPredicate() { - @Override - public boolean evaluate(Info element) { - if (element instanceof ObjectTypeExact) { - return ((ObjectTypeExact) element).type != type; - } else { - return (element instanceof Equals) && ((Equals) element).constant.isNull(); - } - } - }); - } - - @Override - public String toString() { - return store.toString(); - } - - @Override - public ObjectTypeFeedbackStore store() { - return store; - } - - @Override - public ValueNode dependency() { - return store.dependency; - } - } - - private static final Info[] EMPTY_INFO_ARRAY = new Info[0]; - - private static class Info { - - } - - private static final class Equals extends Info { - public final Constant constant; - - public Equals(Constant constant) { - this.constant = constant; - } - - @Override - public String toString() { - return "== " + constant.asObject(); - } - } - - private static final class NotEquals extends Info { - public final Constant constant; - - public NotEquals(Constant constant) { - this.constant = constant; - } - - @Override - public String toString() { - return "!= " + constant.asObject(); - } - } - - private static class ObjectType extends Info { - public final ResolvedJavaType type; - - public ObjectType(ResolvedJavaType type) { - this.type = type; - } - } - - private static final class ObjectTypeDeclared extends ObjectType { - - public ObjectTypeDeclared(ResolvedJavaType type) { - super(type); - } - - @Override - public String toString() { - return "instanceof " + type; - } - } - - private static final class ObjectTypeExact extends ObjectType { - - public ObjectTypeExact(ResolvedJavaType type) { - super(type); - } - - @Override - public String toString() { - return "exact " + type; - } - } - - private static final class MergedTypeInfo extends Info { - public final Info[][] mergedInfos; - - public MergedTypeInfo(Info[][] infos) { - mergedInfos = infos; - } - - @Override - public String toString() { - return "merged type: [" + Arrays.deepToString(mergedInfos) + "]"; - } - } - - private final LinkedList infos = new LinkedList<>(); - private HashMap valueBounds; - - private final TypeFeedbackChanged changed; - - private ValueNode dependency; - - private void updateDependency() { - dependency = changed.node; - } - - private static boolean prove(Info[] infos, Class clazz, IdentityHashMap cache, BooleanPredicate predicate) { - for (Info info : infos) { - if (clazz.isAssignableFrom(info.getClass())) { - if (predicate.evaluate(clazz.cast(info))) { - return true; - } - } - if (info instanceof MergedTypeInfo) { - if (cache.get(info) != null) { - return cache.get(info); - } - for (Info[] subInfos : ((MergedTypeInfo) info).mergedInfos) { - if (!prove(subInfos, clazz, cache, predicate)) { - cache.put((MergedTypeInfo) info, false); - return false; - } - } - cache.put((MergedTypeInfo) info, true); - return true; - } - } - return false; - } - - public boolean prove(Class clazz, BooleanPredicate predicate) { - for (Info info : infos) { - if (clazz.isAssignableFrom(info.getClass())) { - if (predicate.evaluate(clazz.cast(info))) { - return true; - } - } - if (info instanceof MergedTypeInfo) { - IdentityHashMap cache = new IdentityHashMap<>(); - for (Info[] subInfos : ((MergedTypeInfo) info).mergedInfos) { - if (!prove(subInfos, clazz, cache, predicate)) { - return false; - } - } - return true; - } - } - return false; - } - - public ObjectTypeFeedbackStore(TypeFeedbackChanged changed) { - this.changed = changed; - this.dependency = null; - } - - private ObjectTypeFeedbackStore(ObjectTypeFeedbackStore other) { - this.changed = other.changed; - if (other.valueBounds != null && !other.valueBounds.isEmpty()) { - valueBounds = new HashMap<>(other.valueBounds.size()); - valueBounds.putAll(other.valueBounds); - } - infos.addAll(other.infos); - this.dependency = other.dependency; - } - - @Override - public void constantBound(Condition condition, Constant constant) { - assert condition == Condition.EQ || condition == Condition.NE; - - if (condition == Condition.EQ) { - if (infos.size() == 1 && infos.element() instanceof Equals && ((Equals) infos.element()).constant.equals(constant)) { - return; - } - infos.clear(); - infos.add(new Equals(constant)); - updateDependency(); - } else if (condition == Condition.NE) { - for (ListIterator iter = infos.listIterator(); iter.hasNext();) { - int index = iter.nextIndex(); - Info info = iter.next(); - if (info instanceof NotEquals && ((NotEquals) info).constant.equals(constant)) { - if (index == 0) { - return; - } else { - iter.remove(); - } - } - } - infos.add(new NotEquals(constant)); - updateDependency(); - } else { - throw new GraalInternalError("unexpected condition: %s", condition); - } - } - - @Override - public void valueBound(Condition condition, ValueNode otherValue) { - assert condition == Condition.EQ || condition == Condition.NE; - - if (otherValue != null) { - if (valueBounds == null) { - valueBounds = new HashMap<>(); - } - Condition cond = valueBounds.get(otherValue); - if (cond == null) { - valueBounds.put(otherValue, condition); - updateDependency(); - } else { - Condition newCondition = cond.join(condition); - if (newCondition == null) { - valueBounds.remove(otherValue); - } else { - if (cond != newCondition) { - valueBounds.put(otherValue, newCondition); - updateDependency(); - } - } - } - } - } - - @Override - public void declaredType(ResolvedJavaType type, boolean nonNull) { - assert type != null; - - for (ListIterator iter = infos.listIterator(); iter.hasNext();) { - int index = iter.nextIndex(); - Info info = iter.next(); - if (info instanceof ObjectTypeDeclared) { - ObjectTypeDeclared typeInfo = (ObjectTypeDeclared) info; - if (typeInfo.type == type && index == 0) { - if (index == 0) { - if (nonNull) { - constantBound(Condition.NE, Constant.NULL_OBJECT); - } - return; - } else { - iter.remove(); - } - } - } - } - infos.add(new ObjectTypeDeclared(type)); - updateDependency(); - if (nonNull) { - constantBound(Condition.NE, Constant.NULL_OBJECT); - } - } - - @Override - public void exactType(ResolvedJavaType type) { - assert type != null; - - for (ListIterator iter = infos.listIterator(); iter.hasNext();) { - int index = iter.nextIndex(); - Info info = iter.next(); - if (info instanceof ObjectTypeExact) { - ObjectTypeExact typeInfo = (ObjectTypeExact) info; - if (typeInfo.type == type && index == 0) { - if (index == 0) { - constantBound(Condition.NE, Constant.NULL_OBJECT); - return; - } else { - iter.remove(); - } - } - } - } - infos.add(new ObjectTypeExact(type)); - updateDependency(); - constantBound(Condition.NE, Constant.NULL_OBJECT); - } - - @Override - public void notDeclaredType(ResolvedJavaType type, boolean includesNull) { - } - - @Override - public void notExactType(ResolvedJavaType type) { - } - - public static ObjectTypeFeedbackStore meet(ObjectTypeFeedbackStore[] others) { - boolean emptyValueBounds = false; - for (int i = 0; i < others.length; i++) { - if (others[i] == null) { - return null; - } - if (others[i].valueBounds == null || others[i].valueBounds.isEmpty()) { - emptyValueBounds = true; - } - } - - ObjectTypeFeedbackStore first = others[0]; - ObjectTypeFeedbackStore result = new ObjectTypeFeedbackStore(first.changed); - - if (!emptyValueBounds) { - for (Map.Entry entry : first.valueBounds.entrySet()) { - Condition condition = entry.getValue(); - for (int i = 1; i < others.length; i++) { - Condition otherCond = others[i].valueBounds.get(entry.getKey()); - if (otherCond != null) { - condition = null; - break; - } - condition = condition.meet(otherCond); - if (condition == null) { - break; - } - } - if (condition != null) { - if (result.valueBounds == null) { - result.valueBounds = new HashMap<>(first.valueBounds.size()); - } - result.valueBounds.put(entry.getKey(), condition); - } - } - } - - boolean simpleMerge = true; - for (int i = 1; i < others.length; i++) { - if (!others[i].infos.equals(others[i - 1].infos)) { - simpleMerge = false; - break; - } - } - if (simpleMerge) { - result.infos.addAll(others[0].infos); - } else { - Info[][] infos = new Info[others.length][]; - for (int i = 0; i < others.length; i++) { - infos[i] = others[i].infos.toArray(EMPTY_INFO_ARRAY); - } - MergedTypeInfo merged = new MergedTypeInfo(infos); - result.infos.add(merged); - } - return result; - } - - @Override - public ObjectTypeFeedbackStore clone() { - return new ObjectTypeFeedbackStore(this); - } - - public ObjectTypeQuery query() { - return new Query(this); - } - - public boolean isEmpty() { - return infos.isEmpty() && (valueBounds == null || valueBounds.isEmpty()); - } - - @Override - public String toString() { - StringBuilder str = new StringBuilder(); - for (Info info : infos) { - str.append(info).append(", "); - } - if (valueBounds != null) { - for (Map.Entry entry : valueBounds.entrySet()) { - str.append(entry.getValue().operator).append(' ').append(entry.getKey()).append(", "); - } - } - if (str.length() > 1) { - str.setLength(str.length() - 2); - } - if (dependency != null) { - str.append(" @ ").append(dependency); - } - return str.toString(); - } - - /* -// equals contains all the values that might happen to be in this variable. If it is null then there is no information about possible values. -// If it is empty, then we're currently in a branch that will be removed by canonicalization later on. - private Set equals; -// notEquals contains all the values that cannot be in this variable. - private Set notEquals; - - private HashMap valueBounds; - - private Set exactTypes; - - private Set declaredTypes; - private final TypeFeedbackChanged changed; - - private Node dependency; - - private void updateDependency() { - dependency = changed.node; - } - - public ObjectTypeFeedbackStore(TypeFeedbackChanged changed) { - this.changed = changed; - this.dependency = null; - } - - private ObjectTypeFeedbackStore(ObjectTypeFeedbackStore other) { - this.changed = other.changed; - if (other.valueBounds != null && !other.valueBounds.isEmpty()) { - valueBounds = new HashMap<>(other.valueBounds.size()); - valueBounds.putAll(other.valueBounds); - } - if (other.equals != null) { - equals = new HashSet<>(other.equals); - } - if (other.notEquals != null && !other.notEquals.isEmpty()) { - notEquals = new HashSet<>(other.notEquals); - } - this.dependency = other.dependency; - } - - @Override - public void constantBound(Condition condition, Constant constant) { - assert condition == Condition.EQ || condition == Condition.NE; - - if (condition == Condition.EQ) { - if (equals == null) { - equals = new HashSet<>(); - equals.add(constant); - updateDependency(); - } else { - if (equals.contains(constant)) { - equals.clear(); - equals.add(constant); - updateDependency(); - } else { - // join with a value that cannot exist: we're in a branch that will hopefully be canonicalized away - equals.clear(); - } - } - } else if (condition == Condition.NE) { - if (notEquals == null) { - notEquals = new HashSet<>(); - } - if (equals != null && equals.contains(constant)) { - equals.remove(constant); - } - if (notEquals.add(constant)) { - updateDependency(); - } - } - } - - @Override - public void valueBound(Condition condition, ValueNode otherValue) { - assert condition == Condition.EQ || condition == Condition.NE; - - if (otherValue != null) { - if (valueBounds == null) { - valueBounds = new HashMap<>(); - } - Condition cond = valueBounds.get(otherValue); - if (cond == null) { - valueBounds.put(otherValue, condition); - updateDependency(); - } else { - Condition newCondition = cond.join(condition); - if (newCondition == null) { - valueBounds.remove(otherValue); - } else { - if (cond != newCondition) { - valueBounds.put(otherValue, newCondition); - updateDependency(); - } - } - } - } - } - - @Override - public void declaredType(ResolvedJavaType type, boolean nonNull) { - if (declaredTypes == null) { - declaredTypes = new HashSet<>(); - declaredTypes.add(type); - updateDependency(); - } else { - if (type.isInterface()) { - for (Iterator iter = declaredTypes.iterator(); iter.hasNext();) { - ResolvedJavaType declaredType = iter.next(); - if (declaredType.isInterface()) { - if (type.isSubtypeOf(declaredType)) { - iter.remove(); - } else if (declaredType.isSubtypeOf(type)) { - // some more specific type is already in the list - nothing to do - return; - } - } - } - if (declaredTypes.add(type)) { - updateDependency(); - } - } else { - for (Iterator iter = declaredTypes.iterator(); iter.hasNext();) { - ResolvedJavaType declaredType = iter.next(); - if (!declaredType.isInterface()) { - if (type.isSubtypeOf(declaredType)) { - iter.remove(); - } else if (declaredType.isSubtypeOf(type)) { - // some more specific type is already in the list - nothing to do - return; - } - } - } - if (declaredTypes.add(type)) { - updateDependency(); - } - } - } - if (nonNull) { - constantBound(Condition.NE, Constant.NULL_OBJECT); - } - } - - @Override - public void exactType(ResolvedJavaType type) { - if (exactTypes == null) { - exactTypes = new HashSet<>(); - exactTypes.add(type); - updateDependency(); - } else { - if (exactTypes.contains(type)) { - exactTypes.clear(); - exactTypes.add(type); - updateDependency(); - } else { - // join with a value that cannot exist: we're in a branch that will hopefully be canonicalized away - exactTypes.clear(); - } - } - constantBound(Condition.NE, Constant.NULL_OBJECT); - } - - @Override - public void notDeclaredType(ResolvedJavaType type, boolean nonNull) { - } - - @Override - public void notExactType(ResolvedJavaType type) { - } - - @Override - public void meet(ObjectTypeFeedbackStore other) { - dependency = null; - if (equals != null && other.equals != null) { - equals.addAll(other.equals); - } else { - equals = null; - } - if (notEquals != null && !notEquals.isEmpty() && other.notEquals != null && !other.notEquals.isEmpty()) { - for (Iterator iter = notEquals.iterator(); iter.hasNext();) { - Constant constant = iter.next(); - if (!other.notEquals.contains(constant)) { - iter.remove(); - } - } - } else { - notEquals = null; - } - if (valueBounds != null && !valueBounds.isEmpty() && other.valueBounds != null && !other.valueBounds.isEmpty()) { - HashMap newBounds = new HashMap<>(valueBounds.size()); - for (Map.Entry entry : valueBounds.entrySet()) { - Condition otherCond = other.valueBounds.get(entry.getKey()); - if (otherCond != null) { - Condition newCondition = entry.getValue().meet(otherCond); - if (newCondition != null) { - newBounds.put(entry.getKey(), newCondition); - } - } - } - if (newBounds.isEmpty()) { - valueBounds = null; - } else { - valueBounds = newBounds; - } - } else { - valueBounds = null; - } - declaredTypes = null; - exactTypes = null; - } - - @Override - public ObjectTypeFeedbackStore clone() { - return new ObjectTypeFeedbackStore(this); - } - - public ObjectTypeQuery query() { - return new Query(this); - } - - public boolean isEmpty() { - return equals == null && (notEquals == null || notEquals.isEmpty()) && (valueBounds == null || valueBounds.isEmpty()); - } - - @Override - public String toString() { - StringBuilder str = new StringBuilder(); - if (equals != null && !equals.isEmpty()) { - str.append("== "); - if (equals.size() == 1) { - str.append(equals.iterator().next()); - } else { - str.append("("); - for (Constant constant : equals) { - str.append(constant).append(','); - } - str.setLength(str.length() - 1); - str.append(')'); - } - str.append(", "); - } - if (notEquals != null && !notEquals.isEmpty()) { - str.append("!= "); - if (notEquals.size() == 1) { - str.append(notEquals.iterator().next()); - } else { - str.append("("); - for (Constant constant : notEquals) { - str.append(constant).append(','); - } - str.setLength(str.length() - 1); - str.append(')'); - } - str.append(", "); - } - if (valueBounds != null) { - for (Map.Entry entry : valueBounds.entrySet()) { - str.append(entry.getValue().operator).append(' ').append(entry.getKey()).append(", "); - } - } - if (declaredTypes != null) { - str.append("declared ("); - for (ResolvedJavaType type: declaredTypes) { - str.append(type).append(','); - } - str.setLength(str.length() - 1); - str.append("), "); - } - if (exactTypes != null) { - str.append("exact ("); - for (ResolvedJavaType type: exactTypes) { - str.append(type).append(','); - } - str.setLength(str.length() - 1); - str.append("), "); - } - if (str.length() > 1) { - str.setLength(str.length() - 2); - } - if (dependency != null) { - str.append(" @ ").append(dependency); - } - return str.toString(); - }*/ -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackTool.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public interface ObjectTypeFeedbackTool { - - void constantBound(Condition condition, Constant constant); - - void valueBound(Condition condition, ValueNode otherValue); - - void declaredType(ResolvedJavaType type, boolean nonNull); - - void exactType(ResolvedJavaType type); - - void notDeclaredType(ResolvedJavaType type, boolean includesNull); - - void notExactType(ResolvedJavaType type); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeQuery.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeQuery.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public interface ObjectTypeQuery extends TypeQuery { - - boolean constantBound(Condition condition, Constant constant); - - boolean valueBound(Condition condition, ValueNode otherValue); - - boolean declaredType(ResolvedJavaType type); - - boolean exactType(ResolvedJavaType type); - - boolean notDeclaredType(ResolvedJavaType type); - - boolean notExactType(ResolvedJavaType type); - - ObjectTypeFeedbackStore store(); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackStore.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackStore.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public class ScalarTypeFeedbackStore extends TypeFeedbackStore implements ScalarTypeFeedbackTool, CloneableTypeFeedback { - - public static class Query implements ScalarTypeQuery { - - private final ScalarTypeFeedbackStore store; - - public Query(ScalarTypeFeedbackStore store) { - this.store = store; - } - - @Override - public boolean constantBound(Condition condition, Constant constant) { - if (constant.kind == Kind.Int || constant.kind == Kind.Long) { - switch (condition) { - case EQ: - return store.constantBounds.lowerBound == constant.asLong() && store.constantBounds.upperBound == constant.asLong(); - case NE: - return store.constantBounds.lowerBound > constant.asLong() || store.constantBounds.upperBound < constant.asLong(); - case LT: - return store.constantBounds.upperBound < constant.asLong(); - case LE: - return store.constantBounds.upperBound <= constant.asLong(); - case GT: - return store.constantBounds.lowerBound > constant.asLong(); - case GE: - return store.constantBounds.lowerBound >= constant.asLong(); - case BT: - return constant.asLong() >= 0 && store.constantBounds.upperBound < constant.asLong() && store.constantBounds.lowerBound >= 0; - case BE: - return constant.asLong() >= 0 && store.constantBounds.upperBound <= constant.asLong() && store.constantBounds.lowerBound >= 0; - case AT: - return constant.asLong() < 0 && store.constantBounds.lowerBound > constant.asLong() && store.constantBounds.upperBound < 0; - case AE: - return constant.asLong() < 0 && store.constantBounds.lowerBound >= constant.asLong() && store.constantBounds.upperBound < 0; - } - } - return false; - } - - @Override - public boolean valueBound(Condition condition, ValueNode otherValue) { - Condition cond = store.valueBounds == null ? null : store.valueBounds.get(otherValue); - if (cond == null) { - return false; - } else { - return cond.implies(condition); - } - } - - @Override - public String toString() { - return store.toString(); - } - - @Override - public ScalarTypeFeedbackStore store() { - return store; - } - - @Override - public ValueNode dependency() { - return store.dependency; - } - } - - private static class ConstantBound { - - public long lowerBound; - public long upperBound; - - public ConstantBound(long lowerBound, long upperBound) { - this.lowerBound = lowerBound; - this.upperBound = upperBound; - } - - public void meet(ConstantBound other) { - lowerBound = Math.min(lowerBound, other.lowerBound); - upperBound = Math.max(upperBound, other.upperBound); - } - - public boolean join(ConstantBound other) { - long oldLower = lowerBound; - long oldUpper = upperBound; - lowerBound = Math.max(lowerBound, other.lowerBound); - upperBound = Math.min(upperBound, other.upperBound); - return oldLower != lowerBound || oldUpper != upperBound; - } - } - - private final Kind kind; - private final ConstantBound constantBounds; - private final TypeFeedbackChanged changed; - private ValueNode dependency; - private HashMap valueBounds; - - private void updateDependency() { - dependency = changed.node; - } - - public ScalarTypeFeedbackStore(Kind kind, TypeFeedbackChanged changed) { - this.kind = kind; - if (kind == Kind.Int) { - constantBounds = new ConstantBound(Integer.MIN_VALUE, Integer.MAX_VALUE); - } else if (kind == Kind.Long) { - constantBounds = new ConstantBound(Long.MIN_VALUE, Long.MAX_VALUE); - } else { - constantBounds = null; - } - this.changed = changed; - this.dependency = null; - } - - private ScalarTypeFeedbackStore(ScalarTypeFeedbackStore other) { - this.kind = other.kind; - if (other.constantBounds == null) { - constantBounds = null; - } else { - constantBounds = new ConstantBound(other.constantBounds.lowerBound, other.constantBounds.upperBound); - } - if (other.valueBounds != null && !other.valueBounds.isEmpty()) { - valueBounds = new HashMap<>(other.valueBounds.size()); - valueBounds.putAll(other.valueBounds); - } - this.changed = other.changed; - this.dependency = other.dependency; - } - - @Override - public void constantBound(Condition condition, Constant constant) { - ConstantBound newBound = createBounds(condition, constant); - if (newBound != null) { - if (constantBounds.join(newBound)) { - updateDependency(); - } - } - } - - private static ConstantBound createBounds(Condition condition, Constant constant) { - ConstantBound newBound; - if (constant.kind == Kind.Int || constant.kind == Kind.Long) { - switch (condition) { - case EQ: - newBound = new ConstantBound(constant.asLong(), constant.asLong()); - break; - case NE: - newBound = null; - break; - case GT: - newBound = new ConstantBound(constant.asLong() + 1, Long.MAX_VALUE); - break; - case GE: - newBound = new ConstantBound(constant.asLong(), Long.MAX_VALUE); - break; - case LT: - newBound = new ConstantBound(Long.MIN_VALUE, constant.asLong() - 1); - break; - case LE: - newBound = new ConstantBound(Long.MIN_VALUE, constant.asLong()); - break; - default: - newBound = null; - break; - } - } else { - newBound = null; - } - return newBound; - } - - private void simpleValueBound(Condition condition, ValueNode otherValue) { - if (otherValue != null) { - if (valueBounds == null) { - valueBounds = new HashMap<>(); - } - Condition cond = valueBounds.get(otherValue); - if (cond == null) { - valueBounds.put(otherValue, condition); - updateDependency(); - } else { - Condition newCondition = cond.join(condition); - if (newCondition == null) { - valueBounds.remove(otherValue); - } else { - if (cond != newCondition) { - valueBounds.put(otherValue, newCondition); - updateDependency(); - } - } - } - } - } - - @Override - public void valueBound(Condition condition, ValueNode otherValue, ScalarTypeQuery type) { - ScalarTypeFeedbackStore other = type.store(); - switch (condition) { - case EQ: - simpleValueBound(condition, otherValue); - if (constantBounds.join(other.constantBounds)) { - updateDependency(); - } - break; - case NE: - simpleValueBound(condition, otherValue); - break; - case LE: - case LT: - simpleValueBound(condition, otherValue); - constantBound(condition, new Constant(kind, other.constantBounds.upperBound)); - break; - case GE: - case GT: - simpleValueBound(condition, otherValue); - constantBound(condition, new Constant(kind, other.constantBounds.lowerBound)); - break; - case BT: - if (other.constantBounds.lowerBound >= 0) { - simpleValueBound(Condition.LT, otherValue); - constantBound(Condition.GE, new Constant(kind, 0)); - constantBound(Condition.LT, new Constant(kind, other.constantBounds.upperBound)); - } - break; - case BE: - if (other.constantBounds.lowerBound >= 0) { - simpleValueBound(Condition.LE, otherValue); - constantBound(Condition.GE, new Constant(kind, 0)); - constantBound(Condition.LE, new Constant(kind, other.constantBounds.upperBound)); - } - break; - case AT: - if (other.constantBounds.upperBound < 0) { - simpleValueBound(Condition.GT, otherValue); - constantBound(Condition.LT, new Constant(kind, 0)); - constantBound(Condition.GT, new Constant(kind, other.constantBounds.lowerBound)); - } - break; - case AE: - if (other.constantBounds.upperBound < 0) { - simpleValueBound(Condition.GE, otherValue); - constantBound(Condition.LT, new Constant(kind, 0)); - constantBound(Condition.GE, new Constant(kind, other.constantBounds.lowerBound)); - } - break; - } - } - - public ScalarTypeQuery query() { - return new Query(this); - } - - public static ScalarTypeFeedbackStore meet(ScalarTypeFeedbackStore[] others) { - boolean emptyValueBounds = false; - for (int i = 0; i < others.length; i++) { - if (others[i] == null) { - return null; - } - if (others[i].valueBounds == null || others[i].valueBounds.isEmpty()) { - emptyValueBounds = true; - } - } - - ScalarTypeFeedbackStore first = others[0]; - ScalarTypeFeedbackStore result = new ScalarTypeFeedbackStore(first.kind, first.changed); - - if (!emptyValueBounds) { - for (Map.Entry entry : first.valueBounds.entrySet()) { - Condition condition = entry.getValue(); - for (int i = 1; i < others.length; i++) { - Condition otherCond = others[i].valueBounds.get(entry.getKey()); - if (otherCond != null) { - condition = null; - break; - } - condition = condition.meet(otherCond); - if (condition == null) { - break; - } - } - if (condition != null) { - if (result.valueBounds == null) { - result.valueBounds = new HashMap<>(first.valueBounds.size()); - } - result.valueBounds.put(entry.getKey(), condition); - } - } - } - - result.constantBounds.lowerBound = first.constantBounds.lowerBound; - result.constantBounds.upperBound = first.constantBounds.upperBound; - - for (int i = 1; i < others.length; i++) { - result.constantBounds.meet(others[i].constantBounds); - } - return result; - } - - @Override - public ScalarTypeFeedbackStore clone() { - return new ScalarTypeFeedbackStore(this); - } - - @Override - public String toString() { - StringBuilder str = new StringBuilder().append('('); - if (constantBounds.lowerBound == minValue(kind)) { - str.append('-'); - } else { - str.append(constantBounds.lowerBound); - } - str.append(','); - if (constantBounds.upperBound == maxValue(kind)) { - str.append('-'); - } else { - str.append(constantBounds.upperBound); - } - str.append(')'); - - if (valueBounds != null) { - for (Map.Entry entry : valueBounds.entrySet()) { - str.append(", ").append(entry.getValue().operator).append(' ').append(entry.getKey()); - } - } - if (dependency != null) { - str.append(" @ ").append(dependency); - } - return str.toString(); - } - - @Override - public void setTranslated(Constant deltaConstant, ScalarTypeQuery old) { - assert deltaConstant.kind == kind; - ScalarTypeFeedbackStore other = old.store(); - assert other.kind == kind; - long lower = other.constantBounds.lowerBound; - long upper = other.constantBounds.upperBound; - if (kind == Kind.Int) { - int delta = deltaConstant.asInt(); - int newLower = (int) lower + delta; - int newUpper = (int) upper + delta; - if ((newLower <= lower && newUpper <= upper) || (newLower > lower && newUpper > upper)) { - constantBounds.join(new ConstantBound(newLower, newUpper)); - } - } else if (kind == Kind.Long) { - long delta = deltaConstant.asLong(); - long newLower = lower + delta; - long newUpper = upper + delta; - if ((newLower <= lower && newUpper <= upper) || (newLower > lower && newUpper > upper)) { - constantBounds.join(new ConstantBound(newLower, newUpper)); - } - } else { - // nothing yet - } - } - - public boolean isEmpty() { - return constantBounds.lowerBound == minValue(kind) && constantBounds.upperBound == maxValue(kind) && (valueBounds == null || valueBounds.isEmpty()); - } - - private static long minValue(Kind kind) { - if (kind == Kind.Int) { - return Integer.MIN_VALUE; - } else if (kind == Kind.Long) { - return Long.MIN_VALUE; - } else { - throw new UnsupportedOperationException(); - } - } - - private static long maxValue(Kind kind) { - if (kind == Kind.Int) { - return Integer.MAX_VALUE; - } else if (kind == Kind.Long) { - return Long.MAX_VALUE; - } else { - throw new UnsupportedOperationException(); - } - } -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackTool.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public interface ScalarTypeFeedbackTool { - - void constantBound(Condition condition, Constant constant); - - void valueBound(Condition condition, ValueNode otherValue, ScalarTypeQuery type); - - void setTranslated(Constant delta, ScalarTypeQuery old); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeQuery.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeQuery.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; - -public interface ScalarTypeQuery extends TypeQuery { - - boolean constantBound(Condition condition, Constant constant); - - boolean valueBound(Condition condition, ValueNode otherValue); - - ScalarTypeFeedbackStore store(); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/SplitTypeFeedbackProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/SplitTypeFeedbackProvider.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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.nodes.spi.types; - -public interface SplitTypeFeedbackProvider { - - void typeFeedback(int blockSuccessor, TypeFeedbackTool tool); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeCanonicalizable.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeCanonicalizable.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import java.util.*; - -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; - -public interface TypeCanonicalizable { - - ValueNode[] EMPTY_ARRAY = new ValueNode[0]; - - public static class Result { - public final ValueNode replacement; - public final ValueNode[] dependencies; - - public Result(ValueNode replacement) { - this.replacement = replacement; - this.dependencies = EMPTY_ARRAY; - } - - public Result(ValueNode replacement, TypeQuery query) { - assert query != null; - this.replacement = replacement; - if (query.dependency() != null) { - this.dependencies = new ValueNode[] {query.dependency()}; - } else { - this.dependencies = EMPTY_ARRAY; - } - } - - public Result(ValueNode replacement, TypeQuery... queries) { - this.replacement = replacement; - HashSet deps = new HashSet<>(); - for (TypeQuery query : queries) { - if (query.dependency() != null) { - deps.add(query.dependency()); - } - } - this.dependencies = deps.toArray(new ValueNode[deps.size()]); - } - - @Override - public String toString() { - StringBuilder str = new StringBuilder().append('['); - str.append(replacement); - if (dependencies.length > 0) { - str.append(" @"); - for (Node dep : dependencies) { - str.append(' ').append(dep); - } - } - return str.append(']').toString(); - } - } - - Result canonical(TypeFeedbackTool tool); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackChanged.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackChanged.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.nodes.*; - -public class TypeFeedbackChanged { - - public ValueNode node; - -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackProvider.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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.nodes.spi.types; - -public interface TypeFeedbackProvider { - - void typeFeedback(TypeFeedbackTool tool); -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackStore.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackStore.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - - -public abstract class TypeFeedbackStore { - -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackTool.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.nodes.*; - -public interface TypeFeedbackTool { - - ScalarTypeFeedbackTool addScalar(ValueNode value); - - ObjectTypeFeedbackTool addObject(ValueNode value); - - ScalarTypeQuery queryScalar(ValueNode value); - - ObjectTypeQuery queryObject(ValueNode value); - - CodeCacheProvider runtime(); - - TypeFeedbackTool negate(); - -} diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeQuery.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeQuery.java Mon Aug 20 15:11:15 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.nodes.spi.types; - -import com.oracle.graal.nodes.*; - -public interface TypeQuery { - - ValueNode dependency(); -} - diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java Mon Aug 20 15:21:31 2012 +0200 @@ -24,7 +24,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.types.*; /** * A stamp is the basis for a type system over the nodes in a graph. @@ -41,14 +40,6 @@ return kind; } - public ScalarTypeQuery scalarType() { - return null; - } - - public ObjectTypeQuery objectType() { - return null; - } - public boolean nonNull() { return false; } @@ -57,6 +48,7 @@ /** * Returns the union of this stamp and the given stamp. Typically used to create stamps for {@link PhiNode}s. + * * @param other The stamp that will enlarge this stamp. * @return The union of this stamp and the given stamp. */ @@ -64,6 +56,7 @@ /** * Returns the intersection of this stamp and the given stamp. + * * @param other The stamp that will tighten this stamp. * @return The intersection of this stamp and the given stamp. */ diff -r c241963cda6d -r fd8832ae511d graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/TypeSystemTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/TypeSystemTest.java Mon Aug 20 15:11:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/TypeSystemTest.java Mon Aug 20 15:21:31 2012 +0200 @@ -30,7 +30,6 @@ import com.oracle.graal.compiler.phases.*; import com.oracle.graal.compiler.schedule.*; -import com.oracle.graal.compiler.types.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.cfg.*; @@ -113,7 +112,7 @@ } } -// @Test + @Test public void test5() { test("test5Snippet", "referenceSnippet5"); } @@ -190,7 +189,7 @@ StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); new CanonicalizerPhase(null, runtime(), null).apply(graph); - new PropagateTypeCachePhase(null, runtime(), null).apply(graph); + new CheckCastEliminationPhase().apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph); new GlobalValueNumberingPhase().apply(graph); StructuredGraph referenceGraph = parse(referenceSnippet); @@ -240,7 +239,7 @@ StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); new CanonicalizerPhase(null, runtime(), null).apply(graph); - new PropagateTypeCachePhase(null, runtime(), null).apply(graph); + new CheckCastEliminationPhase().apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph); Debug.dump(graph, "Graph"); Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes(clazz).iterator().hasNext());