# HG changeset patch # User twisti # Date 1337971153 25200 # Node ID 4d8787136e08639e4e273ebab6f14a69c10221aa # Parent 8f6ce6f1049ba33cc3dc46badded000de9a30123 7170145: C1 doesn't respect the JMM with volatile field loads Reviewed-by: kvn, roland diff -r 8f6ce6f1049b -r 4d8787136e08 src/share/vm/c1/c1_ValueMap.hpp --- a/src/share/vm/c1/c1_ValueMap.hpp Fri May 25 07:53:11 2012 -0700 +++ b/src/share/vm/c1/c1_ValueMap.hpp Fri May 25 11:39:13 2012 -0700 @@ -141,8 +141,11 @@ // visitor functions void do_StoreField (StoreField* x) { - if (x->is_init_point()) { - // putstatic is an initialization point so treat it as a wide kill + if (x->is_init_point() || // putstatic is an initialization point so treat it as a wide kill + // This is actually too strict and the JMM doesn't require + // this in all cases (e.g. load a; volatile store b; load a) + // but possible future optimizations might require this. + x->field()->is_volatile()) { kill_memory(); } else { kill_field(x->field()); @@ -160,8 +163,8 @@ void do_Local (Local* x) { /* nothing to do */ } void do_Constant (Constant* x) { /* nothing to do */ } void do_LoadField (LoadField* x) { - if (x->is_init_point()) { - // getstatic is an initialization point so treat it as a wide kill + if (x->is_init_point() || // getstatic is an initialization point so treat it as a wide kill + x->field()->is_volatile()) { // the JMM requires this kill_memory(); } }