# HG changeset patch # User Christos Kotselidis # Date 1373219078 -7200 # Node ID 13c6440ac75007fd6ba458c7079c28ae38f2b989 # Parent 844be189150c29e04f714a2513bbfc11a272c9aa Add nullcheck at G1 Pre Barrier diff -r 844be189150c -r 13c6440ac750 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Sun Jul 07 19:09:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Sun Jul 07 19:44:38 2013 +0200 @@ -90,7 +90,11 @@ } @Snippet - public static void g1PreWriteBarrier(Object object, Object expectedObject, Object location, @ConstantParameter boolean doLoad, @ConstantParameter boolean trace) { + public static void g1PreWriteBarrier(Object object, Object expectedObject, Object location, @ConstantParameter boolean doLoad, @ConstantParameter boolean nullCheck, + @ConstantParameter boolean trace) { + if (nullCheck && object == null) { + DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException); + } Word thread = thread(); Object fixedObject = FixedValueAnchorNode.getObject(object); verifyOop(fixedObject); @@ -323,6 +327,7 @@ args.add("expectedObject", writeBarrierPre.getExpectedObject()); args.add("location", writeBarrierPre.getLocation()); args.addConst("doLoad", writeBarrierPre.doLoad()); + args.addConst("nullCheck", !writeBarrierPre.getObject().stamp().nonNull()); args.addConst("trace", traceBarrier()); template(args).instantiate(runtime, writeBarrierPre, DEFAULT_REPLACER, args); }