changeset 4463:6616513a42de

bugfixes
author Christian Haeubl <christian.haeubl@oracle.com>
date Thu, 02 Feb 2012 19:50:18 -0800
parents 428a91f18858
children f304ba0d4e24
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java src/share/vm/graal/graalCompiler.cpp
diffstat 5 files changed, 52 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Feb 02 17:46:37 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Feb 02 19:50:18 2012 -0800
@@ -747,6 +747,9 @@
         XirArgument otherClass = toXirArgument(x.type().getEncoding(Representation.ObjectHub));
         XirSnippet snippet = xir.genTypeBranch(site(x), thisClass, otherClass, x.type());
         emitXir(snippet, x, info, null, false, trueSuccessor, falseSuccessor);
+        if (trueSuccessor != null) {
+            emitJump(trueSuccessor, null);
+        }
     }
 
     @Override
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java	Thu Feb 02 17:46:37 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java	Thu Feb 02 19:50:18 2012 -0800
@@ -77,7 +77,7 @@
             filter = filter.replace("[", "\\[");
             filter = filter.replace("]", "\\]");
             filter = filter.replace(":", "\\:");*/
-            System.out.println("regexp: " + filter + " string=" + currentScope + ", " + Pattern.matches(filter, currentScope));
+            //System.out.println("regexp: " + filter + " string=" + currentScope + ", " + Pattern.matches(filter, currentScope));
             return Pattern.matches(filter, currentScope);
         }
         return currentScope.contains(filter);
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Feb 02 17:46:37 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Feb 02 19:50:18 2012 -0800
@@ -383,7 +383,9 @@
 
     private PhasePlan getDefaultPhasePlan() {
         PhasePlan phasePlan = new PhasePlan();
-        phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
+        if (GraalOptions.Intrinsify) {
+            phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
+        }
         return phasePlan;
     }
 }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Feb 02 17:46:37 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Feb 02 19:50:18 2012 -0800
@@ -21,8 +21,8 @@
  * questions.
  */
 package com.oracle.max.graal.hotspot.snippets;
-
 import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.cri.*;
 import com.oracle.max.graal.hotspot.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
@@ -232,8 +232,8 @@
             long dstAddr = GetObjectAddressNode.get(dest);
             long start = (dstAddr + header + destPos * 8L) >>> cardShift;
             long end = (dstAddr + header + (destPos + length - 1) * 8L) >>> cardShift;
-            long count = end - start;
-            while (count-- >= 0) {
+            long count = end - start + 1;
+            while (count-- > 0) {
                 DirectStoreNode.store((start + cardStart) + count, false);
             }
         }
@@ -281,10 +281,9 @@
         long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object);
         for (long i = (length - 1) * 8; i >= 0; i -= 8) {
             Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object);
+            DirectObjectStoreNode.store(dest, i + (destOffset + header), a);
         }
     }
-
     /**
      * Copies {@code length} bytes from {@code src} starting at {@code srcPos} to {@code dest} starting at {@code destPos}.
      * @param src source object
@@ -343,10 +342,9 @@
         long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object);
         for (long i = 0; i < length * 8L; i += 8) {
             Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object);
+            DirectObjectStoreNode.store(dest, i + (destOffset + header), a);
         }
     }
-
     private static class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable {
         @Input private ValueNode object;
 
@@ -397,6 +395,44 @@
             gen.emitStore(new CiAddress(v.kind, gen.operand(address)), v, false);
         }
     }
+    private static class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable {
+        @Input private ValueNode object;
+        @Input private ValueNode value;
+        @Input private ValueNode offset;
+
+        public DirectObjectStoreNode(ValueNode object, ValueNode offset, ValueNode value) {
+            super(StampFactory.illegal());
+            this.object = object;
+            this.value = value;
+            this.offset = offset;
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static void store(Object obj, long offset, long value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static void store(Object obj, long offset, boolean value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static void store(Object obj, long offset, Object value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void lower(CiLoweringTool tool) {
+            StructuredGraph graph = (StructuredGraph) this.graph();
+            IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, value.kind(), 0, offset, graph, false);
+            WriteNode write = graph.add(new WriteNode(object, value, location));
+            graph.replaceFixedWithFixed(this, write);
+        }
+    }
 
     private static class CardTableShiftNode extends ConstantNode {
         public CardTableShiftNode() {
--- a/src/share/vm/graal/graalCompiler.cpp	Thu Feb 02 17:46:37 2012 -0800
+++ b/src/share/vm/graal/graalCompiler.cpp	Thu Feb 02 19:50:18 2012 -0800
@@ -29,6 +29,7 @@
 #include "graal/graalVmIds.hpp"
 #include "graal/graalEnv.hpp"
 #include "c1/c1_Runtime1.hpp"
+#include "compiler/compilerOracle.hpp"
 #include "runtime/arguments.hpp"
 
 GraalCompiler* GraalCompiler::_instance = NULL;
@@ -270,7 +271,7 @@
   HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int());
   HotSpotMethodResolved::set_maxLocals(obj, method->max_locals());
   HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack());
-  HotSpotMethodResolved::set_canBeInlined(obj, true);
+  HotSpotMethodResolved::set_canBeInlined(obj, !CompilerOracle::should_not_inline(method));
   
   method->set_graal_mirror(obj());
   return obj;