# HG changeset patch # User Gilles Duboscq # Date 1328890179 -3600 # Node ID e43d36482d127f3e2d155c914c051d76c1510ea1 # Parent 723df37192d621bca194fa89195ada7ee0bbabf4# Parent ce13e056d821147f2df59f4a2388c574617c9f07 Merge diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java Fri Feb 10 17:09:39 2012 +0100 @@ -67,12 +67,12 @@ * or local class. * @return the simple name */ - public static String getSimpleName(Class clazz, boolean withEnclosingClass) { + public static String getSimpleName(Class< ? > clazz, boolean withEnclosingClass) { final String simpleName = clazz.getSimpleName(); if (simpleName.length() != 0) { if (withEnclosingClass) { String prefix = ""; - Class enclosingClass = clazz; + Class< ? > enclosingClass = clazz; while ((enclosingClass = enclosingClass.getEnclosingClass()) != null) { prefix = prefix + enclosingClass.getSimpleName() + "."; } @@ -95,6 +95,7 @@ public static final int K = 1024; public static final int M = 1024 * 1024; + public static boolean isOdd(int n) { return (n & 1) == 1; } @@ -124,8 +125,8 @@ } /** - * Computes the log (base 2) of the specified integer, rounding down. - * (E.g {@code log2(8) = 3}, {@code log2(21) = 4}) + * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4} + * ) * * @param val the value * @return the log base 2 of the value @@ -136,8 +137,7 @@ } /** - * Computes the log (base 2) of the specified long, rounding down. - * (E.g {@code log2(8) = 3}, {@code log2(21) = 4}) + * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4}) * * @param val the value * @return the log base 2 of the value @@ -154,6 +154,7 @@ /** * Gets a word with the nth bit set. + * * @param n the nth bit to set * @return an integer value with the nth bit set */ @@ -163,6 +164,7 @@ /** * Gets a word with the right-most n bits set. + * * @param n the number of right most bits to set * @return an integer value with the right-most n bits set */ @@ -196,6 +198,7 @@ } return internalNameToJava(riType.name(), qualified); } + /** * Converts a given type to its Java programming language name. The following are examples of strings returned by * this method: @@ -330,6 +333,7 @@ } return sb.toString(); } + /** * Gets a string for a given field formatted according to a given format specification. A format specification is * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of @@ -350,8 +354,8 @@ * * @param format a format specification * @param field the field to be formatted - * @param kinds if {@code true} then {@code field}'s type is printed in the - * {@linkplain CiKind#jniName JNI} form of its {@linkplain CiKind kind} + * @param kinds if {@code true} then {@code field}'s type is printed in the {@linkplain CiKind#jniName JNI} form of + * its {@linkplain CiKind kind} * @return the result of formatting this field according to {@code format} * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} */ @@ -424,8 +428,7 @@ } /** - * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} - * when comparing values. + * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} when comparing values. * * @param the type of elements in the set * @return a set based on reference-equality @@ -435,8 +438,8 @@ } /** - * Prepends the String {@code indentation} to every line in String {@code lines}, - * including a possibly non-empty line following the final newline. + * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty + * line following the final newline. */ public static String indent(String lines, String indentation) { if (lines.length() == 0) { @@ -537,26 +540,26 @@ } /** - * Convenient shortcut for calling {@link #appendLocation(StringBuilder, RiMethod, int)} - * without having to supply a a {@link StringBuilder} instance and convert the result - * to a string. + * Convenient shortcut for calling {@link #appendLocation(StringBuilder, RiMethod, int)} without having to supply a + * a {@link StringBuilder} instance and convert the result to a string. */ public static String toLocation(RiResolvedMethod method, int bci) { return appendLocation(new StringBuilder(), method, bci).toString(); } - /** - * Appends a string representation of a location specified by a given method and bci to - * a given {@link StringBuilder}. If a stack trace element with a non-null file name - * and non-negative line number is {@linkplain RiMethod#toStackTraceElement(int) available} - * for the given method, then the string returned is the {@link StackTraceElement#toString()} - * value of the stack trace element, suffixed by the bci location. For example: + * Appends a string representation of a location specified by a given method and bci to a given + * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is + * {@linkplain RiMethod#toStackTraceElement(int) available} for the given method, then the string returned is the + * {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For example: + * *
      *     java.lang.String.valueOf(String.java:2930) [bci: 12]
      * 
