# HG changeset patch # User Doug Simon # Date 1427405178 -3600 # Node ID b9041d4e91c5dda941353ecf5d33367cac55bdd0 # Parent b2e8b26f504052e86a58635b71a8ba900edf7c29# Parent e87754e57be7548cbfe2f24412b7f996d7053be0 Merge. diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Thu Mar 26 22:26:18 2015 +0100 @@ -51,7 +51,7 @@ */ public static long getMemorySizeRecursive(MetaAccessProvider access, ConstantReflectionProvider constantReflection, JavaConstant constant, PrintStream out, int printTopN) { Set marked = new HashSet<>(); - Stack stack = new Stack<>(); + Deque stack = new ArrayDeque<>(); if (constant.getKind() == Kind.Object && constant.isNonNull()) { marked.add(constant); } @@ -120,7 +120,7 @@ return sum; } - private static void pushConstant(Set marked, Stack stack, JavaConstant value) { + private static void pushConstant(Set marked, Deque stack, JavaConstant value) { if (value.isNonNull()) { if (!marked.contains(value)) { marked.add(value); diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/UnsafeAccess.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/UnsafeAccess.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/UnsafeAccess.java Thu Mar 26 22:26:18 2015 +0100 @@ -65,7 +65,7 @@ if (address == 0) { return null; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0;; i++) { char c = (char) unsafe.getByte(address + i); if (c == 0) { diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.graph/.checkstyle_checks.xml --- a/graal/com.oracle.graal.graph/.checkstyle_checks.xml Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.graph/.checkstyle_checks.xml Thu Mar 26 22:26:18 2015 +0100 @@ -122,9 +122,13 @@ + - + + + + diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java Thu Mar 26 22:26:18 2015 +0100 @@ -299,8 +299,8 @@ @Test public void test14() throws Exception { - HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBufferTest", Object.class, Object.class); - StringBuffer buffer = new StringBuffer("TestTestTestTestTestTestTest"); + HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBuilderTest", Object.class, Object.class); + StringBuilder buffer = new StringBuilder("TestTestTestTestTestTestTest"); Assert.assertTrue(buffer.length() == 28); String a = new String("TestTestTestTestTestTestTest"); installedBenchmarkCode.executeVarargs(buffer, a.toCharArray()); @@ -308,8 +308,8 @@ Assert.assertTrue(buffer.toString().equals("TestTestTestTestTestTestTestTestTestTestTestTestTestTest")); } - public static void stringBufferTest(Object c1, Object c2) { - StringBuffer source = (StringBuffer) c1; + public static void stringBuilderTest(Object c1, Object c2) { + StringBuilder source = (StringBuilder) c1; char[] add = (char[]) c2; for (int i = 0; i < add.length; i++) { source.append(add[i]); @@ -318,12 +318,12 @@ @Test public void test15() throws Exception { - HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBufferTestIn"); + HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBuilderTestIn"); installedBenchmarkCode.executeVarargs(); } - public static void stringBufferTestIn() { - StringBuffer buffer = new StringBuffer("TestTestTestTestTestTestTest"); + public static void stringBuilderTestIn() { + StringBuilder buffer = new StringBuilder("TestTestTestTestTestTestTest"); Assert.assertTrue(buffer.length() == 28); String a = new String("TestTestTestTestTestTestTest"); char[] add = a.toCharArray(); @@ -336,12 +336,12 @@ @Test public void test16() throws Exception { - HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBufferArrayCopy"); + HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBuilderArrayCopy"); installedBenchmarkCode.executeVarargs(); } - public static void stringBufferArrayCopy() { - StringBuffer buffer = new StringBuffer("TestTestTestTestTestTestTest"); + public static void stringBuilderArrayCopy() { + StringBuilder buffer = new StringBuilder("TestTestTestTestTestTestTest"); Assert.assertTrue(buffer.length() == 28); String a = new String("TestTestTestTestTestTestTest"); char[] dst = new char[buffer.length() * 2]; diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Thu Mar 26 22:26:18 2015 +0100 @@ -63,7 +63,7 @@ return cs.hashCode(); } - if (cs instanceof StringBuffer) { + if (cs instanceof StringBuilder) { int[] hash = {0}; cs.chars().forEach(c -> hash[0] += c); return hash[0]; diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Mar 26 22:26:18 2015 +0100 @@ -296,7 +296,7 @@ private final boolean explodeLoops; private final boolean mergeExplosions; private final Map mergeExplosionsMap; - private Stack explodeLoopsContext; + private Deque explodeLoopsContext; private int nextPeelIteration = 1; private boolean controlFlowSplit; private final InvocationPluginReceiver invocationPluginReceiver = new InvocationPluginReceiver(this); @@ -452,7 +452,7 @@ private void detectLoops(FixedNode startInstruction) { NodeBitMap visited = currentGraph.createNodeBitMap(); NodeBitMap active = currentGraph.createNodeBitMap(); - Stack stack = new Stack<>(); + Deque stack = new ArrayDeque<>(); stack.add(startInstruction); visited.mark(startInstruction); while (!stack.isEmpty()) { @@ -498,7 +498,7 @@ private void insertLoopEnds(FixedNode startInstruction) { NodeBitMap visited = currentGraph.createNodeBitMap(); - Stack stack = new Stack<>(); + Deque stack = new ArrayDeque<>(); stack.add(startInstruction); visited.mark(startInstruction); List loopBegins = new ArrayList<>(); @@ -538,7 +538,7 @@ private void insertLoopExits(LoopBeginNode loopBegin, IdentityHashMap> innerLoopsMap) { NodeBitMap visited = currentGraph.createNodeBitMap(); - Stack stack = new Stack<>(); + Deque stack = new ArrayDeque<>(); for (LoopEndNode loopEnd : loopBegin.loopEnds()) { stack.push(loopEnd); visited.mark(loopEnd); @@ -622,7 +622,7 @@ private int iterateExplodedLoopHeader(BciBlock[] blocks, BciBlock header) { if (explodeLoopsContext == null) { - explodeLoopsContext = new Stack<>(); + explodeLoopsContext = new ArrayDeque<>(); } ExplodedLoopContext context = new ExplodedLoopContext(); @@ -1870,9 +1870,7 @@ } private int findOperatingDimensionWithLoopExplosion(BciBlock block, HIRFrameStateBuilder state) { - int i; - for (i = explodeLoopsContext.size() - 1; i >= 0; --i) { - ExplodedLoopContext context = explodeLoopsContext.elementAt(i); + for (ExplodedLoopContext context : explodeLoopsContext) { if (context.header == block) { if (this.mergeExplosions) { diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Switch02.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Switch02.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Switch02.java Thu Mar 26 22:26:18 2015 +0100 @@ -89,7 +89,7 @@ break; case (char) 0xFFFF - 21: result = 858112498 / val; - x = new Hashtable<>(); + x = new HashMap<>(); break; default: result = 34324341 / val; @@ -142,7 +142,7 @@ break; case (short) -0x7FFF + 21: result = 858112498 / val; - x = new Hashtable<>(); + x = new HashMap<>(); break; default: result = 34324341 / val; @@ -198,7 +198,7 @@ break; case (byte) -0x7F + 21: result = 858112498 / val; - x = new Hashtable<>(); + x = new HashMap<>(); break; default: result = 34324341 / val; diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java Thu Mar 26 22:26:18 2015 +0100 @@ -130,13 +130,13 @@ private static class Instance { private final NodeMap map; - private final Stack loopExits; + private final Deque loopExits; private final Function> blockToNodes; private final Function nodeToBlock; public Instance(StructuredGraph graph, Function> blockToNodes, Function nodeToBlock) { map = graph.createNodeMap(); - loopExits = new Stack<>(); + loopExits = new ArrayDeque<>(); this.blockToNodes = blockToNodes; this.nodeToBlock = nodeToBlock; } @@ -282,8 +282,8 @@ } Block guardBlock = nodeToBlock.apply(proxiedGuard); assert guardBlock != null; - for (int i = 0; i < loopExits.size(); ++i) { - LoopExitNode loopExitNode = loopExits.get(i); + for (Iterator iter = loopExits.descendingIterator(); iter.hasNext();) { + LoopExitNode loopExitNode = iter.next(); Block loopExitBlock = nodeToBlock.apply(loopExitNode); if (guardBlock != loopExitBlock && AbstractControlFlowGraph.dominates(guardBlock, loopExitBlock)) { Block loopBeginBlock = nodeToBlock.apply(loopExitNode.loopBegin()); diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java Thu Mar 26 22:26:18 2015 +0100 @@ -57,7 +57,7 @@ } public boolean apply(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) { - if (wordOperationPlugin.apply(b, method, args)) { + if (b.parsingReplacement() && wordOperationPlugin.apply(b, method, args)) { return true; } else if (b.parsingReplacement()) { NodeIntrinsic intrinsic = nodeIntrinsification.getIntrinsic(method); diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Mar 26 22:26:18 2015 +0100 @@ -268,6 +268,9 @@ if (targetMethod != null) { // TODO maybe cast arguments + if (!targetMethod.canBeInlined()) { + return null; + } if (targetMethod.canBeStaticallyBound()) { return new InlineInfo(targetMethod, false, false); } diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java Thu Mar 26 22:26:18 2015 +0100 @@ -91,6 +91,7 @@ assert wordImplType.isLinked(); wordMethod = wordImplType.resolveConcreteMethod(targetMethod, callingContextType); } + assert wordMethod != null : targetMethod; assert wordMethod.getAnnotation(Operation.class) != null : wordMethod; return wordMethod; } diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.truffle.api/.checkstyle_checks.xml --- a/graal/com.oracle.truffle.api/.checkstyle_checks.xml Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.truffle.api/.checkstyle_checks.xml Thu Mar 26 22:26:18 2015 +0100 @@ -5,7 +5,7 @@ This configuration file was written by the eclipse-cs plugin configuration editor --> @@ -122,8 +122,12 @@ + - + + + + diff -r e87754e57be7 -r b9041d4e91c5 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Thu Mar 26 13:51:37 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Thu Mar 26 22:26:18 2015 +0100 @@ -84,7 +84,7 @@ private static final List> allSources = Collections.synchronizedList(new ArrayList>()); // Files and pseudo files are indexed. - private static final Map> filePathToSource = new Hashtable<>(); + private static final Map> filePathToSource = new HashMap<>(); private static boolean fileCacheEnabled = true;