# HG changeset patch # User Bernhard Urban # Date 1364897655 -7200 # Node ID 1a8a0375ba74d6a21241e65270f835f8be35ddd9 # Parent aa291d601ee884fbdcd6435ad12aaf5218418d51 unsafeCast: anchor cast after initialization of an object diff -r aa291d601ee8 -r 1a8a0375ba74 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Mon Apr 08 17:09:10 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Tue Apr 02 12:14:15 2013 +0200 @@ -91,7 +91,10 @@ } result = memory.toObject(); } - return unsafeCast(verifyOop(result), StampFactory.forNodeIntrinsic()); + /* make sure that the unsafeCast is anchored after initialization, + * see ReadAfterCheckCast and CheckCastSnippets */ + BeginNode anchorNode = BeginNode.anchor(StampFactory.forNodeIntrinsic()); + return unsafeCast(verifyOop(result), StampFactory.forNodeIntrinsic(), anchorNode); } @Snippet