- * Otherwise, the string returned is the value of {@code CiUtil.format("%H.%n(%p)"}, suffixed - * by the bci location. For example: + * + * Otherwise, the string returned is the value of {@code CiUtil.format("%H.%n(%p)"}, suffixed by the bci location. + * For example: + * *
      *     java.lang.String.valueOf(int) [bci: 12]
      * 
@@ -633,6 +636,7 @@ * Formats a location present in a register or frame reference map. */ public static class RefMapFormatter { + /** * The size of a stack slot. */ @@ -646,8 +650,8 @@ public final CiArchitecture arch; /** - * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot - * corresponding to bit 0 in the frame reference map. + * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding to bit 0 in the frame + * reference map. */ public final int refMapToFPOffset; @@ -732,9 +736,9 @@ return result; } - public static Class[] signatureToTypes(RiSignature signature, RiResolvedType accessingClass) { + public static Class< ? >[] signatureToTypes(RiSignature signature, RiResolvedType accessingClass) { int count = signature.argumentCount(false); - Class[] result = new Class[count]; + Class< ? >[] result = new Class< ? >[count]; for (int i = 0; i < result.length; ++i) { result[i] = signature.argumentTypeAt(i, accessingClass).resolve(accessingClass).toJava(); } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java Fri Feb 10 17:09:39 2012 +0100 @@ -24,9 +24,10 @@ /** - * Represents profiling information for one specific method. - * Every accessor method returns the information that is available at the time of its invocation. - * If a method is invoked multiple times, it may return a significantly different results for every invocation. + * Provides access to the profiling information of one specific method. + * Every accessor method returns the information that is available at the time of invocation. + * If a method is invoked multiple times, it may return significantly different results for every invocation + * as the profiling information may be changed by other Java threads at any time. */ public interface RiProfilingInfo { /** diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Fri Feb 10 17:09:39 2012 +0100 @@ -70,6 +70,11 @@ // absolute probability analysis public static boolean ProbabilityAnalysis = true; + // profiling information + public static int MatureExecutionsBranch = 50; + public static int MatureExecutionsPerSwitchCase = 15; + public static int MatureExecutionsTypeProfile = 100; + //rematerialize settings public static float MinimumUsageProbability = 0.95f; @@ -92,6 +97,7 @@ // Debug settings: public static boolean Debug = true; + public static boolean SummarizeDebugValues = ____; public static String Dump = null; public static String Meter = null; public static String Time = null; diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Fri Feb 10 17:09:39 2012 +0100 @@ -820,9 +820,6 @@ } public Variable emitConditional(BooleanNode node, CiValue trueValue, CiValue falseValue) { - assert trueValue instanceof CiConstant && (trueValue.kind.stackKind() == CiKind.Int || trueValue.kind == CiKind.Long); - assert falseValue instanceof CiConstant && (falseValue.kind.stackKind() == CiKind.Int || trueValue.kind == CiKind.Long); - if (node instanceof NullCheckNode) { return emitNullCheckConditional((NullCheckNode) node, trueValue, falseValue); } else if (node instanceof CompareNode) { diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ConvertDeoptimizeToGuardPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ConvertDeoptimizeToGuardPhase.java Fri Feb 10 17:09:39 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.compiler.phases; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.*; + +public class ConvertDeoptimizeToGuardPhase extends Phase { + + private static BeginNode findBeginNode(Node startNode) { + Node n = startNode; + while (true) { + if (n instanceof BeginNode) { + return (BeginNode) n; + } else { + n = n.predecessor(); + } + } + } + + @Override + protected void run(final StructuredGraph graph) { + List nodes = graph.getNodes(DeoptimizeNode.class).snapshot(); + if (nodes.size() == 0) { + return; + } + + for (DeoptimizeNode d : nodes) { + BeginNode myBeginNode = findBeginNode(d); + Node controlSplit = myBeginNode.predecessor(); + + if (controlSplit instanceof IfNode) { + IfNode ifNode = (IfNode) controlSplit; + BeginNode otherBegin = ifNode.trueSuccessor(); + BooleanNode conditionNode = ifNode.compare(); + if (myBeginNode == ifNode.trueSuccessor()) { + conditionNode = conditionNode.negate(); + otherBegin = ifNode.falseSuccessor(); + } + BeginNode ifBlockBegin = findBeginNode(ifNode); + graph.unique(new GuardNode(conditionNode, ifBlockBegin)); + otherBegin.replaceAtUsages(ifBlockBegin); + FixedNode next = otherBegin.next(); + otherBegin.setNext(null); + ifNode.replaceAtPredecessors(next); + } + } + + new DeadCodeEliminationPhase().apply(graph); + } +} diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java Fri Feb 10 17:09:39 2012 +0100 @@ -45,10 +45,16 @@ } public final void apply(final StructuredGraph graph) { + apply(graph, true); + } + + public final void apply(final StructuredGraph graph, final boolean dumpGraph) { Debug.scope(name, this, new Runnable() { public void run() { Phase.this.run(graph); - Debug.dump(graph, "After phase %s", name); + if (dumpGraph) { + Debug.dump(graph, "After phase %s", name); + } } }); } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Fri Feb 10 17:09:39 2012 +0100 @@ -26,7 +26,6 @@ import static com.oracle.max.cri.ci.CiValueUtil.*; import static com.oracle.max.graal.lir.amd64.AMD64Arithmetic.*; import static com.oracle.max.graal.lir.amd64.AMD64Compare.*; -import static com.oracle.max.graal.lir.amd64.AMD64CompareToIntOpcode.*; import java.util.*; @@ -599,27 +598,4 @@ postGCWriteBarrier(address.base, newValue); } } - - // TODO The class NormalizeCompareNode should be lowered away in the front end, since the code generated is long and uses branches anyway. - @Override - public void visitNormalizeCompare(NormalizeCompareNode x) { - emitCompare(operand(x.x()), operand(x.y())); - Variable result = newVariable(x.kind()); - switch (x.x().kind()){ - case Float: - case Double: - if (x.isUnorderedLess) { - append(CMP2INT_UL.create(result)); - } else { - append(CMP2INT_UG.create(result)); - } - break; - case Long: - append(CMP2INT.create(result)); - break; - default: - throw GraalInternalError.shouldNotReachHere(); - } - setResult(x, result); - } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java Fri Feb 10 17:09:39 2012 +0100 @@ -51,8 +51,6 @@ HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); - boolean HotSpotMethodData_isMature(HotSpotMethodData methodData); - RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve); Object RiConstantPool_lookupConstant(HotSpotTypeResolved pool, int cpi); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVMImpl.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVMImpl.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVMImpl.java Fri Feb 10 17:09:39 2012 +0100 @@ -114,9 +114,6 @@ public native HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); @Override - public native boolean HotSpotMethodData_isMature(HotSpotMethodData methodData); - - @Override public native RiType getType(Class javaClass); @Override diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Fri Feb 10 17:09:39 2012 +0100 @@ -205,17 +205,48 @@ List topLevelMaps = DebugValueMap.getTopLevelMaps(); List debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { - for (DebugValueMap map : topLevelMaps) { - TTY.println("Showing the results for thread: " + map.getName()); - map.group(); - map.normalize(); - printMap(map, debugValues, 0); + if (GraalOptions.SummarizeDebugValues) { + printSummary(topLevelMaps, debugValues); + } else { + for (DebugValueMap map : topLevelMaps) { + TTY.println("Showing the results for thread: " + map.getName()); + map.group(); + map.normalize(); + printMap(map, debugValues, 0); + } } } } } - private void printMap(DebugValueMap map, List debugValues, int level) { + private static void printSummary(List topLevelMaps, List debugValues) { + DebugValueMap result = new DebugValueMap("Summary"); + for (int i = debugValues.size() - 1; i >= 0; i--) { + DebugValue debugValue = debugValues.get(i); + int index = debugValue.getIndex(); + long total = collectTotal(topLevelMaps, index); + result.setCurrentValue(index, total); + } + printMap(result, debugValues, 0); + } + + private static long collectTotal(List maps, int index) { + long total = 0; + for (int i = 0; i < maps.size(); i++) { + DebugValueMap map = maps.get(i); + // the top level accumulates some counters -> do not process the children if we find a value + long value = map.getCurrentValue(index); + if (value == 0) { + total += collectTotal(map.getChildren(), index); + } else { + total += value; + } + } + return total; + } + + + private static void printMap(DebugValueMap map, List debugValues, int level) { printIndent(level); TTY.println(map.getName()); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodData.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodData.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodData.java Fri Feb 10 17:09:39 2012 +0100 @@ -27,6 +27,7 @@ import sun.misc.*; import com.oracle.max.cri.ri.*; +import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.hotspot.*; import com.oracle.max.graal.hotspot.Compiler; @@ -57,7 +58,6 @@ private Object hotspotMirror; private int normalDataSize; private int extraDataSize; - private boolean mature; private HotSpotMethodData(Compiler compiler) { super(compiler); @@ -76,19 +76,6 @@ return normalDataSize; } - public boolean isMature() { - // TODO (ch) maturity of profiling information is an issue in general. Not all optimizations require mature data as long as the code - // does deoptimize/recompile on violations (might decrease startup and increase peak performance). - // Maturity is currently used on several levels: - // 1) whole method data - // 2) individual branch/switch profiling data - // 3) MatureInvocationCount for eliminating exception edges - if (!mature) { - mature = compiler.getVMEntries().HotSpotMethodData_isMature(this); - } - return mature; - } - public boolean isWithin(int position) { return position >= 0 && position < normalDataSize + extraDataSize; } @@ -104,7 +91,7 @@ } public HotSpotMethodDataAccessor getExtraData(int position) { - if (position >= extraDataSize) { + if (position >= normalDataSize + extraDataSize) { return null; } return getData(position); @@ -381,7 +368,7 @@ RiResolvedType[] types; double[] probabilities; - if (entries <= 0) { + if (entries <= 0 || totalCount < GraalOptions.MatureExecutionsTypeProfile) { return null; } else if (entries < sparseTypes.length) { types = Arrays.copyOf(sparseTypes, entries); @@ -459,7 +446,6 @@ private static final int BRANCH_DATA_TAG = 7; private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3); private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2); - private static final int BRANCH_DATA_MATURE_COUNT = 40; public BranchData() { super(BRANCH_DATA_TAG, BRANCH_DATA_SIZE); @@ -471,7 +457,7 @@ long notTakenCount = data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET); long total = takenCount + notTakenCount; - if (total < BRANCH_DATA_MATURE_COUNT) { + if (total < GraalOptions.MatureExecutionsBranch) { return -1; } else { return takenCount / (double) total; @@ -536,7 +522,7 @@ result[i - 1] = count; } - if (totalCount < 10 * (length + 2)) { + if (totalCount < GraalOptions.MatureExecutionsPerSwitchCase * length) { return null; } else { for (int i = 0; i < length; i++) { diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Feb 10 17:09:39 2012 +0100 @@ -203,7 +203,7 @@ methodData = compiler.getVMEntries().RiMethod_methodData(this); } - if (methodData == null || !methodData.isMature()) { + if (methodData == null) { return new HotSpotNoProfilingInfo(compiler); } else { return new HotSpotProfilingInfo(compiler, methodData); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotNoProfilingInfo.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotNoProfilingInfo.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotNoProfilingInfo.java Fri Feb 10 17:09:39 2012 +0100 @@ -26,13 +26,17 @@ import com.oracle.max.graal.hotspot.*; import com.oracle.max.graal.hotspot.Compiler; - +/** + * Dummy profiling information in case that a method was not executed frequently enough so that + * no profiling information does exist yet. + */ public final class HotSpotNoProfilingInfo extends CompilerObject implements RiProfilingInfo { /** * */ private static final long serialVersionUID = 4357945025049704109L; - private static final HotSpotMethodDataAccessor noData = HotSpotMethodData.getNoDataExceptionPossibleAccessor(); + // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. + private static final HotSpotMethodDataAccessor noData = HotSpotMethodData.getNoDataNoExceptionAccessor(); public HotSpotNoProfilingInfo(Compiler compiler) { super(compiler); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Feb 10 17:09:39 2012 +0100 @@ -23,6 +23,7 @@ package com.oracle.max.graal.hotspot.ri; import com.oracle.max.cri.ri.*; +import com.oracle.max.graal.debug.*; import com.oracle.max.graal.hotspot.*; import com.oracle.max.graal.hotspot.Compiler; @@ -108,7 +109,10 @@ currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition); } - exceptionPossiblyNotRecorded = !methodData.isWithin(currentPosition); + if (!methodData.isWithin(currentPosition)) { + exceptionPossiblyNotRecorded = true; + Debug.metric("InsufficientSpaceForProfilingData").increment(); + } } noDataFound(exceptionPossiblyNotRecorded); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotXirGenerator.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotXirGenerator.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotXirGenerator.java Fri Feb 10 17:09:39 2012 +0100 @@ -762,8 +762,8 @@ XirOperand result = asm.restart(CiKind.Int); XirParameter object = asm.createInputParameter("object", CiKind.Object); final XirOperand hub = is(EXACT_HINTS, flags) ? null : asm.createConstantInputParameter("hub", CiKind.Object); - XirOperand trueValue = asm.createConstantInputParameter("trueValue", CiKind.Int); - XirOperand falseValue = asm.createConstantInputParameter("falseValue", CiKind.Int); + XirOperand trueValue = asm.createInputParameter("trueValue", CiKind.Int); + XirOperand falseValue = asm.createInputParameter("falseValue", CiKind.Int); XirOperand objHub = asm.createTemp("objHub", CiKind.Object); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BciBlockMapping.java --- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BciBlockMapping.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BciBlockMapping.java Fri Feb 10 17:09:39 2012 +0100 @@ -363,12 +363,6 @@ private static boolean canTrap(int opcode, int bci, RiProfilingInfo profilingInfo) { switch (opcode) { - case INVOKESTATIC: - case INVOKESPECIAL: - case INVOKEVIRTUAL: - case INVOKEINTERFACE: { - return true; - } case IASTORE: case LASTORE: case FASTORE: @@ -388,7 +382,7 @@ case PUTFIELD: case GETFIELD: { if (GraalOptions.AllowExplicitExceptionChecks) { - return profilingInfo.getExceptionSeen(bci) == RiExceptionSeen.TRUE; + return profilingInfo.getExceptionSeen(bci) != RiExceptionSeen.FALSE; } } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderConfiguration.java --- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderConfiguration.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderConfiguration.java Fri Feb 10 17:09:39 2012 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.java; +import com.oracle.max.cri.ri.*; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.phases.*; @@ -34,6 +35,7 @@ private final boolean useBranchPrediction; private final ResolvePolicy resolving; private final PhasePlan plan; + private RiResolvedType[] skippedExceptionTypes; public GraphBuilderConfiguration(boolean useBranchPrediction, ResolvePolicy resolving, PhasePlan plan) { this.useBranchPrediction = useBranchPrediction; @@ -45,6 +47,15 @@ return useBranchPrediction; } + + public void setSkippedExceptionTypes(RiResolvedType[] skippedExceptionTypes) { + this.skippedExceptionTypes = skippedExceptionTypes; + } + + public RiResolvedType[] getSkippedExceptionTypes() { + return skippedExceptionTypes; + } + public boolean eagerResolvingForSnippets() { return (resolving == ResolvePolicy.EagerForSnippets || resolving == ResolvePolicy.Eager); } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Fri Feb 10 17:09:39 2012 +0100 @@ -324,7 +324,7 @@ if (GraalOptions.UseExceptionProbability) { // be conservative if information was not recorded (could result in endless recompiles otherwise) - if (bci != FrameState.BEFORE_BCI && exceptionObject == null && profilingInfo.getExceptionSeen(bci) != RiExceptionSeen.TRUE) { + if (bci != FrameState.BEFORE_BCI && exceptionObject == null && profilingInfo.getExceptionSeen(bci) == RiExceptionSeen.FALSE) { return null; } else { Debug.log("Creating exception edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, profilingInfo.getExceptionSeen(bci)); @@ -1446,7 +1446,18 @@ if (config.eagerResolving()) { catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); } - ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, catchType, (catchType instanceof RiResolvedType) && ((RiResolvedType) catchType).isInitialized()); + boolean initialized = (catchType instanceof RiResolvedType) && ((RiResolvedType) catchType).isInitialized(); + if (initialized && config.getSkippedExceptionTypes() != null) { + RiResolvedType resolvedCatchType = (RiResolvedType) catchType; + for (RiResolvedType skippedType : config.getSkippedExceptionTypes()) { + initialized &= !resolvedCatchType.isSubtypeOf(skippedType); + if (!initialized) { + break; + } + } + } + + ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, catchType, initialized); if (typeInstruction != null) { Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1); FixedNode catchSuccessor = createTarget(block.successors.get(0), frameState); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64CompareToIntOpcode.java --- a/graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64CompareToIntOpcode.java Fri Feb 10 17:04:03 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.lir.amd64; - -import static com.oracle.max.cri.ci.CiValueUtil.*; - -import java.util.*; - -import com.oracle.max.asm.*; -import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag; -import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; -import com.oracle.max.graal.graph.*; -import com.oracle.max.graal.lir.*; -import com.oracle.max.graal.lir.asm.*; - -/** - * Implementation of the Java bytecodes that compare a long, float, or double value and produce the - * integer constants -1, 0, 1 on less, equal, or greater, respectively. For floating point compares, - * unordered can be either greater {@link #CMP2INT_UG} or less {@link #CMP2INT_UL}. - */ -public enum AMD64CompareToIntOpcode { - CMP2INT, CMP2INT_UG, CMP2INT_UL; - - public LIRInstruction create(CiValue result) { - CiValue[] outputs = new CiValue[] {result}; - - return new AMD64LIRInstruction(this, outputs, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { - @Override - public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - emit(masm, output(0)); - } - - @Override - protected EnumSet flagsFor(OperandMode mode, int index) { - if (mode == OperandMode.Output && index == 0) { - return EnumSet.of(OperandFlag.Register); - } - throw GraalInternalError.shouldNotReachHere(); - } - }; - } - - private void emit(AMD64MacroAssembler masm, CiValue result) { - CiRegister dest = asIntReg(result); - Label high = new Label(); - Label low = new Label(); - Label done = new Label(); - - // comparison is done by a separate LIR instruction before - switch (this) { - case CMP2INT: - masm.jcc(ConditionFlag.greater, high); - masm.jcc(ConditionFlag.less, low); - break; - case CMP2INT_UG: - masm.jcc(ConditionFlag.parity, high); - masm.jcc(ConditionFlag.above, high); - masm.jcc(ConditionFlag.below, low); - break; - case CMP2INT_UL: - masm.jcc(ConditionFlag.parity, low); - masm.jcc(ConditionFlag.above, high); - masm.jcc(ConditionFlag.below, low); - break; - default: - throw GraalInternalError.shouldNotReachHere(); - } - - // equal -> 0 - masm.xorptr(dest, dest); - masm.jmp(done); - - // greater -> 1 - masm.bind(high); - masm.xorptr(dest, dest); - masm.incrementl(dest, 1); - masm.jmp(done); - - // less -> -1 - masm.bind(low); - masm.xorptr(dest, dest); - masm.decrementl(dest, 1); - - masm.bind(done); - } -} diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64ControlFlow.java --- a/graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64ControlFlow.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64ControlFlow.java Fri Feb 10 17:09:39 2012 +0100 @@ -354,10 +354,10 @@ switch (cond) { case EQ: return ConditionFlag.equal; case NE: return ConditionFlag.notEqual; - case BT: return ConditionFlag.below; - case BE: return ConditionFlag.belowEqual; - case AE: return ConditionFlag.aboveEqual; - case AT: return ConditionFlag.above; + case LT: return ConditionFlag.below; + case LE: return ConditionFlag.belowEqual; + case GE: return ConditionFlag.aboveEqual; + case GT: return ConditionFlag.above; default: throw GraalInternalError.shouldNotReachHere(); } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/asm/TargetMethodAssembler.java --- a/graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/asm/TargetMethodAssembler.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/asm/TargetMethodAssembler.java Fri Feb 10 17:09:39 2012 +0100 @@ -97,7 +97,7 @@ Debug.metric("DataPatches").add(targetMethod.dataReferences.size()); Debug.metric("ExceptionHandlersEmitted").add(targetMethod.exceptionHandlers.size()); - Debug.log("Finished target method %s, isStub %d", name, isStub); + Debug.log("Finished target method %s, isStub %b", name, isStub); /* if (GraalOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) { Util.printSection("Target Method", Util.SECTION_CHARACTER); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/cfg/Block.java --- a/graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/cfg/Block.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.lir/src/com/oracle/max/graal/lir/cfg/Block.java Fri Feb 10 17:09:39 2012 +0100 @@ -98,6 +98,19 @@ return dominator; } + public Block getEarliestPostDominated() { + Block b = this; + while (true) { + Block dom = b.getDominator(); + if (dom != null && dom.getPostdominator() == b) { + b = dom; + } else { + break; + } + } + return b; + } + public List getDominated() { if (dominated == null) { return Collections.emptyList(); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/DeoptimizeNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/DeoptimizeNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -40,6 +40,10 @@ @Data private String message; @Data private final DeoptAction action; + public DeoptimizeNode() { + this(DeoptAction.InvalidateReprofile); + } + public DeoptimizeNode(DeoptAction action) { super(StampFactory.illegal()); this.action = action; @@ -61,4 +65,9 @@ public void generate(LIRGeneratorTool gen) { gen.emitDeoptimizeOn(null, action, message); } + + @NodeIntrinsic + public static void deopt() { + throw new UnsupportedOperationException(); + } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/InvokeNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/InvokeNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/InvokeNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -29,6 +29,7 @@ import com.oracle.max.graal.nodes.extended.*; import com.oracle.max.graal.nodes.java.*; import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.util.*; /** * The {@code InvokeNode} represents all kinds of method calls. @@ -117,7 +118,15 @@ assert kind() == CiKind.Void && usages().isEmpty(); ((StructuredGraph) graph()).removeFixed(this); } else { - ((StructuredGraph) graph()).replaceFixed(this, node); + if (node instanceof FixedWithNextNode) { + ((StructuredGraph) graph()).replaceFixedWithFixed(this, (FixedWithNextNode) node); + } else if (node instanceof DeoptimizeNode) { + this.replaceAtPredecessors(node); + this.replaceAtUsages(null); + GraphUtil.killCFG(this); + } else { + ((StructuredGraph) graph()).replaceFixed(this, node); + } } call.safeDelete(); if (stateAfter.usages().isEmpty()) { diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MaterializeNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MaterializeNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MaterializeNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -31,7 +31,7 @@ super(condition, trueValue, falseValue); } - public static MaterializeNode create(BooleanNode condition, Graph graph, ConstantNode trueValue, ConstantNode falseValue) { + public static MaterializeNode create(BooleanNode condition, Graph graph, ValueNode trueValue, ValueNode falseValue) { MaterializeNode result = new MaterializeNode(condition, trueValue, falseValue); return graph.unique(result); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/CompareNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/CompareNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -146,17 +146,6 @@ private ValueNode optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode) { if (constant.kind == CiKind.Int && constant.asInt() == 0) { Condition cond = condition(); - if (normalizeNode.x().kind().isFloatOrDouble()) { - switch (cond) { - case LT: cond = Condition.BT; break; - case LE: cond = Condition.BE; break; - case GE: cond = Condition.AE; break; - case GT: cond = Condition.AT; break; - } - } - if (normalizeNode == y()) { - cond = cond.mirror(); - } boolean isLess = cond == Condition.LE || cond == Condition.LT || cond == Condition.BE || cond == Condition.BT; boolean canonUnorderedIsTrue = cond != Condition.EQ && (cond == Condition.NE || !(isLess ^ normalizeNode.isUnorderedLess)); CompareNode result = graph().unique(new CompareNode(normalizeNode.x(), cond, canonUnorderedIsTrue, normalizeNode.y())); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java Fri Feb 10 17:09:39 2012 +0100 @@ -227,13 +227,9 @@ switch (this) { case EQ: return x == y; case NE: return x != y; - case BT: case LT: return x < y; - case BE: case LE: return x <= y; - case AT: case GT: return x > y; - case AE: case GE: return x >= y; } } @@ -246,13 +242,9 @@ switch (this) { case EQ: return x == y; case NE: return x != y; - case BT: case LT: return x < y; - case BE: case LE: return x <= y; - case AT: case GT: return x > y; - case AE: case GE: return x >= y; } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/IntegerAddNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/IntegerAddNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -28,7 +28,7 @@ import com.oracle.max.graal.nodes.spi.*; @NodeInfo(shortName = "+") -public final class IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable { +public class IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable { public IntegerAddNode(CiKind kind, ValueNode x, ValueNode y) { super(kind, x, y); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/NormalizeCompareNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/NormalizeCompareNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/NormalizeCompareNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -22,21 +22,15 @@ */ package com.oracle.max.graal.nodes.calc; -import java.util.*; - import com.oracle.max.cri.ci.*; +import com.oracle.max.graal.cri.*; import com.oracle.max.graal.nodes.*; import com.oracle.max.graal.nodes.spi.*; /** - * Returns -1, 0, or 1 if either x > y, x == y, or x < y. + * Returns -1, 0, or 1 if either x < y, x == y, or x > y. */ -// TODO(cwi): Since the machine code representation of this node uses branches and individual constant assignemnts anyway, -// it should be lowered to explicit control flow nodes. This removes AMD64CompareToIntOpcode. -// For code generated by javac, the opcodes are followed by a branch instruction immediately, so in all cases that matter -// this node is canonicalized away. -// Consider moving this node and the code that does the lowering / canonicalization in a Java-specific project. -public final class NormalizeCompareNode extends BinaryNode implements LIRLowerable { +public final class NormalizeCompareNode extends BinaryNode implements Lowerable { @Data public final boolean isUnorderedLess; /** @@ -51,14 +45,15 @@ } @Override - public void generate(LIRGeneratorTool gen) { - gen.visitNormalizeCompare(this); - } + public void lower(CiLoweringTool tool) { + StructuredGraph graph = (StructuredGraph) graph(); - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("isUnorderedLess", isUnorderedLess); - return properties; + CompareNode equalComp = graph.unique(new CompareNode(x(), Condition.EQ, false, y())); + MaterializeNode equalValue = MaterializeNode.create(equalComp, graph, ConstantNode.forInt(0, graph), ConstantNode.forInt(1, graph)); + + CompareNode lessComp = graph.unique(new CompareNode(x(), Condition.LT, isUnorderedLess, y())); + MaterializeNode value = MaterializeNode.create(lessComp, graph, ConstantNode.forInt(-1, graph), equalValue); + + graph.replaceFloating(this, value); } } diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -62,25 +62,27 @@ if (source.isConstant()) { CiConstant constant = source.asConstant(); Object o = constant.asObject(); - switch (kind()) { - case Boolean: - return ConstantNode.forBoolean((Boolean) o, graph()); - case Byte: - return ConstantNode.forByte((Byte) o, graph()); - case Char: - return ConstantNode.forChar((Character) o, graph()); - case Short: - return ConstantNode.forShort((Short) o, graph()); - case Int: - return ConstantNode.forInt((Integer) o, graph()); - case Long: - return ConstantNode.forLong((Long) o, graph()); - case Float: - return ConstantNode.forFloat((Long) o, graph()); - case Double: - return ConstantNode.forDouble((Long) o, graph()); - default: - assert false; + if (o != null) { + switch (kind()) { + case Boolean: + return ConstantNode.forBoolean((Boolean) o, graph()); + case Byte: + return ConstantNode.forByte((Byte) o, graph()); + case Char: + return ConstantNode.forChar((Character) o, graph()); + case Short: + return ConstantNode.forShort((Short) o, graph()); + case Int: + return ConstantNode.forInt((Integer) o, graph()); + case Long: + return ConstantNode.forLong((Long) o, graph()); + case Float: + return ConstantNode.forFloat((Long) o, graph()); + case Double: + return ConstantNode.forDouble((Long) o, graph()); + default: + assert false; + } } } return this; diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/InstanceOfNode.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/InstanceOfNode.java Fri Feb 10 17:09:39 2012 +0100 @@ -63,6 +63,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { + assert object() != null : this; RiResolvedType exact = object().exactType(); if (exact != null) { boolean result = exact.isSubtypeOf(targetClass()); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/LIRGeneratorTool.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/LIRGeneratorTool.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/LIRGeneratorTool.java Fri Feb 10 17:09:39 2012 +0100 @@ -103,9 +103,6 @@ // * The actual compare-and-swap public abstract void visitCompareAndSwap(CompareAndSwapNode i); - // The class NormalizeCompareNode should be lowered away in the front end, since the code generated is long and uses branches anyway. - public abstract void visitNormalizeCompare(NormalizeCompareNode i); - // Functionality that is currently implemented in XIR. // These methods will go away eventually when lowering is done via snippets in the front end. public abstract void visitArrayLength(ArrayLengthNode i); diff -r 723df37192d6 -r e43d36482d12 graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java --- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java Fri Feb 10 17:04:03 2012 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java Fri Feb 10 17:09:39 2012 +0100 @@ -23,9 +23,8 @@ package com.oracle.max.graal.compiler.tests; import static com.oracle.max.graal.graph.iterators.NodePredicates.*; -import junit.framework.*; -import org.junit.Test; +import org.junit.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.debug.*; diff -r 723df37192d6 -r e43d36482d12 src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Fri Feb 10 17:04:03 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Fri Feb 10 17:09:39 2012 +0100 @@ -40,5 +40,5 @@ # Disable assertions for RequestProcessor to prevent annoying messages in case # of multiple SceneAnimator update tasks in the default RequestProcessor. -run.args.extra = -J-client -J-da:org.openide.util.RequestProcessor -debug.args.extra = -J-client -J-da:org.openide.util.RequestProcessor +run.args.extra = -J-server -J-da:org.openide.util.RequestProcessor -J-Xms2g -J-Xmx2g +debug.args.extra = -J-server -J-da:org.openide.util.RequestProcessor diff -r 723df37192d6 -r e43d36482d12 src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Fri Feb 10 17:04:03 2012 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Fri Feb 10 17:09:39 2012 +0100 @@ -291,7 +291,6 @@ HotSpotMethodData::set_hotspotMirror(obj, method_data()); HotSpotMethodData::set_normalDataSize(obj, method_data()->data_size()); HotSpotMethodData::set_extraDataSize(obj, method_data()->extra_data_size()); - HotSpotMethodData::set_mature(obj, method_data()->is_mature()); method_data->set_graal_mirror(obj()); return obj; diff -r 723df37192d6 -r e43d36482d12 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Fri Feb 10 17:04:03 2012 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Fri Feb 10 17:09:39 2012 +0100 @@ -200,13 +200,6 @@ } } -JNIEXPORT jboolean JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_HotSpotMethodData_1isMature(JNIEnv *, jobject, jobject hotspot_method_data) { - TRACE_graal_3("CompilerToVM::HotSpotMethodData_isMature"); - VM_ENTRY_MARK; - methodDataHandle method_data = getMethodDataFromHotSpotMethodData(hotspot_method_data); - return method_data->is_mature(); -} - // ------------------------------------------------------------------ // Adjust a CounterData count to be commensurate with // interpreter_invocation_count. If the MDO exists for @@ -951,7 +944,6 @@ {CC"RiMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(RiMethod_1uniqueConcreteMethod)}, {CC"getRiMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getRiMethod)}, {CC"RiMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(RiMethod_1methodData)}, - {CC"HotSpotMethodData_isMature", CC"("METHOD_DATA")Z", FN_PTR(HotSpotMethodData_1isMature)}, {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1invocationCount)}, {CC"RiMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasCompiledCode)}, {CC"RiMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1getCompiledCodeSize)}, diff -r 723df37192d6 -r e43d36482d12 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Fri Feb 10 17:04:03 2012 +0100 +++ b/src/share/vm/graal/graalJavaAccess.hpp Fri Feb 10 17:09:39 2012 +0100 @@ -75,7 +75,6 @@ oop_field(HotSpotMethodData, hotspotMirror, "Ljava/lang/Object;") \ int_field(HotSpotMethodData, normalDataSize) \ int_field(HotSpotMethodData, extraDataSize) \ - boolean_field(HotSpotMethodData, mature) \ end_class \ start_class(HotSpotType) \ oop_field(HotSpotType, name, "Ljava/lang/String;") \ diff -r 723df37192d6 -r e43d36482d12 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Fri Feb 10 17:04:03 2012 +0100 +++ b/src/share/vm/runtime/arguments.cpp Fri Feb 10 17:09:39 2012 +0100 @@ -2126,7 +2126,7 @@ errno = 0; DIR* graal_dir_handle = os::opendir(graal_dir); while ((dentry = os::readdir(graal_dir_handle, (struct dirent *)tdbuf)) != NULL) { - if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..")) { + if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..") != 0 && strcmp(dentry->d_name, "com.oracle.max.graal.tests") != 0) { prepend_to_graal_classpath(scp_compiler, graal_dir, dentry->d_name); if (PrintVMOptions) { tty->print_cr("Adding project directory %s to bootclasspath", dentry->d_name);