changeset 18873:9f85ac52d521

[SPARC] make check for EA more tight
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Fri, 16 Jan 2015 11:48:52 +0100
parents 7735bac1f781
children e847e842ce93
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Thu Jan 15 13:56:34 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Fri Jan 16 11:48:52 2015 +0100
@@ -70,8 +70,9 @@
 
                 if (entryIndex != -1) {
                     ValueNode entry = state.getEntry(entryIndex);
-                    boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entry.getKind();
-                    if (isLoadSafe && (entry.getKind() == getKind() || state.getVirtualObject().entryKind(entryIndex) == accessKind())) {
+                    Kind entryKind = state.getVirtualObject().entryKind(entryIndex);
+                    boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entryKind;
+                    if (isLoadSafe && (entry.getKind() == getKind() || entryKind == accessKind())) {
                         tool.replaceWith(entry);
                     }
                 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Thu Jan 15 13:56:34 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Fri Jan 16 11:48:52 2015 +0100
@@ -88,7 +88,7 @@
                 if (entryIndex != -1) {
                     Kind entryKind = state.getVirtualObject().entryKind(entryIndex);
                     ValueNode entry = state.getEntry(entryIndex);
-                    boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entry.getKind();
+                    boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entryKind;
                     if (isLoadSafe) {
                         if (entry.getKind() == value.getKind() || entryKind == accessKind()) {
                             tool.setVirtualEntry(state, entryIndex, value(), true);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Thu Jan 15 13:56:34 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Fri Jan 16 11:48:52 2015 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.nodes.java;
 
+import java.nio.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodeinfo.*;
@@ -69,8 +71,11 @@
             int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
             if (idx >= 0 && idx < arrayState.getVirtualObject().entryCount()) {
                 ResolvedJavaType componentType = arrayState.getVirtualObject().type().getComponentType();
-                if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null ||
-                                (StampTool.typeOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
+                // isStoreSafe prevents on Little Endian machines to not do an implicit cast of
+                // primitives (Causes troubles with deoptimization)
+                boolean isStoreSafe = !componentType.isPrimitive() || ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || componentType.equals(StampTool.typeOrNull(value));
+                if (isStoreSafe &&
+                                (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null || (StampTool.typeOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value))))) {
                     tool.setVirtualEntry(arrayState, idx, value(), false);
                     tool.delete();
                 }