Mercurial > hg > truffle
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java @ 18848:49e5c062e77a
[SPARC] Do not virtualize objects, when the types do not match on big endian machines
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Mon, 12 Jan 2015 21:12:24 +0100 |
parents | 9619ba4daf4c |
children | 55a30b4beb5f |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Jan 12 19:34:31 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Jan 12 21:12:24 2015 +0100 @@ -24,6 +24,8 @@ import static com.oracle.graal.compiler.common.UnsafeAccess.*; +import java.nio.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodeinfo.*; @@ -94,18 +96,21 @@ if (entryIndex != -1) { Kind entryKind = state.getVirtualObject().entryKind(entryIndex); ValueNode entry = state.getEntry(entryIndex); - if (entry.getKind() == value.getKind() || entryKind == accessKind()) { - tool.setVirtualEntry(state, entryIndex, value(), true); - tool.delete(); - } else { - if ((accessKind() == Kind.Long || accessKind() == Kind.Double) && entryKind == Kind.Int) { - int nextIndex = state.getVirtualObject().entryIndexForOffset(off + 4); - if (nextIndex != -1) { - Kind nextKind = state.getVirtualObject().entryKind(nextIndex); - if (nextKind == Kind.Int) { - tool.setVirtualEntry(state, entryIndex, value(), true); - tool.setVirtualEntry(state, nextIndex, ConstantNode.forConstant(JavaConstant.forIllegal(), tool.getMetaAccessProvider(), graph()), true); - tool.delete(); + boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entry.getKind(); + if (isLoadSafe) { + if (entry.getKind() == value.getKind() || entryKind == accessKind()) { + tool.setVirtualEntry(state, entryIndex, value(), true); + tool.delete(); + } else { + if ((accessKind() == Kind.Long || accessKind() == Kind.Double) && entryKind == Kind.Int) { + int nextIndex = state.getVirtualObject().entryIndexForOffset(off + 4); + if (nextIndex != -1) { + Kind nextKind = state.getVirtualObject().entryKind(nextIndex); + if (nextKind == Kind.Int) { + tool.setVirtualEntry(state, entryIndex, value(), true); + tool.setVirtualEntry(state, nextIndex, ConstantNode.forConstant(JavaConstant.forIllegal(), tool.getMetaAccessProvider(), graph()), true); + tool.delete(); + } } } }