comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java @ 18950:3fc907b46313

[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 26 Jan 2015 21:21:06 +0100
parents 9f85ac52d521
children 7e2c87dae93e
comparison
equal deleted inserted replaced
18949:886cf229e5ee 18950:3fc907b46313
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.graal.nodes.extended; 23 package com.oracle.graal.nodes.extended;
24 24
25 import static com.oracle.graal.compiler.common.UnsafeAccess.*; 25 import static com.oracle.graal.compiler.common.UnsafeAccess.*;
26
27 import java.nio.*;
28 26
29 import com.oracle.graal.api.meta.*; 27 import com.oracle.graal.api.meta.*;
30 import com.oracle.graal.compiler.common.type.*; 28 import com.oracle.graal.compiler.common.type.*;
31 import com.oracle.graal.nodeinfo.*; 29 import com.oracle.graal.nodeinfo.*;
32 import com.oracle.graal.nodes.*; 30 import com.oracle.graal.nodes.*;
64 State state = tool.getObjectState(object()); 62 State state = tool.getObjectState(object());
65 if (state != null && state.getState() == EscapeState.Virtual) { 63 if (state != null && state.getState() == EscapeState.Virtual) {
66 ValueNode offsetValue = tool.getReplacedValue(offset()); 64 ValueNode offsetValue = tool.getReplacedValue(offset());
67 if (offsetValue.isConstant()) { 65 if (offsetValue.isConstant()) {
68 long off = offsetValue.asJavaConstant().asLong(); 66 long off = offsetValue.asJavaConstant().asLong();
69 int entryIndex = state.getVirtualObject().entryIndexForOffset(off); 67 int entryIndex = state.getVirtualObject().entryIndexForOffset(off, accessKind());
70 68
71 if (entryIndex != -1) { 69 if (entryIndex != -1) {
72 ValueNode entry = state.getEntry(entryIndex); 70 ValueNode entry = state.getEntry(entryIndex);
73 Kind entryKind = state.getVirtualObject().entryKind(entryIndex); 71 Kind entryKind = state.getVirtualObject().entryKind(entryIndex);
74 boolean isLoadSafe = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN || accessKind() == entryKind; 72 if (entry.getKind() == getKind() || entryKind == accessKind()) {
75 if (isLoadSafe && (entry.getKind() == getKind() || entryKind == accessKind())) {
76 tool.replaceWith(entry); 73 tool.replaceWith(entry);
77 } 74 }
78 } 75 }
79 } 76 }
80 } 77 }