# HG changeset patch # User Doug Simon # Date 1427996414 -7200 # Node ID 6f669b9be43c6958b4806cf2f2f93f2543cc526f # Parent 46bb6e576335d9c4e7558f25ec7547669ff18327 lower JavaReadNode to a ReadNode that will never float diff -r 46bb6e576335 -r 6f669b9be43c graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java --- 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); diff -r 46bb6e576335 -r 6f669b9be43c graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java --- 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; }