changeset 20148:6f669b9be43c

lower JavaReadNode to a ReadNode that will never float
author Doug Simon <doug.simon@oracle.com>
date Thu, 02 Apr 2015 19:40:14 +0200
parents 46bb6e576335
children 7bf5292dd7ad
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Thu Apr 02 19:30:19 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Thu Apr 02 19:40:14 2015 +0200
@@ -327,6 +327,9 @@
         Stamp loadStamp = loadStamp(read.stamp(), valueKind, read.isCompressible());
 
         ReadNode memoryRead = graph.add(new ReadNode(read.object(), read.location(), loadStamp, read.getBarrierType()));
+        // An unsafe read must not float otherwise it may float above
+        // a test guaranteeing the read is safe.
+        memoryRead.setForceFixed(true);
         ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead, read.isCompressible());
         memoryRead.setGuard(read.getGuard());
         read.replaceAtUsages(readValue);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu Apr 02 19:30:19 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu Apr 02 19:40:14 2015 +0200
@@ -231,12 +231,12 @@
     }
 
     public static ValueNode readOp(GraphBuilderContext b, Kind readKind, ValueNode base, LocationNode location, BarrierType barrierType, boolean compressible) {
+        /*
+         * A JavaReadNode lowered to a ReadNode that will not float. This means it cannot float
+         * above an explicit zero check on its base address or any other test that ensures the read
+         * is safe.
+         */
         JavaReadNode read = b.add(new JavaReadNode(readKind, base, location, barrierType, compressible));
-        /*
-         * The read must not float outside its block otherwise it may float above an explicit zero
-         * check on its base address.
-         */
-        read.setGuard(AbstractBeginNode.prevBegin(read));
         return read;
     }