changeset 21948:0458778bb188

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 12 Jun 2015 15:47:54 +0200
parents b121c00d3c4c (current diff) e701664f4168 (diff)
children 185d7a9a2cfa
files make/jvmci.make mx/mx_graal_makefile.py
diffstat 5 files changed, 91 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCAddressLowering.java	Fri Jun 12 15:34:11 2015 +0200
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCAddressLowering.java	Fri Jun 12 15:47:54 2015 +0200
@@ -48,14 +48,14 @@
     public AddressNode lower(ValueNode base, ValueNode offset) {
         JavaConstant immBase = asImmediate(base);
         if (immBase != null && SPARCAssembler.isSimm13(immBase)) {
-            return lower(signExtend(offset), immBase.asLong());
+            return lower(offset, immBase.asLong());
         }
 
         JavaConstant immOffset = asImmediate(offset);
         if (immOffset != null && SPARCAssembler.isSimm13(immOffset)) {
             return lower(base, immOffset.asLong());
         }
-        return base.graph().unique(new SPARCIndexedAddressNode(base, signExtend(offset)));
+        return base.graph().unique(new SPARCIndexedAddressNode(base, offset));
     }
 
     private AddressNode lower(ValueNode base, long displacement) {
@@ -81,10 +81,6 @@
         return base.graph().unique(new SPARCImmediateAddressNode(base, (int) displacement));
     }
 
-    private static SignExtendNode signExtend(ValueNode node) {
-        return node.graph().unique(new SignExtendNode(node, Kind.Long.getBitCount()));
-    }
-
     private JavaConstant asImmediate(ValueNode value) {
         JavaConstant c = value.asJavaConstant();
         if (c != null && c.getKind().isNumericInteger() && !codeCache.needsDataPatch(c)) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Fri Jun 12 15:34:11 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Fri Jun 12 15:47:54 2015 +0200
@@ -121,9 +121,11 @@
         FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
         graph().addBeforeFixed(this, basePtr);
         HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime.getJVMCIRuntime();
+        Stamp wordStamp = StampFactory.forKind(runtime.getTarget().wordKind);
+        ValueNode wordPos = IntegerConvertNode.convert(pos, wordStamp, graph());
         int shift = CodeUtil.log2(jvmciRuntime.getArrayIndexScale(elementKind));
-        ValueNode scaledIndex = graph().unique(new LeftShiftNode(pos, ConstantNode.forInt(shift, graph())));
-        ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forInt(jvmciRuntime.getArrayBaseOffset(elementKind), graph())));
+        ValueNode scaledIndex = graph().unique(new LeftShiftNode(wordPos, ConstantNode.forInt(shift, graph())));
+        ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forIntegerStamp(wordStamp, jvmciRuntime.getArrayBaseOffset(elementKind), graph())));
         return graph().unique(new OffsetAddressNode(basePtr, offset));
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ReadOnlyArrayListPartialEvaluationTest.java	Fri Jun 12 15:47:54 2015 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, 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.truffle.test;
+
+import org.junit.*;
+
+import com.oracle.graal.truffle.test.nodes.*;
+import com.oracle.truffle.api.frame.*;
+
+public class ReadOnlyArrayListPartialEvaluationTest extends PartialEvaluationTest {
+
+    public static Object constant42() {
+        return 42;
+    }
+
+    @Test
+    public void constantValue() {
+        FrameDescriptor fd = new FrameDescriptor();
+        AbstractTestNode result = new ReadOnlyArrayListConstantNode(42);
+        assertPartialEvalEquals("constant42", new RootTestNode(fd, "constantValue", result));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/ReadOnlyArrayListConstantNode.java	Fri Jun 12 15:47:54 2015 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, 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.truffle.test.nodes;
+
+import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.interop.impl.ReadOnlyArrayList;
+import java.util.List;
+
+public class ReadOnlyArrayListConstantNode extends AbstractTestNode {
+
+    private final int value;
+
+    public ReadOnlyArrayListConstantNode(int value) {
+        this.value = value;
+    }
+
+    @Override
+    public int execute(VirtualFrame frame) {
+        List<Object> arr = ReadOnlyArrayList.asList(new Object[]{value, value, value}, 0, 3);
+        return (int) arr.subList(1, 3).get(0);
+    }
+}
--- a/make/jvmci.make	Fri Jun 12 15:34:11 2015 +0200
+++ b/make/jvmci.make	Fri Jun 12 15:47:54 2015 +0200
@@ -188,4 +188,4 @@
 
 
 default: $(JVMCI_API_JAR) $(JVMCI_SERVICE_JAR) $(JVMCI_HOTSPOT_JAR)
-.PHONY: default
\ No newline at end of file
+.PHONY: default